pub trait Account: ViewOnlyAccount {
// Required method
fn get_asset_inputs_for_amount<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Input>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn get_asset_outputs_for_amount(
&self,
to: &Bech32Address,
asset_id: AssetId,
amount: u64,
) -> Vec<Output> { ... }
fn adjust_for_fee<'life0, 'life1, 'async_trait, Tb>(
&'life0 self,
tb: &'life1 mut Tb,
used_base_amount: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Tb: 'async_trait + TransactionBuilder + Sync,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn add_witnesses<Tb: TransactionBuilder>(&self, _tb: &mut Tb) -> Result<()> { ... }
fn transfer<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32Address,
amount: u64,
asset_id: AssetId,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(TxId, Vec<Receipt>)>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn force_transfer_to_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32ContractId,
balance: u64,
asset_id: AssetId,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(String, Vec<Receipt>)>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn withdraw_to_base_layer<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32Address,
amount: u64,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(TxId, Nonce, Vec<Receipt>)>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Required Methods§
Sourcefn get_asset_inputs_for_amount<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Input>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_asset_inputs_for_amount<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Input>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a vector consisting of Input::Coin
s and Input::Message
s for the given
asset ID and amount. The witness_index
is the position of the witness (signature)
in the transaction’s list of witnesses. In the validation process, the node will
use the witness at this index to validate the coins returned by this method.
Provided Methods§
Sourcefn get_asset_outputs_for_amount(
&self,
to: &Bech32Address,
asset_id: AssetId,
amount: u64,
) -> Vec<Output>
fn get_asset_outputs_for_amount( &self, to: &Bech32Address, asset_id: AssetId, amount: u64, ) -> Vec<Output>
Returns a vector containing the output coin and change output given an asset and amount
Sourcefn adjust_for_fee<'life0, 'life1, 'async_trait, Tb>(
&'life0 self,
tb: &'life1 mut Tb,
used_base_amount: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Tb: 'async_trait + TransactionBuilder + Sync,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn adjust_for_fee<'life0, 'life1, 'async_trait, Tb>(
&'life0 self,
tb: &'life1 mut Tb,
used_base_amount: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Tb: 'async_trait + TransactionBuilder + Sync,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add base asset inputs to the transaction to cover the estimated fee. Requires contract inputs to be at the start of the transactions inputs vec so that their indexes are retained
fn add_witnesses<Tb: TransactionBuilder>(&self, _tb: &mut Tb) -> Result<()>
Sourcefn transfer<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32Address,
amount: u64,
asset_id: AssetId,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(TxId, Vec<Receipt>)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transfer<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32Address,
amount: u64,
asset_id: AssetId,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(TxId, Vec<Receipt>)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Transfer funds from this account to another Address
.
Fails if amount for asset ID is larger than address’s spendable coins.
Returns the transaction ID that was sent and the list of receipts.
Sourcefn force_transfer_to_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32ContractId,
balance: u64,
asset_id: AssetId,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(String, Vec<Receipt>)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn force_transfer_to_contract<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32ContractId,
balance: u64,
asset_id: AssetId,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(String, Vec<Receipt>)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unconditionally transfers balance
of type asset_id
to
the contract at to
.
Fails if balance for asset_id
is larger than this account’s spendable balance.
Returns the corresponding transaction ID and the list of receipts.
CAUTION !!!
This will transfer coins to a contract, possibly leading to the PERMANENT LOSS OF COINS if not used with care.
Sourcefn withdraw_to_base_layer<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32Address,
amount: u64,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(TxId, Nonce, Vec<Receipt>)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn withdraw_to_base_layer<'life0, 'life1, 'async_trait>(
&'life0 self,
to: &'life1 Bech32Address,
amount: u64,
tx_policies: TxPolicies,
) -> Pin<Box<dyn Future<Output = Result<(TxId, Nonce, Vec<Receipt>)>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Withdraws an amount of the base asset to an address on the base chain. Returns the transaction ID, message ID and the list of receipts.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.