pub trait ChainBackend {
type AccountId;
type Balance: Send + From<u32>;
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;
}
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_name
must be in camel case, for exampleBalances
.call_name
must be snake case, for exampleforce_transfer
.call_data
is 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.