Commit Graph

79 Commits

Author SHA1 Message Date
Andrew Jones 8ea264d7b0 Upgrade to substrate alpha.3 crates.io dependencies (#73)
* Use substrate dependencies from crates.io

* Remove test that depends on node_runtime.

Because node_runtime is not on crates.io and was downloading duplicate substrate dependencies. The integration tests will test whether the serialization of keys and calls works.

* Fix updated jsonrpsee compilation errors

* Add missing frame-metadata dependency
2020-03-06 11:58:23 +00:00
Andrew Jones 253a7d8b0b Convert to std futures (#58)
* WIP

* Begin converting rpc layer to use std futures and jsonrpsee

* Convert metadata to async/await

* Convert block_hash to async/await

* Convert more methods to async/await

* Remove sp_rpc

* Fix more compilation errors

* Remove connect

* Starting to convert subscription functions

* Use jsonrpsee branch from PR for public client types

* Implement subscribe events with jsonrpsee subscription

* Converting subscriptions and wait_for_block_events

* WIP converting lib methods to async

* Use shared client reference directly for rpc call

`rpc_api!` macro currently only supports RawClient (which cannot be shared).
Also supports named params only which is not currently compatible with substrate rpd which accepts only positional params.

* Use &self instead of &mut self for shared Client

* Convert submit_and_watch to async/await

* Convert more Client fns to async

* Pin some trait futures

* Add serde error

* Fix client creation

* Fix client request compiler errors

* Unify metadata errors

* Add WS handshake error variant

* Fix some more compiler errors

* Fix more compiler errors

* Convert submit_extrinsic to async

* Convert submit and submit_and_watch

* Add Send + Sync constraints

* Clone clients

* Fix EventArg conversion error

* Fix remaining warnings/errors

* Replace deny warnings with specific lints

* Infallable subscription loops

* Use jsonrpsee wss branch

* Fix example

* Start to fix up tests

* Make contracts tests compile

* Make some more tests pass

* Fix up remaining tests

* Fmt

* Use correct event storage key type

* Fix finding events

* Use master jsonrpsee
2020-01-20 12:00:08 +00:00
Andrew Jones a9df35c570 Add FromStr constraint to BlockNumber, bump version (#56) 2019-12-17 12:33:46 +00:00
Andrew Jones 6561535467 Remove pallet crates to improve compilation time (#55) 2019-12-17 11:41:40 +00:00
Andrew Jones daa1415297 Fix contracts instantiation (#51)
* Move contracts tests to contracts module

* Add test for instantiating a contract

* Fix InstantiateArgs encoding

* Ignore PhantomData primitives, they are 0

* Increase endowment and log code hash

* Update SystemEvent

* Fix codec import

* Oops

* Write buffer directly to output to avoid encoding vec

* Debug with StorageChanges encoded as hex

* Logging and format code
2019-12-17 09:39:56 +00:00
Andrew Jones f1926f55cf Update substrate and codec crate aliases (#54)
* Replace substrate crate aliases with actual crate names

* Alias parity-scale-codec to just codec, like in substrate

* Format code
2019-12-16 15:57:48 +00:00
Yuanchao Sun fdb423a7a4 Update package name (#52) 2019-12-13 17:16:36 +00:00
Andrew Jones 625621e6ab New substrate crate renames (#50) 2019-12-02 13:41:20 +00:00
Yuanchao Sun 5108bce467 Fix the module index used to create a encoded func (#47)
* Fix the module index used to create a encoded func

Same as Events, modules with no calls should be ignored when calculating
the module index.

* Update substrate
2019-11-28 12:46:39 +00:00
Andrew Jones a6439500eb Update to latest substrate changes (#48) 2019-11-27 10:54:02 +00:00
Qinxuan Chen 4769b4b016 Use thiserror instead of derive_more (#44)
- Use thiserror instead of derive_more
- Format code
- Fix clippy warnings
- Add LICENSE_TEMPLATE

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2019-11-26 12:09:17 +00:00
Hero Bird 40a8ed3f58 update version 0.2 -> 0.3 (#42) 2019-11-25 09:04:39 +00:00
Andrew Jones 55e067a294 Rename palette -> frame (#41) 2019-11-22 18:35:36 +00:00
Andrew Jones 5242939f4d Rename paint -> palette with pallets (#38) 2019-11-21 10:08:54 +00:00
Andrew Jones 5ec410baeb Bump version to 0.2.0 2019-11-15 18:03:31 +00:00
Andrew Jones b39ff1771a New substrate signing API, srml -> paint rename (#33)
* Update jsonrpc to align with substrate

* Update to new substrate signing

* Default to MultiSignature

* Add missing event type sizes

* Rename TakeFees check to ChargeTransactionPayment

* Fix extrinsic Signature

* Ignore AuthorityList type size

* Rename srml to paint (#32)
2019-11-15 15:04:06 +00:00
Andrew Plaza 32ce13c599 update deps for jsonrpc (#31) 2019-11-06 11:52:08 +00:00
Andrew Jones 58959db9d4 Define node_runtime compatible Runtime types (#23)
* Define default `node_runtime` compatible Runtime

* rustfmt
2019-10-04 17:54:16 +01:00
Andrew Jones 98e3bb8640 Depend on txpool subcrate for Status to avoid big dependency graph (#22) 2019-10-04 09:55:41 +01:00
Andrew Jones 90cb9fc4cc Remove runtime dependency (#21)
* Remove System::Event type

* WIP: removing requirement for concrete Runtime impl for extras

* Use built in substrate types for constructing/signing the extrinsic

* Implement SignedExtension for copied types

* Fix remaining compilation errors

* Allow plugging in of predefined runtime types with blanket impls

* rustfmt

* Add CheckBlockGasLimit

* Construct DefaultExtrinsic in XtBuilder

* Derive Debug for extras

* Replace SignedExtension macro with explicit implementations

* Replace Lookup associated type with Address

* Move balances and contracts to main deps
2019-10-03 18:17:28 +01:00
Andrew Jones ee6db12917 Runtime agnostic Events (#20)
* Introduce OpaqueEvent

* Look up event by module and variant

* Index events by module

* Get events by module

* Dynamically decode events

* Decode System events and EventRecord topics

* Use type sizes to decode raw events

* Remove unused imports

* rustfmt

* Unify error types, fix some compiler errors

* Make dynamic event decoding work

- fix compilation errors
- skip modules with no events when indexing
- preallocate vec for raw event data

* Remove printlns, replace where required with log

* Remove unused import

* Check missing type sizes

* Ignore unknown event arg type sizes

* Decode concrete System events, assumes every Runtime has the module

* Reorganise usings

* pub use some types

* Code docs

* Export Error

* Error Display impls

* Format code
2019-09-26 17:48:25 +01:00
Andrew Plaza f9ae14bdb9 add substrate-rpc-primitives to use NubmerOrHex in rpc.rs (#19) 2019-09-16 11:20:54 +01:00
Yuanchao Sun 650c6d3bb0 Fix compile errors (#17)
* Fix compile errors

* Fix tests, close #13 BTW
2019-09-12 20:31:05 +01:00
Andrew Jones 25c3e81811 Fetch runtime version and add to extrinsic payload (#12)
* Update extrinsic extra data to include CheckVersion

* Fetch version via rpc and add to raw extrinsic payload

* Add missing sr-version dependency
2019-08-23 18:24:34 +01:00
Andrew Jones d46b6a975e Allow either submit or submit_and_watch on the builder. (#9)
* Refactor: allow submit and submit_and_watch, separate module builders

* Convert Balances, and use generic ModuleCalls

* Convert System, and use generic ModuleCalls

* Extract common calls to set_call

* rustfmt

* Test contract put_code with valid contract

* Patch jsonrpc client dependency for bugfix

* Handle result from call builder inside submit

* Use patched version of jsonrpc

* Lift module calls to Error

* jsonrpc 13.0

* Remove unused static constraints
2019-08-20 16:57:06 +01:00
David Craven 19604e8f2e Use substrate metadata, introduce builder for client (#4)
* Export Error type

* Fix license headers

* Remove unnecessary fully qualified associated types

* Update to parity-scale-codec, handles decoding errors

* rustfmt

* Add metadata.

* Use metadata for calls.

* Refactor generics.

* Storage metadata.

* Use builders.

* Finish making generic.

* Fix merge.

* Run rustfmt.

* Fix merge.
2019-08-08 15:04:50 +01:00
David Craven 6522bb08d0 Misc changes (#2)
* Remove dependency on tokio, submit returns a future
* Enable logging in tests
* Add fetch, fetch_or, fetch_or_default
2019-08-06 15:26:11 +01:00
Andrew Jones 5a046d043e Make generic, removing dependency on node_runtime (#1)
* Extract error to file

* Update readme

* Extract Rpc to separate file

* Make Rpc generic over Runtime

* Editor config etc.

* rustfmt

* Remove node-runtime dependency, generic soup

* Move generic trait bounds to impl

* rustfmt

* Remove unused stuff

* Add test for balance transfer call
2019-08-06 13:12:12 +01:00
Andrew Jones 766e47d709 First commit (extracted from ink! cli) 2019-08-05 11:37:29 +01:00