From 25193d75af539c1810eb55c3262234939f94bd70 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 26 Apr 2024 16:18:19 +0200 Subject: [PATCH] add `frontier/ethereum` example (#1557) * add ethereum example The ethereum config doesn't work with the default PolkadotConfig which this shows how to do. Tested with a frontier node * address grumbles * Update subxt/examples/tx_basic_frontier.rs * Update subxt/examples/tx_basic_frontier.rs --- artifacts/frontier_metadata_small.scale | Bin 0 -> 41423 bytes signer/src/eth.rs | 2 +- subxt/Cargo.toml | 4 +- subxt/examples/tx_basic_frontier.rs | 64 ++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 artifacts/frontier_metadata_small.scale create mode 100644 subxt/examples/tx_basic_frontier.rs diff --git a/artifacts/frontier_metadata_small.scale b/artifacts/frontier_metadata_small.scale new file mode 100644 index 0000000000000000000000000000000000000000..67cf986a8105686f363bdee85a3ffef1b15f5271 GIT binary patch literal 41423 zcmchA4`8Ilb>Gb1cd!Rbyu_jvt!O?R5$o{YhwiMyLJ>r|la7z)9xo} zeXHGNzumhNF)eQG7HZr;3JoOZ=A4k!BzB8a(?WwAJ2kD{*ey=&#BS}zGX}WxAm1qcHnTM zUXFC$R?dX&P!Fg9Jy53~@>&`wJzQ?o{aR8Ln8tklBQcu0@To@%$k15{9I5Kx@2hPHsBtEs03 zb-uHE&$v=PzEWy9H)c@WX*L_JwqL2n&9Gfwn_7rkGv@F8wJ?r7Z%L1+oF1$fxqqV^;)JSe5ZWd2Q)z!6jJS_hfPwW}IiEFUdH20Na zySg3~bgpytn9?Iyn#M{ouHI>@R6(ipMinS#`*~_CJK1bi*Q@R7iKxhk&L7;f_i7@a zaYIdS-UDjF9JgVTpruKrGFdg1CrDaYeT+4<8r7p#wLDmA`lRSuMx+=|P(E5)gWGwgL*razw2nP~5Cxbh|#I7Ch=e>FnSlvj9)srkiP=FfqZP zOq%BCRrzM8#h$ubzjM>h>}ii#-j?fPGlTNU0CxUz&|6~~Z9a;5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JvPtrYJj@Yp)~m*16EAnJtsVufGey3^mk%{ zgOG`bMajG#%&=fPo%5f^3vi5yG4Jx_uASw7ao57DUi6 z{zfz!)`|@s2vcGNrAb;&O{C?~`GIaf1KEg*AoCH_7CE}`W)DwbThe9=#tq(}kq~0l zD8dIQC}S&0hY(AiNiYoi7FI@b?vv68;mM0jbGGtPSU;>5t6_!QA$-^|8#)e*O)X)G z?(~mYf|*cHcK4I7HXzqFo8f3FTktrvsNHH698Bgrybj}=sn9M-Fw|g`+A{)K%!4j@dIySIu z2RG`#(*tOU#5TT$!)_A+l66Of!OwKgfi4b z{+Amt4d8iAW6yyeQUMPnIl`(hJkOKU5(vN-3ZVyiW5$a}36YWcX2=u~HU9A~+OW<> zZbqmQQZJeQ<|?p)-p#<7vjxlvu*`LR7NirHn=BNhi;ZwwT;jkj?Of+n8#!4J^_9OP zqh{n6+%bj?fQ?G&2AzzWmjfzXJ1MZWBieHR~XSE6ooWb2^=~R^HnVaohHTjyD|v>KWbbW zCK(WaXz&L;3&@hjL6S3HJ?cH^K08naN5J(``+LU{Lm#I)f;5I|ZUzP$5iIq;VVoyPD=5Gcf_& zRE$#XRAxw@N`S;YY!(1?S%;SaW^|8^dDvlRfs!{8H$5x7i!wqS`$1N4W58rCLYkpPbW@)Pv(J)Lh1!FSPjd_e=Vba zHlxNYUuWG~;o9SxS*WzM6hRhD*~Tzh(6zLfF1a=PwKoldru`yiEi96VAwH^bx z%7ex8ov}s^#Iniw=)wyk@eO&hb$;NQK6W6SOkc)8w$I5Ll7;iySd-Y*+^DRBcBwn&0v Z-fZ`@cfm`)Px1ie4TG!s=F7LK{}1U8i_QQ5 literal 0 HcmV?d00001 diff --git a/signer/src/eth.rs b/signer/src/eth.rs index 49fdbd02d7..63d23bf384 100644 --- a/signer/src/eth.rs +++ b/signer/src/eth.rs @@ -298,7 +298,7 @@ mod test { use proptest::prelude::*; use secp256k1::Secp256k1; - use subxt_core::{config::*, tx::Signer as SignerT, utils::H256}; + use subxt_core::{config::*, tx::signer::Signer as SignerT, utils::H256}; use super::*; diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index a8fd772ff3..698e85a450 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -119,7 +119,7 @@ sp-core = { workspace = true } sp-keyring = { workspace = true } sp-runtime = { workspace = true } assert_matches = { workspace = true } -subxt-signer = { path = "../signer" } +subxt-signer = { path = "../signer", features = ["unstable-eth"] } # 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 light-client wlll emit INFO logs with @@ -146,4 +146,4 @@ features = ["default", "substrate-compat", "unstable-light-client"] rustdoc-args = ["--cfg", "docsrs"] [package.metadata.playground] -features = ["default", "substrate-compat", "unstable-light-client"] \ No newline at end of file +features = ["default", "substrate-compat", "unstable-light-client"] diff --git a/subxt/examples/tx_basic_frontier.rs b/subxt/examples/tx_basic_frontier.rs new file mode 100644 index 0000000000..adeba406d0 --- /dev/null +++ b/subxt/examples/tx_basic_frontier.rs @@ -0,0 +1,64 @@ +//! Example to use subxt to talk to substrate-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. + +#![allow(missing_docs)] + +use subxt::OnlineClient; +use subxt_signer::eth::{dev, AccountId20, Signature}; + +#[subxt::subxt(runtime_metadata_path = "../artifacts/frontier_metadata_small.scale")] +mod eth_runtime {} + +enum EthRuntimeConfig {} + +impl subxt::Config for EthRuntimeConfig { + type Hash = subxt::utils::H256; + type AccountId = AccountId20; + type Address = AccountId20; + type Signature = Signature; + type Hasher = subxt::config::substrate::BlakeTwo256; + type Header = + subxt::config::substrate::SubstrateHeader; + type ExtrinsicParams = subxt::config::SubstrateExtrinsicParams; + 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 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> { + let api = OnlineClient::::from_insecure_url("ws://127.0.0.1:9944").await?; + + let alith = dev::alith(); + let baltathar = dev::baltathar(); + let dest = baltathar.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); + + let events = api + .tx() + .sign_and_submit_then_watch_default(&balance_transfer_tx, &alith) + .await? + .wait_for_finalized_success() + .await?; + + let transfer_event = events.find_first::()?; + if let Some(event) = transfer_event { + println!("Balance transfer success: {event:?}"); + } + + Ok(()) +}