pub struct Wallet { /* private fields */ }
Expand description
The wallet provides the main entry point to this crate.
Implementations§
Source§impl Wallet
impl Wallet
Sourcepub fn new(
config: BlockchainConfig,
signer: &Signer,
client: Client,
) -> Result<Self>
pub fn new( config: BlockchainConfig, signer: &Signer, client: Client, ) -> Result<Self>
Creates a new wallet from a config, signer and client.
Sourcepub fn config(&self) -> &BlockchainConfig
pub fn config(&self) -> &BlockchainConfig
Returns the blockchain config.
Sourcepub fn public_key(&self) -> &PublicKey
pub fn public_key(&self) -> &PublicKey
Returns the public key.
Sourcepub fn account(&self) -> &AccountIdentifier
pub fn account(&self) -> &AccountIdentifier
Returns the account identifier.
Sourcepub async fn status(&self) -> Result<BlockIdentifier>
pub async fn status(&self) -> Result<BlockIdentifier>
Returns the current block identifier.
Sourcepub async fn block(&self, data: PartialBlockIdentifier) -> Result<Block>
pub async fn block(&self, data: PartialBlockIdentifier) -> Result<Block>
Returns block data Takes PartialBlockIdentifier
Sourcepub async fn block_transaction(
&self,
block_identifer: BlockIdentifier,
tx_identifier: TransactionIdentifier,
) -> Result<BlockTransactionResponse>
pub async fn block_transaction( &self, block_identifer: BlockIdentifier, tx_identifier: TransactionIdentifier, ) -> Result<BlockTransactionResponse>
Returns transactions included in a block Parameters:
- block_identifier: BlockIdentifier containing block number and hash
- tx_identifier: TransactionIdentifier containing hash of transaction
Sourcepub async fn call(&self, method: String, params: &Value) -> Result<CallResponse>
pub async fn call(&self, method: String, params: &Value) -> Result<CallResponse>
Extension of rosetta-api does multiple things
- fetching storage
- calling extrinsic/contract
Sourcepub async fn metadata(&self, metadata_params: Value) -> Result<Value>
pub async fn metadata(&self, metadata_params: Value) -> Result<Value>
Returns the on chain metadata. Parameters:
- metadata_params: the metadata parameters which we got from transaction builder.
Sourcepub async fn submit(&self, transaction: &[u8]) -> Result<TransactionIdentifier>
pub async fn submit(&self, transaction: &[u8]) -> Result<TransactionIdentifier>
Submits a transaction and returns the transaction identifier. Parameters:
- transaction: the transaction bytes to submit
Sourcepub async fn construct(
&self,
metadata_params: Value,
) -> Result<TransactionIdentifier>
pub async fn construct( &self, metadata_params: Value, ) -> Result<TransactionIdentifier>
Creates, signs and submits a transaction.
Sourcepub async fn transfer(
&self,
account: &AccountIdentifier,
amount: u128,
) -> Result<TransactionIdentifier>
pub async fn transfer( &self, account: &AccountIdentifier, amount: u128, ) -> Result<TransactionIdentifier>
Makes a transfer. Parameters:
- account: the account to transfer to
- amount: the amount to transfer
Sourcepub async fn faucet(
&self,
faucet_parameter: u128,
) -> Result<TransactionIdentifier>
pub async fn faucet( &self, faucet_parameter: u128, ) -> Result<TransactionIdentifier>
Uses the faucet on dev chains to seed the account with funds. Parameters:
- faucet_parameter: the amount to seed the account with
Sourcepub async fn transaction(
&self,
tx: TransactionIdentifier,
) -> Result<BlockTransaction>
pub async fn transaction( &self, tx: TransactionIdentifier, ) -> Result<BlockTransaction>
Returns the transaction matching the transaction identifier. Parameters:
- tx: the transaction identifier to search for.
Sourcepub fn transactions(&self, limit: u16) -> TransactionStream
pub fn transactions(&self, limit: u16) -> TransactionStream
Returns a stream of transactions associated with the account.