Trait alloy_zksync::provider::ZksyncProvider
source · pub trait ZksyncProvider<T = BoxTransport>: Provider<Zksync>where
T: Transport + Clone,{
Show 22 methods
// Provided methods
fn get_main_contract(&self) -> ProviderCall<NoParams, Address> { ... }
fn get_testnet_paymaster(&self) -> ProviderCall<NoParams, Option<Address>> { ... }
fn get_l1_chain_id(&self) -> ProviderCall<NoParams, U64> { ... }
fn get_l1_batch_number(&self) -> ProviderCall<NoParams, U64> { ... }
fn estimate_fee(
&self,
tx: TransactionRequest,
) -> ProviderCall<(TransactionRequest,), Eip712Fee> { ... }
fn estimate_gas_l1_to_l2(
&self,
tx: TransactionRequest,
) -> ProviderCall<(TransactionRequest,), U256> { ... }
fn get_bridgehub_contract(&self) -> ProviderCall<NoParams, Option<Address>> { ... }
fn get_bridge_contracts(&self) -> ProviderCall<NoParams, BridgeAddresses> { ... }
fn get_base_token_l1_address(&self) -> ProviderCall<NoParams, Address> { ... }
fn get_all_account_balances(
&self,
address: Address,
) -> ProviderCall<(Address,), HashMap<Address, U256>> { ... }
fn get_l2_to_l1_msg_proof(
&self,
block_number: u64,
sender: Address,
msg: B256,
l2_log_position: Option<usize>,
) -> ProviderCall<(u64, Address, B256, Option<usize>), Option<L2ToL1LogProof>> { ... }
fn get_l2_to_l1_log_proof(
&self,
tx_hash: B256,
l2_to_l1_log_index: Option<usize>,
) -> ProviderCall<(B256, Option<usize>), Option<L2ToL1LogProof>> { ... }
fn get_block_details(
&self,
block_number: u64,
) -> ProviderCall<(u64,), Option<BlockDetails>> { ... }
fn get_transaction_details(
&self,
tx_hash: B256,
) -> ProviderCall<(B256,), Option<TransactionDetails>> { ... }
fn get_raw_block_transactions(
&self,
block_number: u64,
) -> ProviderCall<(u64,), Vec<Transaction>> { ... }
fn get_l1_batch_details(
&self,
l1_batch_number: u64,
) -> ProviderCall<(u64,), Option<L1BatchDetails>> { ... }
fn get_bytecode_by_hash(
&self,
tx_hash: B256,
) -> ProviderCall<(B256,), Option<Bytes>> { ... }
fn get_l1_batch_block_range(
&self,
l1_batch_number: u64,
) -> ProviderCall<(u64,), Option<(U64, U64)>> { ... }
fn get_l1_gas_price(&self) -> ProviderCall<NoParams, U256> { ... }
fn get_fee_params(&self) -> ProviderCall<NoParams, FeeParams> { ... }
fn get_protocol_version(
&self,
version_id: Option<u16>,
) -> ProviderCall<(Option<u16>,), Option<ProtocolVersion>> { ... }
fn get_proof(
&self,
address: Address,
keys: Vec<B256>,
l1_batch_number: u64,
) -> ProviderCall<(Address, Vec<B256>, u64), Option<Proof>> { ... }
}
Expand description
ZKsync provider is an extension trait for the Provider
trait that adds ZKsync-specific methods.
This trait has a blanket implementation for any type that implements
Provider
trait. It means that it can be built using normal ProviderBuilder
by specifying the network generic parameter.
For convenience, you can use zksync_provider
function instead.
Provided Methods§
sourcefn get_main_contract(&self) -> ProviderCall<NoParams, Address>
fn get_main_contract(&self) -> ProviderCall<NoParams, Address>
Gets the address of the main ZKsync contract on L1.
sourcefn get_testnet_paymaster(&self) -> ProviderCall<NoParams, Option<Address>>
fn get_testnet_paymaster(&self) -> ProviderCall<NoParams, Option<Address>>
Gets the address of the testnet paymaster ZKsync contract on L2, if it’s present on the network.
sourcefn get_l1_chain_id(&self) -> ProviderCall<NoParams, U64>
fn get_l1_chain_id(&self) -> ProviderCall<NoParams, U64>
Gets the L1 Chain ID.
sourcefn get_l1_batch_number(&self) -> ProviderCall<NoParams, U64>
fn get_l1_batch_number(&self) -> ProviderCall<NoParams, U64>
Gets the latest L1 batch number.
sourcefn estimate_fee(
&self,
tx: TransactionRequest,
) -> ProviderCall<(TransactionRequest,), Eip712Fee>
fn estimate_fee( &self, tx: TransactionRequest, ) -> ProviderCall<(TransactionRequest,), Eip712Fee>
Estimates transaction gas for a transaction.
sourcefn estimate_gas_l1_to_l2(
&self,
tx: TransactionRequest,
) -> ProviderCall<(TransactionRequest,), U256>
fn estimate_gas_l1_to_l2( &self, tx: TransactionRequest, ) -> ProviderCall<(TransactionRequest,), U256>
Estimates the gas required for an L1 to L2 transaction.
sourcefn get_bridgehub_contract(&self) -> ProviderCall<NoParams, Option<Address>>
fn get_bridgehub_contract(&self) -> ProviderCall<NoParams, Option<Address>>
Retrieves the bridge hub contract address.
sourcefn get_bridge_contracts(&self) -> ProviderCall<NoParams, BridgeAddresses>
fn get_bridge_contracts(&self) -> ProviderCall<NoParams, BridgeAddresses>
Retrieves the addresses of canonical bridge contracts for ZKsync Era.
sourcefn get_base_token_l1_address(&self) -> ProviderCall<NoParams, Address>
fn get_base_token_l1_address(&self) -> ProviderCall<NoParams, Address>
Retrieves the L1 base token address.
sourcefn get_all_account_balances(
&self,
address: Address,
) -> ProviderCall<(Address,), HashMap<Address, U256>>
fn get_all_account_balances( &self, address: Address, ) -> ProviderCall<(Address,), HashMap<Address, U256>>
sourcefn get_l2_to_l1_msg_proof(
&self,
block_number: u64,
sender: Address,
msg: B256,
l2_log_position: Option<usize>,
) -> ProviderCall<(u64, Address, B256, Option<usize>), Option<L2ToL1LogProof>>
fn get_l2_to_l1_msg_proof( &self, block_number: u64, sender: Address, msg: B256, l2_log_position: Option<usize>, ) -> ProviderCall<(u64, Address, B256, Option<usize>), Option<L2ToL1LogProof>>
Retrieves the proof for an L2 to L1 message.
§Parameters
block_number
: the block number where the message was emitted.sender
: The sender of the message.msg
: The keccak256 hash of the sent message.l2_log_position
: Optional: The index in the block of the event that was emitted by the L1Messenger when submitting this message. If it is omitted, the proof for the first message is returned.
sourcefn get_l2_to_l1_log_proof(
&self,
tx_hash: B256,
l2_to_l1_log_index: Option<usize>,
) -> ProviderCall<(B256, Option<usize>), Option<L2ToL1LogProof>>
fn get_l2_to_l1_log_proof( &self, tx_hash: B256, l2_to_l1_log_index: Option<usize>, ) -> ProviderCall<(B256, Option<usize>), Option<L2ToL1LogProof>>
Retrieves the log proof for an L2 to L1 transaction.
§Parameters
tx_hash
: hash of the L2 transaction the L2 to L1 log was produced in.l2_to_l1_log_index
: Optional: The index of the L2 to L1 log in the transaction.
sourcefn get_block_details(
&self,
block_number: u64,
) -> ProviderCall<(u64,), Option<BlockDetails>>
fn get_block_details( &self, block_number: u64, ) -> ProviderCall<(u64,), Option<BlockDetails>>
Retrieves details for a given L2 block.
sourcefn get_transaction_details(
&self,
tx_hash: B256,
) -> ProviderCall<(B256,), Option<TransactionDetails>>
fn get_transaction_details( &self, tx_hash: B256, ) -> ProviderCall<(B256,), Option<TransactionDetails>>
Retrieves details for a given transaction.
sourcefn get_raw_block_transactions(
&self,
block_number: u64,
) -> ProviderCall<(u64,), Vec<Transaction>>
fn get_raw_block_transactions( &self, block_number: u64, ) -> ProviderCall<(u64,), Vec<Transaction>>
Lists transactions in a native encoding (e.g. that has more details, but does not adhere to the “common” Web3 Transaction interface).
sourcefn get_l1_batch_details(
&self,
l1_batch_number: u64,
) -> ProviderCall<(u64,), Option<L1BatchDetails>>
fn get_l1_batch_details( &self, l1_batch_number: u64, ) -> ProviderCall<(u64,), Option<L1BatchDetails>>
Retrieves details for a given L1 batch.
sourcefn get_bytecode_by_hash(
&self,
tx_hash: B256,
) -> ProviderCall<(B256,), Option<Bytes>>
fn get_bytecode_by_hash( &self, tx_hash: B256, ) -> ProviderCall<(B256,), Option<Bytes>>
Retrieves the bytecode of a transaction by its hash.
sourcefn get_l1_batch_block_range(
&self,
l1_batch_number: u64,
) -> ProviderCall<(u64,), Option<(U64, U64)>>
fn get_l1_batch_block_range( &self, l1_batch_number: u64, ) -> ProviderCall<(u64,), Option<(U64, U64)>>
Returns the range of blocks contained within a batch given by the batch number.
sourcefn get_l1_gas_price(&self) -> ProviderCall<NoParams, U256>
fn get_l1_gas_price(&self) -> ProviderCall<NoParams, U256>
Retrieves the current L1 gas price.
sourcefn get_fee_params(&self) -> ProviderCall<NoParams, FeeParams>
fn get_fee_params(&self) -> ProviderCall<NoParams, FeeParams>
Retrieves the current fee parameters.
sourcefn get_protocol_version(
&self,
version_id: Option<u16>,
) -> ProviderCall<(Option<u16>,), Option<ProtocolVersion>>
fn get_protocol_version( &self, version_id: Option<u16>, ) -> ProviderCall<(Option<u16>,), Option<ProtocolVersion>>
Gets the protocol version.
sourcefn get_proof(
&self,
address: Address,
keys: Vec<B256>,
l1_batch_number: u64,
) -> ProviderCall<(Address, Vec<B256>, u64), Option<Proof>>
fn get_proof( &self, address: Address, keys: Vec<B256>, l1_batch_number: u64, ) -> ProviderCall<(Address, Vec<B256>, u64), Option<Proof>>
Generates Merkle proofs for one or more storage values associated with a specific account, accompanied by a proof of their authenticity. It verifies that these values remain unaltered.
§Parameters
address
: account address to fetch storage values and proofs for.keys
: the keys in the account.l1_batch_number
: number of the L1 batch specifying the point in time at which the requested values are returned.
§Returns
The account details and proofs for storage keys.