mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 23:31:04 +00:00
Simplify creating and signing extrinsics (#490)
* WIP extrinsic api updates * First pass done; now to get things compiling again * document and tweak new structs/traits * cargo check --all-targets now compiles without issue * Polkadot and Substrate take different extra params; support both * Fix transaction format (missing byte from AccountId -> Address) and fmt * Tweak Signer trait * Tweak comments and such in extrinsic params * check all examples against newer polkadot, add new one with params, import path tweaks * clippy fix, and save an allocation when signing * Remove unnecessary Default clauses * Tidy up and fix comments. Panic if payload size >4GB * fix typo
This commit is contained in:
@@ -34,10 +34,7 @@ use sp_runtime::{
|
||||
AccountId32,
|
||||
MultiAddress,
|
||||
};
|
||||
use subxt::{
|
||||
Error,
|
||||
Signer,
|
||||
};
|
||||
use subxt::Error;
|
||||
|
||||
#[async_std::test]
|
||||
async fn tx_basic_transfer() -> Result<(), subxt::Error<DispatchError>> {
|
||||
@@ -62,7 +59,7 @@ async fn tx_basic_transfer() -> Result<(), subxt::Error<DispatchError>> {
|
||||
.tx()
|
||||
.balances()
|
||||
.transfer(bob_address, 10_000)
|
||||
.sign_and_submit_then_watch(&alice)
|
||||
.sign_and_submit_then_watch_default(&alice)
|
||||
.await?
|
||||
.wait_for_finalized_success()
|
||||
.await?;
|
||||
@@ -118,7 +115,7 @@ async fn multiple_transfers_work_nonce_incremented(
|
||||
.tx()
|
||||
.balances()
|
||||
.transfer(bob_address.clone(), 10_000)
|
||||
.sign_and_submit_then_watch(&alice)
|
||||
.sign_and_submit_then_watch_default(&alice)
|
||||
.await?
|
||||
.wait_for_in_block() // Don't need to wait for finalization; this is quicker.
|
||||
.await?
|
||||
@@ -163,7 +160,7 @@ async fn storage_balance_lock() -> Result<(), subxt::Error<DispatchError>> {
|
||||
100_000_000_000_000,
|
||||
runtime_types::pallet_staking::RewardDestination::Stash,
|
||||
)
|
||||
.sign_and_submit_then_watch(&bob)
|
||||
.sign_and_submit_then_watch_default(&bob)
|
||||
.await?
|
||||
.wait_for_finalized_success()
|
||||
.await?
|
||||
@@ -203,7 +200,7 @@ async fn transfer_error() {
|
||||
.tx()
|
||||
.balances()
|
||||
.transfer(hans_address, 100_000_000_000_000_000)
|
||||
.sign_and_submit_then_watch(&alice)
|
||||
.sign_and_submit_then_watch_default(&alice)
|
||||
.await
|
||||
.unwrap()
|
||||
.wait_for_finalized_success()
|
||||
@@ -215,7 +212,7 @@ async fn transfer_error() {
|
||||
.tx()
|
||||
.balances()
|
||||
.transfer(alice_addr, 100_000_000_000_000_000)
|
||||
.sign_and_submit_then_watch(&hans)
|
||||
.sign_and_submit_then_watch_default(&hans)
|
||||
.await
|
||||
.unwrap()
|
||||
.wait_for_finalized_success()
|
||||
@@ -242,7 +239,7 @@ async fn transfer_implicit_subscription() {
|
||||
.tx()
|
||||
.balances()
|
||||
.transfer(bob_addr, 10_000)
|
||||
.sign_and_submit_then_watch(&alice)
|
||||
.sign_and_submit_then_watch_default(&alice)
|
||||
.await
|
||||
.unwrap()
|
||||
.wait_for_finalized_success()
|
||||
|
||||
Reference in New Issue
Block a user