clients

package
v0.0.0-...-63bf43c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxApproveAmount             = big.NewInt(0).Sub(big.NewInt(0).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(1))
	DefaultThreshold             = big.NewInt(0).Exp(big.NewInt(2), big.NewInt(255), nil)
	RecommendedDepositL2GasLimit = big.NewInt(10000000)
	DepositGasPerPubdataLimit    = big.NewInt(800)
)

Functions

This section is empty.

Types

type BaseClient

type BaseClient struct {
	// contains filtered or unexported fields
}

func (*BaseClient) AllAccountBalances

func (c *BaseClient) AllAccountBalances(ctx context.Context, address common.Address) (map[common.Address]*big.Int, error)

func (*BaseClient) BalanceAt

func (c *BaseClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

func (*BaseClient) BlockByHash

func (c *BaseClient) BlockByHash(ctx context.Context, hash common.Hash) (*zkTypes.Block, error)

func (*BaseClient) BlockByNumber

func (c *BaseClient) BlockByNumber(ctx context.Context, number *big.Int) (*zkTypes.Block, error)

func (*BaseClient) BlockDetails

func (c *BaseClient) BlockDetails(ctx context.Context, block uint32) (*zkTypes.BlockDetails, error)

func (*BaseClient) BlockNumber

func (c *BaseClient) BlockNumber(ctx context.Context) (uint64, error)

func (*BaseClient) BridgeContracts

func (c *BaseClient) BridgeContracts(ctx context.Context) (*zkTypes.BridgeContracts, error)

func (*BaseClient) CallContract

func (c *BaseClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*BaseClient) CallContractAtHash

func (c *BaseClient) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)

func (*BaseClient) CallContractAtHashL2

func (c *BaseClient) CallContractAtHashL2(ctx context.Context, msg zkTypes.CallMsg, blockHash common.Hash) ([]byte, error)

func (*BaseClient) CallContractL2

func (c *BaseClient) CallContractL2(ctx context.Context, msg zkTypes.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*BaseClient) ChainID

func (c *BaseClient) ChainID(ctx context.Context) (*big.Int, error)

func (*BaseClient) Client

func (c *BaseClient) Client() *rpc.Client

func (*BaseClient) Close

func (c *BaseClient) Close()

func (*BaseClient) CodeAt

