1

I'm currently trying to deploy & interact with my contract using rust, but I can't find any methods or examples about this. (I've searched paritytech's github) Is there any way to deploy & interact with my contract using rust? (Not by polkadot js) I think I can interact with chain by using subxt or substrate-api-client, but I can't deploy or interact with my contract (Call or Execute my functions)

I appreciate any help you can provide.

2 Answers 2

2

There are some examples of working with contracts in the subxt tests (see https://github.com/paritytech/subxt/blob/master/testing/integration-tests/src/frame/contracts.rs#L58).

There's also this Rust based tool which uses subxt and exists to help manage and deploy ink based contracts: https://github.com/paritytech/cargo-contract.

Having a look at said tests, or the cargo-contract code should get you well on your way to using subxt to work with contracts!

0
1

In addition to @jsdw's suggestions, have a look at https://github.com/paritytech/smart-bench. There I have written a macro which generates code based on a contract's metadata, which can then be used to build messages to send to ink! contracts via subxt.

e.g. https://github.com/paritytech/smart-bench/blob/master/src/wasm/mod.rs#L27

In the future it would be nice to extract that to it's own library so it can be reused, but that likely won't happen for a while so feel free to just copy that code for now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.