mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +00:00
Add 20-byte account id to subxt_core (#1638)
* Add accountId20 impl to subxt_core closes #1576
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use subxt::OnlineClient;
|
||||
use subxt_signer::eth::{dev, AccountId20, Signature};
|
||||
use subxt_core::utils::AccountId20;
|
||||
use subxt_signer::eth::{dev, Signature};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/frontier_metadata_small.scale")]
|
||||
mod eth_runtime {}
|
||||
@@ -25,28 +26,20 @@ impl subxt::Config for EthRuntimeConfig {
|
||||
type AssetId = u32;
|
||||
}
|
||||
|
||||
// This helper makes it easy to use our `AccountId20`'s with generated
|
||||
// code that expects a generated `eth_runtime::runtime_types::fp_account:AccountId20` type.
|
||||
impl From<AccountId20> for eth_runtime::runtime_types::fp_account::AccountId20 {
|
||||
fn from(a: AccountId20) -> Self {
|
||||
eth_runtime::runtime_types::fp_account::AccountId20(a.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let api = OnlineClient::<EthRuntimeConfig>::from_insecure_url("ws://127.0.0.1:9944").await?;
|
||||
|
||||
let alith = dev::alith();
|
||||
let baltathar = dev::baltathar();
|
||||
let dest = baltathar.account_id();
|
||||
let dest = baltathar.public_key().to_account_id();
|
||||
|
||||
println!("baltathar pub: {}", hex::encode(baltathar.public_key().0));
|
||||
println!("baltathar addr: {}", hex::encode(dest));
|
||||
|
||||
let balance_transfer_tx = eth_runtime::tx()
|
||||
.balances()
|
||||
.transfer_allow_death(dest.into(), 10_001);
|
||||
.transfer_allow_death(dest, 10_001);
|
||||
|
||||
let events = api
|
||||
.tx()
|
||||
|
||||
Reference in New Issue
Block a user