Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/interlay/subxt-workshop
Subxt Workshop for Polkadot Decoded 2022
https://github.com/interlay/subxt-workshop
polkadot rust substrate subxt workshop
Last synced: about 2 months ago
JSON representation
Subxt Workshop for Polkadot Decoded 2022
- Host: GitHub
- URL: https://github.com/interlay/subxt-workshop
- Owner: interlay
- Created: 2022-06-21T13:45:47.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-26T20:54:34.000Z (over 2 years ago)
- Last Synced: 2023-03-03T20:10:28.544Z (almost 2 years ago)
- Topics: polkadot, rust, substrate, subxt, workshop
- Language: Rust
- Homepage: https://decoded.polkadot.network/agenda/?date=2022-06-30&location=berlin&presentation=building-off-chain-software-with-subxt&tz=berlin
- Size: 125 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Subxt Workshop (Polkadot Decoded 2022)
## Getting Started
### Install Rust
Follow the [Substrate docs](https://docs.substrate.io/main-docs/install/rust-builds/).
### Download Polkadot
```shell
curl "https://github.com/paritytech/polkadot/releases/download/v0.9.18/polkadot" --output /usr/local/bin/polkadot --location
```## Instructions
Run the Polkadot node in a separate terminal:
```shell
polkadot --dev --tmp> 2022-06-23 21:43:57 Parity Polkadot
> 2022-06-23 21:43:57 ✌️ version 0.9.18-99cd17ddb2-x86_64-linux-gnu
> 2022-06-23 21:43:57 ❤️ by Parity Technologies , 2017-2022
> 2022-06-23 21:43:57 📋 Chain specification: Development
> ...
```Run the test suite:
```shell
cargo test
```Notice the test failures, your task is to implement the helper functions.
The files in the [`tests/`](tests/) directory are ranked in order of difficulty.1. [Exercise 01](tests/01-get-block-number.rs) - Get the block number for a given `block_hash`.
2. [Exercise 02](tests/02-get-balance.rs) - Get the `free` balance of an `account`.
3. [Exercise 03](tests/03-get-total-frozen.rs) - Sum the total `frozen` balance.
4. [Exercise 04](tests/04-get-first-n-accounts.rs) - Fetch the first `n` accounts from storage.
5. [Exercise 05](tests/05-get-version.rs) - Return the embedded `RuntimeVersion`.
6. [Exercise 06](tests/06-transfer-balance.rs) - Transfer an `amount` from the `signer` to `dest`.
7. [Exercise 07](tests/07-estimate-inclusion-fee.rs) - Estimate the fees for an extrinsic using a custom RPC.
8. [Exercise 08](tests/08-batch-transfer.rs) - Make multiple transfers in the same call.
9. [Exercise 09](tests/09-propose-spend.rs) - Create a spending proposal and check the deposit.
10. [Exercise 10](tests/10-approve-multisig.rs) - Listen and approve multisig operations.## Other Notes
### Refresh Metadata
This is only required if you change the node / runtime.
```shell
cargo install subxt-cli
subxt metadata -f bytes > polkadot_metadata.scale
```### Examine Metadata
Verbose but helpful expansion of the generated Rust code.
```shell
cargo install cargo-expand
cargo expand
```## Credits
Thanks to all subxt / substrate maintainers and contributors.