mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-22 02:08:00 +00:00
Rebrand subxt to pezkuwi-subxt with pezsp_runtime support
- Renamed all crate names from subxt-* to pezkuwi-subxt-* - Updated codegen to use pezsp_runtime, pezsp_core, pezframe_support instead of sp_runtime, sp_core, frame_support - Replaced all internal references from subxt_* to pezkuwi_subxt_* - Added local path dependencies to Pezkuwi SDK crates - Updated workspace configuration for edition 2024
This commit is contained in:
Generated
+1304
-1567
File diff suppressed because it is too large
Load Diff
+32
-44
@@ -1,49 +1,37 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
|
# All pezkuwi-subxt crates
|
||||||
members = [
|
members = [
|
||||||
"cli",
|
"cli",
|
||||||
"codegen",
|
"codegen",
|
||||||
"core",
|
"core",
|
||||||
"lightclient",
|
"lightclient",
|
||||||
"historic",
|
|
||||||
"testing/substrate-runner",
|
|
||||||
"testing/test-runtime",
|
|
||||||
"testing/integration-tests",
|
|
||||||
"testing/integration-tests/subxt-test-macro",
|
|
||||||
"testing/ui-tests",
|
|
||||||
"testing/generate-custom-metadata",
|
|
||||||
"macro",
|
"macro",
|
||||||
"metadata",
|
"metadata",
|
||||||
"rpcs",
|
"rpcs",
|
||||||
"signer",
|
"signer",
|
||||||
"subxt",
|
"subxt",
|
||||||
"scripts/artifacts",
|
|
||||||
"utils/fetch-metadata",
|
"utils/fetch-metadata",
|
||||||
"utils/strip-metadata",
|
"utils/strip-metadata",
|
||||||
]
|
]
|
||||||
|
|
||||||
# We exclude any crates that would depend on non mutually
|
# Exclude testing and examples for now
|
||||||
# exclusive feature flags and thus can't compile with the
|
|
||||||
# workspace:
|
|
||||||
exclude = [
|
exclude = [
|
||||||
"testing/no-std-tests",
|
"historic",
|
||||||
"testing/wasm-rpc-tests",
|
"testing",
|
||||||
"testing/wasm-lightclient-tests",
|
"scripts",
|
||||||
"signer/wasm-tests",
|
"examples",
|
||||||
"examples/wasm-example",
|
|
||||||
"examples/parachain-example",
|
|
||||||
"examples/ffi-example",
|
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Pezkuwi Chain <admin@pezkuwichain.io>"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
rust-version = "1.85.0"
|
rust-version = "1.85.0"
|
||||||
license = "Apache-2.0 OR GPL-3.0"
|
license = "Apache-2.0 OR GPL-3.0"
|
||||||
repository = "https://github.com/paritytech/subxt"
|
repository = "https://github.com/pezkuwichain/pezkuwi-subxt"
|
||||||
documentation = "https://docs.rs/subxt"
|
documentation = "https://docs.rs/pezkuwi-subxt"
|
||||||
homepage = "https://www.parity.io/"
|
homepage = "https://pezkuwichain.org/"
|
||||||
|
|
||||||
[workspace.lints.rust]
|
[workspace.lints.rust]
|
||||||
bad_style = "deny"
|
bad_style = "deny"
|
||||||
@@ -144,30 +132,30 @@ futures-timer = "3"
|
|||||||
web-time = { version = "1.1", default-features = false }
|
web-time = { version = "1.1", default-features = false }
|
||||||
tokio-util = "0.7.12"
|
tokio-util = "0.7.12"
|
||||||
|
|
||||||
# Substrate crates:
|
# Pezkuwi SDK crates (rebranded from Substrate) - using local paths:
|
||||||
sc-executor = { version = "0.42.0", default-features = false }
|
pezsc-executor = { path = "../../bizinikiwi/client/executor", default-features = false }
|
||||||
sc-executor-common = { version = "0.38.0", default-features = false }
|
pezsc-executor-common = { path = "../../bizinikiwi/client/executor/common", default-features = false }
|
||||||
sp-crypto-hashing = { version = "0.1.0", default-features = false }
|
pezsp-crypto-hashing = { path = "../../bizinikiwi/primitives/crypto/hashing", default-features = false }
|
||||||
sp-core = { version = "36.1.0", default-features = false }
|
pezsp-core = { path = "../../bizinikiwi/primitives/core", default-features = false }
|
||||||
sp-keyring = { version = "41.0.0", default-features = false }
|
pezsp-keyring = { path = "../../bizinikiwi/primitives/keyring", default-features = false }
|
||||||
sp-maybe-compressed-blob = { version = "11.0.0", default-features = false }
|
pezsp-maybe-compressed-blob = { path = "../../bizinikiwi/primitives/maybe-compressed-blob", default-features = false }
|
||||||
sp-io = { version = "40.0.1", default-features = false }
|
pezsp-io = { path = "../../bizinikiwi/primitives/io", default-features = false }
|
||||||
sp-state-machine = { version = "0.45.0", default-features = false }
|
pezsp-state-machine = { path = "../../bizinikiwi/primitives/state-machine", default-features = false }
|
||||||
sp-runtime = { version = "41.1.0", default-features = false }
|
pezsp-runtime = { path = "../../bizinikiwi/primitives/runtime", default-features = false }
|
||||||
|
|
||||||
# Subxt workspace crates:
|
# Pezkuwi-Subxt workspace crates:
|
||||||
subxt = { version = "0.44.0", path = "subxt", default-features = false }
|
pezkuwi-subxt = { version = "0.44.0", path = "subxt", default-features = false }
|
||||||
subxt-core = { version = "0.44.0", path = "core", default-features = false }
|
pezkuwi-subxt-core = { version = "0.44.0", path = "core", default-features = false }
|
||||||
subxt-macro = { version = "0.44.0", path = "macro" }
|
pezkuwi-subxt-macro = { version = "0.44.0", path = "macro" }
|
||||||
subxt-metadata = { version = "0.44.0", path = "metadata", default-features = false }
|
pezkuwi-subxt-metadata = { version = "0.44.0", path = "metadata", default-features = false }
|
||||||
subxt-codegen = { version = "0.44.0", path = "codegen" }
|
pezkuwi-subxt-codegen = { version = "0.44.0", path = "codegen" }
|
||||||
subxt-signer = { version = "0.44.0", path = "signer", default-features = false }
|
pezkuwi-subxt-signer = { version = "0.44.0", path = "signer", default-features = false }
|
||||||
subxt-rpcs = { version = "0.44.0", path = "rpcs", default-features = false }
|
pezkuwi-subxt-rpcs = { version = "0.44.0", path = "rpcs", default-features = false }
|
||||||
subxt-lightclient = { version = "0.44.0", path = "lightclient", default-features = false }
|
pezkuwi-subxt-lightclient = { version = "0.44.0", path = "lightclient", default-features = false }
|
||||||
subxt-utils-fetchmetadata = { version = "0.44.0", path = "utils/fetch-metadata", default-features = false }
|
pezkuwi-subxt-utils-fetchmetadata = { version = "0.44.0", path = "utils/fetch-metadata", default-features = false }
|
||||||
subxt-utils-stripmetadata = { version = "0.44.0", path = "utils/strip-metadata", default-features = false }
|
pezkuwi-subxt-utils-stripmetadata = { version = "0.44.0", path = "utils/strip-metadata", default-features = false }
|
||||||
test-runtime = { path = "testing/test-runtime" }
|
test-runtime = { path = "testing/test-runtime" }
|
||||||
substrate-runner = { path = "testing/substrate-runner" }
|
bizinikiwi-runner = { path = "testing/substrate-runner" }
|
||||||
|
|
||||||
# subxt-signer deps that I expect aren't useful anywhere else:
|
# subxt-signer deps that I expect aren't useful anywhere else:
|
||||||
bip39 = { version = "2.1.0", default-features = false }
|
bip39 = { version = "2.1.0", default-features = false }
|
||||||
|
|||||||
+6
-6
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-cli"
|
name = "pezkuwi-subxt-cli"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -26,12 +26,12 @@ workspace = true
|
|||||||
chain-spec-pruning = ["smoldot"]
|
chain-spec-pruning = ["smoldot"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
subxt-codegen = { workspace = true }
|
pezkuwi-subxt-codegen = { workspace = true }
|
||||||
scale-typegen = { workspace = true }
|
scale-typegen = { workspace = true }
|
||||||
subxt-utils-fetchmetadata = { workspace = true, features = ["url"] }
|
pezkuwi-subxt-utils-fetchmetadata = { workspace = true, features = ["url"] }
|
||||||
subxt-utils-stripmetadata = { workspace = true }
|
pezkuwi-subxt-utils-stripmetadata = { workspace = true }
|
||||||
subxt-metadata = { workspace = true, features = ["legacy"] }
|
pezkuwi-subxt-metadata = { workspace = true, features = ["legacy"] }
|
||||||
subxt = { workspace = true, features = ["default"] }
|
pezkuwi-subxt = { workspace = true, features = ["default"] }
|
||||||
clap = { workspace = true }
|
clap = { workspace = true }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
color-eyre = { workspace = true }
|
color-eyre = { workspace = true }
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use jsonrpsee::{
|
|||||||
http_client::HttpClientBuilder,
|
http_client::HttpClientBuilder,
|
||||||
};
|
};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use subxt_utils_fetchmetadata::Url;
|
use pezkuwi_subxt_utils_fetchmetadata::Url;
|
||||||
|
|
||||||
/// Returns the node's chainSpec from the provided URL.
|
/// Returns the node's chainSpec from the provided URL.
|
||||||
pub async fn fetch_chain_spec(url: Url) -> Result<serde_json::Value, FetchSpecError> {
|
pub async fn fetch_chain_spec(url: Url) -> Result<serde_json::Value, FetchSpecError> {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use clap::Parser as ClapParser;
|
|||||||
#[cfg(feature = "chain-spec-pruning")]
|
#[cfg(feature = "chain-spec-pruning")]
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::{io::Write, path::PathBuf};
|
use std::{io::Write, path::PathBuf};
|
||||||
use subxt_utils_fetchmetadata::Url;
|
use pezkuwi_subxt_utils_fetchmetadata::Url;
|
||||||
|
|
||||||
mod fetch;
|
mod fetch;
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ use scale_typegen_description::scale_typegen::typegen::{
|
|||||||
validation::{registry_contains_type_path, similar_type_paths_in_registry},
|
validation::{registry_contains_type_path, similar_type_paths_in_registry},
|
||||||
};
|
};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use subxt_codegen::CodegenBuilder;
|
use pezkuwi_subxt_codegen::CodegenBuilder;
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
/// Generate runtime API client code from metadata.
|
/// Generate runtime API client code from metadata.
|
||||||
///
|
///
|
||||||
@@ -52,7 +52,7 @@ pub struct Opts {
|
|||||||
#[clap(long = "substitute-type", value_parser = substitute_type_parser)]
|
#[clap(long = "substitute-type", value_parser = substitute_type_parser)]
|
||||||
substitute_types: Vec<(String, String)>,
|
substitute_types: Vec<(String, String)>,
|
||||||
/// The `subxt` crate access path in the generated code.
|
/// The `subxt` crate access path in the generated code.
|
||||||
/// Defaults to `::subxt::ext::subxt_core`.
|
/// Defaults to `::pezkuwi_subxt::ext::pezkuwi_subxt_core`.
|
||||||
#[clap(long = "crate")]
|
#[clap(long = "crate")]
|
||||||
crate_path: Option<String>,
|
crate_path: Option<String>,
|
||||||
/// Do not generate documentation for the runtime API code.
|
/// Do not generate documentation for the runtime API code.
|
||||||
@@ -230,7 +230,7 @@ fn codegen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let metadata = {
|
let metadata = {
|
||||||
let runtime_metadata = subxt_metadata::decode_runtime_metadata(metadata_bytes)?;
|
let runtime_metadata = pezkuwi_subxt_metadata::decode_runtime_metadata(metadata_bytes)?;
|
||||||
let mut metadata = match runtime_metadata {
|
let mut metadata = match runtime_metadata {
|
||||||
// Too old to work with:
|
// Too old to work with:
|
||||||
frame_metadata::RuntimeMetadata::V0(_)
|
frame_metadata::RuntimeMetadata::V0(_)
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ use color_eyre::eyre::WrapErr;
|
|||||||
use jsonrpsee::client_transport::ws::Url;
|
use jsonrpsee::client_transport::ws::Url;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
use subxt_utils_fetchmetadata::MetadataVersion;
|
use pezkuwi_subxt_utils_fetchmetadata::MetadataVersion;
|
||||||
|
|
||||||
use crate::utils::validate_url_security;
|
use crate::utils::validate_url_security;
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ async fn fetch_runtime_metadata(
|
|||||||
url: Url,
|
url: Url,
|
||||||
version: MetadataVersion,
|
version: MetadataVersion,
|
||||||
) -> color_eyre::Result<Metadata> {
|
) -> color_eyre::Result<Metadata> {
|
||||||
let bytes = subxt_utils_fetchmetadata::from_url(url, version, None).await?;
|
let bytes = pezkuwi_subxt_utils_fetchmetadata::from_url(url, version, None).await?;
|
||||||
let metadata = Metadata::decode(&mut &bytes[..])?;
|
let metadata = Metadata::decode(&mut &bytes[..])?;
|
||||||
Ok(metadata)
|
Ok(metadata)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use color_eyre::owo_colors::OwoColorize;
|
|||||||
use scale_info::Variant;
|
use scale_info::Variant;
|
||||||
use scale_info::form::PortableForm;
|
use scale_info::form::PortableForm;
|
||||||
|
|
||||||
use subxt_metadata::{
|
use pezkuwi_subxt_metadata::{
|
||||||
ConstantMetadata, Metadata, PalletMetadata, RuntimeApiMetadata, StorageEntryMetadata,
|
ConstantMetadata, Metadata, PalletMetadata, RuntimeApiMetadata, StorageEntryMetadata,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use clap::Subcommand;
|
|||||||
|
|
||||||
use indoc::writedoc;
|
use indoc::writedoc;
|
||||||
use subxt::Metadata;
|
use subxt::Metadata;
|
||||||
use subxt_metadata::PalletMetadata;
|
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||||
|
|
||||||
use crate::utils::{FileOrUrl, Indent, first_paragraph_of_docs};
|
use crate::utils::{FileOrUrl, Indent, first_paragraph_of_docs};
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use subxt::{
|
|||||||
Metadata,
|
Metadata,
|
||||||
ext::{scale_decode::DecodeAsType, scale_encode::EncodeAsType},
|
ext::{scale_decode::DecodeAsType, scale_encode::EncodeAsType},
|
||||||
};
|
};
|
||||||
use subxt_metadata::RuntimeApiMetadata;
|
use pezkuwi_subxt_metadata::RuntimeApiMetadata;
|
||||||
|
|
||||||
/// Runs for a specified runtime API trait.
|
/// Runs for a specified runtime API trait.
|
||||||
/// Cases to consider:
|
/// Cases to consider:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use codec::{Decode, Encode};
|
|||||||
use color_eyre::eyre::{self, bail};
|
use color_eyre::eyre::{self, bail};
|
||||||
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
||||||
use std::{io::Write, path::PathBuf};
|
use std::{io::Write, path::PathBuf};
|
||||||
use subxt_utils_stripmetadata::StripMetadata;
|
use pezkuwi_subxt_utils_stripmetadata::StripMetadata;
|
||||||
|
|
||||||
/// Download metadata from a substrate node, for use with `subxt` codegen.
|
/// Download metadata from a substrate node, for use with `subxt` codegen.
|
||||||
#[derive(Debug, ClapParser)]
|
#[derive(Debug, ClapParser)]
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ use std::{fs, io::Read, path::PathBuf};
|
|||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
|
|
||||||
use scale_value::Value;
|
use scale_value::Value;
|
||||||
use subxt_utils_fetchmetadata::{self as fetch_metadata, MetadataVersion, Url};
|
use pezkuwi_subxt_utils_fetchmetadata::{self as fetch_metadata, MetadataVersion, Url};
|
||||||
|
|
||||||
/// The source of the metadata.
|
/// The source of the metadata.
|
||||||
#[derive(Debug, Args, Clone)]
|
#[derive(Debug, Args, Clone)]
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-codegen"
|
name = "pezkuwi-subxt-codegen"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -7,9 +7,9 @@ rust-version.workspace = true
|
|||||||
publish = true
|
publish = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
documentation = "https://docs.rs/subxt-codegen"
|
documentation = "https://docs.rs/pezkuwi-subxt-codegen"
|
||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
description = "Generate an API for interacting with a substrate node from FRAME metadata"
|
description = "Generate an API for interacting with a Pezkuwi/Bizinikiwi node from FRAME metadata"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
@@ -23,7 +23,7 @@ proc-macro2 = { workspace = true }
|
|||||||
quote = { workspace = true }
|
quote = { workspace = true }
|
||||||
syn = { workspace = true }
|
syn = { workspace = true }
|
||||||
scale-info = { workspace = true }
|
scale-info = { workspace = true }
|
||||||
subxt-metadata = { workspace = true }
|
pezkuwi-subxt-metadata = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
scale-typegen = { workspace = true }
|
scale-typegen = { workspace = true }
|
||||||
|
|
||||||
@@ -42,4 +42,4 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||||||
default-features = true
|
default-features = true
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use proc_macro2::TokenStream as TokenStream2;
|
|||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||||
use scale_typegen::{TypeGenerator, typegen::ir::type_ir::CompositeIRKind};
|
use scale_typegen::{TypeGenerator, typegen::ir::type_ir::CompositeIRKind};
|
||||||
use subxt_metadata::PalletMetadata;
|
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||||
|
|
||||||
/// Generate calls from the provided pallet's metadata. Each call returns a `StaticPayload`
|
/// Generate calls from the provided pallet's metadata. Each call returns a `StaticPayload`
|
||||||
/// that can be passed to the subxt client to submit/sign/encode.
|
/// that can be passed to the subxt client to submit/sign/encode.
|
||||||
@@ -17,7 +17,7 @@ use subxt_metadata::PalletMetadata;
|
|||||||
///
|
///
|
||||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||||
/// - `pallet` - Pallet metadata from which the calls are generated.
|
/// - `pallet` - Pallet metadata from which the calls are generated.
|
||||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||||
pub fn generate_calls(
|
pub fn generate_calls(
|
||||||
type_gen: &TypeGenerator,
|
type_gen: &TypeGenerator,
|
||||||
pallet: &PalletMetadata,
|
pallet: &PalletMetadata,
|
||||||
@@ -123,7 +123,7 @@ pub fn generate_calls(
|
|||||||
use super::root_mod;
|
use super::root_mod;
|
||||||
use super::#types_mod_ident;
|
use super::#types_mod_ident;
|
||||||
|
|
||||||
type DispatchError = #types_mod_ident::sp_runtime::DispatchError;
|
type DispatchError = #types_mod_ident::pezsp_runtime::DispatchError;
|
||||||
|
|
||||||
pub mod types {
|
pub mod types {
|
||||||
use super::#types_mod_ident;
|
use super::#types_mod_ident;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use proc_macro2::TokenStream as TokenStream2;
|
|||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
use scale_typegen::TypeGenerator;
|
use scale_typegen::TypeGenerator;
|
||||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||||
use subxt_metadata::PalletMetadata;
|
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||||
|
|
||||||
use super::CodegenError;
|
use super::CodegenError;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ use super::CodegenError;
|
|||||||
///
|
///
|
||||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||||
/// - `pallet` - Pallet metadata from which the constants are generated.
|
/// - `pallet` - Pallet metadata from which the constants are generated.
|
||||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||||
pub fn generate_constants(
|
pub fn generate_constants(
|
||||||
type_gen: &TypeGenerator,
|
type_gen: &TypeGenerator,
|
||||||
pallet: &PalletMetadata,
|
pallet: &PalletMetadata,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use heck::ToSnakeCase as _;
|
|||||||
use scale_typegen::TypeGenerator;
|
use scale_typegen::TypeGenerator;
|
||||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use subxt_metadata::{CustomValueMetadata, Metadata};
|
use pezkuwi_subxt_metadata::{CustomValueMetadata, Metadata};
|
||||||
|
|
||||||
use proc_macro2::TokenStream as TokenStream2;
|
use proc_macro2::TokenStream as TokenStream2;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
use proc_macro2::TokenStream as TokenStream2;
|
use proc_macro2::TokenStream as TokenStream2;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use scale_typegen::TypeGenerator;
|
use scale_typegen::TypeGenerator;
|
||||||
use subxt_metadata::PalletMetadata;
|
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||||
|
|
||||||
use super::CodegenError;
|
use super::CodegenError;
|
||||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use proc_macro2::TokenStream as TokenStream2;
|
|||||||
use quote::quote;
|
use quote::quote;
|
||||||
use scale_typegen::TypeGenerator;
|
use scale_typegen::TypeGenerator;
|
||||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||||
use subxt_metadata::PalletMetadata;
|
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||||
|
|
||||||
/// Generate events from the provided pallet metadata.
|
/// Generate events from the provided pallet metadata.
|
||||||
///
|
///
|
||||||
@@ -28,7 +28,7 @@ use subxt_metadata::PalletMetadata;
|
|||||||
/// pub struct EventName {
|
/// pub struct EventName {
|
||||||
/// pub event_param: type,
|
/// pub event_param: type,
|
||||||
/// }
|
/// }
|
||||||
/// impl ::subxt::events::StaticEvent for EventName {
|
/// impl ::pezkuwi_subxt::events::StaticEvent for EventName {
|
||||||
/// ...
|
/// ...
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
@@ -37,7 +37,7 @@ use subxt_metadata::PalletMetadata;
|
|||||||
///
|
///
|
||||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||||
/// - `pallet` - Pallet metadata from which the events are generated.
|
/// - `pallet` - Pallet metadata from which the events are generated.
|
||||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||||
pub fn generate_events(
|
pub fn generate_events(
|
||||||
type_gen: &TypeGenerator,
|
type_gen: &TypeGenerator,
|
||||||
pallet: &PalletMetadata,
|
pallet: &PalletMetadata,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use scale_typegen::typegen::ir::ToTokensWithSettings;
|
|||||||
use scale_typegen::typegen::ir::type_ir::{CompositeFieldIR, CompositeIR, CompositeIRKind};
|
use scale_typegen::typegen::ir::type_ir::{CompositeFieldIR, CompositeIR, CompositeIRKind};
|
||||||
use scale_typegen::typegen::type_params::TypeParameters;
|
use scale_typegen::typegen::type_params::TypeParameters;
|
||||||
use scale_typegen::typegen::type_path::TypePath;
|
use scale_typegen::typegen::type_path::TypePath;
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
use syn::{Ident, parse_quote};
|
use syn::{Ident, parse_quote};
|
||||||
|
|
||||||
use crate::error::CodegenError;
|
use crate::error::CodegenError;
|
||||||
@@ -268,7 +268,7 @@ impl RuntimeGenerator {
|
|||||||
pub static RUNTIME_APIS: [&str; #runtime_api_names_len] = [ #(#runtime_api_names,)* ];
|
pub static RUNTIME_APIS: [&str; #runtime_api_names_len] = [ #(#runtime_api_names,)* ];
|
||||||
|
|
||||||
/// The error type that is returned when there is a runtime issue.
|
/// The error type that is returned when there is a runtime issue.
|
||||||
pub type DispatchError = #types_mod_ident::sp_runtime::DispatchError;
|
pub type DispatchError = #types_mod_ident::pezsp_runtime::DispatchError;
|
||||||
|
|
||||||
/// The outer event enum.
|
/// The outer event enum.
|
||||||
pub type Event = #event_path;
|
pub type Event = #event_path;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use quote::{format_ident, quote};
|
|||||||
use scale_typegen::TypeGenerator;
|
use scale_typegen::TypeGenerator;
|
||||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use subxt_metadata::{PalletMetadata, ViewFunctionMetadata};
|
use pezkuwi_subxt_metadata::{PalletMetadata, ViewFunctionMetadata};
|
||||||
|
|
||||||
pub fn generate_pallet_view_functions(
|
pub fn generate_pallet_view_functions(
|
||||||
type_gen: &TypeGenerator,
|
type_gen: &TypeGenerator,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use heck::ToUpperCamelCase as _;
|
|||||||
|
|
||||||
use scale_typegen::TypeGenerator;
|
use scale_typegen::TypeGenerator;
|
||||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||||
use subxt_metadata::{Metadata, RuntimeApiMetadata};
|
use pezkuwi_subxt_metadata::{Metadata, RuntimeApiMetadata};
|
||||||
|
|
||||||
use proc_macro2::TokenStream as TokenStream2;
|
use proc_macro2::TokenStream as TokenStream2;
|
||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
@@ -239,7 +239,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use scale_info::meta_type;
|
use scale_info::meta_type;
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
fn metadata_with_runtime_apis(runtime_apis: Vec<RuntimeApiMetadata>) -> Metadata {
|
fn metadata_with_runtime_apis(runtime_apis: Vec<RuntimeApiMetadata>) -> Metadata {
|
||||||
let extrinsic_metadata = v15::ExtrinsicMetadata {
|
let extrinsic_metadata = v15::ExtrinsicMetadata {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use heck::ToSnakeCase as _;
|
|||||||
use proc_macro2::TokenStream as TokenStream2;
|
use proc_macro2::TokenStream as TokenStream2;
|
||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
use scale_typegen::TypeGenerator;
|
use scale_typegen::TypeGenerator;
|
||||||
use subxt_metadata::{PalletMetadata, StorageEntryMetadata};
|
use pezkuwi_subxt_metadata::{PalletMetadata, StorageEntryMetadata};
|
||||||
|
|
||||||
use super::CodegenError;
|
use super::CodegenError;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ use scale_typegen::typegen::ir::ToTokensWithSettings;
|
|||||||
///
|
///
|
||||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||||
/// - `pallet` - Pallet metadata from which the storage items are generated.
|
/// - `pallet` - Pallet metadata from which the storage items are generated.
|
||||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||||
pub fn generate_storage(
|
pub fn generate_storage(
|
||||||
type_gen: &TypeGenerator,
|
type_gen: &TypeGenerator,
|
||||||
pallet: &PalletMetadata,
|
pallet: &PalletMetadata,
|
||||||
@@ -173,7 +173,7 @@ fn generate_storage_entry_fns(
|
|||||||
mod tests {
|
mod tests {
|
||||||
use frame_metadata::v15;
|
use frame_metadata::v15;
|
||||||
use scale_info::{MetaType, meta_type};
|
use scale_info::{MetaType, meta_type};
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
// TODO: Think about adding tests for storage codegen which can use this sort of function.
|
// TODO: Think about adding tests for storage codegen which can use this sort of function.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
+10
-10
@@ -28,7 +28,7 @@ use syn::parse_quote;
|
|||||||
|
|
||||||
// Part of the public interface, so expose:
|
// Part of the public interface, so expose:
|
||||||
pub use error::CodegenError;
|
pub use error::CodegenError;
|
||||||
pub use subxt_metadata::Metadata;
|
pub use pezkuwi_subxt_metadata::Metadata;
|
||||||
pub use syn;
|
pub use syn;
|
||||||
|
|
||||||
/// Generate a type safe interface to use with `subxt`.
|
/// Generate a type safe interface to use with `subxt`.
|
||||||
@@ -42,7 +42,7 @@ pub use syn;
|
|||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use codec::Decode;
|
/// use codec::Decode;
|
||||||
/// use subxt_codegen::{ Metadata, CodegenBuilder };
|
/// use pezkuwi_subxt_codegen::{ Metadata, CodegenBuilder };
|
||||||
///
|
///
|
||||||
/// // Get hold of and decode some metadata:
|
/// // Get hold of and decode some metadata:
|
||||||
/// let encoded = std::fs::read("../artifacts/polkadot_metadata_full.scale").unwrap();
|
/// let encoded = std::fs::read("../artifacts/polkadot_metadata_full.scale").unwrap();
|
||||||
@@ -71,7 +71,7 @@ pub struct CodegenBuilder {
|
|||||||
impl Default for CodegenBuilder {
|
impl Default for CodegenBuilder {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
CodegenBuilder {
|
CodegenBuilder {
|
||||||
crate_path: syn::parse_quote!(::subxt::ext::subxt_core),
|
crate_path: syn::parse_quote!(::pezkuwi_subxt::ext::pezkuwi_subxt_core),
|
||||||
use_default_derives: true,
|
use_default_derives: true,
|
||||||
use_default_substitutions: true,
|
use_default_substitutions: true,
|
||||||
generate_docs: true,
|
generate_docs: true,
|
||||||
@@ -216,7 +216,7 @@ impl CodegenBuilder {
|
|||||||
self.item_mod = item_mod;
|
self.item_mod = item_mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the path to the `subxt` crate. By default, we expect it to be at `::subxt::ext::subxt_core`.
|
/// Set the path to the `subxt` crate. By default, we expect it to be at `::pezkuwi_subxt::ext::pezkuwi_subxt_core`.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
@@ -232,7 +232,7 @@ impl CodegenBuilder {
|
|||||||
self.crate_path = crate_path;
|
self.crate_path = crate_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate an interface, assuming that the default path to the `subxt` crate is `::subxt::ext::subxt_core`.
|
/// Generate an interface, assuming that the default path to the `subxt` crate is `::pezkuwi_subxt::ext::pezkuwi_subxt_core`.
|
||||||
/// If the `subxt` crate is not available as a top level dependency, use `generate` and provide
|
/// If the `subxt` crate is not available as a top level dependency, use `generate` and provide
|
||||||
/// a valid path to the `subxt¦ crate.
|
/// a valid path to the `subxt¦ crate.
|
||||||
pub fn generate(self, metadata: Metadata) -> Result<TokenStream2, CodegenError> {
|
pub fn generate(self, metadata: Metadata) -> Result<TokenStream2, CodegenError> {
|
||||||
@@ -300,7 +300,7 @@ impl CodegenBuilder {
|
|||||||
/// The default [`scale_typegen::TypeGeneratorSettings`], subxt is using for generating code.
|
/// The default [`scale_typegen::TypeGeneratorSettings`], subxt is using for generating code.
|
||||||
/// Useful for emulating subxt's code generation settings from e.g. subxt-explorer.
|
/// Useful for emulating subxt's code generation settings from e.g. subxt-explorer.
|
||||||
pub fn default_subxt_type_gen_settings() -> TypeGeneratorSettings {
|
pub fn default_subxt_type_gen_settings() -> TypeGeneratorSettings {
|
||||||
let crate_path: syn::Path = parse_quote!(::subxt::ext::subxt_core);
|
let crate_path: syn::Path = parse_quote!(::pezkuwi_subxt::ext::pezkuwi_subxt_core);
|
||||||
let derives = default_derives(&crate_path);
|
let derives = default_derives(&crate_path);
|
||||||
let substitutes = default_substitutes(&crate_path);
|
let substitutes = default_substitutes(&crate_path);
|
||||||
subxt_type_gen_settings(derives, substitutes, &crate_path, true)
|
subxt_type_gen_settings(derives, substitutes, &crate_path, true)
|
||||||
@@ -377,7 +377,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
|||||||
parse_quote!(#crate_path::utils::bits::Msb0),
|
parse_quote!(#crate_path::utils::bits::Msb0),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
parse_quote!(sp_core::crypto::AccountId32),
|
parse_quote!(pezsp_core::crypto::AccountId32),
|
||||||
parse_quote!(#crate_path::utils::AccountId32),
|
parse_quote!(#crate_path::utils::AccountId32),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -385,7 +385,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
|||||||
parse_quote!(#crate_path::utils::AccountId20),
|
parse_quote!(#crate_path::utils::AccountId20),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
parse_quote!(sp_runtime::multiaddress::MultiAddress),
|
parse_quote!(pezsp_runtime::multiaddress::MultiAddress),
|
||||||
parse_quote!(#crate_path::utils::MultiAddress),
|
parse_quote!(#crate_path::utils::MultiAddress),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -401,7 +401,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
|||||||
parse_quote!(#crate_path::utils::H512),
|
parse_quote!(#crate_path::utils::H512),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
parse_quote!(frame_support::traits::misc::WrapperKeepOpaque),
|
parse_quote!(pezframe_support::traits::misc::WrapperKeepOpaque),
|
||||||
parse_quote!(#crate_path::utils::WrapperKeepOpaque),
|
parse_quote!(#crate_path::utils::WrapperKeepOpaque),
|
||||||
),
|
),
|
||||||
// BTreeMap and BTreeSet impose an `Ord` constraint on their key types. This
|
// BTreeMap and BTreeSet impose an `Ord` constraint on their key types. This
|
||||||
@@ -427,7 +427,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
|||||||
|
|
||||||
// Note: Not sure if this is appropriate or not. The most recent polkadot.rs file does not have these.
|
// Note: Not sure if this is appropriate or not. The most recent polkadot.rs file does not have these.
|
||||||
(
|
(
|
||||||
parse_quote!(sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic),
|
parse_quote!(pezsp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic),
|
||||||
parse_quote!(#crate_path::utils::UncheckedExtrinsic),
|
parse_quote!(#crate_path::utils::UncheckedExtrinsic),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
+11
-11
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-core"
|
name = "pezkuwi-subxt-core"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -20,16 +20,16 @@ std = [
|
|||||||
"codec/std",
|
"codec/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
"frame-metadata/std",
|
"frame-metadata/std",
|
||||||
"subxt-metadata/std",
|
"pezkuwi-subxt-metadata/std",
|
||||||
"hex/std",
|
"hex/std",
|
||||||
"serde/std",
|
"serde/std",
|
||||||
"serde_json/std",
|
"serde_json/std",
|
||||||
"tracing/std",
|
"tracing/std",
|
||||||
"impl-serde/std",
|
"impl-serde/std",
|
||||||
"primitive-types/std",
|
"primitive-types/std",
|
||||||
"sp-core/std",
|
"pezsp-core/std",
|
||||||
"sp-keyring/std",
|
"pezsp-keyring/std",
|
||||||
"sp-crypto-hashing/std",
|
"pezsp-crypto-hashing/std",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -41,13 +41,13 @@ scale-bits = { workspace = true, default-features = false }
|
|||||||
scale-decode = { workspace = true, default-features = false, features = ["derive", "primitive-types"] }
|
scale-decode = { workspace = true, default-features = false, features = ["derive", "primitive-types"] }
|
||||||
scale-encode = { workspace = true, default-features = false, features = ["derive", "primitive-types", "bits"] }
|
scale-encode = { workspace = true, default-features = false, features = ["derive", "primitive-types", "bits"] }
|
||||||
frame-metadata = { workspace = true, default-features = false }
|
frame-metadata = { workspace = true, default-features = false }
|
||||||
subxt-metadata = { workspace = true, default-features = false }
|
pezkuwi-subxt-metadata = { workspace = true, default-features = false }
|
||||||
derive-where = { workspace = true }
|
derive-where = { workspace = true }
|
||||||
hex = { workspace = true }
|
hex = { workspace = true }
|
||||||
serde = { workspace = true, default-features = false, features = ["derive"] }
|
serde = { workspace = true, default-features = false, features = ["derive"] }
|
||||||
serde_json = { workspace = true, default-features = false, features = ["raw_value", "alloc"] }
|
serde_json = { workspace = true, default-features = false, features = ["raw_value", "alloc"] }
|
||||||
tracing = { workspace = true, default-features = false }
|
tracing = { workspace = true, default-features = false }
|
||||||
sp-crypto-hashing = { workspace = true }
|
pezsp-crypto-hashing = { workspace = true }
|
||||||
hashbrown = { workspace = true }
|
hashbrown = { workspace = true }
|
||||||
thiserror = { workspace = true, default-features = false }
|
thiserror = { workspace = true, default-features = false }
|
||||||
|
|
||||||
@@ -66,10 +66,10 @@ keccak-hash = { workspace = true}
|
|||||||
assert_matches = { workspace = true }
|
assert_matches = { workspace = true }
|
||||||
bitvec = { workspace = true }
|
bitvec = { workspace = true }
|
||||||
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
||||||
subxt-macro = { workspace = true }
|
pezkuwi-subxt-macro = { workspace = true }
|
||||||
subxt-signer = { workspace = true, features = ["sr25519", "subxt"] }
|
pezkuwi-subxt-signer = { workspace = true, features = ["sr25519", "subxt"] }
|
||||||
sp-core = { workspace = true }
|
pezsp-core = { workspace = true }
|
||||||
sp-keyring = { workspace = true }
|
pezsp-keyring = { workspace = true }
|
||||||
hex = { workspace = true }
|
hex = { workspace = true }
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
let runtime_metadata: RuntimeMetadataPrefixed = meta.into();
|
let runtime_metadata: RuntimeMetadataPrefixed = meta.into();
|
||||||
let metadata: subxt_metadata::Metadata = runtime_metadata.try_into().unwrap();
|
let metadata: pezkuwi_subxt_metadata::Metadata = runtime_metadata.try_into().unwrap();
|
||||||
|
|
||||||
metadata
|
metadata
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,15 @@
|
|||||||
//! ```rust
|
//! ```rust
|
||||||
//! extern crate alloc;
|
//! extern crate alloc;
|
||||||
//!
|
//!
|
||||||
//! use subxt_macro::subxt;
|
//! use pezkuwi_subxt_macro::subxt;
|
||||||
//! use subxt_core::blocks;
|
//! use pezkuwi_subxt_core::blocks;
|
||||||
//! use subxt_core::Metadata;
|
//! use pezkuwi_subxt_core::Metadata;
|
||||||
//! use subxt_core::config::PolkadotConfig;
|
//! use pezkuwi_subxt_core::config::PolkadotConfig;
|
||||||
//! use alloc::vec;
|
//! use alloc::vec;
|
||||||
//!
|
//!
|
||||||
//! // If we generate types without `subxt`, we need to point to `::subxt_core`:
|
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
|
||||||
//! #[subxt(
|
//! #[subxt(
|
||||||
//! crate = "::subxt_core",
|
//! crate = "::pezkuwi_subxt_core",
|
||||||
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
||||||
//! )]
|
//! )]
|
||||||
//! pub mod polkadot {}
|
//! pub mod polkadot {}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use core::fmt::Debug;
|
|||||||
use scale_decode::DecodeAsType;
|
use scale_decode::DecodeAsType;
|
||||||
use scale_encode::EncodeAsType;
|
use scale_encode::EncodeAsType;
|
||||||
use serde::{Serialize, de::DeserializeOwned};
|
use serde::{Serialize, de::DeserializeOwned};
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
pub use default_extrinsic_params::{DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder};
|
pub use default_extrinsic_params::{DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder};
|
||||||
pub use extrinsic_params::{ExtrinsicParams, ExtrinsicParamsEncoder};
|
pub use extrinsic_params::{ExtrinsicParams, ExtrinsicParamsEncoder};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use alloc::vec::Vec;
|
|||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
pub use primitive_types::{H256, U256};
|
pub use primitive_types::{H256, U256};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
/// Default set of commonly used types by Substrate runtimes.
|
/// Default set of commonly used types by Substrate runtimes.
|
||||||
// Note: We only use this at the type level, so it should be impossible to
|
// Note: We only use this at the type level, so it should be impossible to
|
||||||
@@ -51,7 +51,7 @@ impl Hasher for BlakeTwo256 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn hash(&self, s: &[u8]) -> Self::Output {
|
fn hash(&self, s: &[u8]) -> Self::Output {
|
||||||
sp_crypto_hashing::blake2_256(s).into()
|
pezsp_crypto_hashing::blake2_256(s).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,8 +100,8 @@ impl Hasher for DynamicHasher256 {
|
|||||||
|
|
||||||
fn hash(&self, s: &[u8]) -> Self::Output {
|
fn hash(&self, s: &[u8]) -> Self::Output {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
HashType::BlakeTwo256 | HashType::Unknown => sp_crypto_hashing::blake2_256(s).into(),
|
HashType::BlakeTwo256 | HashType::Unknown => pezsp_crypto_hashing::blake2_256(s).into(),
|
||||||
HashType::Keccak256 => sp_crypto_hashing::keccak_256(s).into(),
|
HashType::Keccak256 => pezsp_crypto_hashing::keccak_256(s).into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use subxt_macro::subxt;
|
//! use pezkuwi_subxt_macro::subxt;
|
||||||
//! use subxt_core::constants;
|
//! use pezkuwi_subxt_core::constants;
|
||||||
//! use subxt_core::Metadata;
|
//! use pezkuwi_subxt_core::Metadata;
|
||||||
//!
|
//!
|
||||||
//! // If we generate types without `subxt`, we need to point to `::subxt_core`:
|
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
|
||||||
//! #[subxt(
|
//! #[subxt(
|
||||||
//! crate = "::subxt_core",
|
//! crate = "::pezkuwi_subxt_core",
|
||||||
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
||||||
//! )]
|
//! )]
|
||||||
//! pub mod polkadot {}
|
//! pub mod polkadot {}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use subxt_macro::subxt;
|
//! use pezkuwi_subxt_macro::subxt;
|
||||||
//! use subxt_core::custom_values;
|
//! use pezkuwi_subxt_core::custom_values;
|
||||||
//! use subxt_core::Metadata;
|
//! use pezkuwi_subxt_core::Metadata;
|
||||||
//!
|
//!
|
||||||
//! // If we generate types without `subxt`, we need to point to `::subxt_core`:
|
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
|
||||||
//! #[subxt(
|
//! #[subxt(
|
||||||
//! crate = "::subxt_core",
|
//! crate = "::pezkuwi_subxt_core",
|
||||||
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
||||||
//! )]
|
//! )]
|
||||||
//! pub mod polkadot {}
|
//! pub mod polkadot {}
|
||||||
@@ -156,7 +156,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let metadata: subxt_metadata::Metadata = frame_metadata.try_into().unwrap();
|
let metadata: pezkuwi_subxt_metadata::Metadata = frame_metadata.try_into().unwrap();
|
||||||
metadata
|
metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -7,15 +7,15 @@
|
|||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use subxt_macro::subxt;
|
//! use pezkuwi_subxt_macro::subxt;
|
||||||
//! use subxt_core::config::PolkadotConfig;
|
//! use pezkuwi_subxt_core::config::PolkadotConfig;
|
||||||
//! use subxt_core::events;
|
//! use pezkuwi_subxt_core::events;
|
||||||
//! use subxt_core::Metadata;
|
//! use pezkuwi_subxt_core::Metadata;
|
||||||
//! use subxt_core::dynamic::Value;
|
//! use pezkuwi_subxt_core::dynamic::Value;
|
||||||
//!
|
//!
|
||||||
//! // If we generate types without `subxt`, we need to point to `::subxt_core`:
|
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
|
||||||
//! #[subxt(
|
//! #[subxt(
|
||||||
//! crate = "::subxt_core",
|
//! crate = "::pezkuwi_subxt_core",
|
||||||
//! runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
//! runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||||
//! )]
|
//! )]
|
||||||
//! pub mod polkadot {}
|
//! pub mod polkadot {}
|
||||||
@@ -45,7 +45,7 @@ use alloc::vec::Vec;
|
|||||||
use codec::{Compact, Decode, Encode};
|
use codec::{Compact, Decode, Encode};
|
||||||
use derive_where::derive_where;
|
use derive_where::derive_where;
|
||||||
use scale_decode::{DecodeAsFields, DecodeAsType};
|
use scale_decode::{DecodeAsFields, DecodeAsType};
|
||||||
use subxt_metadata::PalletMetadata;
|
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Metadata,
|
Metadata,
|
||||||
@@ -587,7 +587,7 @@ pub(crate) mod test_utils {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
let runtime_metadata: RuntimeMetadataPrefixed = meta.into();
|
let runtime_metadata: RuntimeMetadataPrefixed = meta.into();
|
||||||
let metadata: subxt_metadata::Metadata = runtime_metadata.try_into().unwrap();
|
let metadata: pezkuwi_subxt_metadata::Metadata = runtime_metadata.try_into().unwrap();
|
||||||
|
|
||||||
metadata
|
metadata
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ pub mod view_functions;
|
|||||||
|
|
||||||
pub use config::Config;
|
pub use config::Config;
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
pub use subxt_metadata::Metadata;
|
pub use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
/// Re-exports of some of the key external crates.
|
/// Re-exports of some of the key external crates.
|
||||||
pub mod ext {
|
pub mod ext {
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use subxt_macro::subxt;
|
//! use pezkuwi_subxt_macro::subxt;
|
||||||
//! use subxt_core::runtime_api;
|
//! use pezkuwi_subxt_core::runtime_api;
|
||||||
//! use subxt_core::Metadata;
|
//! use pezkuwi_subxt_core::Metadata;
|
||||||
//!
|
//!
|
||||||
//! // If we generate types without `subxt`, we need to point to `::subxt_core`:
|
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
|
||||||
//! #[subxt(
|
//! #[subxt(
|
||||||
//! crate = "::subxt_core",
|
//! crate = "::pezkuwi_subxt_core",
|
||||||
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
||||||
//! )]
|
//! )]
|
||||||
//! pub mod polkadot {}
|
//! pub mod polkadot {}
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use subxt_signer::sr25519::dev;
|
//! use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
//! use subxt_macro::subxt;
|
//! use pezkuwi_subxt_macro::subxt;
|
||||||
//! use subxt_core::storage;
|
//! use pezkuwi_subxt_core::storage;
|
||||||
//! use subxt_core::Metadata;
|
//! use pezkuwi_subxt_core::Metadata;
|
||||||
//!
|
//!
|
||||||
//! // If we generate types without `subxt`, we need to point to `::subxt_core`:
|
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
|
||||||
//! #[subxt(
|
//! #[subxt(
|
||||||
//! crate = "::subxt_core",
|
//! crate = "::pezkuwi_subxt_core",
|
||||||
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
||||||
//! )]
|
//! )]
|
||||||
//! pub mod polkadot {}
|
//! pub mod polkadot {}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use alloc::sync::Arc;
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use frame_decode::storage::{IntoEncodableValues, StorageInfo};
|
use frame_decode::storage::{IntoEncodableValues, StorageInfo};
|
||||||
use scale_info::PortableRegistry;
|
use scale_info::PortableRegistry;
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
/// Create a [`StorageEntry`] to work with a given storage entry.
|
/// Create a [`StorageEntry`] to work with a given storage entry.
|
||||||
pub fn entry<'info, Addr: Address>(
|
pub fn entry<'info, Addr: Address>(
|
||||||
|
|||||||
+10
-10
@@ -7,17 +7,17 @@
|
|||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use subxt_signer::sr25519::dev;
|
//! use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
//! use subxt_macro::subxt;
|
//! use pezkuwi_subxt_macro::subxt;
|
||||||
//! use subxt_core::config::{PolkadotConfig, HashFor};
|
//! use pezkuwi_subxt_core::config::{PolkadotConfig, HashFor};
|
||||||
//! use subxt_core::config::DefaultExtrinsicParamsBuilder as Params;
|
//! use pezkuwi_subxt_core::config::DefaultExtrinsicParamsBuilder as Params;
|
||||||
//! use subxt_core::tx;
|
//! use pezkuwi_subxt_core::tx;
|
||||||
//! use subxt_core::utils::H256;
|
//! use pezkuwi_subxt_core::utils::H256;
|
||||||
//! use subxt_core::Metadata;
|
//! use pezkuwi_subxt_core::Metadata;
|
||||||
//!
|
//!
|
||||||
//! // If we generate types without `subxt`, we need to point to `::subxt_core`:
|
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
|
||||||
//! #[subxt(
|
//! #[subxt(
|
||||||
//! crate = "::subxt_core",
|
//! crate = "::pezkuwi_subxt_core",
|
||||||
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
|
||||||
//! )]
|
//! )]
|
||||||
//! pub mod polkadot {}
|
//! pub mod polkadot {}
|
||||||
@@ -69,7 +69,7 @@ use alloc::vec::Vec;
|
|||||||
use codec::{Compact, Encode};
|
use codec::{Compact, Encode};
|
||||||
use payload::Payload;
|
use payload::Payload;
|
||||||
use signer::Signer as SignerT;
|
use signer::Signer as SignerT;
|
||||||
use sp_crypto_hashing::blake2_256;
|
use pezsp_crypto_hashing::blake2_256;
|
||||||
|
|
||||||
// Expose these here since we expect them in some calls below.
|
// Expose these here since we expect them in some calls below.
|
||||||
pub use crate::client::{ClientState, RuntimeVersion};
|
pub use crate::client::{ClientState, RuntimeVersion};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use hex::decode;
|
use hex::decode;
|
||||||
use std::{ffi::CStr, os::raw::c_char, sync::OnceLock};
|
use std::{ffi::CStr, os::raw::c_char, sync::OnceLock};
|
||||||
use subxt::{OnlineClient, PolkadotConfig, dynamic::Value, ext::scale_value::Composite, tx};
|
use subxt::{OnlineClient, PolkadotConfig, dynamic::Value, ext::scale_value::Composite, tx};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
|
|
||||||
static TOKIO: OnceLock<Runtime> = OnceLock::new();
|
static TOKIO: OnceLock<Runtime> = OnceLock::new();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use subxt::{
|
|||||||
utils::{AccountId32, MultiAddress},
|
utils::{AccountId32, MultiAddress},
|
||||||
OnlineClient,
|
OnlineClient,
|
||||||
};
|
};
|
||||||
use subxt_signer::sr25519::dev::{self};
|
use pezkuwi_subxt_signer::sr25519::dev::{self};
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "statemint_metadata.scale")]
|
#[subxt::subxt(runtime_metadata_path = "statemint_metadata.scale")]
|
||||||
pub mod statemint {}
|
pub mod statemint {}
|
||||||
|
|||||||
+2
-2
@@ -42,7 +42,7 @@ jsonrpsee = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
subxt-rpcs = { workspace = true }
|
pezkuwi-subxt-rpcs = { workspace = true }
|
||||||
frame-decode = { workspace = true, features = ["legacy", "legacy-types"] }
|
frame-decode = { workspace = true, features = ["legacy", "legacy-types"] }
|
||||||
frame-metadata = { workspace = true, features = ["std", "legacy"] }
|
frame-metadata = { workspace = true, features = ["std", "legacy"] }
|
||||||
scale-type-resolver = { workspace = true, features = ["scale-info"] }
|
scale-type-resolver = { workspace = true, features = ["scale-info"] }
|
||||||
@@ -52,7 +52,7 @@ scale-info = { workspace = true }
|
|||||||
scale-info-legacy = { workspace = true }
|
scale-info-legacy = { workspace = true }
|
||||||
scale-decode = { workspace = true }
|
scale-decode = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
sp-crypto-hashing = { workspace = true }
|
pezsp-crypto-hashing = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ use codec::{Compact, Decode, Encode};
|
|||||||
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
||||||
use scale_info_legacy::TypeRegistrySet;
|
use scale_info_legacy::TypeRegistrySet;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use subxt_rpcs::methods::chain_head::ArchiveCallResult;
|
use pezkuwi_subxt_rpcs::methods::chain_head::ArchiveCallResult;
|
||||||
use subxt_rpcs::{ChainHeadRpcMethods, RpcClient};
|
use pezkuwi_subxt_rpcs::{ChainHeadRpcMethods, RpcClient};
|
||||||
|
|
||||||
#[cfg(feature = "jsonrpsee")]
|
#[cfg(feature = "jsonrpsee")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "jsonrpsee")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "jsonrpsee")))]
|
||||||
@@ -51,7 +51,7 @@ impl<T: Config> OnlineClient<T> {
|
|||||||
})?;
|
})?;
|
||||||
if !Self::is_url_secure(&url) {
|
if !Self::is_url_secure(&url) {
|
||||||
return Err(OnlineClientError::RpcClientError(
|
return Err(OnlineClientError::RpcClientError(
|
||||||
subxt_rpcs::Error::InsecureUrl(url_str.to_string()),
|
pezkuwi_subxt_rpcs::Error::InsecureUrl(url_str.to_string()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
OnlineClient::from_insecure_url(config, url).await
|
OnlineClient::from_insecure_url(config, url).await
|
||||||
@@ -206,7 +206,7 @@ async fn get_spec_version<T: Config>(
|
|||||||
block_hash: <T as Config>::Hash,
|
block_hash: <T as Config>::Hash,
|
||||||
) -> Result<u32, OnlineClientAtBlockError> {
|
) -> Result<u32, OnlineClientAtBlockError> {
|
||||||
use codec::Decode;
|
use codec::Decode;
|
||||||
use subxt_rpcs::methods::chain_head::ArchiveCallResult;
|
use pezkuwi_subxt_rpcs::methods::chain_head::ArchiveCallResult;
|
||||||
|
|
||||||
// make a runtime call to get the version information. This is also a constant
|
// make a runtime call to get the version information. This is also a constant
|
||||||
// in the metadata and so we could fetch it from there to avoid the call, but it would be a
|
// in the metadata and so we could fetch it from there to avoid the call, but it would be a
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ pub mod substrate;
|
|||||||
use scale_info_legacy::TypeRegistrySet;
|
use scale_info_legacy::TypeRegistrySet;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use subxt_rpcs::RpcConfig;
|
use pezkuwi_subxt_rpcs::RpcConfig;
|
||||||
|
|
||||||
pub use polkadot::PolkadotConfig;
|
pub use polkadot::PolkadotConfig;
|
||||||
pub use substrate::SubstrateConfig;
|
pub use substrate::SubstrateConfig;
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ impl Config for PolkadotConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl subxt_rpcs::RpcConfig for PolkadotConfig {
|
impl pezkuwi_subxt_rpcs::RpcConfig for PolkadotConfig {
|
||||||
type Hash = <SubstrateConfig as subxt_rpcs::RpcConfig>::Hash;
|
type Hash = <SubstrateConfig as pezkuwi_subxt_rpcs::RpcConfig>::Hash;
|
||||||
type Header = <SubstrateConfig as subxt_rpcs::RpcConfig>::Header;
|
type Header = <SubstrateConfig as pezkuwi_subxt_rpcs::RpcConfig>::Header;
|
||||||
type AccountId = <SubstrateConfig as subxt_rpcs::RpcConfig>::AccountId;
|
type AccountId = <SubstrateConfig as pezkuwi_subxt_rpcs::RpcConfig>::AccountId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,11 +116,11 @@ impl Config for SubstrateConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn hash(s: &[u8]) -> <Self as Config>::Hash {
|
fn hash(s: &[u8]) -> <Self as Config>::Hash {
|
||||||
sp_crypto_hashing::blake2_256(s).into()
|
pezsp_crypto_hashing::blake2_256(s).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl subxt_rpcs::RpcConfig for SubstrateConfig {
|
impl pezkuwi_subxt_rpcs::RpcConfig for SubstrateConfig {
|
||||||
type Hash = <Self as Config>::Hash;
|
type Hash = <Self as Config>::Hash;
|
||||||
// We don't use these types in any of the RPC methods we call,
|
// We don't use these types in any of the RPC methods we call,
|
||||||
// so don't bother setting them up:
|
// so don't bother setting them up:
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ pub enum OnlineClientError {
|
|||||||
url: String,
|
url: String,
|
||||||
},
|
},
|
||||||
#[error("Cannot construct OnlineClient owing to an RPC client error: {0}")]
|
#[error("Cannot construct OnlineClient owing to an RPC client error: {0}")]
|
||||||
RpcClientError(#[from] subxt_rpcs::Error),
|
RpcClientError(#[from] pezkuwi_subxt_rpcs::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Errors constructing an offline client at a specific block number.
|
/// Errors constructing an offline client at a specific block number.
|
||||||
@@ -73,7 +73,7 @@ pub enum OnlineClientAtBlockError {
|
|||||||
/// Block number we failed to get the hash for.
|
/// Block number we failed to get the hash for.
|
||||||
block_number: u64,
|
block_number: u64,
|
||||||
/// The error we encountered.
|
/// The error we encountered.
|
||||||
reason: subxt_rpcs::Error,
|
reason: pezkuwi_subxt_rpcs::Error,
|
||||||
},
|
},
|
||||||
#[error("Cannot construct OnlineClientAtBlock: block number {block_number} not found")]
|
#[error("Cannot construct OnlineClientAtBlock: block number {block_number} not found")]
|
||||||
BlockNotFound {
|
BlockNotFound {
|
||||||
@@ -115,7 +115,7 @@ pub enum ExtrinsicsError {
|
|||||||
#[error("Could not fetch extrinsics: {reason}")]
|
#[error("Could not fetch extrinsics: {reason}")]
|
||||||
FetchError {
|
FetchError {
|
||||||
/// The error that occurred while fetching the extrinsics.
|
/// The error that occurred while fetching the extrinsics.
|
||||||
reason: subxt_rpcs::Error,
|
reason: pezkuwi_subxt_rpcs::Error,
|
||||||
},
|
},
|
||||||
#[error("Could not decode extrinsic at index {index}: {reason}")]
|
#[error("Could not decode extrinsic at index {index}: {reason}")]
|
||||||
DecodeError {
|
DecodeError {
|
||||||
@@ -235,7 +235,7 @@ pub enum StorageError {
|
|||||||
#[error("RPC error interacting with storage APIs: {reason}")]
|
#[error("RPC error interacting with storage APIs: {reason}")]
|
||||||
RpcError {
|
RpcError {
|
||||||
/// The error that occurred while fetching the storage entry.
|
/// The error that occurred while fetching the storage entry.
|
||||||
reason: subxt_rpcs::Error,
|
reason: pezkuwi_subxt_rpcs::Error,
|
||||||
},
|
},
|
||||||
#[error("Could not fetch next entry from storage subscription: {reason}")]
|
#[error("Could not fetch next entry from storage subscription: {reason}")]
|
||||||
StorageEventError {
|
StorageEventError {
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ where
|
|||||||
StorageError,
|
StorageError,
|
||||||
> {
|
> {
|
||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
use subxt_rpcs::methods::chain_head::{
|
use pezkuwi_subxt_rpcs::methods::chain_head::{
|
||||||
ArchiveStorageEvent, StorageQuery, StorageQueryType,
|
ArchiveStorageEvent, StorageQuery, StorageQueryType,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ where
|
|||||||
T: Config + 'atblock,
|
T: Config + 'atblock,
|
||||||
Client: OnlineClientAtBlockT<'atblock, T>,
|
Client: OnlineClientAtBlockT<'atblock, T>,
|
||||||
{
|
{
|
||||||
use subxt_rpcs::methods::chain_head::{ArchiveStorageEvent, StorageQuery, StorageQueryType};
|
use pezkuwi_subxt_rpcs::methods::chain_head::{ArchiveStorageEvent, StorageQuery, StorageQueryType};
|
||||||
|
|
||||||
let query = StorageQuery {
|
let query = StorageQuery {
|
||||||
key: key_bytes,
|
key: key_bytes,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-lightclient"
|
name = "pezkuwi-subxt-lightclient"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|||||||
+12
-12
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-macro"
|
name = "pezkuwi-subxt-macro"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -14,9 +14,9 @@ homepage.workspace = true
|
|||||||
description = "Generate types and helpers for interacting with Substrate runtimes."
|
description = "Generate types and helpers for interacting with Substrate runtimes."
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
web = ["subxt-codegen/web"]
|
web = ["pezkuwi-subxt-codegen/web"]
|
||||||
runtime-wasm-path = ["sc-executor", "sc-executor-common", "sp-maybe-compressed-blob", "sp-io", "sp-state-machine"]
|
runtime-wasm-path = ["pezsc-executor", "pezsc-executor-common", "pezsp-maybe-compressed-blob", "pezsp-io", "pezsp-state-machine"]
|
||||||
runtime-metadata-insecure-url = ["subxt-utils-fetchmetadata/url"]
|
runtime-metadata-insecure-url = ["pezkuwi-subxt-utils-fetchmetadata/url"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
@@ -27,15 +27,15 @@ darling = { workspace = true }
|
|||||||
proc-macro-error2 = { workspace = true }
|
proc-macro-error2 = { workspace = true }
|
||||||
syn = { workspace = true }
|
syn = { workspace = true }
|
||||||
quote = { workspace = true }
|
quote = { workspace = true }
|
||||||
subxt-codegen = { workspace = true }
|
pezkuwi-subxt-codegen = { workspace = true }
|
||||||
subxt-metadata = { workspace = true }
|
pezkuwi-subxt-metadata = { workspace = true }
|
||||||
subxt-utils-fetchmetadata = { workspace = true }
|
|
||||||
scale-typegen = { workspace = true }
|
scale-typegen = { workspace = true }
|
||||||
sc-executor = { workspace = true, optional = true }
|
pezsc-executor = { workspace = true, optional = true }
|
||||||
sc-executor-common = { workspace = true, optional = true }
|
pezsc-executor-common = { workspace = true, optional = true }
|
||||||
sp-maybe-compressed-blob = { workspace = true, optional = true }
|
pezsp-maybe-compressed-blob = { workspace = true, optional = true }
|
||||||
sp-io = { workspace = true, optional = true }
|
pezsp-io = { workspace = true, optional = true }
|
||||||
sp-state-machine = { workspace = true, optional = true }
|
pezsp-state-machine = { workspace = true, optional = true }
|
||||||
|
pezkuwi-subxt-utils-fetchmetadata = { workspace = true }
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
+6
-6
@@ -13,7 +13,7 @@ use scale_typegen::typegen::{
|
|||||||
settings::substitutes::path_segments,
|
settings::substitutes::path_segments,
|
||||||
validation::{registry_contains_type_path, similar_type_paths_in_registry},
|
validation::{registry_contains_type_path, similar_type_paths_in_registry},
|
||||||
};
|
};
|
||||||
use subxt_codegen::{CodegenBuilder, CodegenError, Metadata};
|
use pezkuwi_subxt_codegen::{CodegenBuilder, CodegenError, Metadata};
|
||||||
use syn::{parse_macro_input, punctuated::Punctuated};
|
use syn::{parse_macro_input, punctuated::Punctuated};
|
||||||
|
|
||||||
#[cfg(feature = "runtime-wasm-path")]
|
#[cfg(feature = "runtime-wasm-path")]
|
||||||
@@ -229,7 +229,7 @@ fn resolve_path(path_str: &str) -> std::path::PathBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Fetches metadata in a blocking manner, from a url or file path.
|
/// Fetches metadata in a blocking manner, from a url or file path.
|
||||||
fn fetch_metadata(args: &RuntimeMetadataArgs) -> Result<subxt_codegen::Metadata, TokenStream> {
|
fn fetch_metadata(args: &RuntimeMetadataArgs) -> Result<pezkuwi_subxt_codegen::Metadata, TokenStream> {
|
||||||
// Do we want to fetch unstable metadata? This only works if fetching from a URL.
|
// Do we want to fetch unstable metadata? This only works if fetching from a URL.
|
||||||
let unstable_metadata = args.unstable_metadata.is_present();
|
let unstable_metadata = args.unstable_metadata.is_present();
|
||||||
|
|
||||||
@@ -259,13 +259,13 @@ fn fetch_metadata(args: &RuntimeMetadataArgs) -> Result<subxt_codegen::Metadata,
|
|||||||
|
|
||||||
let path = resolve_path(rest_of_path);
|
let path = resolve_path(rest_of_path);
|
||||||
|
|
||||||
subxt_utils_fetchmetadata::from_file_blocking(&path)
|
pezkuwi_subxt_utils_fetchmetadata::from_file_blocking(&path)
|
||||||
.and_then(|b| subxt_codegen::Metadata::decode(&mut &*b).map_err(Into::into))
|
.and_then(|b| pezkuwi_subxt_codegen::Metadata::decode(&mut &*b).map_err(Into::into))
|
||||||
.map_err(|e| CodegenError::Other(e.to_string()).into_compile_error())?
|
.map_err(|e| CodegenError::Other(e.to_string()).into_compile_error())?
|
||||||
}
|
}
|
||||||
#[cfg(feature = "runtime-metadata-insecure-url")]
|
#[cfg(feature = "runtime-metadata-insecure-url")]
|
||||||
(None, Some(url_string)) => {
|
(None, Some(url_string)) => {
|
||||||
use subxt_utils_fetchmetadata::{MetadataVersion, Url, from_url_blocking};
|
use pezkuwi_subxt_utils_fetchmetadata::{MetadataVersion, Url, from_url_blocking};
|
||||||
|
|
||||||
let url = Url::parse(url_string).unwrap_or_else(|_| {
|
let url = Url::parse(url_string).unwrap_or_else(|_| {
|
||||||
abort_call_site!("Cannot download metadata; invalid url: {}", url_string)
|
abort_call_site!("Cannot download metadata; invalid url: {}", url_string)
|
||||||
@@ -278,7 +278,7 @@ fn fetch_metadata(args: &RuntimeMetadataArgs) -> Result<subxt_codegen::Metadata,
|
|||||||
|
|
||||||
from_url_blocking(url, version, None)
|
from_url_blocking(url, version, None)
|
||||||
.map_err(|e| CodegenError::Other(e.to_string()))
|
.map_err(|e| CodegenError::Other(e.to_string()))
|
||||||
.and_then(|b| subxt_codegen::Metadata::decode(&mut &*b).map_err(Into::into))
|
.and_then(|b| pezkuwi_subxt_codegen::Metadata::decode(&mut &*b).map_err(Into::into))
|
||||||
.map_err(|e| e.into_compile_error())?
|
.map_err(|e| e.into_compile_error())?
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "runtime-metadata-insecure-url"))]
|
#[cfg(not(feature = "runtime-metadata-insecure-url"))]
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ use codec::{Decode, Encode};
|
|||||||
use sc_executor::{WasmExecutionMethod, WasmExecutor};
|
use sc_executor::{WasmExecutionMethod, WasmExecutor};
|
||||||
use sc_executor_common::runtime_blob::RuntimeBlob;
|
use sc_executor_common::runtime_blob::RuntimeBlob;
|
||||||
use sp_maybe_compressed_blob::{self, CODE_BLOB_BOMB_LIMIT};
|
use sp_maybe_compressed_blob::{self, CODE_BLOB_BOMB_LIMIT};
|
||||||
use subxt_codegen::{CodegenError, Metadata};
|
use pezkuwi_subxt_codegen::{CodegenError, Metadata};
|
||||||
use subxt_metadata::SUPPORTED_METADATA_VERSIONS;
|
use pezkuwi_subxt_metadata::SUPPORTED_METADATA_VERSIONS;
|
||||||
|
|
||||||
/// Result type shorthand
|
/// Result type shorthand
|
||||||
pub type WasmMetadataResult<A> = Result<A, CodegenError>;
|
pub type WasmMetadataResult<A> = Result<A, CodegenError>;
|
||||||
|
|
||||||
/// Uses wasm artifact produced by compiling the runtime to generate metadata
|
/// Uses wasm artifact produced by compiling the runtime to generate metadata
|
||||||
pub fn from_wasm_file(wasm_file_path: &Path) -> WasmMetadataResult<Metadata> {
|
pub fn from_wasm_file(wasm_file_path: &Path) -> WasmMetadataResult<Metadata> {
|
||||||
let wasm_file = subxt_utils_fetchmetadata::from_file_blocking(wasm_file_path)
|
let wasm_file = pezkuwi_subxt_utils_fetchmetadata::from_file_blocking(wasm_file_path)
|
||||||
.map_err(|e| CodegenError::Other(e.to_string()))
|
.map_err(|e| CodegenError::Other(e.to_string()))
|
||||||
.and_then(maybe_decompress)?;
|
.and_then(maybe_decompress)?;
|
||||||
call_and_decode(wasm_file)
|
call_and_decode(wasm_file)
|
||||||
|
|||||||
+3
-4
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-metadata"
|
name = "pezkuwi-subxt-metadata"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -34,7 +34,7 @@ scale-type-resolver = { workspace = true, optional = true }
|
|||||||
frame-decode = { workspace = true }
|
frame-decode = { workspace = true }
|
||||||
frame-metadata = { workspace = true, default-features = false, features = ["current", "decode"] }
|
frame-metadata = { workspace = true, default-features = false, features = ["current", "decode"] }
|
||||||
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] }
|
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] }
|
||||||
sp-crypto-hashing = { workspace = true }
|
pezsp-crypto-hashing = { workspace = true }
|
||||||
hashbrown = { workspace = true }
|
hashbrown = { workspace = true }
|
||||||
thiserror = { workspace = true, default-features = false }
|
thiserror = { workspace = true, default-features = false }
|
||||||
|
|
||||||
@@ -42,9 +42,8 @@ thiserror = { workspace = true, default-features = false }
|
|||||||
bitvec = { workspace = true, features = ["alloc"] }
|
bitvec = { workspace = true, features = ["alloc"] }
|
||||||
criterion = { workspace = true }
|
criterion = { workspace = true }
|
||||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||||
subxt-utils-stripmetadata = { workspace = true }
|
|
||||||
frame-decode = { workspace = true, features = ["legacy-types"] }
|
frame-decode = { workspace = true, features = ["legacy-types"] }
|
||||||
subxt-codegen = { workspace = true }
|
pezkuwi-subxt-codegen = { workspace = true }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
# Without this, libtest cli opts interfere with criterion benches:
|
# Without this, libtest cli opts interfere with criterion benches:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use codec::Decode;
|
|||||||
use criterion::*;
|
use criterion::*;
|
||||||
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
||||||
use std::{fs, path::Path};
|
use std::{fs, path::Path};
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
fn load_metadata() -> Metadata {
|
fn load_metadata() -> Metadata {
|
||||||
let bytes = fs::read(Path::new("../artifacts/polkadot_metadata_full.scale"))
|
let bytes = fs::read(Path::new("../artifacts/polkadot_metadata_full.scale"))
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ fn test_opts() -> super::Opts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a pair of original metadata + converted subxt_metadata::Metadata
|
/// Return a pair of original metadata + converted pezkuwi_subxt_metadata::Metadata
|
||||||
fn metadata_pair(
|
fn metadata_pair(
|
||||||
version: u8,
|
version: u8,
|
||||||
opts: super::Opts,
|
opts: super::Opts,
|
||||||
@@ -67,7 +67,7 @@ fn metadata_pair(
|
|||||||
types_for_spec
|
types_for_spec
|
||||||
};
|
};
|
||||||
|
|
||||||
let subxt_metadata = match &metadata {
|
let pezkuwi_subxt_metadata = match &metadata {
|
||||||
RuntimeMetadata::V9(m) => super::from_v9(m, &types_for_spec, opts),
|
RuntimeMetadata::V9(m) => super::from_v9(m, &types_for_spec, opts),
|
||||||
RuntimeMetadata::V10(m) => super::from_v10(m, &types_for_spec, opts),
|
RuntimeMetadata::V10(m) => super::from_v10(m, &types_for_spec, opts),
|
||||||
RuntimeMetadata::V11(m) => super::from_v11(m, &types_for_spec, opts),
|
RuntimeMetadata::V11(m) => super::from_v11(m, &types_for_spec, opts),
|
||||||
@@ -75,9 +75,9 @@ fn metadata_pair(
|
|||||||
RuntimeMetadata::V13(m) => super::from_v13(m, &types_for_spec, opts),
|
RuntimeMetadata::V13(m) => super::from_v13(m, &types_for_spec, opts),
|
||||||
_ => panic!("Metadata version {} not expected", metadata.version()),
|
_ => panic!("Metadata version {} not expected", metadata.version()),
|
||||||
}
|
}
|
||||||
.expect("Could not convert to subxt_metadata::Metadata");
|
.expect("Could not convert to pezkuwi_subxt_metadata::Metadata");
|
||||||
|
|
||||||
(types_for_spec, metadata, subxt_metadata)
|
(types_for_spec, metadata, pezkuwi_subxt_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A representation of the shape of some type that we can compare across metadatas.
|
/// A representation of the shape of some type that we can compare across metadatas.
|
||||||
@@ -441,7 +441,7 @@ fn builtin_event() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn codegen_works() {
|
fn codegen_works() {
|
||||||
for version in 9..=13 {
|
for version in 9..=13 {
|
||||||
// We need to do this against `subxt_codegen::Metadata` and so cannot re-use our
|
// We need to do this against `pezkuwi_subxt_codegen::Metadata` and so cannot re-use our
|
||||||
// test functions for it. This is because the compiler sees some difference between
|
// test functions for it. This is because the compiler sees some difference between
|
||||||
// `subxct_codegen::Metadata` and `crate::Metadata` even though they should be identical.
|
// `subxct_codegen::Metadata` and `crate::Metadata` even though they should be identical.
|
||||||
let new_md = {
|
let new_md = {
|
||||||
@@ -457,18 +457,18 @@ fn codegen_works() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
match &metadata {
|
match &metadata {
|
||||||
RuntimeMetadata::V9(m) => subxt_codegen::Metadata::from_v9(m, &types_for_spec),
|
RuntimeMetadata::V9(m) => pezkuwi_subxt_codegen::Metadata::from_v9(m, &types_for_spec),
|
||||||
RuntimeMetadata::V10(m) => subxt_codegen::Metadata::from_v10(m, &types_for_spec),
|
RuntimeMetadata::V10(m) => pezkuwi_subxt_codegen::Metadata::from_v10(m, &types_for_spec),
|
||||||
RuntimeMetadata::V11(m) => subxt_codegen::Metadata::from_v11(m, &types_for_spec),
|
RuntimeMetadata::V11(m) => pezkuwi_subxt_codegen::Metadata::from_v11(m, &types_for_spec),
|
||||||
RuntimeMetadata::V12(m) => subxt_codegen::Metadata::from_v12(m, &types_for_spec),
|
RuntimeMetadata::V12(m) => pezkuwi_subxt_codegen::Metadata::from_v12(m, &types_for_spec),
|
||||||
RuntimeMetadata::V13(m) => subxt_codegen::Metadata::from_v13(m, &types_for_spec),
|
RuntimeMetadata::V13(m) => pezkuwi_subxt_codegen::Metadata::from_v13(m, &types_for_spec),
|
||||||
_ => panic!("Metadata version {} not expected", metadata.version()),
|
_ => panic!("Metadata version {} not expected", metadata.version()),
|
||||||
}
|
}
|
||||||
.expect("Could not convert to subxt_metadata::Metadata")
|
.expect("Could not convert to pezkuwi_subxt_metadata::Metadata")
|
||||||
};
|
};
|
||||||
|
|
||||||
// We only test that generation succeeds without any errors, not necessarily that it's 100% useful:
|
// We only test that generation succeeds without any errors, not necessarily that it's 100% useful:
|
||||||
let codegen = subxt_codegen::CodegenBuilder::new();
|
let codegen = pezkuwi_subxt_codegen::CodegenBuilder::new();
|
||||||
let _ = codegen
|
let _ = codegen
|
||||||
.generate(new_md)
|
.generate(new_md)
|
||||||
.map_err(|e| e.into_compile_error())
|
.map_err(|e| e.into_compile_error())
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ enum TypeBeingHashed {
|
|||||||
|
|
||||||
/// Hashing function utilized internally.
|
/// Hashing function utilized internally.
|
||||||
fn hash(data: &[u8]) -> Hash {
|
fn hash(data: &[u8]) -> Hash {
|
||||||
sp_crypto_hashing::twox_256(data)
|
pezsp_crypto_hashing::twox_256(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// XOR two hashes together. Only use this when you don't care about the order
|
/// XOR two hashes together. Only use this when you don't care about the order
|
||||||
@@ -1169,7 +1169,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn hash_comparison_trimmed_metadata() {
|
fn hash_comparison_trimmed_metadata() {
|
||||||
use subxt_utils_stripmetadata::StripMetadata;
|
use pezkuwi_subxt_utils_stripmetadata::StripMetadata;
|
||||||
|
|
||||||
// trim the metadata:
|
// trim the metadata:
|
||||||
let metadata = metadata_with_pallet_events();
|
let metadata = metadata_with_pallet_events();
|
||||||
|
|||||||
+9
-11
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-rpcs"
|
name = "pezkuwi-subxt-rpcs"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -17,12 +17,10 @@ keywords = ["parity", "subxt", "rpcs"]
|
|||||||
[features]
|
[features]
|
||||||
default = ["jsonrpsee", "native"]
|
default = ["jsonrpsee", "native"]
|
||||||
|
|
||||||
subxt = ["dep:subxt-core"]
|
subxt = ["dep:pezkuwi-subxt-core"]
|
||||||
jsonrpsee = ["dep:jsonrpsee", "dep:tokio-util"]
|
jsonrpsee = ["dep:jsonrpsee", "dep:tokio-util"]
|
||||||
|
|
||||||
unstable-light-client = [
|
unstable-light-client = ["dep:pezkuwi-subxt-lightclient"]
|
||||||
"dep:subxt-lightclient"
|
|
||||||
]
|
|
||||||
|
|
||||||
reconnecting-rpc-client = [
|
reconnecting-rpc-client = [
|
||||||
"jsonrpsee",
|
"jsonrpsee",
|
||||||
@@ -42,7 +40,7 @@ native = [
|
|||||||
"jsonrpsee?/async-client",
|
"jsonrpsee?/async-client",
|
||||||
"jsonrpsee?/client-ws-transport-tls",
|
"jsonrpsee?/client-ws-transport-tls",
|
||||||
"jsonrpsee?/ws-client",
|
"jsonrpsee?/ws-client",
|
||||||
"subxt-lightclient?/native",
|
"pezkuwi-subxt-lightclient?/native",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Enable this for web/wasm builds.
|
# Enable this for web/wasm builds.
|
||||||
@@ -51,7 +49,7 @@ web = [
|
|||||||
"jsonrpsee?/async-wasm-client",
|
"jsonrpsee?/async-wasm-client",
|
||||||
"jsonrpsee?/client-web-transport",
|
"jsonrpsee?/client-web-transport",
|
||||||
"jsonrpsee?/wasm-client",
|
"jsonrpsee?/wasm-client",
|
||||||
"subxt-lightclient?/web",
|
"pezkuwi-subxt-lightclient?/web",
|
||||||
"finito?/wasm-bindgen",
|
"finito?/wasm-bindgen",
|
||||||
"dep:wasm-bindgen-futures",
|
"dep:wasm-bindgen-futures",
|
||||||
"getrandom/js",
|
"getrandom/js",
|
||||||
@@ -80,11 +78,11 @@ tokio-util = { workspace = true, features = ["compat"], optional = true }
|
|||||||
finito = { workspace = true, optional = true }
|
finito = { workspace = true, optional = true }
|
||||||
tokio = { workspace = true, optional = true }
|
tokio = { workspace = true, optional = true }
|
||||||
|
|
||||||
# Included with the lightclient feature
|
# Included with the unstable-light-client feature
|
||||||
subxt-lightclient = { workspace = true, optional = true, default-features = false }
|
pezkuwi-subxt-lightclient = { workspace = true, optional = true, default-features = false }
|
||||||
|
|
||||||
# Included with the subxt-core feature to impl Config for RpcConfig
|
# Included with the pezkuwi-subxt-core feature to impl Config for RpcConfig
|
||||||
subxt-core = { workspace = true, optional = true }
|
pezkuwi-subxt-core = { workspace = true, optional = true }
|
||||||
|
|
||||||
# Included with WASM feature
|
# Included with WASM feature
|
||||||
wasm-bindgen-futures = { workspace = true, optional = true }
|
wasm-bindgen-futures = { workspace = true, optional = true }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use super::{RawRpcFuture, RawRpcSubscription, RpcClientT};
|
|||||||
use crate::Error;
|
use crate::Error;
|
||||||
use futures::stream::{StreamExt, TryStreamExt};
|
use futures::stream::{StreamExt, TryStreamExt};
|
||||||
use serde_json::value::RawValue;
|
use serde_json::value::RawValue;
|
||||||
use subxt_lightclient::{LightClientRpc, LightClientRpcError};
|
use pezkuwi_subxt_lightclient::{LightClientRpc, LightClientRpcError};
|
||||||
|
|
||||||
impl RpcClientT for LightClientRpc {
|
impl RpcClientT for LightClientRpc {
|
||||||
fn request_raw<'a>(
|
fn request_raw<'a>(
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use subxt_rpcs::client::{ RpcClient, MockRpcClient };
|
//! use pezkuwi_subxt_rpcs::client::{ RpcClient, MockRpcClient };
|
||||||
//! use subxt_rpcs::client::mock_rpc_client::Json;
|
//! use pezkuwi_subxt_rpcs::client::mock_rpc_client::Json;
|
||||||
//!
|
//!
|
||||||
//! let mut state = vec![
|
//! let mut state = vec![
|
||||||
//! Json(1u8),
|
//! Json(1u8),
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ crate::macros::cfg_jsonrpsee! {
|
|||||||
|
|
||||||
crate::macros::cfg_unstable_light_client! {
|
crate::macros::cfg_unstable_light_client! {
|
||||||
mod lightclient_impl;
|
mod lightclient_impl;
|
||||||
pub use subxt_lightclient::LightClientRpc as LightClientRpcClient;
|
pub use pezkuwi_subxt_lightclient::LightClientRpc as LightClientRpcClient;
|
||||||
pub use subxt_lightclient::LightClient;
|
pub use pezkuwi_subxt_lightclient::LightClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::macros::cfg_reconnecting_rpc_client! {
|
crate::macros::cfg_reconnecting_rpc_client! {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ```rust,no_run
|
//! ```rust,no_run
|
||||||
//! # async fn foo() -> Result<(), Box<dyn std::error::Error>> {
|
//! # async fn foo() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
//! use subxt_rpcs::client::{RpcClient, RoundRobinRpcClient, jsonrpsee_client};
|
//! use pezkuwi_subxt_rpcs::client::{RpcClient, RoundRobinRpcClient, jsonrpsee_client};
|
||||||
//!
|
//!
|
||||||
//! // Construct some RpcClients (we'll make some jsonrpsee clients here, but
|
//! // Construct some RpcClients (we'll make some jsonrpsee clients here, but
|
||||||
//! // you could use anything which implements `RpcClientT`).
|
//! // you could use anything which implements `RpcClientT`).
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ impl std::ops::Deref for RpcClient {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_rpcs::client::{ rpc_params, RpcParams };
|
/// use pezkuwi_subxt_rpcs::client::{ rpc_params, RpcParams };
|
||||||
///
|
///
|
||||||
/// // If you provide no params you get `None` back
|
/// // If you provide no params you get `None` back
|
||||||
/// let params: RpcParams = rpc_params![];
|
/// let params: RpcParams = rpc_params![];
|
||||||
@@ -139,7 +139,7 @@ pub use rpc_params;
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_rpcs::client::RpcParams;
|
/// use pezkuwi_subxt_rpcs::client::RpcParams;
|
||||||
///
|
///
|
||||||
/// let mut params = RpcParams::new();
|
/// let mut params = RpcParams::new();
|
||||||
/// params.push(1).unwrap();
|
/// params.push(1).unwrap();
|
||||||
|
|||||||
+2
-2
@@ -67,11 +67,11 @@ impl<T> AccountId for T where T: serde::Serialize {}
|
|||||||
#[cfg(feature = "subxt")]
|
#[cfg(feature = "subxt")]
|
||||||
mod impl_config {
|
mod impl_config {
|
||||||
use super::*;
|
use super::*;
|
||||||
use subxt_core::config::HashFor;
|
use pezkuwi_subxt_core::config::HashFor;
|
||||||
|
|
||||||
impl<T> RpcConfig for T
|
impl<T> RpcConfig for T
|
||||||
where
|
where
|
||||||
T: subxt_core::Config,
|
T: pezkuwi_subxt_core::Config,
|
||||||
{
|
{
|
||||||
type Header = T::Header;
|
type Header = T::Header;
|
||||||
type Hash = HashFor<T>;
|
type Hash = HashFor<T>;
|
||||||
|
|||||||
+6
-6
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt-signer"
|
name = "pezkuwi-subxt-signer"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -44,14 +44,14 @@ polkadot-js-compat = ["std", "subxt", "sr25519", "base64", "scrypt", "crypto_sec
|
|||||||
|
|
||||||
# Make the keypair algorithms here compatible with Subxt's Signer trait,
|
# Make the keypair algorithms here compatible with Subxt's Signer trait,
|
||||||
# so that they can be used to sign transactions for compatible chains.
|
# so that they can be used to sign transactions for compatible chains.
|
||||||
subxt = ["dep:subxt-core"]
|
subxt = ["dep:pezkuwi-subxt-core"]
|
||||||
|
|
||||||
# The getrandom package is used via schnorrkel. We need to enable the JS
|
# The getrandom package is used via schnorrkel. We need to enable the JS
|
||||||
# feature on it if compiling for the web.
|
# feature on it if compiling for the web.
|
||||||
web = ["getrandom/js"]
|
web = ["getrandom/js"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
subxt-core = { workspace = true, optional = true, default-features = false }
|
pezkuwi-subxt-core = { workspace = true, optional = true, default-features = false }
|
||||||
secrecy = { workspace = true }
|
secrecy = { workspace = true }
|
||||||
regex = { workspace = true, features = ["unicode"] }
|
regex = { workspace = true, features = ["unicode"] }
|
||||||
hex = { workspace = true }
|
hex = { workspace = true }
|
||||||
@@ -59,7 +59,7 @@ cfg-if = { workspace = true }
|
|||||||
codec = { package = "parity-scale-codec", workspace = true, features = [
|
codec = { package = "parity-scale-codec", workspace = true, features = [
|
||||||
"derive",
|
"derive",
|
||||||
] }
|
] }
|
||||||
sp-crypto-hashing = { workspace = true }
|
pezsp-crypto-hashing = { workspace = true }
|
||||||
pbkdf2 = { workspace = true }
|
pbkdf2 = { workspace = true }
|
||||||
sha2 = { workspace = true }
|
sha2 = { workspace = true }
|
||||||
hmac = { workspace = true }
|
hmac = { workspace = true }
|
||||||
@@ -87,8 +87,8 @@ getrandom = { workspace = true, optional = true }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
proptest = { workspace = true }
|
proptest = { workspace = true }
|
||||||
hex-literal = { workspace = true }
|
hex-literal = { workspace = true }
|
||||||
sp-core = { workspace = true }
|
pezsp-core = { workspace = true }
|
||||||
sp-keyring = { workspace = true }
|
pezsp-keyring = { workspace = true }
|
||||||
|
|
||||||
[package.metadata.cargo-machete]
|
[package.metadata.cargo-machete]
|
||||||
ignored = ["getrandom"]
|
ignored = ["getrandom"]
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ impl DeriveJunction {
|
|||||||
let mut cc: [u8; JUNCTION_ID_LEN] = Default::default();
|
let mut cc: [u8; JUNCTION_ID_LEN] = Default::default();
|
||||||
index.using_encoded(|data| {
|
index.using_encoded(|data| {
|
||||||
if data.len() > JUNCTION_ID_LEN {
|
if data.len() > JUNCTION_ID_LEN {
|
||||||
cc.copy_from_slice(&sp_crypto_hashing::blake2_256(data));
|
cc.copy_from_slice(&pezsp_crypto_hashing::blake2_256(data));
|
||||||
} else {
|
} else {
|
||||||
cc[0..data.len()].copy_from_slice(data);
|
cc[0..data.len()].copy_from_slice(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ use thiserror::Error as DeriveError;
|
|||||||
/// Parse [`DEV_PHRASE`] secret URI with junction:
|
/// Parse [`DEV_PHRASE`] secret URI with junction:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
/// # use pezkuwi_subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||||
/// # use std::str::FromStr;
|
/// # use std::str::FromStr;
|
||||||
/// let suri = SecretUri::from_str("//Alice").expect("Parse SURI");
|
/// let suri = SecretUri::from_str("//Alice").expect("Parse SURI");
|
||||||
///
|
///
|
||||||
@@ -60,7 +60,7 @@ use thiserror::Error as DeriveError;
|
|||||||
/// Parse [`DEV_PHRASE`] secret URI with junction and password:
|
/// Parse [`DEV_PHRASE`] secret URI with junction and password:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
/// # use pezkuwi_subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||||
/// # use std::str::FromStr;
|
/// # use std::str::FromStr;
|
||||||
/// let suri = SecretUri::from_str("//Alice///SECRET_PASSWORD").expect("Parse SURI");
|
/// let suri = SecretUri::from_str("//Alice///SECRET_PASSWORD").expect("Parse SURI");
|
||||||
///
|
///
|
||||||
@@ -72,7 +72,7 @@ use thiserror::Error as DeriveError;
|
|||||||
/// Parse [`DEV_PHRASE`] secret URI with hex phrase and junction:
|
/// Parse [`DEV_PHRASE`] secret URI with hex phrase and junction:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
/// # use pezkuwi_subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||||
/// # use std::str::FromStr;
|
/// # use std::str::FromStr;
|
||||||
/// let suri = SecretUri::from_str("0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a//Alice").expect("Parse SURI");
|
/// let suri = SecretUri::from_str("0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a//Alice").expect("Parse SURI");
|
||||||
///
|
///
|
||||||
|
|||||||
+11
-11
@@ -49,7 +49,7 @@ impl Keypair {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ SecretUri, ecdsa::Keypair };
|
/// use pezkuwi_subxt_signer::{ SecretUri, ecdsa::Keypair };
|
||||||
/// use std::str::FromStr;
|
/// use std::str::FromStr;
|
||||||
///
|
///
|
||||||
/// let uri = SecretUri::from_str("//Alice").unwrap();
|
/// let uri = SecretUri::from_str("//Alice").unwrap();
|
||||||
@@ -85,7 +85,7 @@ impl Keypair {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair };
|
||||||
///
|
///
|
||||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||||
@@ -123,7 +123,7 @@ impl Keypair {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair, DeriveJunction };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair, DeriveJunction };
|
||||||
///
|
///
|
||||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||||
@@ -145,7 +145,7 @@ impl Keypair {
|
|||||||
DeriveJunction::Soft(_) => return Err(Error::SoftJunction),
|
DeriveJunction::Soft(_) => return Err(Error::SoftJunction),
|
||||||
DeriveJunction::Hard(junction_bytes) => {
|
DeriveJunction::Hard(junction_bytes) => {
|
||||||
acc = ("Secp256k1HDKD", acc, junction_bytes)
|
acc = ("Secp256k1HDKD", acc, junction_bytes)
|
||||||
.using_encoded(sp_crypto_hashing::blake2_256)
|
.using_encoded(pezsp_crypto_hashing::blake2_256)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ impl Keypair {
|
|||||||
|
|
||||||
/// Sign some message. These bytes can be used directly in a Substrate `MultiSignature::Ecdsa(..)`.
|
/// Sign some message. These bytes can be used directly in a Substrate `MultiSignature::Ecdsa(..)`.
|
||||||
pub fn sign(&self, message: &[u8]) -> Signature {
|
pub fn sign(&self, message: &[u8]) -> Signature {
|
||||||
self.sign_prehashed(&sp_crypto_hashing::blake2_256(message))
|
self.sign_prehashed(&pezsp_crypto_hashing::blake2_256(message))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Signs a pre-hashed message.
|
/// Signs a pre-hashed message.
|
||||||
@@ -179,7 +179,7 @@ impl Keypair {
|
|||||||
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, ecdsa };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, ecdsa };
|
||||||
///
|
///
|
||||||
/// let keypair = ecdsa::dev::alice();
|
/// let keypair = ecdsa::dev::alice();
|
||||||
/// let message = b"Hello!";
|
/// let message = b"Hello!";
|
||||||
@@ -189,7 +189,7 @@ impl Keypair {
|
|||||||
/// assert!(ecdsa::verify(&signature, message, &public_key));
|
/// assert!(ecdsa::verify(&signature, message, &public_key));
|
||||||
/// ```
|
/// ```
|
||||||
pub fn verify<M: AsRef<[u8]>>(sig: &Signature, message: M, pubkey: &PublicKey) -> bool {
|
pub fn verify<M: AsRef<[u8]>>(sig: &Signature, message: M, pubkey: &PublicKey) -> bool {
|
||||||
let message_hash = sp_crypto_hashing::blake2_256(message.as_ref());
|
let message_hash = pezsp_crypto_hashing::blake2_256(message.as_ref());
|
||||||
let wrapped = Message::from_digest_slice(&message_hash).expect("Message is 32 bytes; qed");
|
let wrapped = Message::from_digest_slice(&message_hash).expect("Message is 32 bytes; qed");
|
||||||
|
|
||||||
internal::verify(&sig.0, &wrapped, pubkey)
|
internal::verify(&sig.0, &wrapped, pubkey)
|
||||||
@@ -298,9 +298,9 @@ pub mod dev {
|
|||||||
mod subxt_compat {
|
mod subxt_compat {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use subxt_core::config::Config;
|
use pezkuwi_subxt_core::config::Config;
|
||||||
use subxt_core::tx::signer::Signer as SignerT;
|
use pezkuwi_subxt_core::tx::signer::Signer as SignerT;
|
||||||
use subxt_core::utils::{AccountId32, MultiAddress, MultiSignature};
|
use pezkuwi_subxt_core::utils::{AccountId32, MultiAddress, MultiSignature};
|
||||||
|
|
||||||
impl From<Signature> for MultiSignature {
|
impl From<Signature> for MultiSignature {
|
||||||
fn from(value: Signature) -> Self {
|
fn from(value: Signature) -> Self {
|
||||||
@@ -325,7 +325,7 @@ mod subxt_compat {
|
|||||||
/// We often want this type, and using this method avoids any
|
/// We often want this type, and using this method avoids any
|
||||||
/// ambiguous type resolution issues.
|
/// ambiguous type resolution issues.
|
||||||
pub fn to_account_id(self) -> AccountId32 {
|
pub fn to_account_id(self) -> AccountId32 {
|
||||||
AccountId32(sp_crypto_hashing::blake2_256(&self.0))
|
AccountId32(pezsp_crypto_hashing::blake2_256(&self.0))
|
||||||
}
|
}
|
||||||
/// A shortcut to obtain a [`MultiAddress`] from a [`PublicKey`].
|
/// A shortcut to obtain a [`MultiAddress`] from a [`PublicKey`].
|
||||||
/// We often want this type, and using this method avoids any
|
/// We often want this type, and using this method avoids any
|
||||||
|
|||||||
+9
-9
@@ -47,7 +47,7 @@ impl Keypair {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, eth::{ Keypair, DerivationPath } };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, eth::{ Keypair, DerivationPath } };
|
||||||
///
|
///
|
||||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||||
@@ -176,7 +176,7 @@ impl AsRef<[u8; 65]> for Signature {
|
|||||||
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, eth };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, eth };
|
||||||
///
|
///
|
||||||
/// let keypair = eth::dev::alith();
|
/// let keypair = eth::dev::alith();
|
||||||
/// let message = b"Hello!";
|
/// let message = b"Hello!";
|
||||||
@@ -309,10 +309,10 @@ pub mod dev {
|
|||||||
#[cfg(feature = "subxt")]
|
#[cfg(feature = "subxt")]
|
||||||
mod subxt_compat {
|
mod subxt_compat {
|
||||||
use super::*;
|
use super::*;
|
||||||
use subxt_core::config::Config;
|
use pezkuwi_subxt_core::config::Config;
|
||||||
use subxt_core::tx::signer::Signer as SignerT;
|
use pezkuwi_subxt_core::tx::signer::Signer as SignerT;
|
||||||
use subxt_core::utils::AccountId20;
|
use pezkuwi_subxt_core::utils::AccountId20;
|
||||||
use subxt_core::utils::MultiAddress;
|
use pezkuwi_subxt_core::utils::MultiAddress;
|
||||||
|
|
||||||
impl<T: Config> SignerT<T> for Keypair
|
impl<T: Config> SignerT<T> for Keypair
|
||||||
where
|
where
|
||||||
@@ -365,9 +365,9 @@ mod test {
|
|||||||
use bip39::Mnemonic;
|
use bip39::Mnemonic;
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
use secp256k1::Secp256k1;
|
use secp256k1::Secp256k1;
|
||||||
use subxt_core::utils::AccountId20;
|
use pezkuwi_subxt_core::utils::AccountId20;
|
||||||
|
|
||||||
use subxt_core::{config::*, tx::signer::Signer as SignerT};
|
use pezkuwi_subxt_core::{config::*, tx::signer::Signer as SignerT};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn check_subxt_signer_implementation_matches(keypair in keypair(), msg in ".*") {
|
fn check_pezkuwi_subxt_signer_implementation_matches(keypair in keypair(), msg in ".*") {
|
||||||
let msg_as_bytes = msg.as_bytes();
|
let msg_as_bytes = msg.as_bytes();
|
||||||
|
|
||||||
assert_eq!(SubxtSigner::account_id(&keypair), keypair.public_key().to_account_id());
|
assert_eq!(SubxtSigner::account_id(&keypair), keypair.public_key().to_account_id());
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use crypto_secretbox::{
|
|||||||
aead::{Aead, KeyInit},
|
aead::{Aead, KeyInit},
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use subxt_core::utils::AccountId32;
|
use pezkuwi_subxt_core::utils::AccountId32;
|
||||||
|
|
||||||
use thiserror::Error as DeriveError;
|
use thiserror::Error as DeriveError;
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ impl Keypair {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ SecretUri, sr25519::Keypair };
|
/// use pezkuwi_subxt_signer::{ SecretUri, sr25519::Keypair };
|
||||||
/// use std::str::FromStr;
|
/// use std::str::FromStr;
|
||||||
///
|
///
|
||||||
/// let uri = SecretUri::from_str("//Alice").unwrap();
|
/// let uri = SecretUri::from_str("//Alice").unwrap();
|
||||||
@@ -95,7 +95,7 @@ impl Keypair {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, sr25519::Keypair };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, sr25519::Keypair };
|
||||||
///
|
///
|
||||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||||
@@ -145,7 +145,7 @@ impl Keypair {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, sr25519::Keypair, DeriveJunction };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, sr25519::Keypair, DeriveJunction };
|
||||||
///
|
///
|
||||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||||
@@ -187,7 +187,7 @@ impl Keypair {
|
|||||||
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
||||||
///
|
///
|
||||||
/// ```rust,standalone_crate
|
/// ```rust,standalone_crate
|
||||||
/// use subxt_signer::{ bip39::Mnemonic, sr25519 };
|
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, sr25519 };
|
||||||
///
|
///
|
||||||
/// let keypair = sr25519::dev::alice();
|
/// let keypair = sr25519::dev::alice();
|
||||||
/// let message = b"Hello!";
|
/// let message = b"Hello!";
|
||||||
@@ -291,7 +291,7 @@ pub mod dev {
|
|||||||
mod subxt_compat {
|
mod subxt_compat {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use subxt_core::{
|
use pezkuwi_subxt_core::{
|
||||||
Config,
|
Config,
|
||||||
tx::signer::Signer as SignerT,
|
tx::signer::Signer as SignerT,
|
||||||
utils::{AccountId32, MultiAddress, MultiSignature},
|
utils::{AccountId32, MultiAddress, MultiSignature},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
use subxt_signer::{ecdsa, eth, sr25519};
|
use pezkuwi_subxt_signer::{ecdsa, eth, sr25519};
|
||||||
|
|
||||||
// Run the tests by calling:
|
// Run the tests by calling:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![cfg(target_arch = "wasm32")]
|
#![cfg(target_arch = "wasm32")]
|
||||||
|
|
||||||
use subxt_signer::{ecdsa, eth, sr25519};
|
use pezkuwi_subxt_signer::{ecdsa, eth, sr25519};
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
|
||||||
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
||||||
|
|||||||
+25
-25
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "subxt"
|
name = "pezkuwi-subxt"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -11,8 +11,8 @@ readme = "../README.md"
|
|||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
documentation.workspace = true
|
documentation.workspace = true
|
||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
description = "Submit extrinsics (transactions) to a substrate node via RPC"
|
description = "Submit extrinsics (transactions) to a Pezkuwi/Bizinikiwi node via RPC"
|
||||||
keywords = ["parity", "substrate", "blockchain"]
|
keywords = ["pezkuwi", "bizinikiwi", "blockchain"]
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
@@ -25,19 +25,19 @@ default = ["jsonrpsee", "native"]
|
|||||||
# Enable this for native (ie non web/wasm builds).
|
# Enable this for native (ie non web/wasm builds).
|
||||||
# Exactly 1 of "web" and "native" is expected.
|
# Exactly 1 of "web" and "native" is expected.
|
||||||
native = [
|
native = [
|
||||||
"subxt-lightclient?/native",
|
"pezkuwi-subxt-lightclient?/native",
|
||||||
"subxt-rpcs/native",
|
"pezkuwi-subxt-rpcs/native",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"tokio?/sync",
|
"tokio?/sync",
|
||||||
"sp-crypto-hashing/std",
|
"pezsp-crypto-hashing/std",
|
||||||
]
|
]
|
||||||
|
|
||||||
# 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 = [
|
web = [
|
||||||
"subxt-lightclient?/web",
|
"pezkuwi-subxt-lightclient?/web",
|
||||||
"subxt-macro/web",
|
"pezkuwi-subxt-macro/web",
|
||||||
"subxt-rpcs/web",
|
"pezkuwi-subxt-rpcs/web",
|
||||||
"tokio?/sync",
|
"tokio?/sync",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -50,13 +50,13 @@ web = [
|
|||||||
runtime = ["tokio/rt", "wasm-bindgen-futures"]
|
runtime = ["tokio/rt", "wasm-bindgen-futures"]
|
||||||
|
|
||||||
# Enable this to use the reconnecting rpc client
|
# Enable this to use the reconnecting rpc client
|
||||||
reconnecting-rpc-client = ["subxt-rpcs/reconnecting-rpc-client"]
|
reconnecting-rpc-client = ["pezkuwi-subxt-rpcs/reconnecting-rpc-client"]
|
||||||
|
|
||||||
# Enable this to use jsonrpsee, which enables the jsonrpsee RPC client, and
|
# Enable this to use jsonrpsee, which enables the jsonrpsee RPC client, and
|
||||||
# a couple of util functions which rely on jsonrpsee.
|
# a couple of util functions which rely on jsonrpsee.
|
||||||
jsonrpsee = [
|
jsonrpsee = [
|
||||||
"dep:jsonrpsee",
|
"dep:jsonrpsee",
|
||||||
"subxt-rpcs/jsonrpsee",
|
"pezkuwi-subxt-rpcs/jsonrpsee",
|
||||||
"runtime"
|
"runtime"
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -68,10 +68,10 @@ unstable-metadata = []
|
|||||||
|
|
||||||
# Activate this to expose the Light Client functionality.
|
# Activate this to expose the Light Client functionality.
|
||||||
# Note that this feature is experimental and things may break or not work as expected.
|
# Note that this feature is experimental and things may break or not work as expected.
|
||||||
unstable-light-client = ["subxt-lightclient", "subxt-rpcs/unstable-light-client"]
|
unstable-light-client = ["pezkuwi-subxt-lightclient", "pezkuwi-subxt-rpcs/unstable-light-client"]
|
||||||
|
|
||||||
# Activate this to expose the ability to generate metadata from Wasm runtime files.
|
# Activate this to expose the ability to generate metadata from Wasm runtime files.
|
||||||
runtime-wasm-path = ["subxt-macro/runtime-wasm-path"]
|
runtime-wasm-path = ["pezkuwi-subxt-macro/runtime-wasm-path"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { workspace = true }
|
async-trait = { workspace = true }
|
||||||
@@ -86,7 +86,7 @@ futures = { workspace = true }
|
|||||||
hex = { workspace = true }
|
hex = { workspace = true }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { workspace = true, features = ["default", "raw_value"] }
|
serde_json = { workspace = true, features = ["default", "raw_value"] }
|
||||||
sp-crypto-hashing = { workspace = true }
|
pezsp-crypto-hashing = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
frame-metadata = { workspace = true }
|
frame-metadata = { workspace = true }
|
||||||
@@ -99,12 +99,12 @@ primitive-types = { workspace = true, features = ["codec", "scale-info", "serde"
|
|||||||
# Included if the "jsonrpsee" feature is enabled.
|
# Included if the "jsonrpsee" feature is enabled.
|
||||||
jsonrpsee = { workspace = true, optional = true, features = ["jsonrpsee-types"] }
|
jsonrpsee = { workspace = true, optional = true, features = ["jsonrpsee-types"] }
|
||||||
|
|
||||||
# Other subxt crates we depend on.
|
# Other pezkuwi-subxt crates we depend on.
|
||||||
subxt-macro = { workspace = true }
|
pezkuwi-subxt-macro = { workspace = true }
|
||||||
subxt-core = { workspace = true, features = ["std"] }
|
pezkuwi-subxt-core = { workspace = true, features = ["std"] }
|
||||||
subxt-metadata = { workspace = true, features = ["std"] }
|
pezkuwi-subxt-metadata = { workspace = true, features = ["std"] }
|
||||||
subxt-lightclient = { workspace = true, optional = true, default-features = false }
|
pezkuwi-subxt-lightclient = { workspace = true, optional = true, default-features = false }
|
||||||
subxt-rpcs = { workspace = true, features = ["subxt"] }
|
pezkuwi-subxt-rpcs = { workspace = true, features = ["subxt"] }
|
||||||
|
|
||||||
# For parsing urls to disallow insecure schemes
|
# For parsing urls to disallow insecure schemes
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
@@ -123,12 +123,12 @@ bitvec = { workspace = true }
|
|||||||
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
||||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||||
tokio = { workspace = true, features = ["macros", "time", "rt-multi-thread", "sync"] }
|
tokio = { workspace = true, features = ["macros", "time", "rt-multi-thread", "sync"] }
|
||||||
sp-core = { workspace = true, features = ["std"] }
|
pezsp-core = { workspace = true, features = ["std"] }
|
||||||
sp-keyring = { workspace = true, features = ["std"] }
|
pezsp-keyring = { workspace = true, features = ["std"] }
|
||||||
sp-runtime = { workspace = true, features = ["std"] }
|
pezsp-runtime = { workspace = true, features = ["std"] }
|
||||||
assert_matches = { workspace = true }
|
assert_matches = { workspace = true }
|
||||||
subxt-signer = { path = "../signer", features = ["unstable-eth"] }
|
pezkuwi-subxt-signer = { path = "../signer", features = ["unstable-eth"] }
|
||||||
subxt-rpcs = { workspace = true, features = ["subxt", "mock-rpc-client"] }
|
pezkuwi-subxt-rpcs = { workspace = true, features = ["subxt", "mock-rpc-client"] }
|
||||||
# Tracing subscriber is useful for light-client examples to ensure that
|
# Tracing subscriber is useful for light-client examples to ensure that
|
||||||
# the `bootNodes` and chain spec are configured correctly. If all is fine, then
|
# the `bootNodes` and chain spec are configured correctly. If all is fine, then
|
||||||
# the light-client will emit INFO logs with
|
# the light-client will emit INFO logs with
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use subxt::{
|
|||||||
client::OnlineClient,
|
client::OnlineClient,
|
||||||
lightclient::{ChainConfig, LightClient},
|
lightclient::{ChainConfig, LightClient},
|
||||||
};
|
};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
// Generate an interface that we can use from the node's metadata.
|
// Generate an interface that we can use from the node's metadata.
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
use subxt::backend::{legacy::LegacyRpcMethods, rpc::RpcClient};
|
use subxt::backend::{legacy::LegacyRpcMethods, rpc::RpcClient};
|
||||||
use subxt::config::DefaultExtrinsicParamsBuilder as Params;
|
use subxt::config::DefaultExtrinsicParamsBuilder as Params;
|
||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
pub mod polkadot {}
|
pub mod polkadot {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::utils::AccountId32;
|
use subxt::utils::AccountId32;
|
||||||
use subxt::{OnlineClient, config::PolkadotConfig};
|
use subxt::{OnlineClient, config::PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::{OnlineClient, config::PolkadotConfig};
|
use subxt::{OnlineClient, config::PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
pub mod polkadot {}
|
pub mod polkadot {}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
use subxt::config::{
|
use subxt::config::{
|
||||||
Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, PolkadotConfig, SubstrateConfig,
|
Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, PolkadotConfig, SubstrateConfig,
|
||||||
};
|
};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt::subxt(
|
#[subxt::subxt(
|
||||||
runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use subxt::config::{
|
|||||||
Config, ExtrinsicParams, ExtrinsicParamsEncoder, ExtrinsicParamsError, HashFor,
|
Config, ExtrinsicParams, ExtrinsicParamsEncoder, ExtrinsicParamsError, HashFor,
|
||||||
transaction_extensions::Params,
|
transaction_extensions::Params,
|
||||||
};
|
};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
|
||||||
pub mod runtime {}
|
pub mod runtime {}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use subxt::config::{
|
|||||||
Config, DefaultExtrinsicParamsBuilder, ExtrinsicParams, ExtrinsicParamsEncoder,
|
Config, DefaultExtrinsicParamsBuilder, ExtrinsicParams, ExtrinsicParamsEncoder,
|
||||||
ExtrinsicParamsError,
|
ExtrinsicParamsError,
|
||||||
};
|
};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
pub mod runtime {}
|
pub mod runtime {}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
// Generate an interface that we can use from the node's metadata.
|
// Generate an interface that we can use from the node's metadata.
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
use subxt::dynamic::{At, Value};
|
use subxt::dynamic::{At, Value};
|
||||||
use subxt::utils::AccountId32;
|
use subxt::utils::AccountId32;
|
||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
// Generate an interface that we can use from the node's metadata.
|
// Generate an interface that we can use from the node's metadata.
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
use subxt::OnlineClient;
|
use subxt::OnlineClient;
|
||||||
use subxt_core::utils::AccountId20;
|
use pezkuwi_subxt_core::utils::AccountId20;
|
||||||
use subxt_signer::eth::{Signature, dev};
|
use pezkuwi_subxt_signer::eth::{Signature, dev};
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/frontier_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/frontier_metadata_small.scale")]
|
||||||
mod eth_runtime {}
|
mod eth_runtime {}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
pub mod polkadot {}
|
pub mod polkadot {}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
type BoxedError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
type BoxedError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::{OnlineClient, PolkadotConfig, tx::TxStatus};
|
use subxt::{OnlineClient, PolkadotConfig, tx::TxStatus};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
// Generate an interface that we can use from the node's metadata.
|
// Generate an interface that we can use from the node's metadata.
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
use subxt::config::polkadot::PolkadotExtrinsicParamsBuilder as Params;
|
use subxt::config::polkadot::PolkadotExtrinsicParamsBuilder as Params;
|
||||||
use subxt::{OnlineClient, PolkadotConfig};
|
use subxt::{OnlineClient, PolkadotConfig};
|
||||||
use subxt_signer::sr25519::dev;
|
use pezkuwi_subxt_signer::sr25519::dev;
|
||||||
|
|
||||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||||
pub mod polkadot {}
|
pub mod polkadot {}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use futures::{FutureExt, Stream, StreamExt, TryStreamExt};
|
|||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use subxt_rpcs::methods::chain_head::{ChainHeadRpcMethods, FollowEvent};
|
use pezkuwi_subxt_rpcs::methods::chain_head::{ChainHeadRpcMethods, FollowEvent};
|
||||||
|
|
||||||
/// A `Stream` whose goal is to remain subscribed to `chainHead_follow`. It will re-subscribe if the subscription
|
/// A `Stream` whose goal is to remain subscribed to `chainHead_follow`. It will re-subscribe if the subscription
|
||||||
/// is ended for any reason, and it will return the current `subscription_id` as an event, along with the other
|
/// is ended for any reason, and it will return the current `subscription_id` as an event, along with the other
|
||||||
@@ -224,7 +224,7 @@ pub(super) mod test_utils {
|
|||||||
use crate::config::substrate::H256;
|
use crate::config::substrate::H256;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use subxt_rpcs::methods::chain_head::{BestBlockChanged, Finalized, Initialized, NewBlock};
|
use pezkuwi_subxt_rpcs::methods::chain_head::{BestBlockChanged, Finalized, Initialized, NewBlock};
|
||||||
|
|
||||||
/// Given some events, returns a follow stream getter that we can use in
|
/// Given some events, returns a follow stream getter that we can use in
|
||||||
/// place of the usual RPC method.
|
/// place of the usual RPC method.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use std::ops::DerefMut;
|
|||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::task::{Context, Poll, Waker};
|
use std::task::{Context, Poll, Waker};
|
||||||
use subxt_rpcs::methods::chain_head::{FollowEvent, Initialized, RuntimeEvent};
|
use pezkuwi_subxt_rpcs::methods::chain_head::{FollowEvent, Initialized, RuntimeEvent};
|
||||||
|
|
||||||
/// A `Stream` which builds on `FollowStreamDriver`, and allows multiple subscribers to obtain events
|
/// A `Stream` which builds on `FollowStreamDriver`, and allows multiple subscribers to obtain events
|
||||||
/// from the single underlying subscription (each being provided an `Initialized` message and all new
|
/// from the single underlying subscription (each being provided an `Initialized` message and all new
|
||||||
@@ -455,7 +455,7 @@ where
|
|||||||
.position(|b| b.hash() == p.hash())
|
.position(|b| b.hash() == p.hash())
|
||||||
else {
|
else {
|
||||||
return Poll::Ready(Some(Err(RpcError::ClientError(
|
return Poll::Ready(Some(Err(RpcError::ClientError(
|
||||||
subxt_rpcs::Error::DisconnectedWillReconnect(
|
pezkuwi_subxt_rpcs::Error::DisconnectedWillReconnect(
|
||||||
"Missed at least one block when the connection was lost"
|
"Missed at least one block when the connection was lost"
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
),
|
),
|
||||||
@@ -742,7 +742,7 @@ mod test {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
matches!(&evs[1], Err(BackendError::Rpc(RpcError::ClientError(subxt_rpcs::Error::DisconnectedWillReconnect(e)))) if e.contains("Missed at least one block when the connection was lost"))
|
matches!(&evs[1], Err(BackendError::Rpc(RpcError::ClientError(pezkuwi_subxt_rpcs::Error::DisconnectedWillReconnect(e)))) if e.contains("Missed at least one block when the connection was lost"))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
evs[2].as_ref().unwrap(),
|
evs[2].as_ref().unwrap(),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use super::follow_stream::FollowStream;
|
|||||||
use crate::config::{Config, Hash, HashFor};
|
use crate::config::{Config, Hash, HashFor};
|
||||||
use crate::error::BackendError;
|
use crate::error::BackendError;
|
||||||
use futures::stream::{FuturesUnordered, Stream, StreamExt};
|
use futures::stream::{FuturesUnordered, Stream, StreamExt};
|
||||||
use subxt_rpcs::methods::chain_head::{
|
use pezkuwi_subxt_rpcs::methods::chain_head::{
|
||||||
BestBlockChanged, Finalized, FollowEvent, Initialized, NewBlock,
|
BestBlockChanged, Finalized, FollowEvent, Initialized, NewBlock,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,18 +30,18 @@ use futures::{Stream, StreamExt};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
use storage_items::StorageItems;
|
use storage_items::StorageItems;
|
||||||
use subxt_rpcs::RpcClient;
|
use pezkuwi_subxt_rpcs::RpcClient;
|
||||||
use subxt_rpcs::methods::chain_head::{
|
use pezkuwi_subxt_rpcs::methods::chain_head::{
|
||||||
FollowEvent, MethodResponse, RuntimeEvent, StorageQuery, StorageQueryType, StorageResultType,
|
FollowEvent, MethodResponse, RuntimeEvent, StorageQuery, StorageQueryType, StorageResultType,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Re-export RPC types and methods from [`subxt_rpcs::methods::chain_head`].
|
/// Re-export RPC types and methods from [`pezkuwi_subxt_rpcs::methods::chain_head`].
|
||||||
pub mod rpc_methods {
|
pub mod rpc_methods {
|
||||||
pub use subxt_rpcs::methods::legacy::*;
|
pub use pezkuwi_subxt_rpcs::methods::legacy::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expose the RPC methods.
|
// Expose the RPC methods.
|
||||||
pub use subxt_rpcs::methods::chain_head::ChainHeadRpcMethods;
|
pub use pezkuwi_subxt_rpcs::methods::chain_head::ChainHeadRpcMethods;
|
||||||
|
|
||||||
/// Configure and build an [`ChainHeadBackend`].
|
/// Configure and build an [`ChainHeadBackend`].
|
||||||
pub struct ChainHeadBackendBuilder<T> {
|
pub struct ChainHeadBackendBuilder<T> {
|
||||||
@@ -603,7 +603,7 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for ChainHeadBackend<T> {
|
|||||||
.await?
|
.await?
|
||||||
.map(|ev| {
|
.map(|ev| {
|
||||||
ev.map(|tx_status| {
|
ev.map(|tx_status| {
|
||||||
use subxt_rpcs::methods::chain_head::TransactionStatus as RpcTransactionStatus;
|
use pezkuwi_subxt_rpcs::methods::chain_head::TransactionStatus as RpcTransactionStatus;
|
||||||
match tx_status {
|
match tx_status {
|
||||||
RpcTransactionStatus::Validated => TransactionStatus::Validated,
|
RpcTransactionStatus::Validated => TransactionStatus::Validated,
|
||||||
RpcTransactionStatus::Broadcasted => TransactionStatus::Broadcasted,
|
RpcTransactionStatus::Broadcasted => TransactionStatus::Broadcasted,
|
||||||
@@ -770,7 +770,7 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for ChainHeadBackend<T> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// When we get one, map it to the correct format (or for finalized ev, wait for the pinned block):
|
// When we get one, map it to the correct format (or for finalized ev, wait for the pinned block):
|
||||||
use subxt_rpcs::methods::chain_head::TransactionStatus as RpcTransactionStatus;
|
use pezkuwi_subxt_rpcs::methods::chain_head::TransactionStatus as RpcTransactionStatus;
|
||||||
let tx_progress_ev = match tx_progress_ev {
|
let tx_progress_ev = match tx_progress_ev {
|
||||||
RpcTransactionStatus::Finalized { block } => {
|
RpcTransactionStatus::Finalized { block } => {
|
||||||
// We'll wait until we have seen this hash, to try to guarantee
|
// We'll wait until we have seen this hash, to try to guarantee
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use std::future::Future;
|
|||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use subxt_rpcs::methods::chain_head::{
|
use pezkuwi_subxt_rpcs::methods::chain_head::{
|
||||||
ChainHeadRpcMethods, FollowEvent, MethodResponse, StorageQuery, StorageResult,
|
ChainHeadRpcMethods, FollowEvent, MethodResponse, StorageQuery, StorageResult,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ use futures::{Future, FutureExt, Stream, StreamExt, future, future::Either, stre
|
|||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use subxt_rpcs::RpcClient;
|
use pezkuwi_subxt_rpcs::RpcClient;
|
||||||
|
|
||||||
/// Re-export legacy RPC types and methods from [`subxt_rpcs::methods::legacy`].
|
/// Re-export legacy RPC types and methods from [`pezkuwi_subxt_rpcs::methods::legacy`].
|
||||||
pub mod rpc_methods {
|
pub mod rpc_methods {
|
||||||
pub use subxt_rpcs::methods::legacy::*;
|
pub use pezkuwi_subxt_rpcs::methods::legacy::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expose the RPC methods.
|
// Expose the RPC methods.
|
||||||
|
|||||||
+15
-15
@@ -17,13 +17,13 @@ use codec::{Decode, Encode};
|
|||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use subxt_core::client::RuntimeVersion;
|
use pezkuwi_subxt_core::client::RuntimeVersion;
|
||||||
use subxt_metadata::Metadata;
|
use pezkuwi_subxt_metadata::Metadata;
|
||||||
|
|
||||||
/// Some re-exports from the [`subxt_rpcs`] crate, also accessible in full via [`crate::ext::subxt_rpcs`].
|
/// Some re-exports from the [`pezkuwi_subxt_rpcs`] crate, also accessible in full via [`crate::ext::pezkuwi_subxt_rpcs`].
|
||||||
pub mod rpc {
|
pub mod rpc {
|
||||||
pub use subxt_rpcs::client::{RawRpcFuture, RawRpcSubscription, RawValue, RpcParams};
|
pub use pezkuwi_subxt_rpcs::client::{RawRpcFuture, RawRpcSubscription, RawValue, RpcParams};
|
||||||
pub use subxt_rpcs::{RpcClient, RpcClientT, rpc_params};
|
pub use pezkuwi_subxt_rpcs::{RpcClient, RpcClientT, rpc_params};
|
||||||
|
|
||||||
crate::macros::cfg_reconnecting_rpc_client! {
|
crate::macros::cfg_reconnecting_rpc_client! {
|
||||||
/// An RPC client that automatically reconnects.
|
/// An RPC client that automatically reconnects.
|
||||||
@@ -63,7 +63,7 @@ pub mod rpc {
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub use subxt_rpcs::client::reconnecting_rpc_client;
|
pub use pezkuwi_subxt_rpcs::client::reconnecting_rpc_client;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,8 +395,8 @@ mod test {
|
|||||||
use primitive_types::H256;
|
use primitive_types::H256;
|
||||||
use rpc::RpcClientT;
|
use rpc::RpcClientT;
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
use subxt_core::{Config, config::DefaultExtrinsicParams};
|
use pezkuwi_subxt_core::{Config, config::DefaultExtrinsicParams};
|
||||||
use subxt_rpcs::client::{
|
use pezkuwi_subxt_rpcs::client::{
|
||||||
MockRpcClient,
|
MockRpcClient,
|
||||||
mock_rpc_client::{Json, MockRpcClientBuilder},
|
mock_rpc_client::{Json, MockRpcClientBuilder},
|
||||||
};
|
};
|
||||||
@@ -405,8 +405,8 @@ mod test {
|
|||||||
H256::random()
|
H256::random()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn disconnected_will_reconnect() -> subxt_rpcs::Error {
|
fn disconnected_will_reconnect() -> pezkuwi_subxt_rpcs::Error {
|
||||||
subxt_rpcs::Error::DisconnectedWillReconnect("..".into())
|
pezkuwi_subxt_rpcs::Error::DisconnectedWillReconnect("..".into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn storage_response<K: Into<Vec<u8>>, V: Into<Vec<u8>>>(key: K, value: V) -> StorageResponse
|
fn storage_response<K: Into<Vec<u8>>, V: Into<Vec<u8>>>(key: K, value: V) -> StorageResponse
|
||||||
@@ -614,7 +614,7 @@ mod test {
|
|||||||
vec![
|
vec![
|
||||||
Ok(Json(runtime_version(4))),
|
Ok(Json(runtime_version(4))),
|
||||||
Ok(Json(runtime_version(5))),
|
Ok(Json(runtime_version(5))),
|
||||||
Err(subxt_rpcs::Error::Client("..".into())),
|
Err(pezkuwi_subxt_rpcs::Error::Client("..".into())),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -644,7 +644,7 @@ mod test {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
results.next().await.unwrap(),
|
results.next().await.unwrap(),
|
||||||
Err(BackendError::Rpc(RpcError::ClientError(
|
Err(BackendError::Rpc(RpcError::ClientError(
|
||||||
subxt_rpcs::Error::Client(_)
|
pezkuwi_subxt_rpcs::Error::Client(_)
|
||||||
)))
|
)))
|
||||||
));
|
));
|
||||||
assert!(results.next().await.is_none());
|
assert!(results.next().await.is_none());
|
||||||
@@ -652,7 +652,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod unstable_backend {
|
mod unstable_backend {
|
||||||
use subxt_rpcs::methods::chain_head::{
|
use pezkuwi_subxt_rpcs::methods::chain_head::{
|
||||||
self, Bytes, Initialized, MethodResponse, MethodResponseStarted, OperationError,
|
self, Bytes, Initialized, MethodResponse, MethodResponseStarted, OperationError,
|
||||||
OperationId, OperationStorageItems, RuntimeSpec, RuntimeVersionEvent,
|
OperationId, OperationStorageItems, RuntimeSpec, RuntimeVersionEvent,
|
||||||
};
|
};
|
||||||
@@ -718,8 +718,8 @@ mod test {
|
|||||||
I: IntoIterator<Item = usize> + Send,
|
I: IntoIterator<Item = usize> + Send,
|
||||||
I::IntoIter: Send + Sync + 'static,
|
I::IntoIter: Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
use subxt_rpcs::client::mock_rpc_client::AndThen;
|
use pezkuwi_subxt_rpcs::client::mock_rpc_client::AndThen;
|
||||||
use subxt_rpcs::{Error, UserError};
|
use pezkuwi_subxt_rpcs::{Error, UserError};
|
||||||
|
|
||||||
let recv = Arc::new(tokio::sync::Mutex::new(recv));
|
let recv = Arc::new(tokio::sync::Mutex::new(recv));
|
||||||
let mut ids = ids.into_iter();
|
let mut ids = ids.into_iter();
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ mod tests {
|
|||||||
use crate::backend::StreamOf;
|
use crate::backend::StreamOf;
|
||||||
|
|
||||||
fn disconnect_err() -> BackendError {
|
fn disconnect_err() -> BackendError {
|
||||||
BackendError::Rpc(subxt_rpcs::Error::DisconnectedWillReconnect(String::new()).into())
|
BackendError::Rpc(pezkuwi_subxt_rpcs::Error::DisconnectedWillReconnect(String::new()).into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn custom_err() -> BackendError {
|
fn custom_err() -> BackendError {
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use derive_where::derive_where;
|
use derive_where::derive_where;
|
||||||
use scale_decode::{DecodeAsFields, DecodeAsType};
|
use scale_decode::{DecodeAsFields, DecodeAsType};
|
||||||
use subxt_core::blocks::{ExtrinsicDetails as CoreExtrinsicDetails, Extrinsics as CoreExtrinsics};
|
use pezkuwi_subxt_core::blocks::{ExtrinsicDetails as CoreExtrinsicDetails, Extrinsics as CoreExtrinsics};
|
||||||
|
|
||||||
// Re-export anything that's directly returned/used in the APIs below.
|
// Re-export anything that's directly returned/used in the APIs below.
|
||||||
pub use subxt_core::blocks::{
|
pub use pezkuwi_subxt_core::blocks::{
|
||||||
ExtrinsicTransactionExtension, ExtrinsicTransactionExtensions, StaticExtrinsic,
|
ExtrinsicTransactionExtension, ExtrinsicTransactionExtensions, StaticExtrinsic,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ where
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::Extrinsics::len()`].
|
/// See [`pezkuwi_subxt_core::blocks::Extrinsics::len()`].
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.inner.len()
|
self.inner.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::Extrinsics::is_empty()`].
|
/// See [`pezkuwi_subxt_core::blocks::Extrinsics::is_empty()`].
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.inner.is_empty()
|
self.inner.is_empty()
|
||||||
}
|
}
|
||||||
@@ -154,87 +154,87 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::hash()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::hash()`].
|
||||||
pub fn hash(&self) -> HashFor<T> {
|
pub fn hash(&self) -> HashFor<T> {
|
||||||
self.inner.hash()
|
self.inner.hash()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::is_signed()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::is_signed()`].
|
||||||
pub fn is_signed(&self) -> bool {
|
pub fn is_signed(&self) -> bool {
|
||||||
self.inner.is_signed()
|
self.inner.is_signed()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::index()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::index()`].
|
||||||
pub fn index(&self) -> u32 {
|
pub fn index(&self) -> u32 {
|
||||||
self.inner.index()
|
self.inner.index()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::bytes()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::bytes()`].
|
||||||
pub fn bytes(&self) -> &[u8] {
|
pub fn bytes(&self) -> &[u8] {
|
||||||
self.inner.bytes()
|
self.inner.bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::call_bytes()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::call_bytes()`].
|
||||||
pub fn call_bytes(&self) -> &[u8] {
|
pub fn call_bytes(&self) -> &[u8] {
|
||||||
self.inner.call_bytes()
|
self.inner.call_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::field_bytes()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::field_bytes()`].
|
||||||
pub fn field_bytes(&self) -> &[u8] {
|
pub fn field_bytes(&self) -> &[u8] {
|
||||||
self.inner.field_bytes()
|
self.inner.field_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::address_bytes()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::address_bytes()`].
|
||||||
pub fn address_bytes(&self) -> Option<&[u8]> {
|
pub fn address_bytes(&self) -> Option<&[u8]> {
|
||||||
self.inner.address_bytes()
|
self.inner.address_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::signature_bytes()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::signature_bytes()`].
|
||||||
pub fn signature_bytes(&self) -> Option<&[u8]> {
|
pub fn signature_bytes(&self) -> Option<&[u8]> {
|
||||||
self.inner.signature_bytes()
|
self.inner.signature_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::transaction_extensions_bytes()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::transaction_extensions_bytes()`].
|
||||||
pub fn transaction_extensions_bytes(&self) -> Option<&[u8]> {
|
pub fn transaction_extensions_bytes(&self) -> Option<&[u8]> {
|
||||||
self.inner.transaction_extensions_bytes()
|
self.inner.transaction_extensions_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::transaction_extensions()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::transaction_extensions()`].
|
||||||
pub fn transaction_extensions(&self) -> Option<ExtrinsicTransactionExtensions<'_, T>> {
|
pub fn transaction_extensions(&self) -> Option<ExtrinsicTransactionExtensions<'_, T>> {
|
||||||
self.inner.transaction_extensions()
|
self.inner.transaction_extensions()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::pallet_index()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::pallet_index()`].
|
||||||
pub fn pallet_index(&self) -> u8 {
|
pub fn pallet_index(&self) -> u8 {
|
||||||
self.inner.pallet_index()
|
self.inner.pallet_index()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::call_index()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::call_index()`].
|
||||||
pub fn call_index(&self) -> u8 {
|
pub fn call_index(&self) -> u8 {
|
||||||
self.inner.call_index()
|
self.inner.call_index()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::pallet_name()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::pallet_name()`].
|
||||||
pub fn pallet_name(&self) -> &str {
|
pub fn pallet_name(&self) -> &str {
|
||||||
self.inner.pallet_name()
|
self.inner.pallet_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::call_name()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::call_name()`].
|
||||||
pub fn call_name(&self) -> &str {
|
pub fn call_name(&self) -> &str {
|
||||||
self.inner.call_name()
|
self.inner.call_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::decode_as_fields()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::decode_as_fields()`].
|
||||||
pub fn decode_as_fields<E: DecodeAsFields>(&self) -> Result<E, ExtrinsicError> {
|
pub fn decode_as_fields<E: DecodeAsFields>(&self) -> Result<E, ExtrinsicError> {
|
||||||
self.inner.decode_as_fields().map_err(Into::into)
|
self.inner.decode_as_fields().map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::as_extrinsic()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::as_extrinsic()`].
|
||||||
pub fn as_extrinsic<E: StaticExtrinsic>(&self) -> Result<Option<E>, ExtrinsicError> {
|
pub fn as_extrinsic<E: StaticExtrinsic>(&self) -> Result<Option<E>, ExtrinsicError> {
|
||||||
self.inner.as_extrinsic::<E>().map_err(Into::into)
|
self.inner.as_extrinsic::<E>().map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`subxt_core::blocks::ExtrinsicDetails::as_root_extrinsic()`].
|
/// See [`pezkuwi_subxt_core::blocks::ExtrinsicDetails::as_root_extrinsic()`].
|
||||||
pub fn as_root_extrinsic<E: DecodeAsType>(&self) -> Result<E, ExtrinsicError> {
|
pub fn as_root_extrinsic<E: DecodeAsType>(&self) -> Result<E, ExtrinsicError> {
|
||||||
self.inner.as_root_extrinsic::<E>().map_err(Into::into)
|
self.inner.as_root_extrinsic::<E>().map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
//! # RPC calls
|
//! # RPC calls
|
||||||
//!
|
//!
|
||||||
//! The RPC interface is provided by the [`subxt_rpcs`] crate but re-exposed here. We have:
|
//! The RPC interface is provided by the [`pezkuwi_subxt_rpcs`] crate but re-exposed here. We have:
|
||||||
//!
|
//!
|
||||||
//! - [`crate::backend::rpc::RpcClient`] and [`crate::backend::rpc::RpcClientT`]: the underlying type and trait
|
//! - [`crate::backend::rpc::RpcClient`] and [`crate::backend::rpc::RpcClientT`]: the underlying type and trait
|
||||||
//! which provides a basic RPC client.
|
//! which provides a basic RPC client.
|
||||||
//! - [`crate::backend::legacy::rpc_methods`] and [`crate::backend::chain_head::rpc_methods`]: RPc methods that
|
//! - [`crate::backend::legacy::rpc_methods`] and [`crate::backend::chain_head::rpc_methods`]: RPc methods that
|
||||||
//! can be instantiated with an RPC client.
|
//! can be instantiated with an RPC client.
|
||||||
//!
|
//!
|
||||||
//! See [`subxt_rpcs`] or [`crate::ext::subxt_rpcs`] for more.
|
//! See [`pezkuwi_subxt_rpcs`] or [`crate::ext::pezkuwi_subxt_rpcs`] for more.
|
||||||
//!
|
//!
|
||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
|
|||||||
@@ -64,26 +64,26 @@
|
|||||||
//! Subxt who the extrinsic is from, and takes care of signing the relevant details to prove this.
|
//! Subxt who the extrinsic is from, and takes care of signing the relevant details to prove this.
|
||||||
//!
|
//!
|
||||||
//! There are two main ways to create a compatible signer instance:
|
//! There are two main ways to create a compatible signer instance:
|
||||||
//! 1. The `subxt_signer` crate provides a WASM compatible implementation of [`crate::tx::Signer`]
|
//! 1. The `pezkuwi_subxt_signer` crate provides a WASM compatible implementation of [`crate::tx::Signer`]
|
||||||
//! for chains which require sr25519 or ecdsa signatures (requires the `subxt` feature to be enabled).
|
//! for chains which require sr25519 or ecdsa signatures (requires the `subxt` feature to be enabled).
|
||||||
//! 2. Alternately, implement your own [`crate::tx::Signer`] instance by wrapping it in a new type pattern.
|
//! 2. Alternately, implement your own [`crate::tx::Signer`] instance by wrapping it in a new type pattern.
|
||||||
//!
|
//!
|
||||||
//! Going for 1 leads to fewer dependencies being imported and WASM compatibility out of the box via
|
//! Going for 1 leads to fewer dependencies being imported and WASM compatibility out of the box via
|
||||||
//! the `web` feature flag. Going for 2 is useful if you're already using the Substrate dependencies or
|
//! the `web` feature flag. Going for 2 is useful if you're already using the Substrate dependencies or
|
||||||
//! need additional signing algorithms that `subxt_signer` doesn't support, and don't care about WASM
|
//! need additional signing algorithms that `pezkuwi_subxt_signer` doesn't support, and don't care about WASM
|
||||||
//! compatibility.
|
//! compatibility.
|
||||||
//!
|
//!
|
||||||
//! Because 2 is more complex and require more code, we'll focus on 1 here.
|
//! Because 2 is more complex and require more code, we'll focus on 1 here.
|
||||||
//! For 2, see the example in `subxt/examples/substrate_compat_signer.rs` how
|
//! For 2, see the example in `subxt/examples/substrate_compat_signer.rs` how
|
||||||
//! you can integrate things like sp_core's signer in subxt.
|
//! you can integrate things like sp_core's signer in subxt.
|
||||||
//!
|
//!
|
||||||
//! Let's go through how to create a signer using the `subxt_signer` crate:
|
//! Let's go through how to create a signer using the `pezkuwi_subxt_signer` crate:
|
||||||
//!
|
//!
|
||||||
//! ```rust,standalone_crate
|
//! ```rust,standalone_crate
|
||||||
//! use subxt::config::PolkadotConfig;
|
//! use subxt::config::PolkadotConfig;
|
||||||
//! use std::str::FromStr;
|
//! use std::str::FromStr;
|
||||||
//!
|
//!
|
||||||
//! use subxt_signer::{SecretUri, sr25519};
|
//! use pezkuwi_subxt_signer::{SecretUri, sr25519};
|
||||||
//!
|
//!
|
||||||
//! // Get hold of a `Signer` for a test account:
|
//! // Get hold of a `Signer` for a test account:
|
||||||
//! let alice = sr25519::dev::alice();
|
//! let alice = sr25519::dev::alice();
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
//! let signature;
|
//! let signature;
|
||||||
//! let account_id;
|
//! let account_id;
|
||||||
//! # use subxt::tx::Signer;
|
//! # use subxt::tx::Signer;
|
||||||
//! # let signer = subxt_signer::sr25519::dev::alice();
|
//! # let signer = pezkuwi_subxt_signer::sr25519::dev::alice();
|
||||||
//! # signature = signer.sign(&signer_payload).into();
|
//! # signature = signer.sign(&signer_payload).into();
|
||||||
//! # account_id = signer.public_key().to_account_id();
|
//! # account_id = signer.public_key().to_account_id();
|
||||||
//!
|
//!
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ pub use offline_client::{OfflineClient, OfflineClientT};
|
|||||||
pub use online_client::{
|
pub use online_client::{
|
||||||
ClientRuntimeUpdater, OnlineClient, OnlineClientT, RuntimeUpdaterStream, Update,
|
ClientRuntimeUpdater, OnlineClient, OnlineClientT, RuntimeUpdaterStream, Update,
|
||||||
};
|
};
|
||||||
pub use subxt_core::client::{ClientState, RuntimeVersion};
|
pub use pezkuwi_subxt_core::client::{ClientState, RuntimeVersion};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use crate::{
|
|||||||
|
|
||||||
use derive_where::derive_where;
|
use derive_where::derive_where;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use subxt_core::client::{ClientState, RuntimeVersion};
|
use pezkuwi_subxt_core::client::{ClientState, RuntimeVersion};
|
||||||
|
|
||||||
/// A trait representing a client that can perform
|
/// A trait representing a client that can perform
|
||||||
/// offline-only actions.
|
/// offline-only actions.
|
||||||
@@ -34,7 +34,7 @@ pub trait OfflineClientT<T: Config>: Clone + Send + Sync + 'static {
|
|||||||
/// Return the hasher used on the chain.
|
/// Return the hasher used on the chain.
|
||||||
fn hasher(&self) -> T::Hasher;
|
fn hasher(&self) -> T::Hasher;
|
||||||
|
|
||||||
/// Return the [subxt_core::client::ClientState] (metadata, runtime version and genesis hash).
|
/// Return the [pezkuwi_subxt_core::client::ClientState] (metadata, runtime version and genesis hash).
|
||||||
fn client_state(&self) -> ClientState<T> {
|
fn client_state(&self) -> ClientState<T> {
|
||||||
ClientState {
|
ClientState {
|
||||||
genesis_hash: self.genesis_hash(),
|
genesis_hash: self.genesis_hash(),
|
||||||
@@ -101,7 +101,7 @@ impl<T: Config> OfflineClient<T> {
|
|||||||
metadata: impl Into<Metadata>,
|
metadata: impl Into<Metadata>,
|
||||||
) -> OfflineClient<T> {
|
) -> OfflineClient<T> {
|
||||||
let metadata = metadata.into();
|
let metadata = metadata.into();
|
||||||
let hasher = <T::Hasher as subxt_core::config::Hasher>::new(&metadata);
|
let hasher = <T::Hasher as pezkuwi_subxt_core::config::Hasher>::new(&metadata);
|
||||||
|
|
||||||
OfflineClient {
|
OfflineClient {
|
||||||
hasher,
|
hasher,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use derive_where::derive_where;
|
|||||||
use futures::TryFutureExt;
|
use futures::TryFutureExt;
|
||||||
use futures::future;
|
use futures::future;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use subxt_core::client::{ClientState, RuntimeVersion};
|
use pezkuwi_subxt_core::client::{ClientState, RuntimeVersion};
|
||||||
|
|
||||||
/// A trait representing a client that can perform
|
/// A trait representing a client that can perform
|
||||||
/// online actions.
|
/// online actions.
|
||||||
@@ -68,7 +68,7 @@ impl<T: Config> OnlineClient<T> {
|
|||||||
|
|
||||||
/// Construct a new [`OnlineClient`], providing a URL to connect to.
|
/// Construct a new [`OnlineClient`], providing a URL to connect to.
|
||||||
pub async fn from_url(url: impl AsRef<str>) -> Result<OnlineClient<T>, OnlineClientError> {
|
pub async fn from_url(url: impl AsRef<str>) -> Result<OnlineClient<T>, OnlineClientError> {
|
||||||
subxt_rpcs::utils::validate_url_is_secure(url.as_ref())?;
|
pezkuwi_subxt_rpcs::utils::validate_url_is_secure(url.as_ref())?;
|
||||||
OnlineClient::from_insecure_url(url).await
|
OnlineClient::from_insecure_url(url).await
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ impl<T: Config> OnlineClient<T> {
|
|||||||
metadata: impl Into<Metadata>,
|
metadata: impl Into<Metadata>,
|
||||||
backend: Arc<B>,
|
backend: Arc<B>,
|
||||||
) -> Result<OnlineClient<T>, OnlineClientError> {
|
) -> Result<OnlineClient<T>, OnlineClientError> {
|
||||||
use subxt_core::config::Hasher;
|
use pezkuwi_subxt_core::config::Hasher;
|
||||||
|
|
||||||
let metadata = metadata.into();
|
let metadata = metadata.into();
|
||||||
let hasher = T::Hasher::new(&metadata);
|
let hasher = T::Hasher::new(&metadata);
|
||||||
@@ -209,7 +209,7 @@ impl<T: Config> OnlineClient<T> {
|
|||||||
block_hash: HashFor<T>,
|
block_hash: HashFor<T>,
|
||||||
) -> Result<Metadata, BackendError> {
|
) -> Result<Metadata, BackendError> {
|
||||||
// The metadata versions we support in Subxt, from newest to oldest.
|
// The metadata versions we support in Subxt, from newest to oldest.
|
||||||
use subxt_metadata::SUPPORTED_METADATA_VERSIONS;
|
use pezkuwi_subxt_metadata::SUPPORTED_METADATA_VERSIONS;
|
||||||
|
|
||||||
// Try to fetch each version that we support in order from newest to oldest.
|
// Try to fetch each version that we support in order from newest to oldest.
|
||||||
for version in SUPPORTED_METADATA_VERSIONS {
|
for version in SUPPORTED_METADATA_VERSIONS {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
use crate::{Config, client::OfflineClientT, error::ConstantError};
|
use crate::{Config, client::OfflineClientT, error::ConstantError};
|
||||||
use derive_where::derive_where;
|
use derive_where::derive_where;
|
||||||
use subxt_core::constants::address::Address;
|
use pezkuwi_subxt_core::constants::address::Address;
|
||||||
|
|
||||||
/// A client for accessing constants.
|
/// A client for accessing constants.
|
||||||
#[derive_where(Clone; Client)]
|
#[derive_where(Clone; Client)]
|
||||||
@@ -30,7 +30,7 @@ impl<T: Config, Client: OfflineClientT<T>> ConstantsClient<T, Client> {
|
|||||||
/// the pallet or constant in question do not exist at all).
|
/// the pallet or constant in question do not exist at all).
|
||||||
pub fn validate<Addr: Address>(&self, address: Addr) -> Result<(), ConstantError> {
|
pub fn validate<Addr: Address>(&self, address: Addr) -> Result<(), ConstantError> {
|
||||||
let metadata = self.client.metadata();
|
let metadata = self.client.metadata();
|
||||||
subxt_core::constants::validate(address, &metadata)
|
pezkuwi_subxt_core::constants::validate(address, &metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access the constant at the address given, returning the type defined by this address.
|
/// Access the constant at the address given, returning the type defined by this address.
|
||||||
@@ -38,12 +38,12 @@ impl<T: Config, Client: OfflineClientT<T>> ConstantsClient<T, Client> {
|
|||||||
/// construct your own, too.
|
/// construct your own, too.
|
||||||
pub fn at<Addr: Address>(&self, address: Addr) -> Result<Addr::Target, ConstantError> {
|
pub fn at<Addr: Address>(&self, address: Addr) -> Result<Addr::Target, ConstantError> {
|
||||||
let metadata = self.client.metadata();
|
let metadata = self.client.metadata();
|
||||||
subxt_core::constants::get(address, &metadata)
|
pezkuwi_subxt_core::constants::get(address, &metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access the bytes of a constant by the address it is registered under.
|
/// Access the bytes of a constant by the address it is registered under.
|
||||||
pub fn bytes_at<Addr: Address>(&self, address: Addr) -> Result<Vec<u8>, ConstantError> {
|
pub fn bytes_at<Addr: Address>(&self, address: Addr) -> Result<Vec<u8>, ConstantError> {
|
||||||
let metadata = self.client.metadata();
|
let metadata = self.client.metadata();
|
||||||
subxt_core::constants::get_bytes(address, &metadata)
|
pezkuwi_subxt_core::constants::get_bytes(address, &metadata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user