1238 Commits

Author SHA1 Message Date
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 c2097aa2e3 Ignore PhantomData primitives, they are 0 (#53) 2019-12-13 17:20:41 +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
Andrew Jones 02e4826662 Update SystemEvent with DispatchInfo (#45) 2019-11-26 12:49:29 +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 0b39bbbc30 Implement DispatchInfo type for SignedExtension (#39) 2019-11-22 14:55:54 +00:00
Andrew Jones 17abfb49b2 Refactor: simplify module call definitions (#24)
* Refactor: simplify module call definitions

* Fix compilation errors after merge

* Add missing comments and remove unused imports

* Now it compiles
2019-11-21 17:53:45 +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 593646c2bc Update default runtime types to match substrate, format code (#34)
* Update default runtime types to match latest substrate

* Format code
2019-11-15 17:57:38 +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
Thomas Scholtes cb6ed508a3 Event arguments are Vec not HashSet (#27)
Event arguments in the metadata are treated as `Vec` instead of
`HashSet`. This fixes an issue with event arguments of the same name.

For example the `Balances::Transfer` event has four arguments:
`AccountId` (from), `AccountId` (to), `Balance` (value), `Balance`
(fee). Before this change the code would only try to parse the two
distinct arguments `AccountId` and `Balance` and decoding would fail.
2019-11-04 15:00:54 +00:00
Thomas Scholtes 29f8badb85 Don’t panic on storage decode error (#30)
Instead of panicking when the storage data reveived cannot be decoded we
pass on the error.
2019-11-04 14:21:00 +00:00
thiolliere 90eaf321ac fix for substrate master (#29) 2019-10-24 16:10:10 +01:00
Andrew Jones eacf7a6a94 Bump metadata version to V8 (#25) 2019-10-09 16:32:02 +01: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
Andrew Plaza e9070e2786 Insipx/add block method (#18)
* Fix compile errors

* Fix tests, close #13 BTW

* add block method

* add block_hash method

* add tests for block and block_hash
2019-09-12 20:34:24 +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 e2123aae47 Add link to alternative substrate rpc lib by SCS 2019-08-23 17:01:14 +01:00
Daogang Tang 8a338f6c3f adding srml_system::CheckVersion to SignedExtra in tests in lib.rs. (#11)
Signed-off-by: daogangtang <daogangtang@gmail.com>
2019-08-23 16:32:44 +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 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 be5ccc1d11 Get it to work. (#6) 2019-08-08 16:01:07 +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