mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 05:41:07 +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:
@@ -28,7 +28,7 @@ use crate::{
|
||||
DispatchError,
|
||||
},
|
||||
test_context,
|
||||
NodeRuntimeSignedExtra,
|
||||
NodeRuntimeParams,
|
||||
TestContext,
|
||||
};
|
||||
use sp_core::sr25519::Pair;
|
||||
@@ -44,7 +44,7 @@ use subxt::{
|
||||
|
||||
struct ContractsTestContext {
|
||||
cxt: TestContext,
|
||||
signer: PairSigner<DefaultConfig, NodeRuntimeSignedExtra, Pair>,
|
||||
signer: PairSigner<DefaultConfig, Pair>,
|
||||
}
|
||||
|
||||
type Hash = <DefaultConfig as Config>::Hash;
|
||||
@@ -62,7 +62,7 @@ impl ContractsTestContext {
|
||||
self.cxt.client()
|
||||
}
|
||||
|
||||
fn contracts_tx(&self) -> TransactionApi<DefaultConfig, NodeRuntimeSignedExtra> {
|
||||
fn contracts_tx(&self) -> TransactionApi<DefaultConfig, NodeRuntimeParams> {
|
||||
self.cxt.api.tx().contracts()
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ impl ContractsTestContext {
|
||||
vec![], // data
|
||||
vec![], // salt
|
||||
)
|
||||
.sign_and_submit_then_watch(&self.signer)
|
||||
.sign_and_submit_then_watch_default(&self.signer)
|
||||
.await?
|
||||
.wait_for_finalized_success()
|
||||
.await?;
|
||||
@@ -131,7 +131,7 @@ impl ContractsTestContext {
|
||||
data,
|
||||
salt,
|
||||
)
|
||||
.sign_and_submit_then_watch(&self.signer)
|
||||
.sign_and_submit_then_watch_default(&self.signer)
|
||||
.await?
|
||||
.wait_for_finalized_success()
|
||||
.await?;
|
||||
@@ -162,7 +162,7 @@ impl ContractsTestContext {
|
||||
None, // storage_deposit_limit
|
||||
input_data,
|
||||
)
|
||||
.sign_and_submit_then_watch(&self.signer)
|
||||
.sign_and_submit_then_watch_default(&self.signer)
|
||||
.await?;
|
||||
|
||||
log::info!("Call result: {:?}", result);
|
||||
|
||||
Reference in New Issue
Block a user