Types

Primary types used in the ZKsync Era

The following section describes key types used in the ZKsync Era. These types facilitate various blockchain operations, such as specifying block ranges, performing withdrawals, and executing transfers.

BlockRange

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

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.
}

TransferCallMsg

Contains parameters for transfer call.

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.

 PaymasterParams *types.PaymasterParams // The paymaster parameters.
 // GasPerPubdata denotes the maximum amount of gas the user is willing
 // to pay for a single byte of pubdata.
 GasPerPubdata *big.Int
 // CustomSignature is used for the cases in which the signer's account
 // is not an EOA.
 CustomSignature hexutil.Bytes
}

// ToL1CallMsg transforms TransferCallMsg to ethereum.CallMsg.
func (m *TransferCallMsg) ToCallMsg() (*ethereum.CallMsg, error)
// ToCallMsg transforms TransferCallMsg to types.CallMsg.
func (m *TransferCallMsg) ToCallMsg() (*types.CallMsg, error)

WithdrawalCallMsg

Contains parameters for withdrawal call.

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.

 PaymasterParams *types.PaymasterParams // The paymaster parameters.
 // GasPerPubdata denotes the maximum amount of gas the user is willing
 // to pay for a single byte of pubdata.
 GasPerPubdata *big.Int
 // CustomSignature is used for the cases in which the signer's account
 // is not an EOA.
 CustomSignature hexutil.Bytes
}

// ToL1CallMsg transforms WithdrawalCallMsg to ethereum.CallMsg.
func (m *WithdrawalCallMsg) ToL1CallMsg(defaultL2Bridge *common.Address) (*ethereum.CallMsg, error)
// ToCallMsg transforms WithdrawalCallMsg to types.CallMsg.
func (m *WithdrawalCallMsg) ToCallMsg(defaultL2Bridge *common.Address) (*types.CallMsg, error)

Made with ❤️ by the ZKsync Community