Complete rebrand: Polkadot→Pezkuwi, Substrate→Bizinikiwi

- Replace PolkadotConfig with PezkuwiConfig
- Replace SubstrateConfig with BizinikiwConfig
- Rename config module files (polkadot.rs→pezkuwi.rs, substrate.rs→bizinikiwi.rs)
- Update all documentation and examples
- All 165 files updated, cargo check passes
This commit is contained in:
2025-12-21 21:42:34 +03:00
parent 99e4ee3ab8
commit 7af0bcd262
166 changed files with 2395 additions and 2395 deletions
+8 -8
View File
@@ -336,7 +336,7 @@ pub struct FoundExtrinsic<T: Config, E> {
#[cfg(test)]
mod tests {
use super::*;
use crate::config::SubstrateConfig;
use crate::config::BizinikiwConfig;
use assert_matches::assert_matches;
use codec::{Decode, Encode};
use frame_metadata::{
@@ -478,7 +478,7 @@ mod tests {
let metadata = metadata();
// Decode with empty bytes.
let result = Extrinsics::<SubstrateConfig>::decode_from(vec![vec![]], metadata);
let result = Extrinsics::<BizinikiwConfig>::decode_from(vec![vec![]], metadata);
assert_matches!(
result.err(),
Some(crate::error::ExtrinsicDecodeErrorAt { extrinsic_index: 0, error: _ })
@@ -492,7 +492,7 @@ mod tests {
let metadata = metadata();
// Decode with invalid version.
let result = Extrinsics::<SubstrateConfig>::decode_from(vec![vec![3u8].encode()], metadata);
let result = Extrinsics::<BizinikiwConfig>::decode_from(vec![vec![3u8].encode()], metadata);
assert_matches!(
result.err(),
@@ -508,7 +508,7 @@ mod tests {
#[test]
fn tx_hashes_line_up() {
let metadata = metadata();
let hasher = <SubstrateConfig as Config>::Hasher::new(&metadata);
let hasher = <BizinikiwConfig as Config>::Hasher::new(&metadata);
let tx = crate::dynamic::tx(
"Test",
@@ -517,11 +517,11 @@ mod tests {
);
// Encoded TX ready to submit.
let tx_encoded = crate::tx::create_v4_unsigned::<SubstrateConfig, _>(&tx, &metadata)
let tx_encoded = crate::tx::create_v4_unsigned::<BizinikiwConfig, _>(&tx, &metadata)
.expect("Valid dynamic parameters are provided");
// Extrinsic details ready to decode.
let extrinsics = Extrinsics::<SubstrateConfig>::decode_from(
let extrinsics = Extrinsics::<BizinikiwConfig>::decode_from(
vec![tx_encoded.encoded().to_owned()],
metadata,
)
@@ -544,13 +544,13 @@ mod tests {
"TestCall",
vec![Value::u128(10), Value::bool(true), Value::string("SomeValue")],
);
let tx_encoded = crate::tx::create_v4_unsigned::<SubstrateConfig, _>(&tx, &metadata)
let tx_encoded = crate::tx::create_v4_unsigned::<BizinikiwConfig, _>(&tx, &metadata)
.expect("Valid dynamic parameters are provided");
// Note: `create_unsigned` produces the extrinsic bytes by prefixing the extrinsic length.
// The length is handled deserializing `ChainBlockExtrinsic`, therefore the first byte is
// not needed.
let extrinsics = Extrinsics::<SubstrateConfig>::decode_from(
let extrinsics = Extrinsics::<BizinikiwConfig>::decode_from(
vec![tx_encoded.encoded().to_owned()],
metadata,
)
+5 -5
View File
@@ -16,18 +16,18 @@
//! use pezkuwi_subxt_macro::subxt;
//! use pezkuwi_subxt_core::blocks;
//! use pezkuwi_subxt_core::Metadata;
//! use pezkuwi_subxt_core::config::PolkadotConfig;
//! use pezkuwi_subxt_core::config::PezkuwiConfig;
//! use alloc::vec;
//!
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
//! #[subxt(
//! crate = "::pezkuwi_subxt_core",
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
//! runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale",
//! )]
//! pub mod polkadot {}
//! pub mod pezkuwi {}
//!
//! // Some metadata we'd like to use to help us decode extrinsics:
//! let metadata_bytes = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
//! let metadata_bytes = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
//! let metadata = Metadata::decode_from(&metadata_bytes[..]).unwrap();
//!
//! // Some extrinsics we'd like to decode:
@@ -38,7 +38,7 @@
//! ];
//!
//! // Given some chain config and metadata, we know how to decode the bytes.
//! let exts = blocks::decode_from::<PolkadotConfig>(ext_bytes, metadata).unwrap();
//! let exts = blocks::decode_from::<PezkuwiConfig>(ext_bytes, metadata).unwrap();
//!
//! // We'll see 3 extrinsics:
//! assert_eq!(exts.len(), 3);
@@ -2,7 +2,7 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! Substrate specific configuration
//! Bizinikiwi specific configuration
use super::{Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, Hasher, Header};
pub use crate::utils::{AccountId32, MultiAddress, MultiSignature};
@@ -12,31 +12,31 @@ use pezkuwi_subxt_metadata::Metadata;
pub use primitive_types::{H256, U256};
use serde::{Deserialize, Serialize};
/// Default set of commonly used types by Substrate runtimes.
/// Default set of commonly used types by Bizinikiwi runtimes.
// Note: We only use this at the type level, so it should be impossible to
// create an instance of it.
// The trait implementations exist just to make life easier,
// but shouldn't strictly be necessary since users can't instantiate this type.
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub enum SubstrateConfig {}
pub enum BizinikiwConfig {}
impl Config for SubstrateConfig {
impl Config for BizinikiwConfig {
type AccountId = AccountId32;
type Address = MultiAddress<Self::AccountId, u32>;
type Signature = MultiSignature;
type Hasher = DynamicHasher256;
type Header = SubstrateHeader<u32, DynamicHasher256>;
type ExtrinsicParams = SubstrateExtrinsicParams<Self>;
type Header = BizinikiwiHeader<u32, DynamicHasher256>;
type ExtrinsicParams = BizinikiwiExtrinsicParams<Self>;
type AssetId = u32;
}
/// A struct representing the signed extra and additional parameters required
/// to construct a transaction for the default substrate node.
pub type SubstrateExtrinsicParams<T> = DefaultExtrinsicParams<T>;
/// to construct a transaction for the default bizinikiwi node.
pub type BizinikiwiExtrinsicParams<T> = DefaultExtrinsicParams<T>;
/// A builder which leads to [`SubstrateExtrinsicParams`] being constructed.
/// A builder which leads to [`BizinikiwiExtrinsicParams`] being constructed.
/// This is what you provide to methods like `sign_and_submit()`.
pub type SubstrateExtrinsicParamsBuilder<T> = DefaultExtrinsicParamsBuilder<T>;
pub type BizinikiwiExtrinsicParamsBuilder<T> = DefaultExtrinsicParamsBuilder<T>;
/// A hasher (ie implements [`Hasher`]) which hashes values using the blaks2_256 algorithm.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -105,11 +105,11 @@ impl Hasher for DynamicHasher256 {
}
}
/// A generic Substrate header type, adapted from `sp_runtime::generic::Header`.
/// A generic Bizinikiwi header type, adapted from `sp_runtime::generic::Header`.
/// The block number and hasher can be configured to adapt this for other nodes.
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubstrateHeader<N: Copy + Into<U256> + TryFrom<U256>, H: Hasher> {
pub struct BizinikiwiHeader<N: Copy + Into<U256> + TryFrom<U256>, H: Hasher> {
/// The parent hash.
pub parent_hash: H::Output,
/// The block number.
@@ -124,11 +124,11 @@ pub struct SubstrateHeader<N: Copy + Into<U256> + TryFrom<U256>, H: Hasher> {
pub digest: Digest,
}
impl<N, H> Header for SubstrateHeader<N, H>
impl<N, H> Header for BizinikiwiHeader<N, H>
where
N: Copy + Into<u64> + Into<U256> + TryFrom<U256> + Encode,
H: Hasher,
SubstrateHeader<N, H>: Encode + Decode,
BizinikiwiHeader<N, H>: Encode + Decode,
{
type Number = N;
type Hasher = H;
@@ -365,12 +365,12 @@ mod test {
}
"#;
let header: SubstrateHeader<u32, BlakeTwo256> =
let header: BizinikiwiHeader<u32, BlakeTwo256> =
serde_json::from_str(numeric_block_number_json).expect("valid block header");
assert_eq!(header.number(), 4);
}
// Substrate returns hex block numbers; ensure we can also deserialize those OK.
// Bizinikiwi returns hex block numbers; ensure we can also deserialize those OK.
#[test]
fn can_deserialize_hex_block_number() {
let numeric_block_number_json = r#"
@@ -385,7 +385,7 @@ mod test {
}
"#;
let header: SubstrateHeader<u32, BlakeTwo256> =
let header: BizinikiwiHeader<u32, BlakeTwo256> =
serde_json::from_str(numeric_block_number_json).expect("valid block header");
assert_eq!(header.number(), 4);
}
+1 -1
View File
@@ -161,7 +161,7 @@ mod test {
#[test]
fn params_are_default() {
let params = DefaultExtrinsicParamsBuilder::<crate::config::PolkadotConfig>::new().build();
let params = DefaultExtrinsicParamsBuilder::<crate::config::PezkuwiConfig>::new().build();
assert_default(params)
}
}
+7 -7
View File
@@ -4,15 +4,15 @@
//! This module provides a [`Config`] type, which is used to define various
//! types that are important in order to speak to a particular chain.
//! [`SubstrateConfig`] provides a default set of these types suitable for the
//! default Substrate node implementation, and [`PolkadotConfig`] for a
//! Polkadot node.
//! [`BizinikiwConfig`] provides a default set of these types suitable for the
//! default Bizinikiwi node implementation, and [`PezkuwiConfig`] for a
//! Pezkuwi node.
mod default_extrinsic_params;
mod extrinsic_params;
pub mod polkadot;
pub mod substrate;
pub mod pezkuwi;
pub mod bizinikiwi;
pub mod transaction_extensions;
use codec::{Decode, Encode};
@@ -24,8 +24,8 @@ use serde::{Serialize, de::DeserializeOwned};
pub use default_extrinsic_params::{DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder};
pub use extrinsic_params::{ExtrinsicParams, ExtrinsicParamsEncoder};
pub use polkadot::{PolkadotConfig, PolkadotExtrinsicParams, PolkadotExtrinsicParamsBuilder};
pub use substrate::{SubstrateConfig, SubstrateExtrinsicParams, SubstrateExtrinsicParamsBuilder};
pub use pezkuwi::{PezkuwiConfig, PezkuwiExtrinsicParams, PezkuwiExtrinsicParamsBuilder};
pub use bizinikiwi::{BizinikiwConfig, BizinikiwiExtrinsicParams, BizinikiwiExtrinsicParamsBuilder};
pub use transaction_extensions::TransactionExtension;
/// Runtime types.
+41
View File
@@ -0,0 +1,41 @@
// Copyright 2019-2024 Parity Technologies (UK) Ltd.
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! Pezkuwi specific configuration
use super::{Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder};
use crate::config::BizinikiwConfig;
pub use crate::utils::{AccountId32, MultiAddress, MultiSignature};
pub use primitive_types::{H256, U256};
/// Default set of commonly used types by Pezkuwi nodes.
// Note: The trait implementations exist just to make life easier,
// but shouldn't strictly be necessary since users can't instantiate this type.
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub enum PezkuwiConfig {}
impl Config for PezkuwiConfig {
type AccountId = <BizinikiwConfig as Config>::AccountId;
type Signature = <BizinikiwConfig as Config>::Signature;
type Hasher = <BizinikiwConfig as Config>::Hasher;
type Header = <BizinikiwConfig as Config>::Header;
type AssetId = <BizinikiwConfig as Config>::AssetId;
// Address on Pezkuwi has no account index, whereas it's u32 on
// the default bizinikiwi dev node.
type Address = MultiAddress<Self::AccountId, ()>;
// These are the same as the default bizinikiwi node, but redefined
// because we need to pass the PezkuwiConfig trait as a param.
type ExtrinsicParams = PezkuwiExtrinsicParams<Self>;
}
/// A struct representing the signed extra and additional parameters required
/// to construct a transaction for a pezkuwi node.
pub type PezkuwiExtrinsicParams<T> = DefaultExtrinsicParams<T>;
/// A builder which leads to [`PezkuwiExtrinsicParams`] being constructed.
/// This is what you provide to methods like `sign_and_submit()`.
pub type PezkuwiExtrinsicParamsBuilder<T> = DefaultExtrinsicParamsBuilder<T>;
-41
View File
@@ -1,41 +0,0 @@
// Copyright 2019-2024 Parity Technologies (UK) Ltd.
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! Polkadot specific configuration
use super::{Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder};
use crate::config::SubstrateConfig;
pub use crate::utils::{AccountId32, MultiAddress, MultiSignature};
pub use primitive_types::{H256, U256};
/// Default set of commonly used types by Polkadot nodes.
// Note: The trait implementations exist just to make life easier,
// but shouldn't strictly be necessary since users can't instantiate this type.
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub enum PolkadotConfig {}
impl Config for PolkadotConfig {
type AccountId = <SubstrateConfig as Config>::AccountId;
type Signature = <SubstrateConfig as Config>::Signature;
type Hasher = <SubstrateConfig as Config>::Hasher;
type Header = <SubstrateConfig as Config>::Header;
type AssetId = <SubstrateConfig as Config>::AssetId;
// Address on Polkadot has no account index, whereas it's u32 on
// the default substrate dev node.
type Address = MultiAddress<Self::AccountId, ()>;
// These are the same as the default substrate node, but redefined
// because we need to pass the PolkadotConfig trait as a param.
type ExtrinsicParams = PolkadotExtrinsicParams<Self>;
}
/// A struct representing the signed extra and additional parameters required
/// to construct a transaction for a polkadot node.
pub type PolkadotExtrinsicParams<T> = DefaultExtrinsicParams<T>;
/// A builder which leads to [`PolkadotExtrinsicParams`] being constructed.
/// This is what you provide to methods like `sign_and_submit()`.
pub type PolkadotExtrinsicParamsBuilder<T> = DefaultExtrinsicParamsBuilder<T>;
+1 -1
View File
@@ -96,7 +96,7 @@ impl<T: Config> TransactionExtension<T> for VerifySignature<T> {
}
/// This allows a signature to be provided to the [`VerifySignature`] transaction extension.
// Dev note: this must encode identically to https://github.com/paritytech/polkadot-sdk/blob/fd72d58313c297a10600037ce1bb88ec958d722e/substrate/frame/verify-signature/src/extension.rs#L43
// Dev note: this must encode identically to https://github.com/pezkuwichain/pezkuwi-sdk/blob/fd72d58313c297a10600037ce1bb88ec958d722e/bizinikiwi/frame/verify-signature/src/extension.rs#L43
#[derive(codec::Encode, codec::Decode)]
pub enum VerifySignatureDetails<T: Config> {
/// A signature has been provided.
+4 -4
View File
@@ -17,16 +17,16 @@
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
//! #[subxt(
//! crate = "::pezkuwi_subxt_core",
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
//! runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale",
//! )]
//! pub mod polkadot {}
//! pub mod pezkuwi {}
//!
//! // Some metadata we'd like to access constants in:
//! let metadata_bytes = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
//! let metadata_bytes = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
//! let metadata = Metadata::decode_from(&metadata_bytes[..]).unwrap();
//!
//! // We can use a static address to obtain some constant:
//! let address = polkadot::constants().balances().existential_deposit();
//! let address = pezkuwi::constants().balances().existential_deposit();
//!
//! // This validates that the address given is in line with the metadata
//! // we're trying to access the constant in:
+4 -4
View File
@@ -17,16 +17,16 @@
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
//! #[subxt(
//! crate = "::pezkuwi_subxt_core",
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
//! runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale",
//! )]
//! pub mod polkadot {}
//! pub mod pezkuwi {}
//!
//! // Some metadata we'd like to access custom values in:
//! let metadata_bytes = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
//! let metadata_bytes = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
//! let metadata = Metadata::decode_from(&metadata_bytes[..]).unwrap();
//!
//! // At the moment, we don't expect to see any custom values in the metadata
//! // for Polkadot, so this will return an error:
//! // for Pezkuwi, so this will return an error:
//! let err = custom_values::get("Foo", &metadata);
//! ```
+12 -12
View File
@@ -8,7 +8,7 @@
//!
//! ```rust
//! use pezkuwi_subxt_macro::subxt;
//! use pezkuwi_subxt_core::config::PolkadotConfig;
//! use pezkuwi_subxt_core::config::PezkuwiConfig;
//! use pezkuwi_subxt_core::events;
//! use pezkuwi_subxt_core::Metadata;
//! use pezkuwi_subxt_core::dynamic::Value;
@@ -16,19 +16,19 @@
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
//! #[subxt(
//! crate = "::pezkuwi_subxt_core",
//! runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
//! runtime_metadata_path = "../artifacts/pezkuwi_metadata_full.scale",
//! )]
//! pub mod polkadot {}
//! pub mod pezkuwi {}
//!
//! // Some metadata we'll use to work with storage entries:
//! let metadata_bytes = include_bytes!("../../artifacts/polkadot_metadata_full.scale");
//! let metadata_bytes = include_bytes!("../../artifacts/pezkuwi_metadata_full.scale");
//! let metadata = Metadata::decode_from(&metadata_bytes[..]).unwrap();
//!
//! // Some bytes representing events (located in System.Events storage):
//! let event_bytes = hex::decode("1c00000000000000a2e9b53d5517020000000100000000000310c96d901d0102000000020000000408d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dbeea5a030000000000000000000000000000020000000402d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48102700000000000000000000000000000000020000000407be5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25fbeea5a030000000000000000000000000000020000002100d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dbeea5a03000000000000000000000000000000000000000000000000000000000000020000000000426df03e00000000").unwrap();
//!
//! // We can decode these bytes like so:
//! let evs = events::decode_from::<PolkadotConfig>(event_bytes, metadata);
//! let evs = events::decode_from::<PezkuwiConfig>(event_bytes, metadata);
//!
//! // And then do things like iterate over them and inspect details:
//! for ev in evs.iter() {
@@ -461,7 +461,7 @@ pub struct EventMetadataDetails<'a> {
#[cfg(test)]
pub(crate) mod test_utils {
use super::*;
use crate::config::{HashFor, SubstrateConfig};
use crate::config::{HashFor, BizinikiwConfig};
use codec::Encode;
use frame_metadata::{
RuntimeMetadataPrefixed,
@@ -494,12 +494,12 @@ pub(crate) mod test_utils {
pub struct EventRecord<E: Encode> {
phase: Phase,
event: AllEvents<E>,
topics: Vec<HashFor<SubstrateConfig>>,
topics: Vec<HashFor<BizinikiwConfig>>,
}
impl<E: Encode> EventRecord<E> {
/// Create a new event record with the given phase, event, and topics.
pub fn new(phase: Phase, event: E, topics: Vec<HashFor<SubstrateConfig>>) -> Self {
pub fn new(phase: Phase, event: E, topics: Vec<HashFor<BizinikiwConfig>>) -> Self {
Self { phase, event: AllEvents::Test(event), topics }
}
}
@@ -580,7 +580,7 @@ pub(crate) mod test_utils {
pub fn events<E: Decode + Encode>(
metadata: Metadata,
event_records: Vec<EventRecord<E>>,
) -> Events<SubstrateConfig> {
) -> Events<BizinikiwConfig> {
let num_events = event_records.len() as u32;
let mut event_bytes = Vec::new();
for ev in event_records {
@@ -595,7 +595,7 @@ pub(crate) mod test_utils {
metadata: Metadata,
event_bytes: Vec<u8>,
num_events: u32,
) -> Events<SubstrateConfig> {
) -> Events<BizinikiwConfig> {
// Prepend compact encoded length to event bytes:
let mut all_event_bytes = Compact(num_events).encode();
all_event_bytes.extend(event_bytes);
@@ -609,7 +609,7 @@ mod tests {
test_utils::{AllEvents, EventRecord, event_record, events, events_raw},
*,
};
use crate::{config::SubstrateConfig, events::Phase};
use crate::{config::BizinikiwConfig, events::Phase};
use codec::Encode;
use primitive_types::H256;
use scale_info::TypeInfo;
@@ -637,7 +637,7 @@ mod tests {
/// Compare some actual [`RawEventDetails`] with a hand-constructed
/// (probably) [`TestRawEventDetails`].
pub fn assert_raw_events_match(
actual: EventDetails<SubstrateConfig>,
actual: EventDetails<BizinikiwConfig>,
expected: TestRawEventDetails,
) {
let actual_fields_no_context: Vec<_> = actual
+4 -4
View File
@@ -15,16 +15,16 @@
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
//! #[subxt(
//! crate = "::pezkuwi_subxt_core",
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
//! runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale",
//! )]
//! pub mod polkadot {}
//! pub mod pezkuwi {}
//!
//! // Some metadata we'll use to work with storage entries:
//! let metadata_bytes = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
//! let metadata_bytes = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
//! let metadata = Metadata::decode_from(&metadata_bytes[..]).unwrap();
//!
//! // Build a storage query to access account information.
//! let payload = polkadot::apis().metadata().metadata_versions();
//! let payload = pezkuwi::apis().metadata().metadata_versions();
//!
//! // We can validate that the payload is compatible with the given metadata.
//! runtime_api::validate(&payload, &metadata).unwrap();
+4 -4
View File
@@ -15,16 +15,16 @@
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
//! #[subxt(
//! crate = "::pezkuwi_subxt_core",
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
//! runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale",
//! )]
//! pub mod polkadot {}
//! pub mod pezkuwi {}
//!
//! // Some metadata we'll use to work with storage entries:
//! let metadata_bytes = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
//! let metadata_bytes = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
//! let metadata = Metadata::decode_from(&metadata_bytes[..]).unwrap();
//!
//! // Build a storage query to access account information.
//! let address = polkadot::storage().system().account();
//! let address = pezkuwi::storage().system().account();
//!
//! // We can validate that the address is compatible with the given metadata.
//! storage::validate(&address, &metadata).unwrap();
+6 -6
View File
@@ -9,7 +9,7 @@
//! ```rust
//! use pezkuwi_subxt_signer::sr25519::dev;
//! use pezkuwi_subxt_macro::subxt;
//! use pezkuwi_subxt_core::config::{PolkadotConfig, HashFor};
//! use pezkuwi_subxt_core::config::{PezkuwiConfig, HashFor};
//! use pezkuwi_subxt_core::config::DefaultExtrinsicParamsBuilder as Params;
//! use pezkuwi_subxt_core::tx;
//! use pezkuwi_subxt_core::utils::H256;
@@ -18,14 +18,14 @@
//! // If we generate types without `subxt`, we need to point to `::pezkuwi_subxt_core`:
//! #[subxt(
//! crate = "::pezkuwi_subxt_core",
//! runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale",
//! runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale",
//! )]
//! pub mod polkadot {}
//! pub mod pezkuwi {}
//!
//! // Gather some other information about the chain that we'll need to construct valid extrinsics:
//! let state = tx::ClientState::<PolkadotConfig> {
//! let state = tx::ClientState::<PezkuwiConfig> {
//! metadata: {
//! let metadata_bytes = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
//! let metadata_bytes = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
//! Metadata::decode_from(&metadata_bytes[..]).unwrap()
//! },
//! genesis_hash: {
@@ -41,7 +41,7 @@
//!
//! // Now we can build a balance transfer extrinsic.
//! let dest = dev::bob().public_key().into();
//! let call = polkadot::tx().balances().transfer_allow_death(dest, 10_000);
//! let call = pezkuwi::tx().balances().transfer_allow_death(dest, 10_000);
//! let params = Params::new().tip(1_000).nonce(0).build();
//!
//! // We can validate that this lines up with the given metadata:
+1 -1
View File
@@ -222,7 +222,7 @@ mod tests {
use scale_value::Composite;
fn test_metadata() -> Metadata {
let metadata_bytes = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
let metadata_bytes = include_bytes!("../../../artifacts/pezkuwi_metadata_small.scale");
Metadata::decode(&mut &metadata_bytes[..]).expect("Valid metadata")
}
+1 -1
View File
@@ -3,7 +3,7 @@
// see LICENSE for license details.
//! A library to **sub**mit e**xt**rinsics to a
//! [substrate](https://github.com/paritytech/substrate) node via RPC.
//! [bizinikiwi](https://github.com/pezkuwichain/bizinikiwi) node via RPC.
use crate::Config;
+12 -12
View File
@@ -2,17 +2,17 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! The "default" Substrate/Polkadot AccountId. This is used in codegen, as well as signing related
//! The "default" Bizinikiwi/Pezkuwi AccountId. This is used in codegen, as well as signing related
//! bits. This doesn't contain much functionality itself, but is easy to convert to/from an
//! `sp_core::AccountId32` for instance, to gain functionality without forcing a dependency on
//! Substrate crates here.
//! Bizinikiwi crates here.
use alloc::{format, string::String, vec, vec::Vec};
use codec::{Decode, Encode};
use serde::{Deserialize, Serialize};
use thiserror::Error as DeriveError;
/// A 32-byte cryptographic identifier. This is a simplified version of Substrate's
/// A 32-byte cryptographic identifier. This is a simplified version of Bizinikiwi's
/// `sp_core::crypto::AccountId32`. To obtain more functionality, convert this into
/// that type.
#[derive(
@@ -52,7 +52,7 @@ impl AccountId32 {
// Return the ss58-check string for this key. Adapted from `sp_core::crypto`. We need this to
// serialize our account appropriately but otherwise don't care.
fn to_ss58check(&self) -> String {
// For serializing to a string to obtain the account nonce, we use the default substrate
// For serializing to a string to obtain the account nonce, we use the default bizinikiwi
// prefix (since we have no way to otherwise pick one). It doesn't really matter, since when
// it's deserialized back in system_accountNextIndex, we ignore this (so long as it's
// valid).
@@ -166,23 +166,23 @@ mod test {
use sp_keyring::sr25519::Keyring;
#[test]
fn ss58_is_compatible_with_substrate_impl() {
fn ss58_is_compatible_with_bizinikiwi_impl() {
let keyrings = vec![Keyring::Alice, Keyring::Bob, Keyring::Charlie];
for keyring in keyrings {
let substrate_account = keyring.to_account_id();
let local_account = AccountId32(substrate_account.clone().into());
let bizinikiwi_account = keyring.to_account_id();
let local_account = AccountId32(bizinikiwi_account.clone().into());
// Both should encode to ss58 the same way:
let substrate_ss58 = substrate_account.to_ss58check();
assert_eq!(substrate_ss58, local_account.to_ss58check());
let bizinikiwi_ss58 = bizinikiwi_account.to_ss58check();
assert_eq!(bizinikiwi_ss58, local_account.to_ss58check());
// Both should decode from ss58 back to the same:
assert_eq!(
sp_core::crypto::AccountId32::from_ss58check(&substrate_ss58).unwrap(),
substrate_account
sp_core::crypto::AccountId32::from_ss58check(&bizinikiwi_ss58).unwrap(),
bizinikiwi_account
);
assert_eq!(AccountId32::from_ss58check(&substrate_ss58).unwrap(), local_account);
assert_eq!(AccountId32::from_ss58check(&bizinikiwi_ss58).unwrap(), local_account);
}
}
}
+3 -3
View File
@@ -2,16 +2,16 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! The "default" Substrate/Polkadot Address type. This is used in codegen, as well as signing
//! The "default" Bizinikiwi/Pezkuwi Address type. This is used in codegen, as well as signing
//! related bits. This doesn't contain much functionality itself, but is easy to convert to/from an
//! `sp_runtime::MultiAddress` for instance, to gain functionality without forcing a dependency on
//! Substrate crates here.
//! Bizinikiwi crates here.
use alloc::vec::Vec;
use codec::{Decode, Encode};
/// A multi-format address wrapper for on-chain accounts. This is a simplified version of
/// Substrate's `sp_runtime::MultiAddress`.
/// Bizinikiwi's `sp_runtime::MultiAddress`.
#[derive(
Clone,
Eq,
+2 -2
View File
@@ -2,10 +2,10 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! The "default" Substrate/Polkadot Signature type. This is used in codegen, as well as signing
//! The "default" Bizinikiwi/Pezkuwi Signature type. This is used in codegen, as well as signing
//! related bits. This doesn't contain much functionality itself, but is easy to convert to/from an
//! `sp_runtime::MultiSignature` for instance, to gain functionality without forcing a dependency on
//! Substrate crates here.
//! Bizinikiwi crates here.
use codec::{Decode, Encode};
+2 -2
View File
@@ -2,7 +2,7 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! The "default" Substrate/Polkadot UncheckedExtrinsic.
//! The "default" Bizinikiwi/Pezkuwi UncheckedExtrinsic.
//! This is used in codegen for runtime API calls.
//!
//! The inner bytes represent the encoded extrinsic expected by the
@@ -17,7 +17,7 @@ use scale_decode::{DecodeAsType, IntoVisitor, TypeResolver, Visitor, visitor::De
use super::{Encoded, Static};
use alloc::vec::Vec;
/// The unchecked extrinsic from substrate.
/// The unchecked extrinsic from bizinikiwi.
#[derive(Clone, Debug, Eq, PartialEq, Encode)]
pub struct UncheckedExtrinsic<Address, Call, Signature, Extra>(
Static<Encoded>,
+2 -2
View File
@@ -15,7 +15,7 @@ use alloc::{format, vec::Vec};
/// access the real type `T` [`Self::try_decode`] needs to be used.
// Dev notes:
//
// - This is adapted from [here](https://github.com/paritytech/substrate/blob/master/frame/support/src/traits/misc.rs).
// - This is adapted from [here](https://github.com/pezkuwichain/bizinikiwi/blob/master/frame/support/src/traits/misc.rs).
// - The encoded bytes will be a compact encoded length followed by that number of bytes.
// - However, the TypeInfo describes the type as a composite with first a compact encoded length and
// next the type itself.
@@ -153,7 +153,7 @@ mod test {
use super::*;
// Copied from https://github.com/paritytech/substrate/blob/master/frame/support/src/traits/misc.rs
// Copied from https://github.com/pezkuwichain/bizinikiwi/blob/master/frame/support/src/traits/misc.rs
// and used for tests to check that we can work with the expected TypeInfo without needing to
// import the frame_support crate, which has quite a lot of dependencies.
impl<T: scale_info::TypeInfo + 'static> scale_info::TypeInfo for WrapperKeepOpaque<T> {