pub trait ChainBackend {
type AccountId;
type Balance: Send + From<u32> + Debug;
type Error;
type EventLog;
// Required methods
fn create_and_fund_account<'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
amount: Self::Balance,
) -> Pin<Box<dyn Future<Output = Keypair> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn free_balance<'life0, 'async_trait>(
&'life0 mut self,
account: Self::AccountId,
) -> Pin<Box<dyn Future<Output = Result<Self::Balance, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn runtime_call<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
pallet_name: &'a str,
call_name: &'a str,
call_data: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Self::EventLog, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn transfer_allow_death<'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
dest: Self::AccountId,
value: Self::Balance,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
General chain operations useful in contract testing.
Required Associated Types§
Required Methods§
Sourcefn create_and_fund_account<'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
amount: Self::Balance,
) -> Pin<Box<dyn Future<Output = Keypair> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_and_fund_account<'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
amount: Self::Balance,
) -> Pin<Box<dyn Future<Output = Keypair> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate a new account and fund it with the given amount of tokens from the
origin.
Sourcefn free_balance<'life0, 'async_trait>(
&'life0 mut self,
account: Self::AccountId,
) -> Pin<Box<dyn Future<Output = Result<Self::Balance, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn free_balance<'life0, 'async_trait>(
&'life0 mut self,
account: Self::AccountId,
) -> Pin<Box<dyn Future<Output = Result<Self::Balance, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the free balance of account.
Sourcefn runtime_call<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
pallet_name: &'a str,
call_name: &'a str,
call_data: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Self::EventLog, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn runtime_call<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
pallet_name: &'a str,
call_name: &'a str,
call_data: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Self::EventLog, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes a runtime call call_name for the pallet_name.
The call_data is a Vec<Value>.
Note:
pallet_namemust be in camel case, for exampleBalances.call_namemust be snake case, for exampleforce_transfer.call_datais aVec<subxt::dynamic::Value>that holds a representation of some value.
Returns when the transaction is included in a block. The return value contains all events that are associated with this transaction.
Since we might run node with an arbitrary runtime, this method inherently must support dynamic calls.
Sourcefn transfer_allow_death<'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
dest: Self::AccountId,
value: Self::Balance,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transfer_allow_death<'life0, 'life1, 'async_trait>(
&'life0 mut self,
origin: &'life1 Keypair,
dest: Self::AccountId,
value: Self::Balance,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Attempt to transfer the value from origin to dest.
Returns Ok on success, and a [subxt::Error] if the extrinsic is
invalid (e.g. out of date nonce)