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
This commit is contained in:
James Wilson authored and GitHub committed 2022-02-02 12:15:44 +00:00
1 parent 171f4ec268
commit 55f04c20a7
44 files changed
+94 -62

No files matched your search

+8 -51
View File
@@ -1,53 +1,10 @@
[workspace]
members = [".", "cli", "codegen", "macro", "test-runtime"]
[package]
name = "subxt"
version = "0.16.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "GPL-3.0"
readme = "README.md"
repository = "https://github.com/paritytech/subxt"
documentation = "https://docs.rs/subxt"
homepage = "https://www.parity.io/"
description = "Submit extrinsics (transactions) to a substrate node via RPC"
keywords = ["parity", "substrate", "blockchain"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
[dependencies]
async-trait = "0.1.49"
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive", "full", "bit-vec"] }
chameleon = "0.1.0"
scale-info = { version = "1.0.0", features = ["bit-vec"] }
futures = "0.3.13"
hex = "0.4.3"
jsonrpsee = { version = "0.8.0", features = ["ws-client", "http-client"] }
log = "0.4.14"
num-traits = { version = "0.2.14", default-features = false }
serde = { version = "1.0.124", features = ["derive"] }
serde_json = "1.0.64"
thiserror = "1.0.24"
url = "2.2.1"
subxt-macro = { version = "0.16.0", path = "macro" }
sp-core = { version = "4.0.0", default-features = false }
sp-runtime = { version = "4.0.0", default-features = false }
sp-version = "4.0.0"
frame-metadata = "14.0.0"
derivative = "2.2.0"
[dev-dependencies]
sp-arithmetic = { version = "4.0.0", default-features = false }
assert_matches = "1.5.0"
async-std = { version = "1.9.0", features = ["attributes", "tokio1"] }
env_logger = "0.9.0"
tempdir = "0.3.7"
wabt = "0.10.0"
which = "4.0.2"
test-runtime = { path = "test-runtime" }
sp-keyring = "4.0.0"
members = [
"cli",
"codegen",
"examples",
"macro",
"subxt",
"test-runtime"
]
+7 -5
View File
@@ -8,6 +8,8 @@ A library to **sub**mit e**xt**rinsics to a [substrate](https://github.com/parit
## Usage
Take a look in the [examples](./examples/examples) folder for various `subxt` usage examples.
### Downloading metadata from a Substrate node
Use the [`subxt-cli`](./cli) tool to download the metadata for your target runtime from a node.
@@ -26,7 +28,7 @@ a different node then the `metadata` command accepts a `--url` argument.
### Generating the runtime API from the downloaded metadata
Declare a module and decorate it with the `subxt` attribute which points at the downloaded metadata for the
Declare a module and decorate it with the `subxt` attribute which points at the downloaded metadata for the
target runtime:
```rust
@@ -34,20 +36,20 @@ target runtime:
pub mod node_runtime { }
```
**Important:** `runtime_metadata_path` resolves to a path relative to the directory where your crate's `Cargo.toml`
**Important:** `runtime_metadata_path` resolves to a path relative to the directory where your crate's `Cargo.toml`
resides ([`CARGO_MANIFEST_DIR`](https://doc.rust-lang.org/cargo/reference/environment-variables.html)), *not* relative to the source file.
### Initializing the API client
API is still a work in progress. See [examples](./examples) for the current usage.
API is still a work in progress. See [examples](./examples/examples) for the current usage.
### Querying Storage
API is still a work in progress. See [tests](./tests/integration/frame) for the current usage.
API is still a work in progress. See [tests](./subxt/tests/integration/frame) for the current usage.
### Submitting Extrinsics
API is still a work in progress. See [examples](./examples/polkadot_balance_transfer.rs) for the current usage.
API is still a work in progress. See [examples](./examples/examples/polkadot_balance_transfer.rs) for the current usage.
## Integration Testing
+1 -1
View File
@@ -55,7 +55,7 @@ We also assume that ongoing work done is being merged directly to the `master` b
sleep 10 && \
(cd macro && cargo hack publish --no-dev-deps --allow-dirty) && \
sleep 10 && \
cargo publish && \
(cd subxt && cargo publish) && \
sleep 10 && \
(cd cli && cargo publish);
```
+1 -1
View File
@@ -161,7 +161,7 @@ fn codegen<I: Input>(
let p = raw_derives
.iter()
.map(|raw| syn::parse_str(&raw))
.map(|raw| syn::parse_str(raw))
.collect::<Result<Vec<_>, _>>()?;
let mut derives = GeneratedTypeDerives::default();
derives.append(p.into_iter());
+21
View File
@@ -0,0 +1,21 @@
[package]
name = "subxt-examples"
version = "0.16.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
publish = false
license = "GPL-3.0"
repository = "https://github.com/paritytech/subxt"
documentation = "https://docs.rs/subxt"
homepage = "https://www.parity.io/"
description = "Subxt example usage"
[dev-dependencies]
subxt = { path = "../subxt" }
async-std = { version = "1.9.0", features = ["attributes", "tokio1"] }
sp-keyring = "4.0.0"
env_logger = "0.9.0"
futures = "0.3.13"
codec = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive", "full", "bit-vec"] }
hex = "0.4.3"
+3
View File
@@ -0,0 +1,3 @@
# Subxt Examples
Take a look in the [examples](./examples) subfolder for various `subxt` usage examples.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -58,7 +58,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?;
let raw = sub.next().await.unwrap().unwrap();
let event = <polkadot::balances::events::Transfer as codec::Decode>::decode(
let event = <polkadot::balances::events::Transfer as subxt::codec::Decode>::decode(
&mut &raw.data[..],
);
if let Ok(e) = event {
+1 -1
View File
@@ -31,6 +31,6 @@ subxt-codegen = { path = "../codegen", version = "0.16.0" }
[dev-dependencies]
pretty_assertions = "1.0.0"
subxt = { path = "..", version = "0.16.0" }
subxt = { path = "../subxt", version = "0.16.0" }
trybuild = "1.0.38"
sp-keyring = "4.0.0"
+49
View File
@@ -0,0 +1,49 @@
[package]
name = "subxt"
version = "0.16.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "GPL-3.0"
readme = "../README.md"
repository = "https://github.com/paritytech/subxt"
documentation = "https://docs.rs/subxt"
homepage = "https://www.parity.io/"
description = "Submit extrinsics (transactions) to a substrate node via RPC"
keywords = ["parity", "substrate", "blockchain"]
[dependencies]
async-trait = "0.1.49"
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive", "full", "bit-vec"] }
chameleon = "0.1.0"
scale-info = { version = "1.0.0", features = ["bit-vec"] }
futures = "0.3.13"
hex = "0.4.3"
jsonrpsee = { version = "0.8.0", features = ["ws-client", "http-client"] }
log = "0.4.14"
num-traits = { version = "0.2.14", default-features = false }
serde = { version = "1.0.124", features = ["derive"] }
serde_json = "1.0.64"
thiserror = "1.0.24"
url = "2.2.1"
subxt-macro = { version = "0.16.0", path = "../macro" }
sp-core = { version = "4.0.0", default-features = false }
sp-runtime = { version = "4.0.0", default-features = false }
sp-version = "4.0.0"
frame-metadata = "14.0.0"
derivative = "2.2.0"
[dev-dependencies]
sp-arithmetic = { version = "4.0.0", default-features = false }
assert_matches = "1.5.0"
async-std = { version = "1.9.0", features = ["attributes", "tokio1"] }
env_logger = "0.9.0"
tempdir = "0.3.7"
wabt = "0.10.0"
which = "4.0.2"
test-runtime = { path = "../test-runtime" }
sp-keyring = "4.0.0"
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -4,12 +4,12 @@ version = "0.16.0"
edition = "2021"
[dependencies]
subxt = { path = ".." }
subxt = { path = "../subxt" }
sp-runtime = "4.0.0"
codec = { package = "parity-scale-codec", version = "2", default-features = false, features = ["derive", "full", "bit-vec"] }
[build-dependencies]
subxt = { path = "..", version = "0.16.0" }
subxt = { path = "../subxt", version = "0.16.0" }
sp-core = "4.0.0"
async-std = { version = "1.9.0", features = ["attributes", "tokio1"] }
which = "4.2.2"