Skip to content

Commit

Permalink
Fix register PNA (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong authored Sep 13, 2024
1 parent 77b4c04 commit 6776272
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions smoketest/tests/register_polkadot_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ use snowbridge_smoketest::{
},
},
};
use subxt_signer::sr25519::dev;
use subxt::tx::Payload;

#[tokio::test]
async fn register_polkadot_token() {
let test_clients = initial_clients().await.expect("initialize clients");

type Junctions = runtime_types::staging_xcm::v4::junctions::Junctions;
let asset = VersionedLocation::V4(runtime_types::staging_xcm::v4::location::Location {
parents: 1,
Expand All @@ -42,20 +41,18 @@ async fn register_polkadot_token() {
),
decimals: 12,
};
let call =
bridgehub::api::ethereum_system::calls::TransactionApi.register_token(asset, metadata);

let result = test_clients
.bridge_hub_client
.tx()
.sign_and_submit_then_watch_default(&call, &dev::bob())
.await
.expect("send register call.")
.wait_for_finalized_success()
.await
.expect("call success");
let ethereum_system_api = bridgehub::api::ethereum_system::calls::TransactionApi;

println!("call issued at bridgehub block hash {:?}", result.extrinsic_hash());
let mut encoded = Vec::new();
ethereum_system_api
.register_token(asset, metadata)
.encode_call_data_to(&test_clients.bridge_hub_client.metadata(), &mut encoded)
.expect("encoded call");

governance_bridgehub_call_from_relay_chain(encoded)
.await
.expect("set token fees");

wait_for_bridgehub_event::<RegisterToken>(&test_clients.bridge_hub_client).await;

Expand Down

0 comments on commit 6776272

Please sign in to comment.