Skip to content

Commit

Permalink
Cleanup example
Browse files Browse the repository at this point in the history
  • Loading branch information
Niederb committed Jun 12, 2024
1 parent 33683f5 commit 81c1b79
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 59 deletions.
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions examples/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ license = "Apache-2.0"
edition = "2021"

[dev-dependencies]
frame-metadata = { version = "16.0", default-features = false, features = ["current", "serde_full", "decode"] }
sp-core = { default-features = false, features = ["full_crypto", "serde"], git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }

substrate-api-client = { default-features = false, path = "../..", version = "0.17" }

pallet-balances = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
kitchensink-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", branch = "master" }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ['derive'] }
56 changes: 5 additions & 51 deletions examples/wasm/examples/wasm_example.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2023 Supercomputing Systems AG
Copyright 2024 Supercomputing Systems AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -11,18 +11,18 @@
limitations under the License.
*/

//! Example that shows how to detect a runtime update and afterwards update the metadata.
//use kitchensink_runtime::RuntimeCall;
//use kitchensink_runtime::constants::currency::DOLLARS;
//! Example that some basic functions that can be executed in WebAssembly.
pub use pallet_balances::Call as BalancesCall;
use sp_core::{
crypto::{AccountId32, Ss58Codec},
sr25519, Bytes, Encode, Pair,
sr25519, Pair,
};
use sp_runtime::MultiAddress;
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
use std::process::ExitCode;
use substrate_api_client::ac_primitives::{AssetRuntimeConfig, ExtrinsicSigner};

fn main() -> Result<ExitCode, i32> {
let alice: sr25519::Pair = Pair::from_string(
"0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a",
Expand All @@ -44,51 +44,5 @@ fn main() -> Result<ExitCode, i32> {
Ok(_) => panic!("Extrinsic should be invalid"),
Err(_) => (),
}
//let _xt1: Bytes = extrinsic.unwrap().encode().into();

//assert_eq!(4, 5);

/*let call1 = RuntimeCall::Balances(BalancesCall::force_transfer {
source: bob.clone(),
dest: bob.clone(),
value: 10,
});
let _xt1: Bytes = UncheckedExtrinsic::new_unsigned(call1).encode().into();
*/

/*
let recipients_extrinsic_address: ExtrinsicAddressOf<AssetExtrinsicSigner> =
bob_account.clone().into();
//let recipient = AccountKeyring::Bob.to_account_id();
let spec_version = 1;
let transaction_version = 2;
let genesis_hash = H256::zero();
//let metadata = Metadata::new();
let signer_nonce = 3;
println!("[+] Alice's Account Nonce is {}", signer_nonce);
// Construct an extrinsic using only functionality available in no_std
let xt = {
let extrinsic_params = <AssetRuntimeConfig as Config>::ExtrinsicParams::new(
spec_version,
transaction_version,
signer_nonce,
genesis_hash,
additional_extrinsic_params,
);
let call = compose_call!(
metadata,
"Balances",
"transfer_allow_death",
recipients_extrinsic_address,
Compact(4u32)
)
.unwrap();
compose_extrinsic_offline!(extrinsic_signer, call, extrinsic_params)
};
*/
Ok(ExitCode::from(0))
}

0 comments on commit 81c1b79

Please sign in to comment.