Struct web30::client::Web3 [−][src]
pub struct Web3 { /* fields omitted */ }
Expand description
An instance of Web3Client.
Implementations
Returns the EIP155 chain ID used for transaction signing at the current best block. Null is returned if not available.
pub async fn eth_estimate_gas(
&self,
transaction: TransactionRequest
) -> Result<Uint256, Web3Error>
pub async fn eth_send_transaction(
&self,
transactions: Vec<TransactionRequest>
) -> Result<Uint256, Web3Error>
pub async fn eth_call_at_height(
&self,
transaction: TransactionRequest,
block: Uint256
) -> Result<Data, Web3Error>
pub async fn eth_get_block_by_number(
&self,
block_number: Uint256
) -> Result<Block, Web3Error>
pub async fn xdai_get_block_by_number(
&self,
block_number: Uint256
) -> Result<XdaiBlock, Web3Error>
pub async fn eth_get_concise_block_by_number(
&self,
block_number: Uint256
) -> Result<ConciseBlock, Web3Error>
pub async fn xdai_get_concise_block_by_number(
&self,
block_number: Uint256
) -> Result<ConciseXdaiBlock, Web3Error>
pub async fn eth_get_transaction_by_hash(
&self,
hash: Uint256
) -> Result<Option<TransactionResponse>, Web3Error>
pub async fn send_transaction(
&self,
to_address: Address,
data: Vec<u8>,
value: Uint256,
own_address: Address,
secret: PrivateKey,
options: Vec<SendTxOption>
) -> Result<Uint256, Web3Error>
pub async fn send_transaction(
&self,
to_address: Address,
data: Vec<u8>,
value: Uint256,
own_address: Address,
secret: PrivateKey,
options: Vec<SendTxOption>
) -> Result<Uint256, Web3Error>
Sends a transaction which changes blockchain state.
options
takes a vector of SendTxOption
for configuration
unlike the lower level eth_send_transaction() this call builds
the transaction abstracting away details like chain id, gas,
and network id.
WARNING: you must specify networkID in situations where a single
node is operating no more than one chain. Otherwise it is possible
for the full node to trick the client into signing transactions
on unintended chains potentially to their benefit
Sends a transaction which does not change blockchain state, usually to get information. optionally this data can come from some historic block
pub async fn wait_for_transaction(
&self,
tx_hash: Uint256,
timeout: Duration,
blocks_to_wait: Option<Uint256>
) -> Result<TransactionResponse, Web3Error>
pub async fn wait_for_transaction(
&self,
tx_hash: Uint256,
timeout: Duration,
blocks_to_wait: Option<Uint256>
) -> Result<TransactionResponse, Web3Error>
Waits for a transaction with the given hash to be included in a block it will wait for at most timeout time and optionally can wait for n blocks to have passed
Checks if any given contract is approved to spend money from any given erc20 contract using any given address. What exactly this does can be hard to grok, essentially when you want contract A to be able to spend your erc20 contract funds you need to call ‘approve’ on the ERC20 contract with your own address and A’s address so that in the future when you call contract A it can manipulate your ERC20 balances. This function checks if that has already been done.
pub async fn approve_erc20_transfers(
&self,
erc20: Address,
eth_private_key: EthPrivateKey,
target_contract: Address,
timeout: Option<Duration>,
options: Vec<SendTxOption>
) -> Result<Uint256, Web3Error>
pub async fn approve_erc20_transfers(
&self,
erc20: Address,
eth_private_key: EthPrivateKey,
target_contract: Address,
timeout: Option<Duration>,
options: Vec<SendTxOption>
) -> Result<Uint256, Web3Error>
Approves a given contract to spend erc20 funds from the given address from the erc20 contract provided.
What exactly this does can be hard to grok, essentially when you want contract A to be able to spend
your erc20 contract funds you need to call ‘approve’ on the ERC20 contract with your own address and A’s
address so that in the future when you call contract A it can manipulate your ERC20 balances.
This function performs that action and waits for it to complete for up to Timeout duration
options
takes a vector of SendTxOption
for configuration
unlike the lower level eth_send_transaction() this call builds
the transaction abstracting away details like chain id, gas,
and network id.
pub async fn erc20_send(
&self,
amount: Uint256,
recipient: Address,
erc20: Address,
sender_private_key: EthPrivateKey,
wait_timeout: Option<Duration>,
options: Vec<SendTxOption>
) -> Result<Uint256, Web3Error>
pub async fn erc20_send(
&self,
amount: Uint256,
recipient: Address,
erc20: Address,
sender_private_key: EthPrivateKey,
wait_timeout: Option<Duration>,
options: Vec<SendTxOption>
) -> Result<Uint256, Web3Error>
Send an erc20 token to the target address, optionally wait until it enters the blockchain
options
takes a vector of SendTxOption
for configuration
unlike the lower level eth_send_transaction() this call builds
the transaction abstracting away details like chain id, gas,
and network id.
WARNING: you must specify networkID in situations where a single
node is operating no more than one chain. Otherwise it is possible
for the full node to trick the client into signing transactions
on unintended chains potentially to their benefit
pub async fn get_erc20_balance(
&self,
erc20: Address,
target_address: Address
) -> Result<Uint256, Web3Error>
pub async fn get_erc20_name(
&self,
erc20: Address,
caller_address: Address
) -> Result<String, Web3Error>
Waits for a single event but instead of creating a filter and checking for changes this function waits for the provided wait time before checking if the event has occurred. This function will wait for at
Sets up an event filter, waits for a single event to happen, then removes the filter. Includes a local filter. If a captured event does not pass this filter, it is ignored. This differs from wait_for_event_alt in that it will check for filter changes every second and potentially exit earlier than the wait_for time provided by the user.
Checks for multiple events as defined by their signature strings over a block range. If no ending block is provided the latest will be used. This function will not wait for events to occur.
Checks for multiple events as defined by arbitrary user input over a block range. If no ending block is provided the latest will be used. This function will not wait for events to occur
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Web3
impl !UnwindSafe for Web3
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V