-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interact with contracts: upload, instantiate and call commands #79
Conversation
@@ -28,7 +28,7 @@ heck = "0.4.0" | |||
zip = { version = "0.5.13", default-features = false } | |||
parity-wasm = "0.42.2" | |||
cargo_metadata = "0.14.1" | |||
codec = { package = "parity-scale-codec", version = "2.3.1", features = ["derive"] } | |||
scale = { package = "parity-scale-codec", version = "2.3.1", features = ["derive"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed because I have an embedded contract for testing purposes and ink!
generates code with ::scale
imports.
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around with it a bit and it is working as I imagined it. Some remarks:
Probably fix now
- Remove trailing new line from debug message. It looks awkward with the quote on the next line.
- Remove the decoding of the module error as long as this is buggy. It is massively confusing to see a wrong error there. Better to not decode.
Fix in follow up
- Add support for
remove_code
extrinsic.
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
…target chain differs
async-std = { version = "1.10.0", features = ["attributes", "tokio1"] } | ||
ink_metadata = { version = "3.0.0-rc8", features = ["derive"] } | ||
ink_env = "3.0.0-rc8" | ||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably trigger a dependabot PR for an upgrade to 2.0.0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep it as 1.0.0
for now since that is the same version as ink_metadata
rc8
is using.
Adds
upload
,instantiate
andcall
commands which allows interacting with contracts on live chains with a compatiblepallet-contracts
.Upload
Instantiate
cargo contract instantiate \ --constructor new \ --args false \ --suri //Alice \ --code-hash 0xbc1b42256696c8a4187ec3ed79fc602789fc11287c4c30926f5e31ed8169574e \ --dry-run
cargo contract instantiate \ --constructor new \ --args false \ --suri //Alice \ --code-hash 0xbc1b42256696c8a4187ec3ed79fc602789fc11287c4c30926f5e31ed8169574e
Instantiate with code
Omitting
--code-hash
will callinstantiate_with_code
:Call
Debug message
If the contract is build in debug mode then
Will result in...
Todo
Call
0x
prefix for hex encoded code hashpallet-contracts-primitives
andsp-rpc
fromcrates.io
Follow ups
These will be promoted to their own issue, or into separate issues for following up once this is merged.
DispatchError::Module
errors, so that error details are displayed correctly across different chains DynamicDispatchError::Module
details paritytech/subxt#443--wait-for-finalization
. so that success/events are not displayed until the block is finalized100CAN
,1MCAN
substrate-contracts-node
and unignore integration test: https://github.com/paritytech/cargo-contract/blob/60f65a2863be1266882bdd81861d836baeb06724/src/cmd/extrinsics/integration_tests.rs#L124