Struct Provider

Source
pub struct Provider { /* private fields */ }
Expand description

Ether network api provider

Implementations§

Source§

impl Provider

Source

pub fn register_filter_listener<A, T>( &self, address: Option<A>, topic_filter: Option<T>, ) -> Result<FilterReceiver<Timeout>, Error>
where A: TryInto<AddressFilter>, <A as TryInto<AddressFilter>>::Error: Error + Sync + Send + 'static, T: TryInto<TopicFilter>, <T as TryInto<TopicFilter>>::Error: Error + Sync + Send + 'static,

Source

pub fn register_transaction_listener<H>( &self, tx_hash: H, ) -> Result<TransactionReceipter<Timeout>, Error>
where H: TryInto<BytesM<32>>, <H as TryInto<BytesM<32>>>::Error: Error + Sync + Send + 'static,

Source§

impl Provider

Source

pub async fn eth_block_number( &mut self, ) -> Result<Uint<256>, Error<String, Value>>

Returns the number of most recent block.

Source

pub async fn eth_chain_id(&mut self) -> Result<Uint<64>, Error<String, Value>>

Returns the chain ID of the current network

Source

pub async fn eth_get_block_by_hash<B>( &mut self, block_hash: B, hydrated: bool, ) -> Result<Option<Block>, Error<String, Value>>
where B: TryInto<BytesM<32>>, <B as TryInto<BytesM<32>>>::Error: Debug + Display,

Returns information about a block by hash.

Source

pub async fn eth_get_block_by_number<BT>( &mut self, block_number_or_tag: BT, hydrated: bool, ) -> Result<Option<Block>, Error<String, Value>>

Returns information about a block by number

Source

pub async fn eth_get_block_transaction_count_by_hash<H>( &mut self, hash: H, ) -> Result<Uint<64>, Error<String, Value>>
where H: TryInto<BytesM<32>>, <H as TryInto<BytesM<32>>>::Error: Debug + Display,

Returns the number of transactions in a block from a block matching the given block hash

Source

pub async fn eth_get_uncle_count_by_block_hash<H>( &mut self, hash: H, ) -> Result<Uint<64>, Error<String, Value>>
where H: TryInto<BytesM<32>>, <H as TryInto<BytesM<32>>>::Error: Debug + Display,

Returns the number of uncles in a block from a block matching the given block hash

Source

pub async fn eth_get_uncle_count_by_block_number<BT>( &mut self, block_number_or_tag: BT, ) -> Result<Uint<64>, Error<String, Value>>

Returns the number of uncles in a block from a block matching the given block hash

Source

pub async fn eth_syncing( &mut self, ) -> Result<SyncingStatus, Error<String, Value>>

Returns an object with data about the sync status or false

Source

pub async fn eth_coinbase(&mut self) -> Result<Address, Error<String, Value>>

Returns the client coinbase address.

Source

pub async fn eth_accounts( &mut self, ) -> Result<Vec<Address>, Error<String, Value>>

Returns a list of addresses owned by client.

Source

pub async fn eth_call<TX, BT>( &mut self, transaction: TX, block_number_or_tag: Option<BT>, ) -> Result<Bytes, Error<String, Value>>

Executes a new message call immediately without creating a transaction on the block chain.

Source

pub async fn eth_estimate_gas<TX, BT>( &mut self, transaction: TX, block_number_or_tag: Option<BT>, ) -> Result<Uint<256>, Error<String, Value>>

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.

Source

pub async fn eth_create_accesslist<TX, BT>( &mut self, transaction: TX, block_number_or_tag: Option<BT>, ) -> Result<Uint<256>, Error<String, Value>>

Generates an access list for a transaction

Source

pub async fn eth_gas_price(&mut self) -> Result<Uint<256>, Error<String, Value>>

Returns the current price gas in wei.

Source

pub async fn eth_max_priority_fee_per_gas( &mut self, ) -> Result<Uint<256>, Error<String, Value>>

Returns the current maxPriorityFeePerGas per gas in wei.

Source

pub async fn eth_fee_history<N, BT, RP>( &mut self, block_count: N, newest_block: BT, reward_percentiles: RP, ) -> Result<FeeHistory, Error<String, Value>>
where N: TryInto<Uint<256>>, <N as TryInto<Uint<256>>>::Error: Debug + Display, BT: TryInto<BlockNumberOrTag>, <BT as TryInto<BlockNumberOrTag>>::Error: Debug + Display, RP: AsRef<[f64]>,