func (c *BaseClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

func (*BaseClient) ConfirmedTokens deprecated

func (c *BaseClient) ConfirmedTokens(ctx context.Context, from uint32, limit uint8) ([]*zkTypes.Token, error)

Deprecated: Method is deprecated and will be removed in the near future.

func (*BaseClient) ContractAccountInfo

func (c *BaseClient) ContractAccountInfo(ctx context.Context, address common.Address) (*zkTypes.ContractAccountInfo, error)

func (*BaseClient) EstimateFee

func (c *BaseClient) EstimateFee(ctx context.Context, msg zkTypes.CallMsg) (*zkTypes.Fee, error)

func (*BaseClient) EstimateGas

func (c *BaseClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)

func (*BaseClient) EstimateGasL1

func (c *BaseClient) EstimateGasL1(ctx context.Context, msg zkTypes.CallMsg) (uint64, error)

func (*BaseClient) EstimateGasL2

func (c *BaseClient) EstimateGasL2(ctx context.Context, msg zkTypes.CallMsg) (uint64, error)

func (*BaseClient) EstimateGasTransfer

func (c *BaseClient) EstimateGasTransfer(ctx context.Context, msg TransferCallMsg) (uint64, error)

func (*BaseClient) EstimateGasWithdraw

func (c *BaseClient) EstimateGasWithdraw(ctx context.Context, msg WithdrawalCallMsg) (uint64, error)

func (*BaseClient) EstimateL1ToL2Execute

func (c *BaseClient) EstimateL1ToL2Execute(ctx context.Context, msg zkTypes.CallMsg) (uint64, error)

func (*BaseClient) FilterLogs

func (c *BaseClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

func (*BaseClient) FilterLogsL2

func (c *BaseClient) FilterLogsL2(ctx context.Context, q ethereum.FilterQuery) ([]zkTypes.Log, error)

func (*BaseClient) HeaderByHash

func (c *BaseClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*BaseClient) HeaderByNumber

func (c *BaseClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

func (*BaseClient) L1BatchBlockRange

func (c *BaseClient) L1BatchBlockRange(ctx context.Context, l1BatchNumber *big.Int) (*BlockRange, error)

func (*BaseClient) L1BatchDetails

func (c *BaseClient) L1BatchDetails(ctx context.Context, l1BatchNumber *big.Int) (*zkTypes.BatchDetails, error)

func (*BaseClient) L1BatchNumber

func (c *BaseClient) L1BatchNumber(ctx context.Context) (*big.Int, error)

func (*BaseClient) L1ChainID

func (c *BaseClient) L1ChainID(ctx context.Context) (*big.Int, error)

func (*BaseClient) L1TokenAddress

func (c *BaseClient) L1TokenAddress(ctx context.Context, token common.Address) (common.Address, error)

func (*BaseClient) L2TokenAddress

func (c *BaseClient) L2TokenAddress(ctx context.Context, token common.Address) (common.Address, error)

func (*BaseClient) L2TransactionFromPriorityOp

func (c *BaseClient) L2TransactionFromPriorityOp(ctx context.Context, l1TxReceipt *types.Receipt) (*zkTypes.TransactionResponse, error)

func (*BaseClient) LogProof

func (c *BaseClient) LogProof(ctx context.Context, txHash common.Hash, logIndex int) (*zkTypes.MessageProof, error)

func (*BaseClient) MainContractAddress

func (c *BaseClient) MainContractAddress(ctx context.Context) (common.Address, error)

func (*BaseClient) MsgProof deprecated

func (c *BaseClient) MsgProof(ctx context.Context, block uint32, sender common.Address, msg common.Hash) (*zkTypes.MessageProof, error)

Deprecated: Endpoint will be deprecated in favor of LogProof

func (*BaseClient) NetworkID

func (c *BaseClient) NetworkID(ctx context.Context) (*big.Int, error)

func (*BaseClient) NonceAt

func (c *BaseClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

func (*BaseClient) PeerCount

func (c *BaseClient) PeerCount(ctx context.Context) (uint64, error)

func (*BaseClient) PendingBalanceAt

func (c *BaseClient) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

func (*BaseClient) PendingCallContract

func (c *BaseClient) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)

func (*BaseClient) PendingCallContractL2

func (c *BaseClient) PendingCallContractL2(ctx context.Context, msg zkTypes.CallMsg) ([]byte, error)

func (*BaseClient) PendingCodeAt

func (c *BaseClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*BaseClient) PendingNonceAt

func (c *BaseClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*BaseClient) PendingStorageAt

func (c *BaseClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)

func (*BaseClient) PendingTransactionCount

func (c *BaseClient) PendingTransactionCount(ctx context.Context) (uint, error)

func (*BaseClient) SendRawTransaction

func (c *BaseClient) SendRawTransaction(ctx context.Context, tx []byte) (common.Hash, error)

func (*BaseClient) SendTransaction

func (c *BaseClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*BaseClient) StorageAt

func (c *BaseClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)

func (*BaseClient) SubscribeFilterLogs

func (c *BaseClient) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*BaseClient) SubscribeFilterLogsL2

func (c *BaseClient) SubscribeFilterLogsL2(ctx context.Context, query ethereum.FilterQuery, ch chan<- zkTypes.Log) (ethereum.Subscription, error)

func (*BaseClient) SubscribeNewHead

func (c *BaseClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

func (*BaseClient) SuggestGasPrice

func (c *BaseClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*BaseClient) SuggestGasTipCap

func (c *BaseClient) SuggestGasTipCap(_ context.Context) (*big.Int, error)

func (*BaseClient) SyncProgress

func (c *BaseClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)

func (*BaseClient) TestnetPaymaster

func (c *BaseClient) TestnetPaymaster(ctx context.Context) (common.Address, error)

func (*BaseClient) TokenPrice deprecated

func (c *BaseClient) TokenPrice(ctx context.Context, address common.Address) (*big.Float, error)

Deprecated: Method is deprecated and will be removed in the near future.

func (*BaseClient) TransactionByHash

func (c *BaseClient) TransactionByHash(ctx context.Context, hash common.Hash) (tx *zkTypes.TransactionResponse, isPending bool, err error)

func (*BaseClient) TransactionCount

func (c *BaseClient) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

func (*BaseClient) TransactionDetails

func (c *BaseClient) TransactionDetails(ctx context.Context, txHash common.Hash) (*zkTypes.TransactionDetails, error)

func (*BaseClient) TransactionInBlock

func (c *BaseClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*zkTypes.TransactionResponse, error)

func (*BaseClient) TransactionReceipt

func (c *BaseClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*zkTypes.Receipt, error)

func (*BaseClient) TransactionSender

func (c *BaseClient) TransactionSender(ctx context.Context, tx *zkTypes.TransactionResponse, block common.Hash, index uint) (common.Address, error)

func (*BaseClient) WaitFinalized

func (c *BaseClient) WaitFinalized(ctx context.Context, txHash common.Hash) (*zkTypes.Receipt, error)

func (*BaseClient) WaitMined

func (c *BaseClient) WaitMined(ctx context.Context, txHash common.Hash) (*zkTypes.Receipt, error)

type BlockRange

type BlockRange struct {
	Beginning *big.Int `json:"beginning"` // Starting block number of the range.
	End       *big.Int `json:"end"`       // Ending block number of the range.
}

BlockRange represents a range of blocks with the starting and ending block numbers.

func (*BlockRange) UnmarshalJSON

func (r *BlockRange) UnmarshalJSON(input []byte) error

type Client

type Client interface {
	EthereumClient
	ZkSyncEraClient
}

Client defines both ethereum and zkSync Era RPC methods and common features.

func Dial

func Dial(rawUrl string) (Client, error)

Dial connects a client to the given URL.

func DialContext

func DialContext(ctx context.Context, rawUrl string) (Client, error)

DialContext connects a client to the given URL with context.

func NewClient

func NewClient(c *rpc.Client) Client

NewClient creates a client that uses the given RPC client.

type DefaultEthProvider deprecated

type DefaultEthProvider struct {
	// contains filtered or unexported fields
}

Deprecated: Deprecated in favor of accounts.Wallet.

func NewDefaultEthProvider deprecated

func NewDefaultEthProvider(rpcClient *rpc.Client, auth *bind.TransactOpts,
	mainContractAddress, l1ERC20BridgeAddress common.Address) (*DefaultEthProvider, error)

Deprecated: Will be removed in the future releases.

func (*DefaultEthProvider) ApproveDeposit deprecated

func (p *DefaultEthProvider) ApproveDeposit(token *zkTypes.Token, limit *big.Int, options *GasOptions) (*types.Transaction, error)

Deprecated: Deprecated in favor of accounts.Wallet.ApproveDeposit.

func (*DefaultEthProvider) ClaimFailedDeposit deprecated

func (p *DefaultEthProvider) ClaimFailedDeposit(l1BridgeAddress common.Address, depositSender common.Address,
	l1Token common.Address, l2TxHash common.Hash, l2BlockNumber *big.Int, l2MessageIndex *big.Int,
	l2TxNumberInBlock *big.Int, proof []common.Hash, options *GasOptions) (*types.Transaction, error)

Deprecated: Deprecated in favor of accounts.Wallet.ClaimFailedDeposit.

func (*DefaultEthProvider) Deposit deprecated

func (p *DefaultEthProvider) Deposit(token *zkTypes.Token, amount *big.Int, address common.Address, options *GasOptions) (*types.Transaction, error)

Deprecated: Deprecated in favor of accounts.Wallet.Deposit.

func (*DefaultEthProvider) FinalizeEthWithdrawal deprecated

func (p *DefaultEthProvider) FinalizeEthWithdrawal(l2BlockNumber *big.Int, l2MessageIndex *big.Int,
	l2TxNumberInBlock *big.Int, message []byte, proof []common.Hash, options *GasOptions) (*types.Transaction, error)

Deprecated: Deprecated in favor of accounts.Wallet.FinalizeEthWithdrawal.

func (*DefaultEthProvider) FinalizeWithdrawal deprecated

func (p *DefaultEthProvider) FinalizeWithdrawal(l1BridgeAddress common.Address, l2BlockNumber *big.Int, l2MessageIndex *big.Int,
	l2TxNumberInBlock *big.Int, message []byte, proof []common.Hash, options *GasOptions) (*types.Transaction, error)

Deprecated: Deprecated in favor of accounts.Wallet.FinalizeWithdrawal.

func (*DefaultEthProvider) GetAddress deprecated

func (p *DefaultEthProvider) GetAddress() common.Address

Deprecated: Will be removed in the future releases.

func (*DefaultEthProvider) GetBaseCost deprecated

func (p *DefaultEthProvider) GetBaseCost(l2GasLimit *big.Int, l2GasPerPubdataByteLimit *big.Int, gasPrice *big.Int) (*big.Int, error)

Deprecated: Deprecated in favor of accounts.Wallet.GetBaseCost.

func (*DefaultEthProvider) GetClient deprecated

func (p *DefaultEthProvider) GetClient() *ethclient.Client

Deprecated: Will be removed in the future releases.

func (*DefaultEthProvider) GetL2HashFromPriorityOp deprecated

func (p *DefaultEthProvider) GetL2HashFromPriorityOp(l1Receipt *types.Receipt) (common.Hash, error)

Deprecated: Deprecated in favor of accounts.Wallet.GetL2HashFromPriorityOp.

func (*DefaultEthProvider) IsDepositApproved deprecated

func (p *DefaultEthProvider) IsDepositApproved(token *zkTypes.Token, to common.Address, threshold *big.Int) (bool, error)

Deprecated: Deprecated in favor of accounts.Wallet.IsDepositApproved.

func (*DefaultEthProvider) IsEthWithdrawalFinalized deprecated

func (p *DefaultEthProvider) IsEthWithdrawalFinalized(l2BlockNumber *big.Int, l2MessageIndex *big.Int) (bool, error)

Deprecated: Deprecated in favor of accounts.Wallet.IsEthWithdrawalFinalized.

func (*DefaultEthProvider) IsWithdrawalFinalized deprecated

func (p *DefaultEthProvider) IsWithdrawalFinalized(l1BridgeAddress common.Address, l2BlockNumber *big.Int,
	l2MessageIndex *big.Int) (bool, error)

Deprecated: Deprecated in favor of accounts.Wallet.IsWithdrawalFinalized.

func (*DefaultEthProvider) RequestExecute deprecated

func (p *DefaultEthProvider) RequestExecute(contractL2 common.Address, l2Value *big.Int, calldata []byte,
	l2GasLimit *big.Int, l2GasPerPubdataByteLimit *big.Int,
	factoryDeps [][]byte, refundRecipient common.Address, auth *bind.TransactOpts) (*types.Transaction, error)

Deprecated: Deprecated in favor of accounts.Wallet.RequestExecute.

func (*DefaultEthProvider) WaitMined deprecated

func (p *DefaultEthProvider) WaitMined(ctx context.Context, txHash common.Hash) (*types.Transaction, error)

Deprecated: Deprecated in favor of accounts.Wallet.WaitMined.

type DefaultProvider deprecated

type DefaultProvider struct {

	// also inherit default Ethereum clients
	*ethclient.Client
	// contains filtered or unexported fields
}

Deprecated: Interface is deprecated in favor of BaseClient.

func NewDefaultProvider deprecated

func NewDefaultProvider(rawUrl string) (*DefaultProvider, error)

Deprecated: Interface is deprecated in favor of NewClient.

func (*DefaultProvider) EstimateGas deprecated

func (p *DefaultProvider) EstimateGas(_ context.Context, call ethereum.CallMsg) (uint64, error)

Deprecated: Deprecated in favor of BaseClient.EstimateGas.

func (*DefaultProvider) EstimateGas712 deprecated

func (p *DefaultProvider) EstimateGas712(tx *zkTypes.Transaction) (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.EstimateGasL2.

func (*DefaultProvider) EstimateGasL1 deprecated

func (p *DefaultProvider) EstimateGasL1(tx *zkTypes.Transaction) (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.EstimateGasL1.

func (*DefaultProvider) EstimateL1ToL2Execute deprecated

func (p *DefaultProvider) EstimateL1ToL2Execute(tx *zkTypes.Transaction) (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.EstimateL1ToL2Execute.

func (*DefaultProvider) GetBalance deprecated

func (p *DefaultProvider) GetBalance(address common.Address, blockNumber zkTypes.BlockNumber) (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.BalanceAt.

func (*DefaultProvider) GetBlockByHash deprecated

func (p *DefaultProvider) GetBlockByHash(blockHash common.Hash) (*zkTypes.Block, error)

Deprecated: Deprecated in favor of BaseClient.BlockByHash.

func (*DefaultProvider) GetBlockByNumber deprecated

func (p *DefaultProvider) GetBlockByNumber(blockNumber zkTypes.BlockNumber) (*zkTypes.Block, error)

Deprecated: Deprecated in favor of BaseClient.BlockByNumber.

func (*DefaultProvider) GetClient deprecated

func (p *DefaultProvider) GetClient() *ethclient.Client

Deprecated: Will be removed in the future releases.

func (*DefaultProvider) GetGasPrice deprecated

func (p *DefaultProvider) GetGasPrice() (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.SuggestGasPrice.

func (*DefaultProvider) GetL1BatchBlockRange deprecated

func (p *DefaultProvider) GetL1BatchBlockRange(l1BatchNumber *big.Int) (*BlockRange, error)

Deprecated: Deprecated in favor of BaseClient.L1BatchBlockRange.

func (*DefaultProvider) GetL1BatchDetails deprecated

func (p *DefaultProvider) GetL1BatchDetails(l1BatchNumber *big.Int) (*zkTypes.BatchDetails, error)

Deprecated: Deprecated in favor of BaseClient.L1BatchDetails.

func (*DefaultProvider) GetLogs deprecated

func (p *DefaultProvider) GetLogs(q zkTypes.FilterQuery) ([]zkTypes.Log, error)

Deprecated: Deprecated in favor of BaseClient.FilterLogsL2.

func (*DefaultProvider) GetTransaction deprecated

func (p *DefaultProvider) GetTransaction(txHash common.Hash) (*zkTypes.TransactionResponse, error)

Deprecated: Deprecated in favor of BaseClient.TransactionByHash.

func (*DefaultProvider) GetTransactionCount deprecated

func (p *DefaultProvider) GetTransactionCount(address common.Address, blockNumber zkTypes.BlockNumber) (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.TransactionCount.

func (*DefaultProvider) GetTransactionDetails deprecated

func (p *DefaultProvider) GetTransactionDetails(txHash common.Hash) (*zkTypes.TransactionDetails, error)

Deprecated: Deprecated in favor of BaseClient.TransactionDetails.

func (*DefaultProvider) GetTransactionReceipt deprecated

func (p *DefaultProvider) GetTransactionReceipt(txHash common.Hash) (*zkTypes.TransactionReceipt, error)

Deprecated: Deprecated in favor of BaseClient.TransactionReceipt.

func (*DefaultProvider) L1TokenAddress deprecated

func (p *DefaultProvider) L1TokenAddress(token common.Address) (common.Address, error)

Deprecated: Deprecated in favor of BaseClient.L1TokenAddress.

func (*DefaultProvider) L2TokenAddress deprecated

func (p *DefaultProvider) L2TokenAddress(token common.Address) (common.Address, error)

Deprecated: Deprecated in favor of BaseClient.L2TokenAddress.

func (*DefaultProvider) SendRawTransaction deprecated

func (p *DefaultProvider) SendRawTransaction(tx []byte) (common.Hash, error)

Deprecated: Deprecated in favor of BaseClient.SendRawTransaction.

func (*DefaultProvider) SuggestGasTipCap deprecated

func (p *DefaultProvider) SuggestGasTipCap(_ context.Context) (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.SuggestGasTipCap.

func (*DefaultProvider) WaitFinalized deprecated

func (p *DefaultProvider) WaitFinalized(ctx context.Context, txHash common.Hash) (*zkTypes.TransactionReceipt, error)

Deprecated: Deprecated in favor of BaseClient.WaitFinalized.

func (*DefaultProvider) WaitMined deprecated

func (p *DefaultProvider) WaitMined(ctx context.Context, txHash common.Hash) (*zkTypes.TransactionReceipt, error)

Deprecated: Deprecated in favor of BaseClient.WaitMined.

func (*DefaultProvider) ZksEstimateFee deprecated

func (p *DefaultProvider) ZksEstimateFee(tx *zkTypes.Transaction) (*zkTypes.Fee, error)

Deprecated: Deprecated in favor of BaseClient.EstimateFee.

func (*DefaultProvider) ZksGetAllAccountBalances deprecated

func (p *DefaultProvider) ZksGetAllAccountBalances(address common.Address) (map[common.Address]*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.AllAccountBalances.

func (*DefaultProvider) ZksGetBlockDetails deprecated

func (p *DefaultProvider) ZksGetBlockDetails(block uint32) (*zkTypes.BlockDetails, error)

Deprecated: Deprecated in favor of BaseClient.BlockDetails.

func (*DefaultProvider) ZksGetBridgeContracts deprecated

func (p *DefaultProvider) ZksGetBridgeContracts() (*zkTypes.BridgeContracts, error)

Deprecated: Deprecated in favor of BaseClient.BridgeContracts.

func (*DefaultProvider) ZksGetConfirmedTokens deprecated

func (p *DefaultProvider) ZksGetConfirmedTokens(from uint32, limit uint8) ([]*zkTypes.Token, error)

Deprecated: Deprecated in favor of BaseClient.ConfirmedTokens.

func (*DefaultProvider) ZksGetL2ToL1LogProof deprecated

func (p *DefaultProvider) ZksGetL2ToL1LogProof(txHash common.Hash, logIndex int) (*zkTypes.MessageProof, error)

Deprecated: Deprecated in favor of BaseClient.LogProof.

func (*DefaultProvider) ZksGetL2ToL1MsgProof deprecated

func (p *DefaultProvider) ZksGetL2ToL1MsgProof(block uint32, sender common.Address, msg common.Hash) (*zkTypes.MessageProof, error)

Deprecated: Deprecated in favor of ZksGetL2ToL1LogProof.

func (*DefaultProvider) ZksGetMainContract deprecated

func (p *DefaultProvider) ZksGetMainContract() (common.Address, error)

Deprecated: Deprecated in favor of BaseClient.MainContractAddress.

func (*DefaultProvider) ZksGetTestnetPaymaster deprecated

func (p *DefaultProvider) ZksGetTestnetPaymaster() (common.Address, error)

Deprecated: Deprecated in favor of BaseClient.TestnetPaymaster.

func (*DefaultProvider) ZksGetTokenPrice deprecated

func (p *DefaultProvider) ZksGetTokenPrice(address common.Address) (*big.Float, error)

Deprecated: Deprecated in favor of BaseClient.TokenPrice.

func (*DefaultProvider) ZksIsTokenLiquid deprecated

func (p *DefaultProvider) ZksIsTokenLiquid(address common.Address) (bool, error)

Deprecated: Deprecated in favor of BaseClient.IsTokenLiquid.

func (*DefaultProvider) ZksL1BatchNumber deprecated

func (p *DefaultProvider) ZksL1BatchNumber() (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.L1BatchNumber.

func (*DefaultProvider) ZksL1ChainId deprecated

func (p *DefaultProvider) ZksL1ChainId() (*big.Int, error)

Deprecated: Deprecated in favor of BaseClient.L1ChainID.

type EthProvider deprecated

type EthProvider interface {
	GetClient() *ethclient.Client
	GetAddress() common.Address
	ApproveDeposit(token *zkTypes.Token, limit *big.Int, options *GasOptions) (*types.Transaction, error)
	IsDepositApproved(token *zkTypes.Token, to common.Address, threshold *big.Int) (bool, error)
	Deposit(token *zkTypes.Token, amount *big.Int, address common.Address, options *GasOptions) (*types.Transaction, error)
	RequestExecute(contractL2 common.Address, l2Value *big.Int, calldata []byte,
		l2GasLimit *big.Int, l2GasPerPubdataByteLimit *big.Int,
		factoryDeps [][]byte, refundRecipient common.Address, auth *bind.TransactOpts) (*types.Transaction, error)
	FinalizeEthWithdrawal(l2BlockNumber *big.Int, l2MessageIndex *big.Int, l2TxNumberInBlock *big.Int,
		message []byte, proof []common.Hash, options *GasOptions) (*types.Transaction, error)
	FinalizeWithdrawal(l1BridgeAddress common.Address, l2BlockNumber *big.Int, l2MessageIndex *big.Int,
		l2TxNumberInBlock *big.Int, message []byte, proof []common.Hash, options *GasOptions) (*types.Transaction, error)
	IsEthWithdrawalFinalized(l2BlockNumber *big.Int, l2MessageIndex *big.Int) (bool, error)
	IsWithdrawalFinalized(l1BridgeAddress common.Address, l2BlockNumber *big.Int, l2MessageIndex *big.Int) (bool, error)
	ClaimFailedDeposit(l1BridgeAddress common.Address, depositSender common.Address,
		l1Token common.Address, l2TxHash common.Hash, l2BlockNumber *big.Int, l2MessageIndex *big.Int,
		l2TxNumberInBlock *big.Int, proof []common.Hash, options *GasOptions) (*types.Transaction, error)
	GetL2HashFromPriorityOp(l1Receipt *types.Receipt) (common.Hash, error)
	GetBaseCost(l2GasLimit *big.Int, l2GasPerPubdataByteLimit *big.Int, gasPrice *big.Int) (*big.Int, error)
	WaitMined(ctx context.Context, txHash common.Hash) (*types.Transaction, error)
}

Deprecated: Deprecated in favor of accounts.AdapterL1.

type EthereumClient

type EthereumClient interface {
	// Client gets the underlying RPC client.
	Client() *rpc.Client
	// Close closes the underlying RPC connection.
	Close()

	// ChainID retrieves the current chain ID for transaction replay protection.
	ChainID(ctx context.Context) (*big.Int, error)
	// BlockByHash returns the given full block.
	//
	// Note that loading full blocks requires two requests. Use HeaderByHash
	// if you don't need all transactions or uncle headers.
	BlockByHash(ctx context.Context, hash common.Hash) (*zkTypes.Block, error)
	// BlockByNumber returns a block from the current canonical chain. If number is nil, the
	// latest known block is returned.
	//
	// Note that loading full blocks requires two requests. Use HeaderByNumber
	// if you don't need all transactions or uncle headers.
	BlockByNumber(ctx context.Context, number *big.Int) (*zkTypes.Block, error)
	// BlockNumber returns the most recent block number
	BlockNumber(ctx context.Context) (uint64, error)
	// PeerCount returns the number of p2p peers as reported by the net_peerCount method
	PeerCount(ctx context.Context) (uint64, error)
	// HeaderByHash returns the block header with the given hash.
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	// HeaderByNumber returns a block header from the current canonical chain. If number is
	// nil, the latest known header is returned.
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	// TransactionByHash returns the transaction with the given hash.
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *zkTypes.TransactionResponse, isPending bool, err error)
	// TransactionSender returns the sender address of the given transaction. The transaction
	// must be known to the remote node and included in the blockchain at the given block and
	// index. The sender is the one derived by the protocol at the time of inclusion.
	TransactionSender(ctx context.Context, tx *zkTypes.TransactionResponse, block common.Hash, index uint) (common.Address, error)
	// TransactionCount returns the total number of transactions in the given block.
	TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
	// TransactionInBlock returns a single transaction at index in the given block.
	TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*zkTypes.TransactionResponse, error)
	// TransactionReceipt returns the receipt of a transaction by transaction hash.
	// Note that the receipt is not available for pending transactions.
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*zkTypes.Receipt, error)
	// SyncProgress retrieves the current progress of the sync algorithm. If there's
	// no sync currently running, it returns nil.
	SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
	// SubscribeNewHead subscribes to notifications about the current blockchain head
	// on the given channel.
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

	// NetworkID returns the network ID for this client.
	NetworkID(ctx context.Context) (*big.Int, error)
	// BalanceAt returns the wei balance of the given account.
	// The block number can be nil, in which case the balance is taken from the latest known block.
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
	// StorageAt returns the value of key in the contract storage of the given account.
	// The block number can be nil, in which case the value is taken from the latest known block.
	StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
	// CodeAt returns the contract code of the given account.
	// The block number can be nil, in which case the code is taken from the latest known block.
	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
	// NonceAt returns the account nonce of the given account.
	// The block number can be nil, in which case the nonce is taken from the latest known block.
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

	// FilterLogs performs the same function as FilterLogsL2, and that method should be used instead.
	// This method is designed to be compatible with bind.ContractBackend.
	FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
	// FilterLogsL2 executes a log filter operation, blocking during execution and
	// returning all the results in one batch.
	FilterLogsL2(ctx context.Context, query ethereum.FilterQuery) ([]zkTypes.Log, error)
	// SubscribeFilterLogs performs the same function as SubscribeFilterLogsL2, and that method should be used instead.
	// This method is designed to be compatible with bind.ContractBackend.
	SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
	// SubscribeFilterLogsL2 creates a background log filtering operation, returning
	// a subscription immediately, which can be used to stream the found events.
	SubscribeFilterLogsL2(ctx context.Context, query ethereum.FilterQuery, ch chan<- zkTypes.Log) (ethereum.Subscription, error)

	// PendingBalanceAt returns the wei balance of the given account in the pending state.
	PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
	// PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
	PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
	// PendingCodeAt returns the contract code of the given account in the pending state.
	PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
	// PendingNonceAt returns the account nonce of the given account in the pending state.
	// This is the nonce that should be used for the next transaction.
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
	// PendingTransactionCount returns the total number of transactions in the pending state.
	PendingTransactionCount(ctx context.Context) (uint, error)

	// CallContract executes a message call transaction, which is directly executed in the VM
	// of the node, but never mined into the blockchain.
	//
	// blockNumber selects the block height at which the call runs. It can be nil, in which
	// case the code is taken from the latest known block. Note that state from very old
	// blocks might not be available.
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	// CallContractL2 is almost the same as CallContract except that it executes a message call
	// for EIP-712 transaction.
	CallContractL2(ctx context.Context, msg zkTypes.CallMsg, blockNumber *big.Int) ([]byte, error)
	// CallContractAtHash is almost the same as CallContract except that it selects
	// the block by block hash instead of block height.
	CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
	// CallContractAtHashL2 is almost the same as CallContractL2 except that it selects
	// the block by block hash instead of block height.
	CallContractAtHashL2(ctx context.Context, msg zkTypes.CallMsg, blockHash common.Hash) ([]byte, error)
	// PendingCallContract executes a message call transaction using the EVM.
	// The state seen by the contract call is the pending state.
	PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
	// PendingCallContractL2 executes a message call for EIP-712 transaction using the EVM.
	// The state seen by the contract call is the pending state.
	PendingCallContractL2(ctx context.Context, msg zkTypes.CallMsg) ([]byte, error)
	// SuggestGasPrice retrieves the currently suggested gas price to allow a timely
	// execution of a transaction.
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	// SuggestGasTipCap retrieves the currently suggested gas tip cap after 1559 to
	// allow a timely execution of a transaction.
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)
	// EstimateGas tries to estimate the gas needed to execute a transaction based on
	// the current pending state of the backend blockchain. There is no guarantee that this is
	// the true gas limit requirement as other transactions may be added or removed by miners,
	// but it should provide a basis for setting a reasonable default.
	EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
	// EstimateGasL2 is almost the same as EstimateGas except that it executes an EIP-712 transaction.
	EstimateGasL2(ctx context.Context, msg zkTypes.CallMsg) (uint64, error)
	// SendTransaction injects a signed transaction into the pending pool for execution.
	//
	// If the transaction was a contract creation use the TransactionReceipt method to get the
	// contract address after the transaction has been mined.
	SendTransaction(ctx context.Context, tx *types.Transaction) error
	// SendRawTransaction injects a signed raw transaction into the pending pool for execution.
	SendRawTransaction(ctx context.Context, tx []byte) (common.Hash, error)

	// WaitMined waits for tx to be mined on the blockchain.
	// It stops waiting when the context is canceled.
	WaitMined(ctx context.Context, txHash common.Hash) (*zkTypes.Receipt, error)
	// WaitFinalized waits for tx to be finalized on the blockchain.
	// It stops waiting when the context is canceled.
	WaitFinalized(ctx context.Context, txHash common.Hash) (*zkTypes.Receipt, error)
}

EthereumClient provides Ethereum RPC methods on zkSync Era node, ones that has `eth_` prefix. Interface contains same methods as ethclient.Client except for FeeHistory method. Additionally, it has extra methods capable of working with EIP-712 transactions. It is designed to be compatible with bind.ContractBackend interface, enabling support for smart contracts generated using the abigen tool. Some types of function parameters and return values are different from original geth library because are not compatible with zkSync Era node and are adjusted accordingly.

type EthereumProvider deprecated

type EthereumProvider interface {
	// Close closes the underlying RPC connection.
	Close()

	// ChainID retrieves the current chain ID for transaction replay protection.
	ChainID(ctx context.Context) (*big.Int, error)
	// BlockByHash returns the given full block.
	//
	// Note that loading full blocks requires two requests. Use HeaderByHash
	// if you don't need all transactions or uncle headers.
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
	// BlockByNumber returns a block from the current canonical chain. If number is nil, the
	// latest known block is returned.
	//
	// Note that loading full blocks requires two requests. Use HeaderByNumber
	// if you don't need all transactions or uncle headers.
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	// BlockNumber returns the most recent block number
	BlockNumber(ctx context.Context) (uint64, error)
	// PeerCount returns the number of p2p peers as reported by the net_peerCount method
	PeerCount(ctx context.Context) (uint64, error)
	// HeaderByHash returns the block header with the given hash.
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	// HeaderByNumber returns a block header from the current canonical chain. If number is
	// nil, the latest known header is returned.
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	// TransactionByHash returns the transaction with the given hash.
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	// TransactionSender returns the sender address of the given transaction. The transaction
	// must be known to the remote node and included in the blockchain at the given block and
	// index. The sender is the one derived by the protocol at the time of inclusion.
	//
	// There is a fast-path for transactions retrieved by TransactionByHash and
	// TransactionInBlock. Getting their sender address can be done without an RPC interaction.
	TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
	// TransactionCount returns the total number of transactions in the given block.
	TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
	// TransactionInBlock returns a single transaction at index in the given block.
	TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
	// TransactionReceipt returns the receipt of a transaction by transaction hash.
	// Note that the receipt is not available for pending transactions.
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	// SyncProgress retrieves the current progress of the sync algorithm. If there's
	// no sync currently running, it returns nil.
	SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
	// SubscribeNewHead subscribes to notifications about the current blockchain head
	// on the given channel.
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

	// NetworkID returns the network ID for this client.
	NetworkID(ctx context.Context) (*big.Int, error)
	// BalanceAt returns the wei balance of the given account.
	// The block number can be nil, in which case the balance is taken from the latest known block.
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
	// StorageAt returns the value of key in the contract storage of the given account.
	// The block number can be nil, in which case the value is taken from the latest known block.
	StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
	// CodeAt returns the contract code of the given account.
	// The block number can be nil, in which case the code is taken from the latest known block.
	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
	// NonceAt returns the account nonce of the given account.
	// The block number can be nil, in which case the nonce is taken from the latest known block.
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

	// FilterLogs executes a log filter operation, blocking during execution and
	// returning all the results in one batch.
	FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
	// SubscribeFilterLogs creates a background log filtering operation, returning
	// a subscription immediately, which can be used to stream the found events.
	SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

	// PendingBalanceAt returns the wei balance of the given account in the pending state.
	PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
	// PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
	PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
	// PendingCodeAt returns the contract code of the given account in the pending state.
	PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
	// PendingNonceAt returns the account nonce of the given account in the pending state.
	// This is the nonce that should be used for the next transaction.
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
	// PendingTransactionCount returns the total number of transactions in the pending state.
	PendingTransactionCount(ctx context.Context) (uint, error)

	// CallContract executes a message call transaction, which is directly executed in the VM
	// of the node, but never mined into the blockchain.
	//
	// blockNumber selects the block height at which the call runs. It can be nil, in which
	// case the code is taken from the latest known block. Note that state from very old
	// blocks might not be available.
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	// CallContractAtHash is almost the same as CallContract except that it selects
	// the block by block hash instead of block height.
	CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
	// PendingCallContract executes a message call transaction using the EVM.
	// The state seen by the contract call is the pending state.
	PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
	// SuggestGasPrice retrieves the currently suggested gas price to allow a timely
	// execution of a transaction.
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	// SuggestGasTipCap retrieves the currently suggested gas tip cap after 1559 to
	// allow a timely execution of a transaction.
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)
	// FeeHistory retrieves the fee market history.
	FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)
	// EstimateGas tries to estimate the gas needed to execute a specific transaction based on
	// the current pending state of the backend blockchain. There is no guarantee that this is
	// the true gas limit requirement as other transactions may be added or removed by miners,
	// but it should provide a basis for setting a reasonable default.
	EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
	// SendTransaction injects a signed transaction into the pending pool for execution.
	//
	// If the transaction was a contract creation use the TransactionReceipt method to get the
	// contract address after the transaction has been mined.
	SendTransaction(ctx context.Context, tx *types.Transaction) error

	GetClient() *ethclient.Client
	GetBalance(address common.Address, blockNumber zkTypes.BlockNumber) (*big.Int, error)
	GetBlockByNumber(blockNumber zkTypes.BlockNumber) (*zkTypes.Block, error)
	GetBlockByHash(blockHash common.Hash) (*zkTypes.Block, error)
	GetTransactionCount(address common.Address, blockNumber zkTypes.BlockNumber) (*big.Int, error)
	GetTransactionReceipt(txHash common.Hash) (*zkTypes.TransactionReceipt, error)
	GetTransaction(txHash common.Hash) (*zkTypes.TransactionResponse, error)
	WaitMined(ctx context.Context, txHash common.Hash) (*zkTypes.TransactionReceipt, error)
	WaitFinalized(ctx context.Context, txHash common.Hash) (*zkTypes.TransactionReceipt, error)
	GetGasPrice() (*big.Int, error)
	SendRawTransaction(tx []byte) (common.Hash, error)
	GetLogs(q zkTypes.FilterQuery) ([]zkTypes.Log, error)
}

Deprecated: Deprecated in favor of EthereumClient.

type GasOptions deprecated

type GasOptions struct {
	GasPrice *big.Int // Gas price to use for the transaction execution (nil = gas price oracle)
	GasLimit uint64   // Gas limit to set for the transaction execution (0 = estimate)
}

Deprecated: Will be removed in the future releases.

type Provider deprecated

type Provider interface {
	EthereumProvider
	ZksyncProvider
}

Deprecated: Interface is deprecated in favor of Client.

type TransferCallMsg

type TransferCallMsg struct {
	To     common.Address // The address of the recipient.
	Amount *big.Int       // The amount of the token to transfer.
	Token  common.Address // The address of the token. ETH by default.
	From   common.Address // The address of the sender.

	Gas       uint64   // If 0, the call executes with near-infinite gas.
	GasPrice  *big.Int // Wei <-> gas exchange ratio.
	GasFeeCap *big.Int // EIP-1559 fee cap per gas.
	GasTipCap *big.Int // EIP-1559 tip per gas.

	AccessList types.AccessList // EIP-2930 access list.
}

TransferCallMsg contains parameters for transfer call.

func (*TransferCallMsg) ToCallMsg

func (m *TransferCallMsg) ToCallMsg() (*ethereum.CallMsg, error)

type WithdrawalCallMsg

type WithdrawalCallMsg struct {
	To            common.Address  // The address of the recipient on L1.
	Amount        *big.Int        // The amount of the token to transfer.
	Token         common.Address  // The address of the token. ETH by default.
	BridgeAddress *common.Address // The address of the bridge contract to be used.
	From          common.Address  // The address of the sender.

	Gas       uint64   // If 0, the call executes with near-infinite gas.
	GasPrice  *big.Int // Wei <-> gas exchange ratio.
	GasFeeCap *big.Int // EIP-1559 fee cap per gas.
	GasTipCap *big.Int // EIP-1559 tip per gas.

	AccessList types.AccessList // EIP-2930 access list.
}

WithdrawalCallMsg contains parameters for withdrawal call.

func (*WithdrawalCallMsg) ToCallMsg

func (m *WithdrawalCallMsg) ToCallMsg(defaultL2Bridge *common.Address) (*ethereum.CallMsg, error)

type ZkSyncEraClient

type ZkSyncEraClient interface {
	// MainContractAddress returns the address of the zkSync Era contract.
	MainContractAddress(ctx context.Context) (common.Address, error)
	// TestnetPaymaster returns the testnet paymaster address if available, or nil.
	TestnetPaymaster(ctx context.Context) (common.Address, error)
	// BridgeContracts returns the addresses of the default zkSync Era bridge
	// contracts on both L1 and L2.
	BridgeContracts(ctx context.Context) (*zkTypes.BridgeContracts, error)
	// ContractAccountInfo returns the version of the supported account abstraction
	// and nonce ordering from a given contract address.
	ContractAccountInfo(ctx context.Context, address common.Address) (*zkTypes.ContractAccountInfo, error)

	// L1ChainID returns the chain id of the underlying L1.
	L1ChainID(ctx context.Context) (*big.Int, error)
	// L1BatchNumber returns the latest L1 batch number.
	L1BatchNumber(ctx context.Context) (*big.Int, error)
	// L1BatchBlockRange returns the range of blocks contained within a batch given
	// by batch number.
	L1BatchBlockRange(ctx context.Context, l1BatchNumber *big.Int) (*BlockRange, error)
	// L1BatchDetails returns data pertaining to a given batch.
	L1BatchDetails(ctx context.Context, l1BatchNumber *big.Int) (*zkTypes.BatchDetails, error)
	// BlockDetails returns additional zkSync Era-specific information about the L2
	// block.
	BlockDetails(ctx context.Context, block uint32) (*zkTypes.BlockDetails, error)
	// TransactionDetails returns data from a specific transaction given by the
	// transaction hash.
	TransactionDetails(ctx context.Context, txHash common.Hash) (*zkTypes.TransactionDetails, error)
	// LogProof returns the proof for a transaction's L2 to L1 log sent via the
	// L1Messenger system contract.
	LogProof(ctx context.Context, txHash common.Hash, logIndex int) (*zkTypes.MessageProof, error)
	// Deprecated: Deprecated in favor of LogProof.
	MsgProof(ctx context.Context, block uint32, sender common.Address, msg common.Hash) (*zkTypes.MessageProof, error)
	// L2TransactionFromPriorityOp returns transaction on L2 network from transaction
	// receipt on L1 network.
	L2TransactionFromPriorityOp(ctx context.Context, l1TxReceipt *types.Receipt) (*zkTypes.TransactionResponse, error)

	// Deprecated: Method is deprecated and will be removed in the near future.
	ConfirmedTokens(ctx context.Context, from uint32, limit uint8) ([]*zkTypes.Token, error)
	// Deprecated: Method is deprecated and will be removed in the near future.
	TokenPrice(ctx context.Context, address common.Address) (*big.Float, error)
	// L2TokenAddress returns the L2 token address equivalent for a L1 token address
	// as they are not equal. ETH address is set to zero address.
	L2TokenAddress(ctx context.Context, token common.Address) (common.Address, error)
	// L1TokenAddress returns the L1 token address equivalent for a L2 token address
	// as they are not equal. ETH address is set to zero address.
	L1TokenAddress(ctx context.Context, token common.Address) (common.Address, error)
	// AllAccountBalances returns all balances for confirmed tokens given by an
	// account address.
	AllAccountBalances(ctx context.Context, address common.Address) (map[common.Address]*big.Int, error)

	// EstimateFee Returns the fee for the transaction.
	EstimateFee(ctx context.Context, tx zkTypes.CallMsg) (*zkTypes.Fee, error)
	// EstimateGasL1 estimates the amount of gas required to submit a transaction
	// from L1 to L2.
	EstimateGasL1(ctx context.Context, tx zkTypes.CallMsg) (uint64, error)
	// EstimateGasTransfer estimates the amount of gas required for a transfer
	// transaction.
	EstimateGasTransfer(ctx context.Context, msg TransferCallMsg) (uint64, error)
	// EstimateGasWithdraw estimates the amount of gas required for a withdrawal
	// transaction.
	EstimateGasWithdraw(ctx context.Context, msg WithdrawalCallMsg) (uint64, error)
	// EstimateL1ToL2Execute estimates the amount of gas required for an L1 to L2
	// execute operation.
	EstimateL1ToL2Execute(ctx context.Context, msg zkTypes.CallMsg) (uint64, error)
}

ZkSyncEraClient provides the API to zkSync Era features and specific RPC methods, ones that that has `zks_` prefix.

type ZksyncProvider deprecated

type ZksyncProvider interface {
	ZksGetMainContract() (common.Address, error)
	ZksL1ChainId() (*big.Int, error)
	ZksL1BatchNumber() (*big.Int, error)
	ZksGetConfirmedTokens(from uint32, limit uint8) ([]*zkTypes.Token, error)
	ZksIsTokenLiquid(address common.Address) (bool, error)
	ZksGetTokenPrice(address common.Address) (*big.Float, error)
	L2TokenAddress(token common.Address) (common.Address, error)
	L1TokenAddress(token common.Address) (common.Address, error)
	ZksGetL2ToL1LogProof(txHash common.Hash, logIndex int) (*zkTypes.MessageProof, error)
	ZksGetL2ToL1MsgProof(block uint32, sender common.Address, msg common.Hash) (*zkTypes.MessageProof, error)
	ZksGetAllAccountBalances(address common.Address) (map[common.Address]*big.Int, error)
	ZksGetBridgeContracts() (*zkTypes.BridgeContracts, error)
	ZksEstimateFee(tx *zkTypes.Transaction) (*zkTypes.Fee, error)
	ZksGetTestnetPaymaster() (common.Address, error)
	ZksGetBlockDetails(block uint32) (*zkTypes.BlockDetails, error)
	EstimateGas712(tx *zkTypes.Transaction) (*big.Int, error)
	EstimateGasL1(tx *zkTypes.Transaction) (*big.Int, error)
	EstimateL1ToL2Execute(tx *zkTypes.Transaction) (*big.Int, error)
	GetL1BatchBlockRange(l1BatchNumber *big.Int) (*BlockRange, error)
	GetL1BatchDetails(l1BatchNumber *big.Int) (*zkTypes.BatchDetails, error)
	GetTransactionDetails(txHash common.Hash) (*zkTypes.TransactionDetails, error)
}

Deprecated: Deprecated in favor of ZkSyncEraClient.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL