Commit Graph

249 Commits

Author SHA1 Message Date
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
Niklas 65fb71a8d3 compile please 2022-01-04 18:46:42 +01:00
Niklas 1551e70ec7 fmt 2022-01-04 17:52:49 +01:00
Niklas 937e9a6481 fix build 2022-01-04 17:41:26 +01:00
Niklas bb103586df Merge remote-tracking branch 'origin/master' into na-jsonrpsee-core-client 2022-01-04 16:36:32 +01:00
Niklas 8d449c3b96 pin nightly to 2021-12-15 2022-01-04 16:28:34 +01:00
James Wilson 26258c84cc Update to jsonrpsee 0.7 and impl Stream on TransactionProgress (#380)
* Update to jsonrpsee 0.7 and impl Stream on TransactionProgress

* Fix doc links after rename to next_item

* Add another doc comment
2022-01-04 15:05:53 +00:00
Andrew Jones 3fb4c7089a Add links to projects using subxt (#376)
* Add links to projects using subxt.

* Add phala-pherry to list

Co-authored-by: h4x3rotab <h4x3rotab@gmail.com>

Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: h4x3rotab <h4x3rotab@gmail.com>
2022-01-04 15:28:03 +01:00
Niklas 32555aa99d ci: pin nightly 2021-12-15 2022-01-04 11:59:00 +01:00
Niklas e2a93e3abb use jsonrpsee crates.io release 2021-12-22 16:22:40 +01:00
Niklas bca14735ab hacky update jsonrpsee 2021-12-22 13:19:54 +01:00
Niklas 2bfc3898b7 hacky 2021-12-21 16:39:02 +01:00
Niklas 752c19e2f4 update jsonrpsee 2021-12-21 11:06:59 +01:00
Andrew Jones 7aac7dfecf Implement pre_dispatch for SignedExtensions (#370)
* Explicitly specify master branch for sp-keyring dev dependency

* Implement pre_dispatch for `SignedExtension`s

* Update macro/Cargo.toml

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

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2021-12-14 17:17:31 +00:00
Andrew Jones 78626eb5ee Export TransactionEvents (#363)
* Export TransactionEvents

* Fmt
2021-12-10 18:14:28 +01:00
James Wilson b777420054 Rebuild test-runtime if substrate binary is updated (#362)
* Re-run test-runtime build script if the substrate binary changes

* cargo fmt

* Can => Cannot
2021-12-10 11:54:07 +00:00
James Wilson dd9bb11fae Expand the subscribe_and_watch example (#361)
* Expand the subscribe_and_watch example

* Fix comment typos

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Add note about error on decoding events

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
2021-12-10 11:20:58 +00:00
James Wilson d0a1a79c5f Add TooManyConsumers variant to track latest sp-runtime addition (#360) 2021-12-09 13:24:15 +00:00
James Wilson 5db9b73899 Implement new API for sign_and_submit_then_watch (#354)
* WIP Implementing new event subscription API

* back to lifetimes, fix example

* no more need for accept_weak_inclusion

* thread lifetime through to prevent 'temporary dropped' issue

* make working with events a little nicer

* Get tests compiling

* fmt and clippy

* _name back to name

* dont take ownership, just have stronger note

* Attempt to fix test

* remove commented-out code

* Add a couple more helper methods and a test

* Remove custom ExtrinsicFailed handling; treat them like other events

* Handle runtime errors in TransactionProgress related bits

* cargo fmt + clippy

* Fix some of the failing tests

* remove unused import

* fix transfer_error test

* Fix compile errors against new substrate latest

* Comment tweaks, and force test-runtime rebuild

* Drop the TransactionProgress subscription when we hit 'end' statuses

* cargo fmt

* find_event to find_first_event and helper to return all matching events

* TransactionProgressStatus to TransactionStatus

* Copy and improve docs on TransactionStatus from substrate

* debug impl for Client to avoid manual debug impls elsewhere

* Add and tweak comments, specifically a note about block inclusion on errors

* clippy + fmt

* Fix docs

* Ignore 'error' statuses and adhere to the substrate docs

* tweak and improve some comments per @dvdplm's suggestions

* Break transaction* structs into separate file

* fmt and fix doc link
2021-12-09 12:23:08 +00:00