mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-24 19:27:57 +00:00
a2b8dde5e6
* Add Static type which defers to Encode/Decode and impls EncodeAsType/DecodeAsType * rename to static_type and impl Deref/Mut * Improve type substitution in codegen so that concrete types can be swapped in * A couple of comment tweaks and no need for a macro export * Extend type substitution logic to work recursively on destination type * cargo fmt * Fix a couple of comments * update ui test outpuot * Add docs and missing_docs lint * Add test for replacing multiple of Ident * Update codegen/src/error.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * update copyright year and fix ui test * simplify another error --------- Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
75 lines
1.9 KiB
Rust
75 lines
1.9 KiB
Rust
// Copyright 2019-2023 Parity Technologies (UK) Ltd.
|
|
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
|
// see LICENSE for license details.
|
|
|
|
use crate::{
|
|
node_runtime::{
|
|
self,
|
|
runtime_types::{self, sp_weights::weight_v2::Weight},
|
|
sudo,
|
|
},
|
|
pair_signer, test_context,
|
|
};
|
|
use sp_keyring::AccountKeyring;
|
|
|
|
type Call = runtime_types::kitchensink_runtime::RuntimeCall;
|
|
type BalancesCall = runtime_types::pallet_balances::pallet::Call;
|
|
|
|
#[tokio::test]
|
|
async fn test_sudo() -> Result<(), subxt::Error> {
|
|
let ctx = test_context().await;
|
|
let api = ctx.client();
|
|
|
|
let alice = pair_signer(AccountKeyring::Alice.pair());
|
|
let bob = AccountKeyring::Bob.to_account_id().into();
|
|
|
|
let call = Call::Balances(BalancesCall::transfer {
|
|
dest: bob,
|
|
value: 10_000,
|
|
});
|
|
let tx = node_runtime::tx().sudo().sudo(call);
|
|
|
|
let found_event = api
|
|
.tx()
|
|
.sign_and_submit_then_watch_default(&tx, &alice)
|
|
.await?
|
|
.wait_for_finalized_success()
|
|
.await?
|
|
.has::<sudo::events::Sudid>()?;
|
|
|
|
assert!(found_event);
|
|
Ok(())
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_sudo_unchecked_weight() -> Result<(), subxt::Error> {
|
|
let ctx = test_context().await;
|
|
let api = ctx.client();
|
|
|
|
let alice = pair_signer(AccountKeyring::Alice.pair());
|
|
let bob = AccountKeyring::Bob.to_account_id().into();
|
|
|
|
let call = Call::Balances(BalancesCall::transfer {
|
|
dest: bob,
|
|
value: 10_000,
|
|
});
|
|
let tx = node_runtime::tx().sudo().sudo_unchecked_weight(
|
|
call,
|
|
Weight {
|
|
ref_time: 0,
|
|
proof_size: 0,
|
|
},
|
|
);
|
|
|
|
let found_event = api
|
|
.tx()
|
|
.sign_and_submit_then_watch_default(&tx, &alice)
|
|
.await?
|
|
.wait_for_finalized_success()
|
|
.await?
|
|
.has::<sudo::events::Sudid>()?;
|
|
|
|
assert!(found_event);
|
|
Ok(())
|
|
}
|