Unverified Commit 4195197c authored by Andrew Jones's avatar Andrew Jones Committed by GitHub
Browse files

Interact with contracts: upload, instantiate and call commands (#79)

* WIP display all events

* Clean up and generalize displaying events

* Fix multiple event new lines

* Fmt

* Create wrapper types for Display, derive Debug for originals

* Control indentation of pretty printing

* Indent events display

* More tuning of runtime events pretty printing

* Fmt

* Use Display impls for printing events

* Add DisplayTransferEvent

* Namespace events

* Add CodeStored and Instantiated events

* Refactor Deploy command and use verbosity for events display

* Fix up string message return

* Code hash LowerHex and println after events

* Use LowerHex api for Bytes

* Parse code hash with 0x prefix

* Fmt

* Spawn canvas node for integration test

* Increment attempts

* Get the test running with spawned canvas node

* Instantiate deploy works with manual node

* Test works locally and cleans up temp dir

* Fmt

* Fix duplicate import

* Build before testing so cargo-contract bin available for testing

* Separate line for build

* Extract decode_hex util fn

* WIP failing Literal tests for SS58 account ids

* Upgrade to nom 0.6

* Use nom error in custom error, impl FromStr

* Fmt

* Update lockfile after merge

* Make TryFrom take reference for verbosity conversion

* Fix parsing literals

* Plumbing for custom encoders

* Implement AccountId32 custom encoder

* Refactor: extract env types

* Test for encoding ss58 literal

* Fmt and add back failing struct test

* Use AccountId type in test

* TEMP: Use github dependencies of scale-info and ink

* Err for 256 bit ints

* Use new registry type enumeration

* Extract type lookup and introduce Encoder

* WIP: extract Transcoder and implement env type decoding

* Implement env type decoding, removes generic Input.

Custom env decoders are trait objects so can't have generic type parameters on its decode method.

* Fix AccountId decoding, add some debug logging

* Test for different AccountId aliasing

* Passing tests for AccountId encoding and fmt

* Update scale-info and ink deps, patch ink deps for now

* Update scale-info and ink deps, patch ink deps for now

* Remove extrinsics feature

* Dependencies

* More deps

* Cargo.lock

* Cargo.lock

* WIP upgrading to latest subxt and scale-info

* More upgrading to latest subxt

* Fix more errors

* Fix up extrinsic commands

* Refactor transcoder decode, handle Compact

* Refactor transcoder encode, initial compact support

* Fmt

* Fix metadata file loading

* Constructor arg rename

* Enable tokio

* Make instantiate work

* Update contracts runtime from substrate-contracts-node

* Fix warnings and add todo

* Update subxt

* Add missing import

* Use explicit substrate branch to match subxt import

* Remove sp_rpc dependency

* Remove sp_rpc dependency

* Use metadata to decode events

* Fmt

* Pretty print events

* WIP custom transcoders for events

* Custom transcoders for events working

* Fix some warnings

* Slim down bat dependency

* Decode contract events

* Use correct field for instantiated contract account

* Fix warnings

* Fix multiple line warning

* Update contracts RPC types

* Fmt

* Fix deploy contract account

* Use ink! master branch

* Oops

* Remove patches

* Bump ink deps to rc6

* Update to latest subxt

* Update to latest subxt

* Fix errors after subxt update

* Fix instantiate_with_code.rs

* Update subxt

* Add deserializing context

* Fmt

* Expose public metadata fields

* Implement full metadata decoding

* Cargo.lock

* Update calls to work with storage_gas_limit from https://github.com/paritytech/substrate/pull/10082



* Cargo.lock

* Update to latest subxt

* Fmt

* WIP unify instantiate command

* Fix call command errors

* Main warning unused result

* Call and instantiate warns and errors and fmt

* Update to ink rc7

* Default to local contract wasm if none specified

* Change instantiate endowment to value

* Use latest subxt branch

* Update to latest subxt

* Unify call and instantiate arg names

* Instantiate and call args consistency

* Add todo comment for encoding message args

* Refactor, tidy up call and instantiate

* Display decoded contract event separately

* Register env types with and without aliases

* Add pretty print flag

* WIP add upload

* Wiring up upload code extrinsic

* Download latest contracts node metadata

* Wire up upload command and WIP manifest path

* in! default features and cargo update

* Add manifest path argument for extrinsics

* Only fetch crate metadata once

* Fmt

* Cargo upgrade

* Update substrate dependencies

* Pretty print code upload dry run values

* Extract name value println macro

* Print code hash from upload extrinsic

* Refactor upload code command

* Pretty print instantiate results

* Add salt arg to instantiate command

* WIP custom events display, removes big bat dep

* Extract method for printing RPC contract result

* Ugly printing of events

* Fix contract event decoding

* Fmt

* Pretty print event fields

* Only print event fields if verbose

* More event prettification

* Fmt

* Resolve some todos

* Remove some code comments, moved to follow ups in PR

* Refactor: extract compact encoding function

* Fix storage_deposit_limit and add todo re: compact primitives

* Add todo re: compact primitives

* Cargo.lock

* Use released substrate crates and subxt master

* Fix encoding compact, inline for each uint

* Fix encoding compact, inline for each uint

* Add extrinsics markdown outline

* Dynamic compact encoding

* Replace bitvec todos with errs, added follow up in PR

* Remove todo about friendly encoding error, add to PR follow ups

* Rename codec to scale for test contract, fix some transcoding tests

* Attempt to fix linking with __ink_generate_metadata

* Update to ink rc8

* Add test for out of order composite fields

* Update ink metadata version

* Update ink metadata types and methods

* Fix metadata error message

* Add std feature to fix test compilation with inline contract

* Fix out of order struct fields

* Improve encoding of field error message

* Fmt imports

* Rename TypeLookupId to TypeLookup

* Remove alias matching for custom env type transcoding

* Fix variant encoding for maps and out of order fields

* Add failing test & impl for compact struct transcoding

* Use released version of pallet-contracts primitives

* WIP attempting to fix compact struct transcoding

* Fix compact struct decoding

* Add todo for integration test

* Renamed SconParseError

* Failing test for invalid integer

* Use nom-supreme for combinators, error handling

* Use released subxt

* Refactor integer parsing

* Refactor char parsing

* Refactor seq parsing

* Refactor tuple parsing

* Refactor unit tuple parsing

* Refactor map parsing

* Refactor bytes parsing

* Remove final nom `map` free function usage

* Use some postfix recognizes

* Remove final recognize combinator

* Use postfix value combinator

* Use opt postfix combinator

* Move entry point and top level parser to the top of the file

* Inline some string parsers

* Inline some local helper functions

* Fix failing integer tests

* Fix Rust ident parsing

* Fix up integration test

* Make clippy happy

* Fmt

* Clippy clippy clippy

* Ignore integration test for CI

* Support parsing underscore separators for integer literals

* + sign prefix parses to signed int

* Allow underscores for balance CLI args

* Add helper function for handling runtime errors

* Add helper function for displaying runtime module errors

* Elide lifetime

* Add some basic module level docs for transcoding

* Improve error message where metadata file not found

* Adding common args section to extrinsics.md

* Move --dry-run to extrinisic opts and more docs

* Move --storage-deposit-limit to ExtrinsicOpts, move ExtrinsicOpts to extrinsics.

* Add instantiate docs

* Add call docs

* Update Extrinsics docs

* Update Cargo.toml

Co-authored-by: default avatarAlexander Theißen <[email protected]>

* Don't wait for finalization before displaying transaction success

* Update docs/extrinsics.md

Co-authored-by: default avatarAlexander Theißen <[email protected]>

* Remove static error detail lookup, since it may be inaccurate if the target chain differs

* CLIPPY

* Print debug message lines

* Display not Debug return value

* Fmt

Co-authored-by: default avatarAlexander Theißen <[email protected]>
parent 942c50c7
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment