29 releases (breaking)

0.35.3 Apr 11, 2024
0.35.0 Mar 21, 2024
0.33.0 Dec 7, 2023
0.32.1 Oct 5, 2023
0.2.0 Nov 15, 2021

#116 in Magic Beans

Download history 2750/week @ 2023-12-23 3807/week @ 2023-12-30 5849/week @ 2024-01-06 5071/week @ 2024-01-13 5636/week @ 2024-01-20 5749/week @ 2024-01-27 7498/week @ 2024-02-03 7572/week @ 2024-02-10 5602/week @ 2024-02-17 5682/week @ 2024-02-24 6033/week @ 2024-03-02 6106/week @ 2024-03-09 6682/week @ 2024-03-16 5607/week @ 2024-03-23 9769/week @ 2024-03-30 6992/week @ 2024-04-06

30,153 downloads per month
Used in 39 crates (3 directly)

Apache-2.0 OR GPL-3.0

240KB
5K SLoC

subxt · build Latest Version Documentation

A library to submit extrinsics to a substrate node via RPC.

Usage

Take a look in the examples folder or the examples folder for various smaller or larger subxt usage examples, or read the guide to learn more.

Downloading metadata from a Substrate node

Use the subxt-cli tool to download the metadata for your target runtime from a node.

  1. Install:
cargo install subxt-cli
  1. Save the encoded metadata to a file:
subxt metadata -f bytes > metadata.scale

This defaults to querying the metadata of a locally running node on the default http://localhost:9933/. If querying a different node then the metadata command accepts a --url argument.

Subxt Documentation

For more details regarding utilizing subxt, please visit the documentation.

Integration Testing

Most tests require a running substrate node to communicate with. This is done by spawning an instance of the substrate node per test. It requires an up-to-date substrate executable on your path.

This can be installed from source via cargo:

cargo install --git https://github.com/paritytech/polkadot-sdk staging-node-cli --force

Real world usage

Please add your project to this list via a PR.

  • cargo-contract CLI for interacting with Wasm smart contracts.
  • xcm-cli CLI for submitting XCM messages.
  • phala-pherry The relayer between Phala blockchain and the off-chain Secure workers.
  • crunch CLI to claim staking rewards in batch every Era or X hours for substrate-based chains.
  • interbtc-clients Client implementations for the interBTC parachain; notably the Vault / Relayer and Oracle.
  • tidext Tidechain client with Stronghold signer.
  • staking-miner-v2 Submit NPos election solutions and get rewards.
  • polkadot-introspector Tools for monitoring Polkadot nodes.
  • ink! Smart contract language that uses subxt for allowing developers to conduct End-to-End testing of their contracts.
  • Chainflip A decentralised exchange for native cross-chain swaps.

Alternatives

substrate-api-client provides similar functionality.

License

The entire code within this repository is dual licensed under the GPL-3.0 or Apache-2.0 licenses. See the LICENSE file for more details.

Please contact us if you have questions about the licensing of our products.


lib.rs:

Generate a type safe Subxt interface for a Substrate runtime from its metadata. This is used by the #[subxt] macro and subxt codegen CLI command, but can also be used directly if preferable.

Dependencies

~7–21MB
~257K SLoC