Skip to content

Commit

Permalink
Move code below comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Niederb committed Dec 4, 2023
1 parent 7b2ecf1 commit e8ea140
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/examples/compose_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ async fn main() {
.tip(0);

println!("Compose extrinsic in no_std environment (No Api instance)");
let signer_nonce = api.get_nonce().unwrap();
println!("[+] Alice's Account Nonce is {}", signer_nonce);
// Get information out of Api (online). This information could also be set offline in the `no_std`,
// but that would need to be static and adapted whenever the node changes.
// You can get the information directly from the node runtime file or the api of https://polkadot.js.org.
let spec_version = api.runtime_version().spec_version;
let transaction_version = api.runtime_version().transaction_version;
let genesis_hash = api.genesis_hash();
let metadata = api.metadata();
let signer_nonce = api.get_nonce().unwrap();
println!("[+] Alice's Account Nonce is {}", signer_nonce);

let recipients_extrinsic_address: ExtrinsicAddressOf<AssetExtrinsicSigner> =
recipient.clone().into();
Expand All @@ -108,7 +108,7 @@ async fn main() {
};

println!("[+] Composed Extrinsic:\n {:?}", xt);
// To send the extrinsic to the node, we need an rpc client which is only available within std-environment. If you want to operate a rpc client in your own no-std environment, take a look at https://github.com/scs/substrate-api-client#rpc-client on how to implement one yourself.
// To send the extrinsic to the node, we need an rpc client which is only available within std-environment. If you want to operate a rpc client in your own no-std environment, take a look at https://github.com/scs/substrate-api-client#rpc-client on how to implement one yourself.
let hash = api
.submit_and_watch_extrinsic_until(xt, XtStatus::InBlock)
.unwrap()
Expand All @@ -122,7 +122,7 @@ async fn main() {
let signer_nonce = api.get_nonce().unwrap();
println!("[+] Alice's Account Nonce is {}", signer_nonce);

// Construct an extrinsic offline (without any calls to the node) with the help of the api client. For example, this allows you to set your own nonce (to achieve future calls or construct an extrsinic that must be sent at a later time).
// Construct an extrinsic offline (without any calls to the node) with the help of the api client. For example, this allows you to set your own nonce (to achieve future calls or construct an extrsinic that must be sent at a later time).
let xt = {
// Set the additional params.
api.set_additional_params(additional_extrinsic_params);
Expand Down

0 comments on commit e8ea140

Please sign in to comment.