diff --git a/Cargo.lock b/Cargo.lock index 761e6e577..7d3f45099 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,10 +65,7 @@ dependencies = [ name = "ac-examples-wasm" version = "0.5.0" dependencies = [ - "frame-metadata 16.0.0", - "kitchensink-runtime", "pallet-balances", - "parity-scale-codec", "sp-core", "sp-runtime", "substrate-api-client", diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml index 58a7c3d03..e620f1e94 100644 --- a/examples/wasm/Cargo.toml +++ b/examples/wasm/Cargo.toml @@ -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'] } diff --git a/examples/wasm/examples/wasm_example.rs b/examples/wasm/examples/wasm_example.rs index b026cfeaf..57a6a7cc1 100644 --- a/examples/wasm/examples/wasm_example.rs +++ b/examples/wasm/examples/wasm_example.rs @@ -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 @@ -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 { let alice: sr25519::Pair = Pair::from_string( "0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a", @@ -44,51 +44,5 @@ fn main() -> Result { 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 = - 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 = ::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)) }