Returns transaction base fee per gas and effective priority fee per gas for the requested/supported block range.

Source

pub async fn eth_new_filter<F>( &mut self, filter: F, ) -> Result<Uint<256>, Error<String, Value>>
where F: TryInto<Filter>, <F as TryInto<Filter>>::Error: Debug + Display,

Returns transaction base fee per gas and effective priority fee per gas for the requested/supported block range.

Source

pub async fn eth_new_block_filter( &mut self, ) -> Result<Uint<256>, Error<String, Value>>

Creates new filter in the node,to notify when a new block arrives.

Source

pub async fn eth_new_pending_transaction_filter( &mut self, ) -> Result<Uint<256>, Error<String, Value>>

Creates new filter in the node,to notify when new pending transactions arrive.

Source

pub async fn eth_uninstall_filter<N>( &mut self, id: N, ) -> Result<bool, Error<String, Value>>
where N: TryInto<Uint<256>>, <N as TryInto<Uint<256>>>::Error: Debug + Display,

Uninstalls a filter with given id

Source

pub async fn eth_get_filter_changes<N>( &mut self, id: N, ) -> Result<Option<FilterEvents>, Error<String, Value>>
where N: TryInto<Uint<256>>, <N as TryInto<Uint<256>>>::Error: Debug + Display,

Polling method for a filter, which returns an arrya of logs which occurred since last poll

Source

pub async fn eth_get_filter_logs<N>( &mut self, id: N, ) -> Result<FilterEvents, Error<String, Value>>
where N: TryInto<Uint<256>>, <N as TryInto<Uint<256>>>::Error: Debug + Display,

Returns any arrays of all logs matching filter with given id

Source

pub async fn eth_get_logs<F>( &mut self, filter: F, ) -> Result<FilterEvents, Error<String, Value>>
where F: TryInto<Filter>, <F as TryInto<Filter>>::Error: Debug + Display,

Returns an array of all logs matching filter with filter description

Source

pub async fn eth_sign<A, M>( &mut self, address: A, message: M, ) -> Result<Eip1559Signature, Error<String, Value>>

Returns an EIP-191 signature over the provided data

Source

pub async fn eth_sign_transaction<T>( &mut self, transaction: T, ) -> Result<Bytes, Error<String, Value>>

Returns an RLP encoded transaction signed by the specified account.

Source

pub async fn eth_get_balance<A>( &mut self, address: A, ) -> Result<Uint<256>, Error<String, Value>>
where A: TryInto<Address>, <A as TryInto<Address>>::Error: Debug + Display,

Returns the balance of the account given address.

Source

pub async fn eth_get_transaction_count<A>( &mut self, address: A, ) -> Result<Uint<256>, Error<String, Value>>
where A: TryInto<Address>, <A as TryInto<Address>>::Error: Debug + Display,

Returns the number of transactions sent from an address

Source

pub async fn eth_send_raw_transaction<B>( &mut self, raw: B, ) -> Result<BytesM<32>, Error<String, Value>>
where B: TryInto<Bytes>, <B as TryInto<Bytes>>::Error: Debug + Display,

Submit a raw transaction.

Source

pub async fn eth_get_transaction_by_hash<H>( &mut self, tx_hash: H, ) -> Result<Option<Transaction>, Error<String, Value>>
where H: TryInto<BytesM<32>>, <H as TryInto<BytesM<32>>>::Error: Debug + Display,

Source

pub async fn eth_get_transaction_receipt<H>( &mut self, tx_hash: H, ) -> Result<Option<TransactionReceipt>, Error<String, Value>>
where H: TryInto<BytesM<32>>, <H as TryInto<BytesM<32>>>::Error: Debug + Display,

Returns the receipt of a transaction by transaction hash

Source§

impl Provider

Source

pub fn new(id: String, rpc_client: Client) -> Provider

Source

pub fn id(&self) -> &str

Source

pub fn client(&mut self) -> &mut Client

Get provider inner jsonrpc Client ref.

Trait Implementations§

Source§

impl Clone for Provider

Source§

fn clone(&self) -> Provider

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T