[−][src]Struct web30::client::Web3
An instance of Web3Client.
Implementations
impl Web3
[src]
pub fn new(url: &str, timeout: Duration) -> Self
[src]
pub async fn eth_accounts<'_>(&'_ self) -> Result<Vec<Address>, Web3Error>
[src]
pub async fn net_version<'_>(&'_ self) -> Result<u64, Web3Error>
[src]
pub async fn eth_new_filter<'_>(
&'_ self,
new_filter: NewFilter
) -> Result<Uint256, Web3Error>
[src]
&'_ self,
new_filter: NewFilter
) -> Result<Uint256, Web3Error>
pub async fn eth_get_filter_changes<'_>(
&'_ self,
filter_id: Uint256
) -> Result<Vec<Log>, Web3Error>
[src]
&'_ self,
filter_id: Uint256
) -> Result<Vec<Log>, Web3Error>
pub async fn eth_uninstall_filter<'_>(
&'_ self,
filter_id: Uint256
) -> Result<bool, Web3Error>
[src]
&'_ self,
filter_id: Uint256
) -> Result<bool, Web3Error>
pub async fn eth_get_logs<'_>(
&'_ self,
new_filter: NewFilter
) -> Result<Vec<Log>, Web3Error>
[src]
&'_ self,
new_filter: NewFilter
) -> Result<Vec<Log>, Web3Error>
pub async fn eth_get_transaction_count<'_>(
&'_ self,
address: Address
) -> Result<Uint256, Web3Error>
[src]
&'_ self,
address: Address
) -> Result<Uint256, Web3Error>
pub async fn eth_gas_price<'_>(&'_ self) -> Result<Uint256, Web3Error>
[src]
pub async fn eth_estimate_gas<'_>(
&'_ self,
transaction: TransactionRequest
) -> Result<Uint256, Web3Error>
[src]
&'_ self,
transaction: TransactionRequest
) -> Result<Uint256, Web3Error>
pub async fn eth_get_balance<'_>(
&'_ self,
address: Address
) -> Result<Uint256, Web3Error>
[src]
&'_ self,
address: Address
) -> Result<Uint256, Web3Error>
pub async fn eth_send_transaction<'_>(
&'_ self,
transactions: Vec<TransactionRequest>
) -> Result<Uint256, Web3Error>
[src]
&'_ self,
transactions: Vec<TransactionRequest>
) -> Result<Uint256, Web3Error>
pub async fn eth_call<'_>(
&'_ self,
transaction: TransactionRequest
) -> Result<Data, Web3Error>
[src]
&'_ self,
transaction: TransactionRequest
) -> Result<Data, Web3Error>
pub async fn eth_block_number<'_>(&'_ self) -> Result<Uint256, Web3Error>
[src]
pub async fn eth_get_block_by_number<'_>(
&'_ self,
block_number: Uint256
) -> Result<Block, Web3Error>
[src]
&'_ self,
block_number: Uint256
) -> Result<Block, Web3Error>
pub async fn xdai_get_block_by_number<'_>(
&'_ self,
block_number: Uint256
) -> Result<XdaiBlock, Web3Error>
[src]
&'_ self,
block_number: Uint256
) -> Result<XdaiBlock, Web3Error>
pub async fn eth_get_concise_block_by_number<'_>(
&'_ self,
block_number: Uint256
) -> Result<ConciseBlock, Web3Error>
[src]
&'_ self,
block_number: Uint256
) -> Result<ConciseBlock, Web3Error>
pub async fn xdai_get_concise_block_by_number<'_>(
&'_ self,
block_number: Uint256
) -> Result<ConciseXdaiBlock, Web3Error>
[src]
&'_ self,
block_number: Uint256
) -> Result<ConciseXdaiBlock, Web3Error>
pub async fn eth_get_latest_block<'_>(
&'_ self
) -> Result<ConciseBlock, Web3Error>
[src]
&'_ self
) -> Result<ConciseBlock, Web3Error>
pub async fn xdai_get_latest_block<'_>(
&'_ self
) -> Result<ConciseXdaiBlock, Web3Error>
[src]
&'_ self
) -> Result<ConciseXdaiBlock, Web3Error>
pub async fn eth_get_latest_block_full<'_>(&'_ self) -> Result<Block, Web3Error>
[src]
pub async fn xdai_get_latest_block_full<'_>(
&'_ self
) -> Result<XdaiBlock, Web3Error>
[src]
&'_ self
) -> Result<XdaiBlock, Web3Error>
pub async fn eth_send_raw_transaction<'_>(
&'_ self,
data: Vec<u8>
) -> Result<Uint256, Web3Error>
[src]
&'_ self,
data: Vec<u8>
) -> Result<Uint256, Web3Error>
pub async fn eth_get_transaction_by_hash<'_>(
&'_ self,
hash: Uint256
) -> Result<Option<TransactionResponse>, Web3Error>
[src]
&'_ self,
hash: Uint256
) -> Result<Option<TransactionResponse>, Web3Error>
pub async fn evm_snapshot<'_>(&'_ self) -> Result<Uint256, Web3Error>
[src]
pub async fn evm_revert<'_>(
&'_ self,
snapshot_id: Uint256
) -> Result<Uint256, Web3Error>
[src]
&'_ self,
snapshot_id: Uint256
) -> 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>
[src]
&'_ 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
pub async fn contract_call<'_, '_, '_>(
&'_ self,
contract_address: Address,
sig: &'_ str,
tokens: &'_ [Token],
own_address: Address
) -> Result<Vec<u8>, Web3Error>
[src]
&'_ self,
contract_address: Address,
sig: &'_ str,
tokens: &'_ [Token],
own_address: Address
) -> Result<Vec<u8>, Web3Error>
Sends a transaction which does not change blockchain state, usually to get information.
pub async fn wait_for_transaction<'_>(
&'_ self,
tx_hash: Uint256,
timeout: Duration,
blocks_to_wait: Option<Uint256>
) -> Result<TransactionResponse, Web3Error>
[src]
&'_ 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
impl Web3
[src]
pub async fn check_erc20_approved<'_>(
&'_ self,
erc20: Address,
own_address: Address,
target_contract: Address
) -> Result<bool, Web3Error>
[src]
&'_ self,
erc20: Address,
own_address: Address,
target_contract: Address
) -> Result<bool, Web3Error>
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_uniswap_dai_transfers<'_>(
&'_ self,
erc20: Address,
eth_private_key: EthPrivateKey,
target_contract: Address,
timeout: Option<Duration>,
options: Vec<SendTxOption>
) -> Result<Uint256, Web3Error>
[src]
&'_ 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>
[src]
&'_ 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>
[src]
&'_ self,
erc20: Address,
target_address: Address
) -> Result<Uint256, Web3Error>
impl Web3
[src]
pub async fn wait_for_event_alt<F: Fn(Log) -> bool + 'static, '_, '_>(
&'_ self,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>,
topic3: Option<Vec<[u8; 32]>>,
local_filter: F
) -> Result<Log, Web3Error>
[src]
&'_ self,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>,
topic3: Option<Vec<[u8; 32]>>,
local_filter: F
) -> Result<Log, Web3Error>
Same as wait_for_event, but doesn't use eth_newFilter
pub async fn wait_for_event<F: Fn(Log) -> bool + 'static, '_, '_>(
&'_ self,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>,
topic3: Option<Vec<[u8; 32]>>,
local_filter: F
) -> Result<Log, Web3Error>
[src]
&'_ self,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>,
topic3: Option<Vec<[u8; 32]>>,
local_filter: F
) -> Result<Log, Web3Error>
Sets up an event filter, waits for the event to happen, then removes the filter. Includes a local filter. If a captured event does not pass this filter, it is ignored.
pub async fn check_for_event<'_, '_>(
&'_ self,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>
) -> Result<Option<Log>, Web3Error>
[src]
&'_ self,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>
) -> Result<Option<Log>, Web3Error>
Checks if a singular event has already happened. If multiple events match the description only the first match is provided.
pub async fn check_for_events<'_, '_>(
&'_ self,
start_block: Uint256,
end_block: Option<Uint256>,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>
) -> Result<Vec<Log>, Web3Error>
[src]
&'_ self,
start_block: Uint256,
end_block: Option<Uint256>,
contract_address: Address,
event: &'_ str,
topic1: Option<Vec<[u8; 32]>>,
topic2: Option<Vec<[u8; 32]>>
) -> Result<Vec<Log>, Web3Error>
Checks for multiple events over a block range. If no ending block is provided the latest will be used.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Web3
impl !Send for Web3
impl !Sync for Web3
impl Unpin for Web3
impl !UnwindSafe for Web3
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,