Skip to content

Commit 4b3d52e

Browse files
authored
Lift dependencies to workspace and move api-client to its own package (#848)
* move api-client to its own crate and lift all dependencies to the workspace * fix examples * fix std leak * taplo fmt * fix cargo check * fmt * fix CI * fix CI 2 * fix ac-examples-wasm * fix balances in std * taplo fmt * add new accepted licence * use workspace deps in ac-keystore * remove unnecessary deps * fix metadata path in test * fix tests * taplo fmt * fix clippy * fix metadata path 2 * fix async testing test * fix licence check
1 parent f72d0af commit 4b3d52e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+292
-272
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ jobs:
5757
cargo build --release -p test-no-std --features node-api,
5858
cargo build --release -p test-no-std --features primitives,
5959

60-
# Check build of stand-alone features.
61-
cargo check --no-default-features,
62-
cargo check --no-default-features --features sync-api,
63-
cargo check --no-default-features --features jsonrpsee-client,
64-
cargo check --no-default-features --features tungstenite-client,
65-
cargo check --no-default-features --features ws-client,
66-
cargo check --no-default-features --features staking-xt,
67-
cargo check --no-default-features --features contracts-xt,
68-
cargo check --no-default-features --features std,
60+
# Check build of stand-alone features.
61+
cargo check --no-default-features -p substrate-api-client,
62+
cargo check --no-default-features -p substrate-api-client --features sync-api,
63+
cargo check --no-default-features -p substrate-api-client --features jsonrpsee-client,
64+
cargo check --no-default-features -p substrate-api-client --features tungstenite-client,
65+
cargo check --no-default-features -p substrate-api-client --features ws-client,
66+
cargo check --no-default-features -p substrate-api-client --features staking-xt,
67+
cargo check --no-default-features -p substrate-api-client --features contracts-xt,
68+
cargo check --no-default-features -p substrate-api-client --features std,
6969

7070
# Test for 32 bit and wasm32-unknown-unknown compatibility
71-
cargo build --target wasm32-unknown-unknown --no-default-features --features sync-api,
71+
cargo build -p substrate-api-client --target wasm32-unknown-unknown --no-default-features --features sync-api,
7272
cargo build --release -p ac-examples-wasm --examples --target wasm32-unknown-unknown,
7373

7474
# Test for 32 bit and wasm32-wasip1 compatibility
75-
cargo build --target wasm32-wasip1 --no-default-features --features std --features staking-xt --features contracts-xt --features sync-api,
75+
cargo build -p substrate-api-client --target wasm32-wasip1 --no-default-features --features std --features staking-xt --features contracts-xt --features sync-api,
7676

7777
# Compile examples and integration test separately to ensure features are not cross-imported
7878
cargo test --release -p ac-examples-async,
@@ -81,9 +81,9 @@ jobs:
8181
cargo test --release -p ac-testing-sync,
8282

8383
# Clippy
84-
cargo clippy -- -D warnings,
85-
cargo clippy --no-default-features -- -D warnings,
86-
cargo clippy --all-features --examples -- -D warnings,
84+
cargo clippy -p substrate-api-client -- -D warnings,
85+
cargo clippy -p substrate-api-client --no-default-features -- -D warnings,
86+
cargo clippy -p substrate-api-client --all-features --examples -- -D warnings,
8787

8888
# Run unit tests
8989
cargo test --release --all-features --workspace --exclude test-no-std --exclude "ac-examples-*" --exclude "ac-testing-*",

Cargo.lock

Lines changed: 8 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 44 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
[package]
2-
name = "substrate-api-client"
3-
version = "1.17.0"
4-
authors = ["Supercomputing Systems AG <[email protected]>"]
5-
license = "Apache-2.0"
6-
edition = "2021"
7-
repository = "https://github.com/scs/substrate-api-client"
8-
description = "Json-rpc client with helper functions compatible with any Substrate node"
9-
readme = "README.md"
10-
keywords = ["json", "rpc", "polkadot", "api", "blockchain"]
11-
categories = ["no-std", "wasm"]
12-
13-
141
[workspace]
2+
resolver = "3"
153
members = [
16-
".",
4+
"api-client",
175
"keystore",
186
"compose-macros",
7+
"primitives",
198
"examples/async",
209
"examples/sync",
2110
"examples/wasm",
@@ -25,108 +14,76 @@ members = [
2514
"testing/sync",
2615
]
2716

28-
[dependencies]
17+
[workspace.dependencies]
2918
# crates.io no_std
3019
async-trait = "0.1"
20+
array-bytes = "9.1"
21+
bitvec = { version = "1.0", default-features = false, features = ["alloc"] }
3122
codec = { package = "parity-scale-codec", version = "3.7", default-features = false, features = ["derive"] }
3223
derive_more = { version = "2.0", default-features = false, features = ["from"] }
24+
either = { version = "1.6", default-features = false }
25+
env_logger = "0.11.8"
26+
impl-serde = { version = "0.5", default-features = false }
3327
frame-metadata = { version = "18.0", default-features = false, features = ["current", "serde_full", "decode"] }
3428
futures-util = { version = "0.3", default-features = false }
3529
hex = { version = "0.4", default-features = false, features = ["alloc"] }
3630
log = { version = "0.4", default-features = false }
3731
maybe-async = { version = "0.2" }
32+
parking_lot = "0.12"
33+
primitive-types = { version = "0.13", default-features = false, features = ["serde_no_std", "scale-info"] }
3834
serde = { version = "1.0", default-features = false, features = ["derive"] }
3935
serde_json = { version = "1.0", default-features = false }
36+
tokio = { version = "1.43", features = ["rt-multi-thread", "macros", "time"] }
37+
tokio-util = "0.7.15"
4038

39+
scale-bits = { version = "0.7", default-features = false, features = ["scale-info", "serde"] }
40+
scale-decode = { version = "0.16", default-features = false, features = ["primitive-types", "derive"] }
41+
scale-encode = { version = "0.10", default-features = false, features = ["bits", "primitive-types", "derive"] }
42+
scale-info = { version = "2.1", default-features = false, features = ["derive"] }
43+
scale-value = { version = "0.18", default-features = false }
4144

4245
# crates.io std only
43-
url = { version = "2.5", optional = true }
46+
url = { version = "2.5" }
4447

4548
# websocket dependent features
46-
jsonrpsee = { version = "0.24", optional = true, features = ["async-client", "client-ws-transport-tls", "jsonrpsee-types"] }
47-
tungstenite = { version = "0.26", optional = true, features = ["native-tls", "url"] }
48-
ws = { version = "0.9", optional = true, features = ["ssl"] }
49+
jsonrpsee = { version = "0.24", features = ["async-client", "client-ws-transport-tls", "jsonrpsee-types"] }
50+
tungstenite = { version = "0.26", features = ["native-tls", "url"] }
51+
ws = { version = "0.9", features = ["ssl"] }
4952

5053
# Substrate no_std dependencies
54+
pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
55+
sp-application-crypto = { default-features = false, features = ["full_crypto"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5156
sp-core = { default-features = false, features = ["full_crypto", "serde"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5257
sp-crypto-hashing = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
58+
sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5359
sp-inherents = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5460
sp-runtime = { default-features = false, features = ["serde"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5561
sp-runtime-interface = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
62+
sp-staking = { default-features = false, features = ["serde"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5663
sp-storage = { default-features = false, features = ["serde"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5764
sp-version = { default-features = false, features = ["serde"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
65+
sp-weights = { default-features = false, features = ["serde"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
5866

5967
# substrate std / wasm only
60-
frame-support = { optional = true, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
68+
frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
69+
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
70+
pallet-assets = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
71+
pallet-contracts = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
72+
pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
73+
pallet-recovery = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
74+
pallet-society = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
75+
pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
76+
sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
77+
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
6178

6279
# local deps
63-
ac-compose-macros = { path = "compose-macros", version = "1.17", default-features = false }
64-
ac-node-api = { path = "node-api", version = "1.17", default-features = false }
65-
ac-primitives = { path = "primitives", version = "1.17", default-features = false }
80+
ac-keystore = { default-features = false, path = "keystore", version = "1.17" }
81+
ac-compose-macros = { default-features = false, path = "compose-macros", version = "1.17" }
82+
ac-node-api = { default-features = false, path = "node-api", version = "1.17" }
83+
ac-primitives = { default-features = false, path = "primitives", version = "1.17" }
84+
substrate-api-client = { default-features = false, path = "api-client", version = "1.17" }
6685

67-
68-
[dev-dependencies]
69-
ac-node-api = { path = "node-api", version = "1.17", features = ["mocks"] }
86+
# Only used as dev-dependencies
7087
rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
71-
scale-info = { version = "2.1", features = ["derive"] }
7288
test-case = "3.1"
73-
74-
[features]
75-
default = ["std", "jsonrpsee-client"]
76-
# To support `no_std` builds in non-32 bit environments.
77-
disable_target_static_assertions = [
78-
"sp-runtime-interface/disable_target_static_assertions",
79-
]
80-
81-
# If this is active all the code compiles in synchronous mode. If not selected, code will compile to async mode.
82-
sync-api = ["ac-compose-macros/sync-api", "maybe-async/is_sync"]
83-
84-
# Use the `jsonrpsee` crate for websocket communication. Does only provide async support and needs a tokio runtime.
85-
# Provides convenience functions such as subscription callbacks.
86-
# Most examples use the `jsonrpsee` feature and can be used for reference.
87-
jsonrpsee-client = ["std", "jsonrpsee"]
88-
89-
# Use the `tungstenite` crate for websocket communication. No async support but has some reconnection capabilities.
90-
# See the example `transfer_with_tungstenite_client` on how to use it.
91-
tungstenite-client = ["std", "tungstenite", "sync-api"]
92-
93-
# Use the `ws` crate for websocket communication. No async support.
94-
# Establishes a new connection for each request and therefore is limited in terms of performance.
95-
# See the example `transfer_with_ws_client` on how to use it.
96-
ws-client = ["std", "ws", "sync-api"]
97-
98-
# Enables functionality that helps to create extrinsics for `pallet-staking`.
99-
# See the `StakingExtrinsics` trait and the `staking_batch_payout` example to get an understanding
100-
# of the functionality this feature provides
101-
staking-xt = ["std", "ac-primitives/staking-xt"]
102-
103-
# Enables functionality that helps to create extrinsics for `pallet-contracts`.
104-
# See the `ContractsExtrinsics` trait and the `contract_instantiate_with_code` example to get an understanding
105-
# of the functionality this feature provides.
106-
contracts-xt = ["std", "ac-primitives/contracts-xt"]
107-
108-
# Enables all std features of dependencies in case of std build.
109-
std = [
110-
# crates.io no_std
111-
"codec/std",
112-
"frame-metadata/std",
113-
"hex/std",
114-
"log/std",
115-
"serde/std",
116-
"serde_json/std",
117-
"futures-util/std",
118-
# crates.io std only
119-
"url",
120-
# substrate no_std
121-
"sp-core/std",
122-
"sp-runtime/std",
123-
"sp-runtime-interface/std",
124-
"sp-storage/std",
125-
"sp-version/std",
126-
# substrate std
127-
"frame-support",
128-
# local deps
129-
"ac-compose-macros/std",
130-
"ac-node-api/std",
131-
"ac-primitives/std",
132-
]
89+
sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }

0 commit comments

Comments
 (0)