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
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 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.
Trait Implementations§
source§impl EthereumExt for Wallet
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,
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,
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,
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,
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,
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more