Commit Graph

23 Commits

Author SHA1 Message Date
Giles Cope 8fe5ebbc00 cargo fmt 2021-09-19 10:49:24 +01:00
Giles Cope 364ed8bed1 Updated to later version of substrate so that it compiles.
(Referencing substrate this way you only have to search and replace one string to upgrade)
2021-09-17 10:52:23 +01:00
Greg Hill 2749bd300b deps: update jsonrpsee 0.3.0 (#289)
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2021-08-03 10:26:29 +01:00
Niklas Adolfsson 94db874942 update jsonrpsee to 0.2.0-alpha.6 (#266)
* update jsonrpsee to 0.2.0-alpha.5

* downgrade subxt client

* cleanup

* make subxt-client compile again

* update jsonrpsee v0.2.0-alpha.6

* fix build again

* remove needless type hints

* cargo fmt

* address grumbles

* remove remaining type hints

* cargo fmt
2021-05-20 21:48:56 +02:00
Greg Hill b37d8ecd5a export ModuleError and RuntimeError for downstream usage (#246)
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2021-03-15 09:26:55 +00:00
Niklas Adolfsson a920e34c20 integration with jsonrpsee v2 (#214)
* hacky integration with jsonrpsee v2

* stray todos

* fmt

* add http support

* make test build compile

* Update src/rpc.rs

* bring back set_client

* use crates.io version jsonrpsee

* WIP: workaround for embedded subxt client (#236)

* workaround for embedded subxt client

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>

* increase default channel size on subxt client

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>

* remove client tests due to inference problem on From

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>

* add comments for missing impls

* more verbose errors

* make subscription notifs buffer bigger

* fmt

Co-authored-by: Greg Hill <gregorydhill@outlook.com>
2021-03-08 10:52:23 +00:00
Andrew Jones de859e7396 Add hooks to register event types for decoding (#227)
* Global registration of type segmenters for event decoding

* Perform type sizes check when building client

* Introduce EventTypeRegistry for global runtime type sizes

* Fmt

* Register runtime type sizes on creation of EventTypeRegistry

* Register more default dispatch types

* Add missing type sizes

* fmt

* Fix up register_type_size builder method

* Update doc comments

* Make register_default_type_sizes public

* Don't allow duplicate registered types

* Remove call to supertraits type registration, done manually in Runtime

* Fix tests and warnings

* Fix duplicate type registration

* Fmt

* review: use is_empty()

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Add panic docs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2021-02-18 10:28:40 +00:00
Andrew Jones 2c8e5211aa Substrate 3.0 (#232)
* Update substrate deps to 3.0.0 and 0.9.0

* Update substrate wasm tools

* Fixing errors for 3.0.0 compat

* Fixing more errors for 3.0.0 compat

* Use MultiAddress for test runtime

* Fmt

* Fix node test

* Pin Funty

* Update AccountInfo struct

* Add comment about funty pin
2021-02-17 16:45:05 +00:00
Andrew Jones 51c48f223a Update license header, bye bye 2020 👋 (#231) 2021-02-11 17:17:24 +00:00
David Craven e9c50e21d0 Only return an error if the extrinsic failed. (#156) 2020-09-01 11:15:04 +01:00
David Craven 3080ec91a6 Improve error handling in proc-macros, handle DispatchError etc. (#123)
* Improve error handling.

* Fix build.

* Handle runtime errors.

* Add runtime trait for better type inference.

* Use runtime trait part 1.

* wip

* Add support for sudo.

* Finish error handling.

* Fix tests.

* Fix clippy warnings.
2020-06-22 07:39:40 +01:00
Andrew Jones 194c7bcf2f Add missing license headers and CI check (#98)
* Add missing license headers and add CI check

* Remove log line

* Remove stale todos
2020-04-30 22:26:22 +01:00
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 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
Andrew Jones 625621e6ab New substrate crate renames (#50) 2019-12-02 13:41:20 +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
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
David Craven 151c7f7e0a Refactor (#7)
* Increment nonce when submitting transaction.

* Refactor.

* use default values from metadata
* use functions from metadata

* Nonce fixup

* Add docs.

* Add contracts module.

* Add set_code.

* Add events to metadata.

* Support pretty printing metadata.

* Add subscriptions.

* Add submit_and_watch to XtBuilder.

* nits from review
2019-08-12 17:07:28 +02: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