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
@@ -1,19 +1,19 @@
//! This example demonstrates how to use to add a custom signer implementation to `subxt`
//! by using the signer implementation from polkadot-sdk.
//! by using the signer implementation from pezkuwi-sdk.
//!
//! Similar functionality was provided by the `substrate-compat` feature in the original `subxt`
//! Similar functionality was provided by the `bizinikiwi-compat` feature in the original `subxt`
//! crate. which is now removed.
#![allow(missing_docs, unused)]
use sp_core::{Pair as _, sr25519};
use pezkuwi_subxt::{Config, OnlineClient, PolkadotConfig, config::substrate::MultiAddress};
use pezkuwi_subxt::{Config, OnlineClient, PezkuwiConfig, config::bizinikiwi::MultiAddress};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
/// A concrete PairSigner implementation which relies on `sr25519::Pair` for signing
/// and that PolkadotConfig is the runtime configuration.
/// and that PezkuwiConfig is the runtime configuration.
mod pair_signer {
use super::*;
use sp_runtime::{
@@ -21,14 +21,14 @@ mod pair_signer {
traits::{IdentifyAccount, Verify},
};
use pezkuwi_subxt::{
config::substrate::{AccountId32, MultiSignature},
config::bizinikiwi::{AccountId32, MultiSignature},
tx::Signer,
};
/// A [`Signer`] implementation for [`sp_core::sr25519::Pair`].
#[derive(Clone)]
pub struct PairSigner {
account_id: <PolkadotConfig as Config>::AccountId,
account_id: <PezkuwiConfig as Config>::AccountId,
signer: sr25519::Pair,
}
@@ -38,14 +38,14 @@ mod pair_signer {
let account_id =
<SpMultiSignature as Verify>::Signer::from(signer.public()).into_account();
Self {
// Convert `sp_core::AccountId32` to `pezkuwi_subxt::config::substrate::AccountId32`.
// Convert `sp_core::AccountId32` to `pezkuwi_subxt::config::bizinikiwi::AccountId32`.
//
// This is necessary because we use `pezkuwi_subxt::config::substrate::AccountId32` and no
// This is necessary because we use `pezkuwi_subxt::config::bizinikiwi::AccountId32` and no
// From/Into impls are provided between `sp_core::AccountId32` because
// `polkadot-sdk` isn't a direct dependency in subxt.
// `pezkuwi-sdk` isn't a direct dependency in subxt.
//
// This can also be done by provided a wrapper type around
// `pezkuwi_subxt::config::substrate::AccountId32` to implement such conversions but
// `pezkuwi_subxt::config::bizinikiwi::AccountId32` to implement such conversions but
// that also most likely requires a custom `Config` with a separate `AccountId` type
// to work properly without additional hacks.
account_id: AccountId32(account_id.into()),
@@ -64,12 +64,12 @@ mod pair_signer {
}
}
impl Signer<PolkadotConfig> for PairSigner {
fn account_id(&self) -> <PolkadotConfig as Config>::AccountId {
impl Signer<PezkuwiConfig> for PairSigner {
fn account_id(&self) -> <PezkuwiConfig as Config>::AccountId {
self.account_id.clone()
}
fn sign(&self, signer_payload: &[u8]) -> <PolkadotConfig as Config>::Signature {
fn sign(&self, signer_payload: &[u8]) -> <PezkuwiConfig as Config>::Signature {
let signature = self.signer.sign(signer_payload);
MultiSignature::Sr25519(signature.0)
}
@@ -80,8 +80,8 @@ mod pair_signer {
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt::init();
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let signer = {
let acc = sr25519::Pair::from_string("//Alice", None)?;
@@ -94,7 +94,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
};
// Build a balance transfer extrinsic.
let balance_transfer_tx = polkadot::tx().balances().transfer_allow_death(dest, 100_000);
let balance_transfer_tx = pezkuwi::tx().balances().transfer_allow_death(dest, 100_000);
// Submit the balance transfer extrinsic from Alice, and wait for it to be successful
// and in a finalized block. We get back the extrinsic events if all is well.
@@ -106,7 +106,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?;
// Find a Transfer event and print it.
let transfer_event = events.find_first::<polkadot::balances::events::Transfer>()?;
let transfer_event = events.find_first::<pezkuwi::balances::events::Transfer>()?;
if let Some(event) = transfer_event {
println!("Balance transfer success: {event:?}");
}
+3 -3
View File
@@ -1,10 +1,10 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client that subscribes to blocks of the Polkadot network.
let api = OnlineClient::<PolkadotConfig>::from_url("wss://rpc.polkadot.io:443").await?;
// Create a client that subscribes to blocks of the Pezkuwi network.
let api = OnlineClient::<PezkuwiConfig>::from_url("wss://rpc.pezkuwi.io:443").await?;
// Subscribe to all finalized blocks:
let mut blocks_sub = api.blocks().subscribe_finalized().await?;
+6 -6
View File
@@ -1,20 +1,20 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
utils::{AccountId32, MultiAddress},
};
use codec::Decode;
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
use polkadot::balances::calls::types::TransferKeepAlive;
use pezkuwi::balances::calls::types::TransferKeepAlive;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client that subscribes to blocks of the Polkadot network.
let api = OnlineClient::<PolkadotConfig>::from_url("wss://rpc.polkadot.io:443").await?;
// Create a client that subscribes to blocks of the Pezkuwi network.
let api = OnlineClient::<PezkuwiConfig>::from_url("wss://rpc.pezkuwi.io:443").await?;
// Subscribe to all finalized blocks:
let mut blocks_sub = api.blocks().subscribe_finalized().await?;
+5 -5
View File
@@ -1,13 +1,13 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Subscribe to all finalized blocks:
let mut blocks_sub = api.blocks().subscribe_finalized().await?;
@@ -31,7 +31,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let bytes_hex = format!("0x{}", hex::encode(ext.bytes()));
// See the API docs for more ways to decode extrinsics:
let decoded_ext = ext.as_root_extrinsic::<polkadot::Call>();
let decoded_ext = ext.as_root_extrinsic::<pezkuwi::Call>();
println!(" Extrinsic #{idx}:");
println!(" Bytes: {bytes_hex}");
+2 -2
View File
@@ -1,10 +1,10 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{OnlineClient, PolkadotConfig, dynamic::Value};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig, dynamic::Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// We can query a constant by providing a tuple of the pallet and constant name. The return type
// will be `Value` if we pass this query:
+5 -5
View File
@@ -1,16 +1,16 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// A query to obtain some constant:
let constant_query = polkadot::constants().system().block_length();
let constant_query = pezkuwi::constants().system().block_length();
// Obtain the value:
let value = api.constants().at(&constant_query)?;
+6 -6
View File
@@ -1,13 +1,13 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Get events for the latest block:
let events = api.events().at_latest().await?;
@@ -29,7 +29,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
for event in events.iter() {
let event = event?;
if let Ok(ev) = event.as_root_event::<polkadot::Event>() {
if let Ok(ev) = event.as_root_event::<pezkuwi::Event>() {
println!("{ev:?}");
} else {
println!("<Cannot decode event>");
@@ -37,7 +37,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
// Or we can look for specific events which match our statically defined ones:
let transfer_event = events.find_first::<polkadot::balances::events::Transfer>()?;
let transfer_event = events.find_first::<pezkuwi::balances::events::Transfer>()?;
if let Some(ev) = transfer_event {
println!(" - Balance transfer success: value: {:?}", ev.amount);
} else {
+12 -12
View File
@@ -1,42 +1,42 @@
#![allow(missing_docs)]
use futures::StreamExt;
use pezkuwi_subxt::{PolkadotConfig, client::OnlineClient, lightclient::LightClient};
use pezkuwi_subxt::{PezkuwiConfig, client::OnlineClient, lightclient::LightClient};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
const POLKADOT_SPEC: &str = include_str!("../../artifacts/demo_chain_specs/polkadot.json");
const POLKADOT_SPEC: &str = include_str!("../../artifacts/demo_chain_specs/pezkuwi.json");
const ASSET_HUB_SPEC: &str =
include_str!("../../artifacts/demo_chain_specs/polkadot_asset_hub.json");
include_str!("../../artifacts/demo_chain_specs/pezkuwi_asset_hub.json");
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// The lightclient logs are informative:
tracing_subscriber::fmt::init();
// Instantiate a light client with the Polkadot relay chain,
// Instantiate a light client with the Pezkuwi relay chain,
// and connect it to Asset Hub, too.
let (lightclient, polkadot_rpc) = LightClient::relay_chain(POLKADOT_SPEC)?;
let (lightclient, pezkuwi_rpc) = LightClient::relay_chain(POLKADOT_SPEC)?;
let asset_hub_rpc = lightclient.parachain(ASSET_HUB_SPEC)?;
// Create Subxt clients from these Smoldot backed RPC clients.
let polkadot_api = OnlineClient::<PolkadotConfig>::from_rpc_client(polkadot_rpc).await?;
let asset_hub_api = OnlineClient::<PolkadotConfig>::from_rpc_client(asset_hub_rpc).await?;
let pezkuwi_api = OnlineClient::<PezkuwiConfig>::from_rpc_client(pezkuwi_rpc).await?;
let asset_hub_api = OnlineClient::<PezkuwiConfig>::from_rpc_client(asset_hub_rpc).await?;
// Use them!
let polkadot_sub = polkadot_api
let pezkuwi_sub = pezkuwi_api
.blocks()
.subscribe_finalized()
.await?
.map(|block| ("Polkadot", block));
.map(|block| ("Pezkuwi", block));
let parachain_sub = asset_hub_api
.blocks()
.subscribe_finalized()
.await?
.map(|block| ("AssetHub", block));
let mut stream_combinator = futures::stream::select(polkadot_sub, parachain_sub);
let mut stream_combinator = futures::stream::select(pezkuwi_sub, parachain_sub);
while let Some((chain, block)) = stream_combinator.next().await {
let block = block?;
+7 -7
View File
@@ -1,15 +1,15 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{
PolkadotConfig,
PezkuwiConfig,
client::OnlineClient,
lightclient::{ChainConfig, LightClient},
utils::fetch_chainspec_from_rpc_node,
};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -24,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// to the local node.
//
// The `12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp` is the P2P address
// from a local polkadot node starting with
// from a local pezkuwi node starting with
// `--node-key 0000000000000000000000000000000000000000000000000000000000000001`
let chain_config = ChainConfig::chain_spec(chain_spec.get()).set_bootnodes([
"/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp",
@@ -32,11 +32,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Start the light client up, establishing a connection to the local node.
let (_light_client, chain_rpc) = LightClient::relay_chain(chain_config)?;
let api = OnlineClient::<PolkadotConfig>::from_rpc_client(chain_rpc).await?;
let api = OnlineClient::<PezkuwiConfig>::from_rpc_client(chain_rpc).await?;
// Build a balance transfer extrinsic.
let dest = dev::bob().public_key().into();
let balance_transfer_tx = polkadot::tx().balances().transfer_allow_death(dest, 10_000);
let balance_transfer_tx = pezkuwi::tx().balances().transfer_allow_death(dest, 10_000);
// Submit the balance transfer extrinsic from Alice, and wait for it to be successful
// and in a finalized block. We get back the extrinsic events if all is well.
@@ -49,7 +49,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?;
// Find a Transfer event and print it.
let transfer_event = events.find_first::<polkadot::balances::events::Transfer>()?;
let transfer_event = events.find_first::<pezkuwi::balances::events::Transfer>()?;
if let Some(event) = transfer_event {
println!("Balance transfer success: {event:?}");
}
+6 -6
View File
@@ -1,13 +1,13 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
backend::{legacy::LegacyRpcMethods, rpc::RpcClient},
config::DefaultExtrinsicParamsBuilder as Params,
};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -15,10 +15,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let rpc_client = RpcClient::from_url("ws://127.0.0.1:9944").await?;
// Use this to construct our RPC methods:
let rpc = LegacyRpcMethods::<PolkadotConfig>::new(rpc_client.clone());
let rpc = LegacyRpcMethods::<PezkuwiConfig>::new(rpc_client.clone());
// We can use the same client to drive our full Subxt interface too:
let api = OnlineClient::<PolkadotConfig>::from_rpc_client(rpc_client.clone()).await?;
let api = OnlineClient::<PezkuwiConfig>::from_rpc_client(rpc_client.clone()).await?;
// Now, we can make some RPC calls using some legacy RPC methods.
println!(
@@ -41,7 +41,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let ext_params = Params::new().mortal(8).nonce(current_nonce).build();
let balance_transfer = polkadot::tx()
let balance_transfer = pezkuwi::tx()
.balances()
.transfer_allow_death(bob.public_key().into(), 1_000_000);
+2 -2
View File
@@ -1,11 +1,11 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{OnlineClient, config::PolkadotConfig, utils::AccountId32};
use pezkuwi_subxt::{OnlineClient, config::PezkuwiConfig, utils::AccountId32};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Create a "dynamic" runtime API payload that calls the
// `AccountNonceApi_account_nonce` function. We could use the
+4 -4
View File
@@ -1,19 +1,19 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
ext::{
codec::{Compact, Decode},
frame_metadata::RuntimeMetadataPrefixed,
},
};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Use runtime APIs at the latest block:
let runtime_apis = api.runtime_api().at_latest().await?;
+5 -5
View File
@@ -1,19 +1,19 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{OnlineClient, config::PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, config::PezkuwiConfig};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Create a runtime API payload that calls into
// `AccountNonceApi_account_nonce` function.
let account = dev::alice().public_key().into();
let runtime_api_call = polkadot::apis().account_nonce_api().account_nonce(account);
let runtime_api_call = pezkuwi::apis().account_nonce_api().account_nonce(account);
// Submit the call and get back a result.
let nonce = api.runtime_api().at_latest().await?.call(runtime_api_call).await;
+2 -2
View File
@@ -5,7 +5,7 @@ use std::{
sync::{Arc, Mutex},
};
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
backend::rpc::{RawRpcFuture, RawRpcSubscription, RawValue, RpcClient, RpcClientT},
};
@@ -73,7 +73,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Pass this into our OnlineClient to instantiate it. This will lead to some
// RPC calls being made to fetch chain details/metadata, which will immediately
// fail..
let _ = OnlineClient::<PolkadotConfig>::from_rpc_client(rpc_client).await;
let _ = OnlineClient::<PezkuwiConfig>::from_rpc_client(rpc_client).await;
// But, we can see that the calls were made via our custom RPC client:
println!("Log of calls made:\n\n{}", log.lock().unwrap().as_str());
+4 -4
View File
@@ -1,6 +1,6 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{
OfflineClient, config::PolkadotConfig, ext::codec::Decode, metadata::Metadata, utils::H256,
OfflineClient, config::PezkuwiConfig, ext::codec::Decode, metadata::Metadata, utils::H256,
};
#[tokio::main]
@@ -14,19 +14,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
H256::from_slice(&bytes)
};
// 2. A runtime version (system_version constant on a Substrate node has these):
// 2. A runtime version (system_version constant on a Bizinikiwi node has these):
let runtime_version =
pezkuwi_subxt::client::RuntimeVersion { spec_version: 9370, transaction_version: 20 };
// 3. Metadata (I'll load it from the downloaded metadata, but you can use `subxt metadata >
// file.scale` to download it):
let metadata = {
let bytes = std::fs::read("./artifacts/polkadot_metadata_small.scale").unwrap();
let bytes = std::fs::read("./artifacts/pezkuwi_metadata_small.scale").unwrap();
Metadata::decode(&mut &*bytes).unwrap()
};
// Create an offline client using the details obtained above:
let _api = OfflineClient::<PolkadotConfig>::new(genesis_hash, runtime_version, metadata);
let _api = OfflineClient::<PezkuwiConfig>::new(genesis_hash, runtime_version, metadata);
Ok(())
}
+7 -7
View File
@@ -1,11 +1,11 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::config::{
Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, PolkadotConfig, SubstrateConfig,
Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, PezkuwiConfig, BizinikiwConfig,
};
#[pezkuwi_subxt::subxt(
runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
runtime_metadata_path = "../artifacts/pezkuwi_metadata_full.scale",
derive_for_type(
path = "staging_xcm::v3::multilocation::MultiLocation",
derive = "Clone, codec::Encode",
@@ -21,11 +21,11 @@ use runtime::runtime_types::{
pub enum AssetHubConfig {}
impl Config for AssetHubConfig {
type AccountId = <SubstrateConfig as Config>::AccountId;
type Address = <PolkadotConfig as Config>::Address;
type Signature = <SubstrateConfig as Config>::Signature;
type Hasher = <SubstrateConfig as Config>::Hasher;
type Header = <SubstrateConfig as Config>::Header;
type AccountId = <BizinikiwConfig as Config>::AccountId;
type Address = <PezkuwiConfig as Config>::Address;
type Signature = <BizinikiwConfig as Config>::Signature;
type Hasher = <BizinikiwConfig as Config>::Hasher;
type Header = <BizinikiwConfig as Config>::Header;
type ExtrinsicParams = DefaultExtrinsicParams<AssetHubConfig>;
// Here we use the MultiLocation from the metadata as a part of the config:
// The `ChargeAssetTxPayment` signed extension that is part of the ExtrinsicParams above, now
+3 -3
View File
@@ -9,7 +9,7 @@ use pezkuwi_subxt::{
},
};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_full.scale")]
pub mod runtime {}
// We don't need to construct this at runtime,
@@ -20,8 +20,8 @@ impl Config for CustomConfig {
type AccountId = pezkuwi_subxt::utils::AccountId32;
type Address = pezkuwi_subxt::utils::MultiAddress<Self::AccountId, ()>;
type Signature = pezkuwi_subxt::utils::MultiSignature;
type Hasher = pezkuwi_subxt::config::substrate::BlakeTwo256;
type Header = pezkuwi_subxt::config::substrate::SubstrateHeader<u32, Self::Hasher>;
type Hasher = pezkuwi_subxt::config::bizinikiwi::BlakeTwo256;
type Header = pezkuwi_subxt::config::bizinikiwi::BizinikiwiHeader<u32, Self::Hasher>;
type ExtrinsicParams = CustomExtrinsicParams<Self>;
type AssetId = u32;
}
@@ -11,7 +11,7 @@ use pezkuwi_subxt::{
},
};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod runtime {}
// We don't need to construct this at runtime,
@@ -23,8 +23,8 @@ impl Config for CustomConfig {
type AccountId = pezkuwi_subxt::utils::AccountId32;
type Address = pezkuwi_subxt::utils::MultiAddress<Self::AccountId, ()>;
type Signature = pezkuwi_subxt::utils::MultiSignature;
type Hasher = pezkuwi_subxt::config::substrate::BlakeTwo256;
type Header = pezkuwi_subxt::config::substrate::SubstrateHeader<u32, Self::Hasher>;
type Hasher = pezkuwi_subxt::config::bizinikiwi::BlakeTwo256;
type Header = pezkuwi_subxt::config::bizinikiwi::BizinikiwiHeader<u32, Self::Hasher>;
type ExtrinsicParams = transaction_extensions::AnyOf<
Self,
(
@@ -10,13 +10,13 @@ use std::time::Duration;
use futures::StreamExt;
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
backend::rpc::reconnecting_rpc_client::{ExponentialBackoff, RpcClient},
};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -43,15 +43,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// use pezkuwi_subxt::OnlineClient;
//
// let backend = ChainHeadBackend::builder().build_with_background_task(RpcClient::new(rpc.clone()));
// let api: OnlineClient<PolkadotConfig> = OnlineClient::from_backend(Arc::new(backend)).await?;
// let api: OnlineClient<PezkuwiConfig> = OnlineClient::from_backend(Arc::new(backend)).await?;
// ```
let api: OnlineClient<PolkadotConfig> = OnlineClient::from_rpc_client(rpc.clone()).await?;
let api: OnlineClient<PezkuwiConfig> = OnlineClient::from_rpc_client(rpc.clone()).await?;
// Run for at most 100 blocks and print a bunch of information about it.
//
// The subscription is automatically re-started when the RPC client has reconnected.
// You can test that by stopping the polkadot node and restarting it.
// You can test that by stopping the pezkuwi node and restarting it.
let mut blocks_sub = api.blocks().subscribe_finalized().await?.take(100);
while let Some(block) = blocks_sub.next().await {
@@ -4,7 +4,7 @@
use futures::StreamExt;
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
backend::{
chain_head::{ChainHeadBackend, ChainHeadBackendBuilder},
rpc::RpcClient,
@@ -12,15 +12,15 @@ use pezkuwi_subxt::{
};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt::init();
let rpc = RpcClient::from_url("ws://localhost:9944".to_string()).await?;
let backend: ChainHeadBackend<PolkadotConfig> =
let backend: ChainHeadBackend<PezkuwiConfig> =
ChainHeadBackendBuilder::default().build_with_background_driver(rpc.clone());
let api = OnlineClient::from_backend(std::sync::Arc::new(backend)).await?;
+6 -6
View File
@@ -1,19 +1,19 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
let account = dev::alice().public_key().into();
// Build a storage query to access account information.
let storage_query = polkadot::storage().system().account();
let storage_query = pezkuwi::storage().system().account();
// Use that query to access a storage entry, fetch a result and decode the value.
// The static address knows that fetching requires a tuple of one value, an
+3 -3
View File
@@ -1,15 +1,15 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
dynamic::{At, Value},
utils::AccountId32,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a dynamic storage query to access account information.
// here, we assume that there is one value to provide at this entry
+6 -6
View File
@@ -1,18 +1,18 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{OnlineClient, PolkadotConfig, ext::futures::StreamExt};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig, ext::futures::StreamExt};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a storage query to access account information. Same as if we were
// fetching a single value from this entry.
let storage_query = polkadot::storage().system().account();
let storage_query = pezkuwi::storage().system().account();
// Use that query to access a storage entry, iterate over it and decode values.
let client_at = api.storage().at_latest().await?;
+3 -3
View File
@@ -1,6 +1,6 @@
#![allow(missing_docs)]
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig,
OnlineClient, PezkuwiConfig,
dynamic::{At, Value},
ext::futures::StreamExt,
utils::AccountId32,
@@ -8,8 +8,8 @@ use pezkuwi_subxt::{
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a dynamic storage query to access account information.
// here, we assume that there is one value to provide at this entry
+7 -7
View File
@@ -1,19 +1,19 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a balance transfer extrinsic.
let dest = dev::bob().public_key().into();
let balance_transfer_tx = polkadot::tx().balances().transfer_allow_death(dest, 10_000);
let balance_transfer_tx = pezkuwi::tx().balances().transfer_allow_death(dest, 10_000);
// Submit the balance transfer extrinsic from Alice, and wait for it to be successful
// and in a finalized block. We get back the extrinsic events if all is well.
@@ -26,7 +26,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?;
// Find a Transfer event and print it.
let transfer_event = events.find_first::<polkadot::balances::events::Transfer>()?;
let transfer_event = events.find_first::<pezkuwi::balances::events::Transfer>()?;
if let Some(event) = transfer_event {
println!("Balance transfer success: {event:?}");
}
+4 -4
View File
@@ -1,4 +1,4 @@
//! Example to use subxt to talk to substrate-based nodes with ethereum accounts
//! Example to use subxt to talk to bizinikiwi-based nodes with ethereum accounts
//! which is not the default for subxt which is why we need to provide a custom config.
//!
//! This example requires to run a local frontier/moonbeam node to work.
@@ -18,10 +18,10 @@ impl pezkuwi_subxt::Config for EthRuntimeConfig {
type AccountId = AccountId20;
type Address = AccountId20;
type Signature = Signature;
type Hasher = pezkuwi_subxt::config::substrate::BlakeTwo256;
type Hasher = pezkuwi_subxt::config::bizinikiwi::BlakeTwo256;
type Header =
pezkuwi_subxt::config::substrate::SubstrateHeader<u32, pezkuwi_subxt::config::substrate::BlakeTwo256>;
type ExtrinsicParams = pezkuwi_subxt::config::SubstrateExtrinsicParams<Self>;
pezkuwi_subxt::config::bizinikiwi::BizinikiwiHeader<u32, pezkuwi_subxt::config::bizinikiwi::BlakeTwo256>;
type ExtrinsicParams = pezkuwi_subxt::config::BizinikiwiExtrinsicParams<Self>;
type AssetId = u32;
}
+6 -6
View File
@@ -1,13 +1,13 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Prepare some extrinsics. These are boxed so that they can live alongside each other.
let txs = [dynamic_remark(), balance_transfer(), remark()];
@@ -28,11 +28,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
fn balance_transfer() -> Box<dyn pezkuwi_subxt::tx::Payload> {
let dest = dev::bob().public_key().into();
Box::new(polkadot::tx().balances().transfer_allow_death(dest, 10_000))
Box::new(pezkuwi::tx().balances().transfer_allow_death(dest, 10_000))
}
fn remark() -> Box<dyn pezkuwi_subxt::tx::Payload> {
Box::new(polkadot::tx().system().remark(vec![1, 2, 3, 4, 5]))
Box::new(pezkuwi::tx().system().remark(vec![1, 2, 3, 4, 5]))
}
fn dynamic_remark() -> Box<dyn pezkuwi_subxt::tx::Payload> {
+5 -5
View File
@@ -1,11 +1,11 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{OnlineClient, PolkadotConfig};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig};
type BoxedError = Box<dyn std::error::Error + Send + Sync + 'static>;
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), BoxedError> {
@@ -16,11 +16,11 @@ async fn main() -> Result<(), BoxedError> {
}
async fn signing_example() -> Result<(), BoxedError> {
let api = OnlineClient::<PolkadotConfig>::new().await?;
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a balance transfer extrinsic.
let dest = dev::bob().public_key().into();
let balance_transfer_tx = polkadot::tx().balances().transfer_allow_death(dest, 10_000);
let balance_transfer_tx = pezkuwi::tx().balances().transfer_allow_death(dest, 10_000);
let alice = dev::alice();
+7 -7
View File
@@ -1,19 +1,19 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{OnlineClient, PolkadotConfig, tx::TxStatus};
use pezkuwi_subxt::{OnlineClient, PezkuwiConfig, tx::TxStatus};
// Generate an interface that we can use from the node's metadata.
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a balance transfer extrinsic.
let dest = dev::bob().public_key().into();
let balance_transfer_tx = polkadot::tx().balances().transfer_allow_death(dest, 10_000);
let balance_transfer_tx = pezkuwi::tx().balances().transfer_allow_death(dest, 10_000);
// Submit the balance transfer extrinsic from Alice, and then monitor the
// progress of it.
@@ -35,7 +35,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let events = in_block.wait_for_success().await?;
// We can look for events (this uses the static interface; we can also iterate
// over them and dynamically decode them):
let transfer_event = events.find_first::<polkadot::balances::events::Transfer>()?;
let transfer_event = events.find_first::<pezkuwi::balances::events::Transfer>()?;
if let Some(event) = transfer_event {
println!("Balance transfer success: {event:?}");
+6 -6
View File
@@ -1,20 +1,20 @@
#![allow(missing_docs)]
use pezkuwi_subxt_signer::sr25519::dev;
use pezkuwi_subxt::{
OnlineClient, PolkadotConfig, config::polkadot::PolkadotExtrinsicParamsBuilder as Params,
OnlineClient, PezkuwiConfig, config::pezkuwi::PezkuwiExtrinsicParamsBuilder as Params,
};
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
pub mod polkadot {}
#[pezkuwi_subxt::subxt(runtime_metadata_path = "../artifacts/pezkuwi_metadata_small.scale")]
pub mod pezkuwi {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new API client, configured to talk to Polkadot nodes.
let api = OnlineClient::<PolkadotConfig>::new().await?;
// Create a new API client, configured to talk to Pezkuwi nodes.
let api = OnlineClient::<PezkuwiConfig>::new().await?;
// Build a balance transfer extrinsic.
let dest = dev::bob().public_key().into();
let tx = polkadot::tx().balances().transfer_allow_death(dest, 10_000);
let tx = pezkuwi::tx().balances().transfer_allow_death(dest, 10_000);
// Configure the transaction parameters; we give a small tip and set the
// transaction to live for 32 blocks from the `latest_block` above.