Commit Graph

267 Commits

Author SHA1 Message Date
Niklas Adolfsson 5ee0bb5ca5 test alex's PR 2022-06-28 17:47:30 +02:00
Niklas 43062cb1bb Merge remote-tracking branch 'origin/master' into na-jsonrpsee-macros 2022-02-10 17:52:35 +01:00
Niklas 5f692acc84 add remaining RPCs 2022-02-10 17:37:09 +01:00
Andrew Jones 4bed7eb716 Fix conversion of Call struct names to UpperCamelCase (#441)
* Fix conversion of `Call` struct names to UpperCamelCase

* Update to latest heck and use ToUpperCamelCase
2022-02-10 13:10:27 +00:00
Alexandru Vasile a7c54f7412 Update release documentation with dry-run (#435)
* releasing: Remove cargo-hack from doc

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* releasing: Add dry-run step

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* releasing: Remove sleep from dry-run step

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-02-04 19:58:35 +02:00
James Wilson 19ae2aa9ee Set "std" feature on sp-runtime to avoid a static assertion error (#438)
* apply std feature to runtime to avoid static assertion error

* std is a default feature anyway
v0.17.0
2022-02-04 17:45:45 +00:00
Alexandru Vasile e9be43aaff Release preparation for v0.17.0 (#434)
* lib: Export `GenericError` to avoid linking to private items

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Bump version to v0.17.0

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* doc: Add crates to bump

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update changelog

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* changelog: Add new line between title and list

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* releasing: Remove extra closing bracket

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* releasing: Fix cargo install typo for cargo-hack

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove subxt version from macro and test-runtime

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* releasing: Change PR link to sort in descending order

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* changelog: Add missing PR

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-02-04 15:44:56 +02:00
Alexandru Vasile 868b465e01 Add more tests for events.rs/decode_and_consume_type (#430)
* test-runtime: Fix README typo

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* test-runtime: Explicit error handling for missing substrate binary

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* test-runtime: Fix documentation typo

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Test primitive decode_and_consume

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Test tuple decode_and_consume

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Test array decode_and_consume

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Extend array with sequences

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Test variant decode_and_consume

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Test composite decode_and_consume

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* events: Test compact decode_and_consume

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2022-02-04 10:46:39 +00:00
Niklas Adolfsson abd7a4145b introduce jsonrpsee client abstraction + kill HTTP support. (#341)
* PoC async rpc client

* add client example should be removed from this repo

* fmt

* cargo fmt

* subxt client tests

* cargo fmt

* fix some nits

* try nightly for all CI jobs

* need wasm also for CI

* wasm for nightly run too

* client: add missing features

* update jsonrpsee

* hacky update jsonrpsee

* use jsonrpsee crates.io release

* ci: pin nightly 2021-12-15

* pin nightly to 2021-12-15

* fix build

* fmt

* compile please

* rewrite me

* fixes

* fixes

* pre-generate metadata

* fix nit

* get rid of needless deps

* remove embedded client

* Update Cargo.toml

* Update subxt/Cargo.toml

* Update subxt/Cargo.toml

* Update subxt/src/client.rs

* Update subxt/src/rpc.rs

* Update test-runtime/build.rs

* cargo fmt

Co-authored-by: James Wilson <james@jsdw.me>
2022-02-04 10:35:59 +00:00
Niklas 489650c9c4 introduce jsonrpsee proc macros API 2022-02-03 18:54:36 +01:00
Andrew Jones 7f3f686cef Update substrate dependencies (#429)
* Update substrate dependencies

* Update sp-keyring deps
2022-02-03 17:19:27 +00:00
Fabio Lama 9f88761e46 Get event context on EventSubscription (#423)
* implement next_context

* write test_context for method next_context

* change how events are uniquely identified

* undo local changes for test-runtime

* introduce EventContext struct

* adjust test_context to EventContext struct

* fix return type for next_context

* add suggestions by jsdw

* ran cargo fmt and clippy
2022-02-03 16:40:46 +00:00
Greg Hill 75ea2cbf15 remove unused PalletError struct (#425)
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2022-02-03 15:09:08 +00:00
Niklas Adolfsson 4053e30399 Update subxt/Cargo.toml 2022-02-03 15:57:23 +01:00
Niklas Adolfsson b21fde8d1f Update subxt/Cargo.toml 2022-02-03 15:57:00 +01:00
Niklas Adolfsson b9bc61fc93 Update Cargo.toml 2022-02-03 15:56:28 +01:00
Niklas b53ae9f433 remove embedded client 2022-02-03 15:28:52 +01:00
Greg Hill 702f4c8457 export RuntimeError struct (#427)
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2022-02-03 12:54:23 +01:00
Niklas a09e8a88bd get rid of needless deps 2022-02-03 12:25:28 +01:00
Niklas a5df40ab09 fix nit 2022-02-03 11:52:04 +01:00
Niklas d433828060 Merge remote-tracking branch 'origin/na-jsonrpsee-core-client' into na-jsonrpsee-core-client 2022-02-03 11:19:35 +01:00
Niklas f603d68a1a pre-generate metadata 2022-02-03 11:17:42 +01:00
Niklas fa3b9057ae fixes 2022-02-03 00:37:43 +01:00
Niklas ae24d3b37b fixes 2022-02-03 00:37:08 +01:00
Niklas 8dc7dda99c Merge remote-tracking branch 'origin/master' into na-jsonrpsee-core-client 2022-02-02 19:16:59 +01:00
James Wilson 55f04c20a7 Move Subxt crate into a subfolder (#424)
* move into subfolder step 1

* Make folders a workspace again

* Move examples into their own workspace crate to make them more visible and easier to run

* clippy fix

* newline

* tweak releasing steps for folder move

* reference exampels more clearly in top level readme
2022-02-02 12:15:44 +00:00
James Wilson 171f4ec268 Add release checklist (#418)
* Add release checklist

* Subxt, not Soketto

* more Soketto -> Subxt fixes

* Signed tags and note about incrementing version of each crate

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

* Add command to publish crates in required order

* undo test breakages and codegen first since macro depends on it

* Update RELEASING.md

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* sleep 10, and text niggles

Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
2022-02-02 10:44:46 +00:00
David 667dfa291c Release prep for v0.16.0 (#417)
* Draft changelog

* Bump (and normalize version): v0.16.0

* Update changelog

* Update Cargo.toml

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

* Add not about 0.16 being disruptive

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
subxt-v0.16.0 v0.16.0
2022-02-01 10:48:41 +00:00
Andrew Jones f5d8a846ec Parameterize AccountData (#409)
* Add custom config example

* Make account data storage item configurable

* Fix contracts

* Regenerate polkadot codegen

* Fmt

* Specify different type for `MyConfig::Index`

* Update comment in custom config example

* Assign concrete types for default AccountData impl

* Fmt

* Fix contracts tests

* Fmt

* Add comments

* Unlink doc comment trait (subxt not in scope)

* Fix missing nonce field error message

* Update codegen/src/api/mod.rs

Co-authored-by: David <dvdplm@gmail.com>

* Update examples/custom_config.rs

Co-authored-by: David <dvdplm@gmail.com>

* Rename Nonce assoc type to Index for consistency

* Add module level docs about codegen assumptions

Co-authored-by: David <dvdplm@gmail.com>
2022-01-31 12:46:29 +00:00
Andrew Jones 79b56612e4 log::debug! message for JSON-RPC response (#415) 2022-01-28 21:52:20 +00:00
Andrew Jones eb266b9be6 Only convert struct names to camel case for Call variant structs (#412)
* Only convert struct names to camel case for `Call` variant structs

* Use Cow for transform fn

* Use as_ref
2022-01-28 09:28:04 +00:00
James Wilson d1494b5cb6 Allow decoding Events containing BitVecs (#408)
* Handle bitvec decoding

* clippy

* rework bitvec decoding; don't care about order and can handle other store primitives

* cargo fmt
2022-01-27 16:02:15 +00:00
Greg Hill 5f5a7ef5f7 add constants api to codegen (#402)
* add constants api to codegen

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

* handle constant decoding error

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

* fix clippy and remove extra constants allocation

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2022-01-27 14:27:20 +00:00
fewensa 3dded0c600 Custom derive for cli (#407)
* Custom derive for cli

* Better than better

* Simplify code

* Simplify code

* Change follow suggestions
2022-01-27 14:20:15 +00:00
Andrew Jones b0004ea79f Refactor type generation, remove code duplication (#352)
* codegen: fix compact unnamed fields

* Fmt

* codegen: move derives and struct_def to types

* codegen: rename struct_def to composite_def.r

* WIP: deduplicate struct def code

* Fmt

* WIP refactoring composite type codegen duplication

* Fmt

* Fix TokenStream import

* Fix field_tokens ty_path parse error

* Fix call struct generation

* Refactor ty_path()

* Optional derives and move CompactAs derive to composite_def

* Fmt

* Introduce CompositeDefFieldType

* Restore default codec derives

* Extract TypeDefParameters and TypeDefGen construction

* Fmt

* Reset codegen to master

* Introduce CompositeDefFields

* Introduce CompositeDefFields

* Fix up errors

* Fix Box field types

* Fmt

* Fix compact attribute

* Handle no fields case

* Handle no fields with trailing semi

* Fix compact field detection

* Fix generic phantom marker

* Fmt

* Fix generic type parm fields

* Clippy

* Fix up boxed call fields

* Fmt

* Add comments to composite_def.rs

* Fix license headers

* Restore Debug derive in tests

* Fix empty struct codegen test

* Use BTreeSet for type params for ordering

* code review: fix comment

* code review: refactor CompositeDefFields as enum

* Fix empty named fields

* Fix generation of call variant enum structs

* Expand field_tokens into separate methods for struct and enum variants

* Add TypeDefParameters docs

* Fix doc link

* Clippy redundant return
2022-01-26 09:18:13 +00:00
James Wilson 934aebcc2c make storage-n-map fields public too (#404) 2022-01-21 13:23:59 +00:00
James Wilson 643795919f Use the generated DispatchError instead of the hardcoded Substrate one (#394)
* WIP DispatchError generic param

* main crate now compiling with new E generic param for DispatchError

* Remove E param from RpcClient since it doesn't really need it

* Point to generated DispatchError in codegen so no need for additional param there

* More error hunting; cargo check --all-targets passes now

* Use our own RuntimeVersion struct (for now) to avoid error decoding into sp_version::RuntimeVersion

* cargo fmt

* fix docs and expose private documented thing that I think should be pub

* move error info to compile time so that we can make DispatchError a little nicer to work with

* cargo fmt

* clippy

* Rework error handling to remove <E> param in most cases

* fix Error doc ambiguity (hopefully)

* doc tweaks

* docs: remove dismbiguation thing that isn't needed now

* One more Error<E> that can be a BasicError

* rewrite pallet errors thing into normal loops to tidy

* tidy errors codegen a little

* tidy examples/custom_type_derives.rs a little

* cargo fmt

* silcnce clippy in example
2022-01-20 16:35:42 +00:00
Niklas c988c4a16a rewrite me 2022-01-20 15:07:14 +01:00
boyswan 79bf32a0a9 Expose transaction::TransactionProgress as public (#401)
* Update transaction.rs

* documentation

* Update src/transaction.rs

Co-authored-by: James Wilson <james@jsdw.me>

* fmt

Co-authored-by: James Wilson <james@jsdw.me>
2022-01-19 18:06:17 +01:00
Greg Hill b358d6ffef add interbtc-clients to real world usage section (#397)
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2022-01-18 10:05:39 +00:00
James Wilson d99cb9f4c3 Make own version of RuntimeVersion to avoid mismatches (#395)
* Make own version of RuntimeVersion to avoid mismatches

* cargo fmt

* remove unneeded Serialize bound on RuntimeVersion
2022-01-17 14:25:37 +00:00
Andrew Jones cc0f980d95 Use released substrate dependencies (#375)
* WIP update dependencies to crates versions

* Use released versions of sp-version and sp-arithmetic

* Attempt to align version of sp-keyring used to correspond to 4.0.0 releases. No luck but closer

* sp-keyring 4.0.0

* also sp-keyring 4.0.0 for macro crate

* simplify cargo.tomls

Co-authored-by: James Wilson <james@jsdw.me>
2022-01-17 14:25:15 +00:00
James Wilson 96fe1d61a9 Remove bounds on Config trait that aren't strictly necessary (#389)
* Use Derivative to skip bounds on T when they aren't necessary, and remove unnecessary bounds on Config

* loosen a couple more derive bounds

* Use PhantomDataSendSync to avoid accidentally removing Send+Sync bounds
2022-01-13 16:07:27 +00:00
sander2 d1e2985ce8 fix: use index override when decoding enums in events (#382)
* fix: use index override when decoding enums in events

* fix: ignore clippy warning in test

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

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2022-01-12 16:46:24 +00:00
Paulo Martins 862373bc3f add crunch to readme (#388) 2022-01-12 16:44:30 +00:00
Paulo Martins ea8c4dd288 fetch system chain, name and version (#385)
* fetch system chain, name and version

* add fetch system tests

* fix fetch system test

* fix cargo fmt

* fix cargo clippy
2022-01-10 14:15:12 +00:00
Andrew Jones e8cbe467cb Fix compact event field decoding (#384)
* Add basic event decoding test

* Failing compact event field test

* Fmt

* Fix compact event field decoding

* Remove println

* Add test for compact wrapper struct

* Revert "Add test for compact wrapper struct"

This reverts commit 4e8332ddcd9b758973bdecbea9901c4a378e26b7.

* Split compact tests and add multiple events test
2022-01-07 14:20:42 +00:00
Andrew Jones ca5345c47e Configurable Config and Extra types (#373)
* WIP config

* WIP separate default config

* Separate trait impls on client

* WIP introduce new ApiConfig (to be renamed) trait

* Update generated polkadot codegen

* Allow configuring Config and Extra types independently

* Add extra default configuration

* Revert ir parsing of config attr

* Add default-features = false to substrate deps

* Revert "Add default-features = false to substrate deps"

This reverts commit 099d20cd4cbf8000ff938d1dc090ecbc28a5e788.
2022-01-06 09:39:38 +00:00
Paulo Martins 30665bf1c2 fix remote node (#386) 2022-01-06 10:08:14 +01:00
Andrew Jones 415e1222d2 2022! (#381) 2022-01-05 10:26:03 +00:00