Struct rosetta_client::Wallet

source ·
pub struct Wallet { /* private fields */ }
Expand description

The wallet provides the main entry point to this crate.

Implementations§

source§

impl Wallet

source

pub fn new( config: BlockchainConfig, signer: &Signer, client: Client ) -> Result<Self>

Creates a new wallet from a config, signer and client.

source

pub fn config(&self) -> &BlockchainConfig

Returns the blockchain config.

source

pub fn client(&self) -> &Client

Returns the rosetta client.

source

pub fn public_key(&self) -> &PublicKey

Returns the public key.

source

pub fn account(&self) -> &AccountIdentifier

Returns the account identifier.

source

pub async fn status(&self) -> Result<BlockIdentifier>

Returns the current block identifier.

source

pub async fn balance(&self) -> Result<Amount>

Returns the balance of the wallet.

source

pub async fn block(&self, data: PartialBlockIdentifier) -> Result<Block>

Returns block data Takes PartialBlockIdentifier

source

pub async fn block_transaction( &self, block_identifer: BlockIdentifier, tx_identifier: TransactionIdentifier ) -> Result<BlockTransactionResponse>

Returns transactions included in a block Parameters:

  1. block_identifier: BlockIdentifier containing block number and hash
  2. tx_identifier: TransactionIdentifier containing hash of transaction
source

pub async fn call(&self, method: String, params: &Value) -> Result<CallResponse>

Extension of rosetta-api does multiple things

  1. fetching storage
  2. calling extrinsic/contract
source

pub async fn coins(&self) -> Result<Vec<Coin>>

Returns the coins of the wallet.

source

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.
source

pub async fn submit(&self, transaction: &[u8]) -> Result<TransactionIdentifier>

Submits a transaction and returns the transaction identifier. Parameters:

  • transaction: the transaction bytes to submit
source

pub async fn construct( &self, metadata_params: Value ) -> Result<TransactionIdentifier>

Creates, signs and submits a transaction.

source

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
source

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
source

pub async fn transaction( &self, tx: TransactionIdentifier ) -> Result<BlockTransaction>

Returns the transaction matching the transaction identifier. Parameters:

  • tx: the transaction identifier to search for.
source

pub fn transactions(&self, limit: u16) -> TransactionStream

Returns a stream of transactions associated with the account.

Trait Implementations§

source§

impl EthereumExt for Wallet

source§

fn eth_deploy_contract<'life0, 'async_trait>( &'life0 self, bytecode: Vec<u8> ) -> Pin<Box<dyn Future<Output = Result<TransactionIdentifier>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

deploys contract to chain
source§

fn eth_send_call<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, contract_address: &'life1 str, method_signature: &'life2 str, params: &'life3 [String], amount: u128 ) -> Pin<Box<dyn Future<Output = Result<TransactionIdentifier>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

calls contract send call function
source§

fn eth_view_call<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, contract_address: &'life1 str, method_signature: &'life2 str, params: &'life3 [String] ) -> Pin<Box<dyn Future<Output = Result<CallResponse>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

calls a contract view call function
source§

fn eth_storage<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, contract_address: &'life1 str, storage_slot: &'life2 str ) -> Pin<Box<dyn Future<Output = Result<CallResponse>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

gets storage from ethereum contract
source§

fn eth_storage_proof<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, contract_address: &'life1 str, storage_slot: &'life2 str ) -> Pin<Box<dyn Future<Output = Result<CallResponse>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

gets storage proof from ethereum contract
source§

fn eth_transaction_receipt<'life0, 'life1, 'async_trait>( &'life0 self, tx_hash: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<CallResponse>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

gets transaction receipt of specific hash

Auto Trait Implementations§

§

impl !RefUnwindSafe for Wallet

§

impl Send for Wallet

§

impl Sync for Wallet

§

impl Unpin for Wallet

§

impl !UnwindSafe for Wallet

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V