Documentation ¶
Index ¶
- Constants
- type AccountAbstractionVersion
- type AccountNonceOrdering
- type ApprovalBasedPaymasterInput
- type BatchDetails
- type Block
- type BlockDetails
- type BlockNumberdeprecated
- type BridgeContracts
- type CallMsg
- type ContractAccountInfo
- type Eip712Meta
- type Fee
- type FilterQuerydeprecated
- type GeneralPaymasterInput
- type L1BridgeContracts
- type L2BridgeContracts
- type L2ToL1Log
- type Log
- type MessageProof
- type PaymasterInput
- type PaymasterParams
- type Receipt
- type StandardConfiguration
- type Token
- type Transactiondeprecated
- type Transaction712
- type TransactionDetails
- type TransactionReceiptdeprecated
- type TransactionResponse
Constants ¶
const EIP712TxType = `0x71`
EIP712TxType represents an EIP-712 transaction type.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountAbstractionVersion ¶
type AccountAbstractionVersion uint8
AccountAbstractionVersion represents an enumeration of account abstraction versions.
const ( None AccountAbstractionVersion = iota Version1 )
type AccountNonceOrdering ¶
type AccountNonceOrdering uint8
AccountNonceOrdering represents an enumeration of account nonce ordering formats.
const ( Sequential AccountNonceOrdering = iota Arbitrary )
type ApprovalBasedPaymasterInput ¶
type ApprovalBasedPaymasterInput struct { Token common.Address // ERC20 token used to pay transaction fee. // Minimal allowance of Token towards the paymaster from the account that pays the fee with the token. MinimalAllowance *big.Int InnerInput []byte // Additional payload that can be sent to the paymaster to implement any logic. }
ApprovalBasedPaymasterInput contains approval-based paymaster input. It should be used if the user is required to set a certain allowance to a token for the paymaster to operate.
func (*ApprovalBasedPaymasterInput) GetInput ¶
func (a *ApprovalBasedPaymasterInput) GetInput() []byte
func (*ApprovalBasedPaymasterInput) GetType ¶
func (a *ApprovalBasedPaymasterInput) GetType() string
type BatchDetails ¶
type BatchDetails struct { BaseSystemContractsHashes struct { Bootloader common.Hash `json:"bootloader"` DefaultAa common.Hash `json:"default_aa"` } `json:"baseSystemContractsHashes"` CommitTxHash common.Hash `json:"commitTxHash"` CommittedAt time.Time `json:"committedAt"` ExecuteTxHash common.Hash `json:"executeTxHash"` ExecutedAt time.Time `json:"executedAt"` L1GasPrice uint64 `json:"l1GasPrice"` L1TxCount uint `json:"l1TxCount"` L2FairGasPrice uint `json:"l2FairGasPrice"` L2TxCount uint `json:"l2TxCount"` Number uint `json:"number"` ProveTxHash common.Hash `json:"proveTxHash"` ProvenAt time.Time `json:"provenAt"` RootHash common.Hash `json:"rootHash"` Status string `json:"status"` Timestamp uint `json:"timestamp"` }
BatchDetails contains batch information.
type Block ¶
type Block struct { Header *types.Header Uncles []*types.Header Transactions []*TransactionResponse Withdrawals types.Withdrawals Hash common.Hash Size *big.Int TotalDifficulty *big.Int SealFields []interface{} ReceivedAt time.Time ReceivedFrom interface{} L1BatchNumber *big.Int L1BatchTimestamp *big.Int }
Block represents a block.
type BlockDetails ¶
type BlockDetails struct { CommitTxHash common.Hash `json:"commitTxHash"` CommittedAt time.Time `json:"committedAt"` ExecuteTxHash common.Hash `json:"executeTxHash"` ExecutedAt time.Time `json:"executedAt"` L1TxCount uint `json:"l1TxCount"` L2TxCount uint `json:"l2TxCount"` Number uint `json:"number"` ProveTxHash common.Hash `json:"proveTxHash"` ProvenAt time.Time `json:"provenAt"` RootHash common.Hash `json:"rootHash"` Status string `json:"status"` Timestamp uint `json:"timestamp"` }
BlockDetails contains block details.
type BlockNumber
deprecated
type BlockNumber string // Enums or hex value
Deprecated: Will be removed in the future releases.
var ( BlockNumberEarliest BlockNumber = "earliest" BlockNumberLatest BlockNumber = "latest" BlockNumberPending BlockNumber = "pending" BlockNumberCommitted BlockNumber = "committed" BlockNumberFinalized BlockNumber = "finalized" )
type BridgeContracts ¶
type BridgeContracts struct { L1Erc20DefaultBridge common.Address `json:"l1Erc20DefaultBridge"` // Default L1Bridge contract address. L2Erc20DefaultBridge common.Address `json:"l2Erc20DefaultBridge"` // Default L2Bridge contract address. }
BridgeContracts represents the addresses of default bridge contracts for both L1 and L2.
type CallMsg ¶
type CallMsg struct { ethereum.CallMsg Meta *Eip712Meta // EIP-712 metadata. }
CallMsg contains parameters for contract call using EIP-712 transaction.
func (CallMsg) MarshalJSON ¶
type ContractAccountInfo ¶
type ContractAccountInfo struct { SupportedAAVersion AccountAbstractionVersion NonceOrdering AccountNonceOrdering }
type Eip712Meta ¶
type Eip712Meta struct { // GasPerPubdata denotes the maximum amount of gas the user is willing // to pay for a single byte of pubdata. GasPerPubdata *hexutil.Big `json:"gasPerPubdata,omitempty"` // CustomSignature is used for the cases in which the signer's account // is not an EOA. CustomSignature hexutil.Bytes `json:"customSignature,omitempty"` // FactoryDeps is a non-empty array of bytes. For deployment transactions, // it should contain the bytecode of the contract being deployed. // If the contract is a factory contract, i.e. it can deploy other contracts, // the array should also contain the bytecodes of the contracts which it can deploy. FactoryDeps []hexutil.Bytes `json:"factoryDeps"` // PaymasterParams contains parameters for configuring the custom paymaster // for the transaction. PaymasterParams *PaymasterParams `json:"paymasterParams,omitempty"` }
Eip712Meta L2-specific transaction metadata.
func (*Eip712Meta) MarshalJSON ¶
func (m *Eip712Meta) MarshalJSON() ([]byte, error)
type Fee ¶
type Fee struct { GasLimit *hexutil.Big `json:"gas_limit"` // Maximum amount of gas allowed for the transaction. // Maximum amount of gas the user is willing to pay for a single byte of pubdata. GasPerPubdataLimit *hexutil.Big `json:"gas_per_pubdata_limit"` MaxFeePerGas *hexutil.Big `json:"max_fee_per_gas"` // EIP-1559 fee cap per gas. MaxPriorityFeePerGas *hexutil.Big `json:"max_priority_fee_per_gas"` // EIP-1559 tip per gas. }
Fee represents the transaction fee parameters.
type FilterQuery
deprecated
type FilterQuery struct { BlockHash *common.Hash FromBlock *BlockNumber ToBlock *BlockNumber Addresses []common.Address Topics [][]common.Hash }
Deprecated: Deprecated in favor of ethereum.FilterQuery
type GeneralPaymasterInput ¶
type GeneralPaymasterInput []byte
GeneralPaymasterInput contains general paymaster input. It should be used if no prior actions are required from the user for the paymaster to operate.
func (*GeneralPaymasterInput) GetInput ¶
func (g *GeneralPaymasterInput) GetInput() []byte
func (*GeneralPaymasterInput) GetType ¶
func (g *GeneralPaymasterInput) GetType() string
type L1BridgeContracts ¶
L1BridgeContracts represents the L1 bridge contracts.
type L2BridgeContracts ¶
L2BridgeContracts represents the L2 bridge contracts.
type L2ToL1Log ¶
type L2ToL1Log struct { BlockNumber *hexutil.Big `json:"blockNumber"` BlockHash common.Hash `json:"blockHash"` L1BatchNumber *hexutil.Big `json:"l1BatchNumber"` TransactionIndex *hexutil.Uint `json:"transactionIndex"` ShardId *hexutil.Uint `json:"shardId"` IsService bool `json:"isService"` Sender common.Address `json:"sender"` Key string `json:"key"` Value string `json:"value"` TxHash common.Hash `json:"transactionHash"` Index *hexutil.Uint `json:"logIndex"` }
L2ToL1Log represents a layer 2 to layer 1 transaction log.
type MessageProof ¶
type MessageProof struct { Id int `json:"id"` Proof []common.Hash `json:"proof"` Root common.Hash `json:"root"` }
MessageProof represents a message proof.
type PaymasterInput ¶
type PaymasterInput interface { // GetType returns the type of the paymaster input. It should provide a // unique identifier for the type of input data. GetType() string // GetInput returns the actual input data in the form of a byte slice. The // data format may vary depending on the type and implementation of the // paymaster. GetInput() []byte }
PaymasterInput is an interface that represents input data for a paymaster. Paymasters can implement this interface to provide specific data required for payment processing.
type PaymasterParams ¶
type PaymasterParams struct { Paymaster common.Address `json:"paymaster"` // address of the paymaster PaymasterInput []byte `json:"paymasterInput"` // encoded input }
PaymasterParams contains parameters for configuring the custom paymaster for the transaction.
func (*PaymasterParams) MarshalJSON ¶
func (p *PaymasterParams) MarshalJSON() ([]byte, error)
type Receipt ¶
type Receipt struct { types.Receipt From common.Address `json:"from"` To common.Address `json:"to"` EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"` L1BatchNumber *hexutil.Big `json:"l1BatchNumber"` L1BatchTxIndex *hexutil.Big `json:"l1BatchTxIndex"` Logs []*Log `json:"logs"` L2ToL1Logs []*L2ToL1Log `json:"l2ToL1Logs"` }
Receipt represents the results of a transaction.
func (*Receipt) MarshalJSON ¶
func (*Receipt) UnmarshalJSON ¶
type StandardConfiguration ¶
type StandardConfiguration struct { Format string `json:"_format"` ContractName string `json:"contractName"` SourceName string `json:"sourceName"` Abi []struct { Inputs []struct { InternalType string `json:"internalType"` Name string `json:"name"` Type string `json:"type"` Indexed bool `json:"indexed,omitempty"` } `json:"inputs"` StateMutability string `json:"stateMutability,omitempty"` Type string `json:"type"` Anonymous bool `json:"anonymous,omitempty"` Name string `json:"name,omitempty"` Outputs []struct { InternalType string `json:"internalType"` Name string `json:"name"` Type string `json:"type"` } `json:"outputs,omitempty"` } `json:"abi"` Bytecode string `json:"bytecode"` DeployedBytecode string `json:"deployedBytecode"` LinkReferences struct { } `json:"linkReferences"` DeployedLinkReferences struct { } `json:"deployedLinkReferences"` FactoryDeps struct { } `json:"factoryDeps"` }
StandardConfiguration presents the standard-json configuration generated as output of zksolc compiler.
type Token ¶
type Token struct { L1Address common.Address `json:"l1Address"` // Token address on L1. L2Address common.Address `json:"l2Address"` // Token address on L2. Name string `json:"name"` // Token name. Symbol string `json:"symbol"` // Token symbol. Decimals uint `json:"decimals"` // Number of decimals for the token. }
Token represents a token with addresses on both L1 and L2 chains.
type Transaction
deprecated
type Transaction struct { From common.Address `json:"from"` To common.Address `json:"to"` Gas *hexutil.Big `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Value *hexutil.Big `json:"value"` Data hexutil.Bytes `json:"data"` Eip712Meta *Eip712Meta `json:"eip712Meta"` }
Deprecated: Will be removed in the future releases.
type Transaction712 ¶
type Transaction712 struct { Nonce *big.Int // Nonce to use for the transaction execution. GasTipCap *big.Int // EIP-1559 tip per gas. GasFeeCap *big.Int // EIP-1559 fee cap per gas. Gas *big.Int // Gas limit to set for the transaction execution. To *common.Address // The address of the recipient. Value *big.Int // Funds to transfer along the transaction (nil = 0 = no funds). Data hexutil.Bytes // Input data, usually an ABI-encoded contract method invocation. AccessList types.AccessList // EIP-2930 access list. ChainID *big.Int // Chain ID of the network. From *common.Address // The address of the sender. Meta *Eip712Meta // EIP-712 metadata. }
Transaction712 represents an EIP-712 compliant transaction. It shares similarities with regular transactions but also includes zkSync-specific features such as account abstraction and paymasters. Smart contracts must be deployed with support for the EIP-712 transaction type.
func (*Transaction712) EIP712Message ¶
func (tx *Transaction712) EIP712Message() (apitypes.TypedDataMessage, error)
func (*Transaction712) EIP712Type ¶
func (tx *Transaction712) EIP712Type() string
func (*Transaction712) EIP712Types ¶
func (tx *Transaction712) EIP712Types() []apitypes.Type
type TransactionDetails ¶
type TransactionDetails struct { EthCommitTxHash common.Hash `json:"ethCommitTxHash"` EthExecuteTxHash common.Hash `json:"ethExecuteTxHash"` EthProveTxHash common.Hash `json:"ethProveTxHash"` Fee hexutil.Big `json:"fee"` InitiatorAddress common.Address `json:"initiatorAddress"` IsL1Originated bool `json:"isL1Originated"` ReceivedAt time.Time `json:"receivedAt"` Status string `json:"status"` }
TransactionDetails contains transaction details.
type TransactionReceipt
deprecated
type TransactionReceipt struct { types.Receipt // extend From common.Address `json:"from"` To common.Address `json:"to"` EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"` L1BatchNumber *hexutil.Big `json:"l1BatchNumber"` L1BatchTxIndex *hexutil.Big `json:"l1BatchTxIndex"` Logs []*Log `json:"logs"` L2ToL1Logs []*L2ToL1Log `json:"l2ToL1Logs"` }
Deprecated: Deprecated in favor of Receipt
func (*TransactionReceipt) MarshalJSON ¶
func (r *TransactionReceipt) MarshalJSON() ([]byte, error)
func (*TransactionReceipt) UnmarshalJSON ¶
func (r *TransactionReceipt) UnmarshalJSON(input []byte) error
type TransactionResponse ¶
type TransactionResponse struct { BlockHash *common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` ChainID hexutil.Big `json:"chainId"` From common.Address `json:"from"` Gas hexutil.Uint64 `json:"gas"` GasPrice hexutil.Big `json:"gasPrice"` Hash common.Hash `json:"hash"` Data hexutil.Bytes `json:"input"` L1BatchNumber hexutil.Big `json:"l1BatchNumber"` L1BatchTxIndex hexutil.Big `json:"l1BatchTxIndex"` MaxFeePerGas hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas hexutil.Big `json:"maxPriorityFeePerGas"` Nonce hexutil.Uint64 `json:"nonce"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` To common.Address `json:"to"` TransactionIndex hexutil.Uint `json:"transactionIndex"` Type hexutil.Uint64 `json:"type"` Value hexutil.Big `json:"value"` }
TransactionResponse includes all properties of a transaction as well as several properties that are useful once it has been mined.