350 Commits

Author SHA1 Message Date
pezkuwichain b8ee6a084f Rebrand subxt to pezkuwi-subxt with pezsp_runtime support
- Renamed all crate names from subxt-* to pezkuwi-subxt-*
- Updated codegen to use pezsp_runtime, pezsp_core, pezframe_support instead of sp_runtime, sp_core, frame_support
- Replaced all internal references from subxt_* to pezkuwi_subxt_*
- Added local path dependencies to Pezkuwi SDK crates
- Updated workspace configuration for edition 2024
2025-12-19 16:00:14 +03:00
PG Herveou d0f91f8631 Allow passing $OUT_DIR in the runtime_metadata_path attribute (#2142)
* Allow passing $OUT_DIR in the runtime_metadata_path attribute

* nit

* fix build

* PR review

* ignore instead of no_run
2025-12-09 12:56:18 +01:00
James Wilson 8203679cbd Merge v0.50.x to master (#2127)
* v0.50.0: Integrate frame-decode, redo storage APIs and break up Error. (#2100)

* WIP integrating new frame-decode and working out new storage APIS

* WIP: first pass adding new storage things to subxt-core

* Second pass over Address type and start impl in Subxt

* WIP new storage APIs

* WIP New storage APIs roughly completed, lots of errors still

* Remove PlainorMap enum; plain and map values now use same struct to simplify usage

* Begin 'fixing' errors

* WIP splitting errors and tidying payload/address traits

* Get subxt-core compiling

* Small fixes in subxt-core and remove metadata mod

* subxt-core: cargo check --all-targets passes

* Fix test

* WIP starting to update subxt from subxt-core changes

* WIP splitting up subxt errors into smaller variants

* WIP errors: add DispatchError errors

* Port new Storage APIs to subxt-core

* cargo check -p subxt passes

* Quick-fix errors in subxt-cli (explore subcommand)

* fmt

* Finish fixing codegen up and start fixing examples

* get Subxt examples compiling and bytes_at for constants

* Add some arcs to limit lifetimes in subxt/subxt-core storage APIs

* A little Arcing to allow more method chaining in Storage APIs, aligning with Subxt

* Update codegen test

* cargo check --all-targets passing

* cargo check --features 'unstable-light-client' passing

* clippy

* Remove unused dep in subxt

* use published frame-decode

* fix wasm-example

* Add new tx extension to fix daily tests

* Remove unused subxt_core::dynamic::DecodedValue type

* Update book to match changes

* Update docs to fix more broken bits

* Add missing docs

* fmt

* allow larger result errs for now

* Add missing alloc imports in subxt-core

* Fix doc tests and fix bug getting constant info

* Fix V14 -> Metadata transform for storage & constants

* Fix parachain example

* Fix FFI example

* BlockLength decodes t ostruct, not u128

* use fetch/iter shorthands rather than entry in most storage tests

* Fix some integration tests

* Fix Runtime codegen tests

* Expose the dynamic custom_value selecter and use in a UI test

* Update codegen metadata

* Tidy CLI storage query and support (str,str) as a storage address

* Add (str,str) as valid constant address too

* Show string tuple in constants example

* Via the magic of traits, avoid needing any clones of queries/addresses and accept references to them

* clippy

* [v0.50] update scale-info-legacy and frame-decode to latest (#2119)

* bump scale-info-legacy and frame-decode to latest

* Remove something we don't need in this PR

* Fully remove unused for now dep

* [v0.50] Convert historic metadata to subxt::Metadata (#2120)

* First pass converting historic metadatas to our subxt::Metadata type

* use published frame-decode

* fmt and rename legacy metadata macro

* Enable legacy feature where needed in subxt_metadata so it compiles on its own

* Use cargo hack more in CI and fix subxt-metadata features

* Add tests for metadata conversion (need to optimise; some too expensive right now

* Address performance and equality issues in metadata conversion testing

* fmt

* fmt all

* clippy

* Fix a doc link

* Test codegen and fixes to make it work

* Remove local frame-decode patch

* bump frame-decode to latest

* [v0.50.0] Allow visiting extrinsic fields in subxt_historic (#2124)

* Allow visiting extrinsic fields

* fmt

* Don't use local scale-decode dep

* Clippy and tidy

* Extend 'subxt codegen' CLI to work with legacy metadatas

* Simplify historic extrinsics example now that AccountId32s have paths/names

* clippy

* clippy

* clippy..

* Allow visiting storage values, too, and clean up extrinsic visiting a little by narrowing lifetime

* Try to fix flaky test

* Add custom value decode to extrinsics example

* Remove useless else branch ra thought I needed

* Simplify examples

* Prep to release v0.0.5 (#2126)
2025-11-22 10:44:03 +00:00
sunnyraindy 4ca7d75782 chore: fix typo in subxt/Cargo.toml (#2117)
Signed-off-by: sunnyraindy <sunnyraindy@outlook.com>
2025-11-10 10:24:18 +00:00
Sven Eriksson a62aea4c37 Fix typos (#2112) 2025-10-24 10:34:25 +01:00
zhoujiaweii 9080b0b2ae chore: remove redundant word in comment (#2090)
Signed-off-by: zhoujiaweii <zjwustc@outlook.com>
2025-09-17 10:01:39 +01:00
Bastian Köcher 07ed8bad33 backend::Rpc: Export RpcParams and rpc_params! (#2077)
* backend::Rpc: Export `RpcParams` and `rpc_params!`

These are required to for example call `request` on the client and thus, should also be re-exported.

* Move exports together

---------

Co-authored-by: James Wilson <james@jsdw.me>
2025-09-02 17:19:22 +01:00
James Wilson 42f1a62a05 Fix 1.89 clippy warnings (#2055)
* Fix 1.89 clippy warnings

* WASM lightclient clippy fixes too
2025-08-11 15:33:55 +01:00
Bastian Köcher 8e162036a1 Block: Implement clone (#2047) 2025-07-31 10:59:12 +01:00
Donn Pawelek 02eda40bba docs: fix typos in docs (#2045)
* docs: fix typos in docs

* up

* up
2025-07-29 16:01:22 +01:00
puzzle-rusher 17b98d0d9e Refactor: improve nonce and block injection in extrinsic params (#2032)
* Refactor: improve nonce and block injection in extrinsic params

* remove excess import

---------

Co-authored-by: James Wilson <james@jsdw.me>
2025-07-04 22:54:04 +01:00
Bastian Köcher 05c9eafe79 Improve docs for at_latest (#2035)
Tell the user that these functions operate with the last finalized block.

Co-authored-by: James Wilson <james@jsdw.me>
2025-07-04 22:06:41 +01:00
puzzle-rusher e892802baf Clippy fixes (#2033)
* clippy fixed

* wasm clippy

* clippy fixes

* post clippy fmt

* last clippy fix
2025-07-04 21:21:31 +01:00
Donn Pawelek 1f57e8fd1a docs: fix minor comment typos (#2027) 2025-06-30 10:20:07 +01:00
gcmutator 3078729271 chore: remove redundant backtick in comment (#2020)
Signed-off-by: gcmutator <329964069@qq.com>
2025-06-18 10:32:58 +01:00
James Wilson ed25a3ac26 Remove codec::Encode and codec::Decode derives from generated APIs by default (#2008)
* Remove codec::Encode and codec::Decode from generated APIs by default

* clippy fixes

* clippy

* More fixes, and CompactAs only if Encode/Decode

* revert println in example

* fix lightclient test

* fix docs

* Fix another rust doc comment

* Fix failing storage test

* Remove now-unnecessary test

* clippy

* clippy

* Remove pointless clone
2025-05-29 14:43:42 +01:00
James Wilson 7de8d36806 Prep to release v0.42.0 (#2003)
* Prep to release v0.42.0

* Remove test_context reference from example

* standalone_crate for doc tests because codegen is expensive

* fmt
2025-05-12 10:32:38 +01:00
James Wilson 23c62f3d5d Update to 2024 edition (#2001)
* Update to 2024 edition

* Update to 2024 edition; fmt, use<> and remove refs

* async functions
2025-05-09 16:12:18 +01:00
James Wilson 9ba89e3ed7 Support v16 metadata and use it by default if it's available (#1999)
* Support v16 metadata and use it by default if it's available

* lockfile

* fix blocks test; new transaction extension in kitchensink runtime

* Bump scale-typegen to 0.11.1 to cater for Duration prelude type

* fmt

* Fix no-std test building

* Cargo update and bump substrate deps

* Update test and no-std deps

* fmt

* fix test
2025-05-08 14:44:44 +01:00
James Wilson 4524590821 Metadata V16: Implement support for Pallet View Functions (#1981)
* Support Pallet View Functions in Subxt

* fmt

* clippy

* Move a little view function logic to subxt_core

* clippy

* Add back check that prob isnt needed

* avoid vec macro in core

* Add view funciton test and apply various fixes to get it working

* Add test for dynamic view fn call and fix issues

* clippy

* fix test-runtime

* fmt

* remove export

* avoid vec for nostd core

* use const instead of fn for view fn call name

* Update to support latest unstable metadata

* Update metadata stripping tests for new v16 version
2025-04-24 14:42:07 +01:00
James Wilson 21b3f52191 Metadata V16: Be more dynamic over which hasher is used. (#1974)
* Use DynamicHasher256 to support Blake2 or Keccack depending on chain

* remove Config::Hash associated type, replace with HashFor<Config> alias

* Fix doc links

* fix wasm tests

* Don't strip system pallet associated types. check System.Hashing, not Hash. Rename BlockHash trait to Hash

* Tweak comment

* fmt

* fix merge

* Fix typo
2025-04-23 10:12:48 +01:00
James Wilson b3317c5b77 Add DefaultParams to allow more transaction extensions to be used when calling _default() methods (#1979)
* Add DefaultParams to allow more transaction extensions to be used when calling _default() methods

* More imple for AnyOf/DefaultParams

* Prevent T param being used twice in macro

* clippy
2025-04-04 10:08:26 +01:00
James Wilson 06e658cd4b Allow submitting transactions ignoring follow events (#1962) 2025-03-14 16:08:38 +00:00
James Wilson 16c50846c1 Map finality timeout to Dropped instead of Invalid (#1953) 2025-03-11 15:49:52 +01:00
James Wilson b6b9ac65c7 Support constructing and submitting V5 transactions (#1931)
* TransactionExtensions basic support for V5 VerifySignature and renames

* WIP: subxt-core v5 transaction support

* Subxt to support V5 extrinsics

* WIP tests failing with wsm trap error

* Actually encode mortality to fix tx encode issue

* fmt

* rename to sign_with_account_and_signature

* Add explicit methods for v4 and v5 ext construction

* clippy

* fix wasm example and no mut self where not needed

* fix doc example

* another doc fix

* Add tests for tx encoding and fix v5 encode issue

* add copyright and todo

* refactor APIs to have clear v4/v5 split in core and slightly nicer split in subxt proper

* rename Partial/SubmittableExtrinsic to *Transaction

* Remove SignerT::address since it's not needed

* doc fixes

* fmt

* doc fixes

* Fix comment number

* Clarify panic behaviour of inject_signature

* fmt
2025-03-11 11:14:27 +00:00
James Wilson 49c66a0fd5 Wrap the subxt::events::Events type to avoid exposing subxt_core errors and types unnecessarily (#1948)
* Wrap the subxt::events::Events type to avoid exposing subxt_core errors and types unnecessarily (#1947)

* Actually import module and fix issues

* Remove a couple of unnecessary conversions now

* Test
2025-03-06 16:30:47 +00:00
James Wilson e59eef21b4 Allow transaction timeout in ChainheadBackend to be configured (#1943)
* Add configurable transaction timeout to ChainheadBackend

* u64, not usize

* Actually, stick with usize
2025-03-05 10:43:54 +00:00
James Wilson 037d5178b8 Document generating interface from Runtime WASM and change feature to runtime-wasm-path (#1936)
* runtime_metadata_path => runtime_wasm_path and document this feature

* fix doc
2025-03-03 12:07:48 +00:00
Alex Bean 72f8e0372e refactor: make ExtrinsicEvents::new public for external access (#1933) 2025-02-25 14:28:01 +00:00
wgyt 396762510a update copyright year (#1924)
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2025-02-24 16:07:29 +00:00
Niklas Adolfsson 69ce6d726f deps: remove polkadot-sdk umbrella crate (#1926)
* deps: get rid of polkadot-sdk umbrella crate

* fix nits

* Update subxt/src/backend/mod.rs

* Update subxt/src/events/events_client.rs

* Update metadata/src/utils/validation.rs

* cargo clippy fix

* fix ui tests
2025-02-24 12:38:21 +01:00
James Wilson 816a86423b Split RPCs into a separate crate (#1910)
* WIP extract RPCs into separate crate

* fmt

* Fix test

* Remove unused deps

* fix import

* WIP: Fix up errors and most tests. Start extracintg some tests/code to rpc crate

* MockRpcClient sync or async

* MockRpcClient only async but better type inference

* WIP MockRpcClient FnMuts and some test updates to use it

* Get all but one test working with new MockRpcClient

* WIP trying to debug failure

* WIP, Tests mostly fixed, need to add back oen more

* Get mock RPC tests working

* fmt

* fmt

* Clippy and comment tweak

* update CI to explicitly check subxt-rpc features

* clippy

* small tweaks after pass over

* feature flag rename

* update some docs

* Fix some examples

* fmt

* Fix features flags to work with web/wasm32

* Fix unused dep warning

* explicit targets in wasm CI

* Add better crate level docs

* fmt

* Address review comments

* Comment out flaky test for now and make more obvious how similar POlkadot and Substrate configs are

* Not a doc comment

* Remove unused imports
2025-02-18 12:07:00 +00:00
James Wilson d924ece39a Don't double hash: use the same hash in ExtrinsicDetails and ExtrinsicDetails (#1917)
* Don't double hash: use the same hash in ExtrinsicDetails and ExtrinsicEvents

* clippy
2025-02-03 17:47:31 +00:00
Niklas Adolfsson 39507c7eb4 fix: don't wrap rpc error in DisconnectedWillReconnect in reconnecting rpc client (#1904)
* fix: don't wrap rpc err in DisconnectedWillRecon

* add clarifying comment

* fix no-std-test build

* fix no-std-test build v2
2025-01-24 14:18:12 +01:00
Niklas Adolfsson f363f77a60 chore: fix clippy lints (#1882) 2024-12-10 13:08:40 +01:00
Niklas Adolfsson f5e9ce0d2c remove substrate compat (#1850)
* remove substrate compat

* add hacky example

* simplify substrate-compat example

* simplify substrate-compat example

* cargo fmt

* fix build

* add more examples

* fix nit

* fix test build

* Update subxt/examples/substrate_compat_signer.rs

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

* keep only polkadot signer example

* remove more substrate compat related stuff

* fix example

* link to substrate signer example in book

* Update subxt/src/book/usage/transactions.rs

* Update subxt/src/book/usage/transactions.rs

* address grumbles

* fix nits

---------

Co-authored-by: James Wilson <james@jsdw.me>
2024-11-27 16:46:38 +01:00
James Wilson 057c847474 Fix unstable-light-client + ChainHeadBackend tx events (#1865)
* Fix unstable-light-client + ChainHeadBackend tx events

* Add note that Broadcasted event should no longer be returned at all

* fmt
2024-11-13 15:26:11 +01:00
James Wilson f861adf5f0 When native feature is enabled, we need polkadot-sdk/std for eg examples to work (#1864) 2024-11-13 10:59:01 +00:00
paritytech-subxt-pr-maker[bot] cb9571d7a6 Update Artifacts (auto-generated) (#1860)
* Update Artifacts (auto-generated)

* fix assethub example

* update Cargo.lock for wasm tests

* cargo fmt

* fix subxt cli tests

* disable failing wasm tests

* add issue link for disabled test

---------

Co-authored-by: niklasad1 <14157425+niklasad1@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2024-11-11 18:34:02 +01:00
PG Herveou 251a925da2 fix (#1843) 2024-10-26 02:26:43 +02:00
Niklas Adolfsson dc0795b3b9 move fetch metadata to a separate crate subxt_utils_fetchmetadata (#1829)
* macros: feature-gate jsonrpsee/fetch metadata url

* make CI happy

* Update codegen/src/error.rs

* extract `fetch-metdata` to separate crate

* add missing license headers

* introduce subxt-utils crate

* add missing files

* codegen: remove unused hex crate

* fix test build

* move subxt_utils -> subxt_utils_fetchmetadata

* cargo fmt

* runtime-path -> runtime-metadata-path

* Update utils/fetch-metadata/src/lib.rs
2024-10-24 14:45:39 +01:00
James Wilson 15cf58f723 Make it clearer which extrinsic failed to decode (#1835)
* Add an extrinsic index to decode errors so that we know which extrinsic failed

* Fix subxt::BlockError to align with subxt_core::BlockError

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2024-10-23 18:03:32 +02:00
Niklas Adolfsson 9b5523e4b0 chore(deps): bump scale family crates, primitive-types and impl-serde (#1832)
* chore(deps): bump scale-encode and scale-decode

* Update Cargo.toml

* Update Cargo.toml

* Update Cargo.toml

* update Cargo.lock

* bump scale-typegen

* use primitive_types::H256

* cargo fmt

* remove old darling hack
2024-10-22 19:23:38 +02:00
Niklas Adolfsson 418bd88e62 chore(deps): replace instant with web-time (#1830)
* chore(deps): replace `instant` with `web-time`

Close https://github.com/paritytech/subxt/issues/1597

* fix build

* fix build v2

* cargo fmt
2024-10-22 15:54:54 +02:00
Niklas Adolfsson 0e86993cd7 deps: use polkadot-sdk umbrella crate (#1786)
* deps: unify usage of polkadot-sdk crates

* cargo fmt

* fix macro crate

* make tests compile

* fix more nits

* fix doc tests

* fix more nits

* more nits

* core: remove polkadot-sdk/std

* cargo fmt

* remove polkadot-sdk/std by default

* Update metadata/Cargo.toml

* remove more std

* Update Cargo.toml
2024-10-11 14:19:11 +02:00
Niklas Adolfsson 5bf1756394 chainhead backend: notify subscribers when the backend is closed (#1817)
* FollowEvent::stop include backend closed or not

* simplify code: enum variant BackendClosed

* check both stopped and backend closed

* simplify hacky code

* remove old test

* Update subxt/src/backend/chain_head/follow_stream_driver.rs

* Update subxt/src/backend/chain_head/mod.rs

* Update subxt/src/backend/chain_head/mod.rs

* Update subxt/src/backend/chain_head/follow_stream_driver.rs
2024-10-11 11:14:50 +02:00
Niklas Adolfsson 8f3c0b44fb stabilize reconnecting-rpc-client (#1803)
* stabilize reconnecting-rpc-client

* fix build

* remove missed unstable stuff
2024-10-03 20:03:16 +02:00
Niklas Adolfsson 3807b29f36 rpc: stabilize chainhead backend (#1802)
* rpc: stabilize ChainHeadBackend

* remove noise from example

* add missing features

* make tests compile

* make tests compile v2

* revert stop event

* feature-gate runtime

* Update subxt/Cargo.toml

* add docsrs feature stuff

* Update subxt/src/backend/chain_head/mod.rs

* Update subxt/src/backend/chain_head/mod.rs

* Update subxt/src/backend/chain_head/mod.rs
2024-10-03 18:14:38 +02:00
Pavlo Khrystenko 7f9a1a17c0 derive serialize on more types (#1797)
* derive serialize on more types

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2024-10-03 11:15:09 +02:00
Niklas Adolfsson cbf05d1999 fix: error message on rpc errors (#1804) 2024-10-01 20:01:07 +02:00