Skip to content

Commit

Permalink
Tangle subxt (#505)
Browse files Browse the repository at this point in the history
* tangle subxt

* clippy fix

* export subxt and scale code package

* remove build script
  • Loading branch information
salman01zp authored Mar 1, 2024
1 parent 81c5c46 commit 8be20aa
Show file tree
Hide file tree
Showing 7 changed files with 37,725 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ members = [
"precompiles/proxy",
"precompiles/preimage",
"precompiles/jobs",
"tangle-subxt"
# "relayer-gadget",
# "relayer-gadget/cli",
]
Expand Down
29 changes: 29 additions & 0 deletions tangle-subxt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "tangle-subxt"
version ={ workspace = true }
authors = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[dependencies]
parity-scale-codec = { workspace = true, optional = true }
scale-info = { workspace = true, optional = true }
subxt = { version = "0.31.0", optional = true }
subxt-metadata = { version = "0.31.0", optional = true }
subxt-codegen = { version = "0.31.0", optional = true }
serde_json = "1"
syn = { version = "2", features = ["full", "parsing"], optional = true }


[features]
default = [
"subxt",
"subxt-codegen",
"subxt-metadata",
"parity-scale-codec",
"scale-info",
"syn"
]

33 changes: 33 additions & 0 deletions tangle-subxt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<h1 align="center">Tangle-Subxt</h1>

<p align="center">
<strong>Rust interface to interact with tangle node via RPC</strong>
<br />
</p>

<br />

### Downloading metadata from a Substrate node

Use the [`subxt-cli`](https://lib.rs/crates/subxt-cli) tool to download the metadata for your target runtime from a node.

1. Install:
```bash
cargo install subxt-cli
```

2. To Save the metadata of `tangle`:
Run the release build of the `tangle` node, then on another terminal run:

```bash
subxt metadata -f bytes > ./metadata/tangle-runtime.scale
```

3. Generating the subxt code from the metadata:

```bash
subxt codegen --file metadata/tangle-runtime.scale > src/tangle_runtime.rs
```



Binary file added tangle-subxt/metadata/tangle-runtime.scale
Binary file not shown.
14 changes: 14 additions & 0 deletions tangle-subxt/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![deny(
trivial_casts,
trivial_numeric_casts,
stable_features,
non_shorthand_field_patterns,
renamed_and_removed_lints,
unsafe_code,
clippy::exhaustive_enums
)]
#![allow(clippy::all, clippy::exhaustive_enums)]
pub mod tangle_runtime;
pub use parity_scale_codec;
pub use scale_info;
pub use subxt;
Loading

0 comments on commit 8be20aa

Please sign in to comment.