mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 20:35:41 +00:00
Add Web Feature to Subxt Codegen (#1175)
* add web feature to subxt codegen * add getrandom * remove compile error * metadata: Generate runtime outer enums if not present in V14 (#1174) * metadata: Extend outer enum generation for V14 Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Generate outer enums if not present Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Porpagate v14 error instead of panic Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Try to find `RuntimeCall` then `Call` enums Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Ensure the returned type is variant for outer enums Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Replace or with or_else Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Apply clippy Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Return error and generate only `RuntimeError` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata: Remove modified path Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * metadata/tests: Check missing runtime types Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * add empty use of getrandom --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Co-authored-by: James Wilson <james@jsdw.me>
This commit is contained in:
Generated
+1
@@ -4255,6 +4255,7 @@ version = "0.31.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitvec",
|
"bitvec",
|
||||||
"frame-metadata 16.0.0",
|
"frame-metadata 16.0.0",
|
||||||
|
"getrandom 0.2.10",
|
||||||
"heck",
|
"heck",
|
||||||
"hex",
|
"hex",
|
||||||
"jsonrpsee",
|
"jsonrpsee",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ description = "Generate an API for interacting with a substrate node from FRAME
|
|||||||
[features]
|
[features]
|
||||||
default = ["fetch-metadata"]
|
default = ["fetch-metadata"]
|
||||||
fetch-metadata = ["dep:jsonrpsee", "dep:tokio", "dep:frame-metadata"]
|
fetch-metadata = ["dep:jsonrpsee", "dep:tokio", "dep:frame-metadata"]
|
||||||
|
web = ["jsonrpsee?/async-wasm-client", "jsonrpsee?/client-web-transport", "getrandom/js"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", workspace = true, features = ["derive"] }
|
codec = { package = "parity-scale-codec", workspace = true, features = ["derive"] }
|
||||||
@@ -30,6 +31,9 @@ hex = { workspace = true }
|
|||||||
tokio = { workspace = true, features = ["rt-multi-thread"], optional = true }
|
tokio = { workspace = true, features = ["rt-multi-thread"], optional = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|
||||||
|
# Included if "web" feature is enabled, to enable its js feature.
|
||||||
|
getrandom = { workspace = true, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bitvec = { workspace = true }
|
bitvec = { workspace = true }
|
||||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||||
|
|||||||
+2
-2
@@ -53,8 +53,8 @@ mod types;
|
|||||||
#[cfg(feature = "fetch-metadata")]
|
#[cfg(feature = "fetch-metadata")]
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
#[cfg(all(feature = "web", feature = "fetch-metadata"))]
|
#[cfg(feature = "web")]
|
||||||
compile_error!("subxt-codegen: the features 'web' and 'fetch_metadata' cannot be used together.");
|
use getrandom as _;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
api::{GenerateRuntimeApi, RuntimeGenerator},
|
api::{GenerateRuntimeApi, RuntimeGenerator},
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ documentation.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
description = "Generate types and helpers for interacting with Substrate runtimes."
|
description = "Generate types and helpers for interacting with Substrate runtimes."
|
||||||
|
|
||||||
|
[features]
|
||||||
|
web = ["subxt-codegen/web"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ native = [
|
|||||||
|
|
||||||
# Enable this for web/wasm builds.
|
# Enable this for web/wasm builds.
|
||||||
# Exactly 1 of "web" and "native" is expected.
|
# Exactly 1 of "web" and "native" is expected.
|
||||||
web = ["jsonrpsee?/async-wasm-client", "jsonrpsee?/client-web-transport", "getrandom/js", "subxt-lightclient?/web"]
|
web = ["jsonrpsee?/async-wasm-client", "jsonrpsee?/client-web-transport", "getrandom/js", "subxt-lightclient?/web", "subxt-macro/web"]
|
||||||
|
|
||||||
# Enable this to use jsonrpsee (allowing for example `OnlineClient::from_url`).
|
# Enable this to use jsonrpsee (allowing for example `OnlineClient::from_url`).
|
||||||
jsonrpsee = ["dep:jsonrpsee"]
|
jsonrpsee = ["dep:jsonrpsee"]
|
||||||
|
|||||||
Reference in New Issue
Block a user