V6

Types and Interfaces

AccountAbstractionVersion

Enumerated list of account abstraction versions.

  • None = 0 - Used for contracts that are not accounts.
  • Version1 = 1 - Used for contracts that are accounts.

AccountNonceOrdering

Enumerated list of account nonce ordering formats.

  • Sequential = 0 - Nonces should be ordered in the same way as in externally owned accounts (EOAs). This means, for instance, that the operator will always wait for a transaction with nonce X before processing a transaction with nonce X+1.
  • Arbitrary = 1 - Nonces can be ordered in arbitrary order.

Address

0x-prefixed, hex-encoded, Ethereum account address as string.

ApprovalBasedPaymasterInput

Interface representation of approval based paymaster input.

  • type: 'ApprovalBased' - The type of the paymaster input.
  • token: Address - The address of the token to be approved.
  • minimalAllowance: bigint - The minimum allowance required for the token approval.
  • innerInput: BytesLike- The additional input data.;

BalancesMap

Type defining a map object containing accounts and their balances.

  • { [key: string]: bigint }

BatchDetails

Interface representation of batch details.

  • number: number - L1 batch number.
  • timestamp: number- Unix timestamp when the batch was processed.
  • l1TxCount: number - Number of L1 transactions included in the batch.
  • l2TxCount: number - Number of L2 transactions associated with this batch.
  • rootHash?: string - Root hash of the state after processing the batch.
  • status: string - Current status of the batch (e.g., verified).
  • commitTxHash?: string - Transaction hash of the commit operation on L1.
  • committedAt?: Date- Timestamp when the block was committed on L1.
  • proveTxHash?: string - Transaction hash of the proof submission on L1.
  • provenAt?: Date - Timestamp when the proof was submitted on L1.
  • executeTxHash?: string - Transaction hash of the execution on L1.
  • executedAt?: Date - Timestamp when the block execution was completed on L1.
  • l1GasPrice: number - L1 gas price at the time of the block's execution.
  • l2FairGasPrice: number - Fair gas price on L2 at the time of the block's execution.
  • baseSystemContractsHashes: object - Hashes of the base system contracts involved in the batch.

Block

Interface representation of block that extends the Ethers providers.Block definition with additional fields.

  • l1BatchNumber: number - The batch number on L1.
  • l1BatchTimestamp: number - The timestamp of the batch on L1.

BlockDetails

Interface representation of block details.

  • number: number - Number of the block.
  • timestamp: number - Unix timestamp when the block was committed.
  • l1BatchNumber: number - Corresponding L1 batch number.
  • l1TxCount: number - Number of L1 transactions included in the block.
  • l2TxCount: number - Number of L2 transactions included in the block.
  • rootHash?: string - Root hash of the block's state after execution.
  • status: string - Current status of the block (e.g., verified, executed).
  • commitTxHash?: string - Transaction hash of the commit operation on L1.
  • committedAt?: Date - Timestamp when the block was committed on L1.
  • proveTxHash?: string - Transaction hash of the proof submission on L1.
  • provenAt?: Date - Timestamp when the proof was submitted on L1.
  • executeTxHash?: string - Transaction hash of the execution on L1.
  • executedAt?: Date - Timestamp when the block execution was completed on L1.
  • l1GasPrice: number - L1 gas price at the time of the block's execution.
  • l2FairGasPrice: number - Fair gas price on L2 at the time of the block's execution.
  • baseSystemContractsHashes: object - A collection of hashes for the base system contracts involved in the block.
  • operatorAddress: string - Address of the operator who committed the block.
  • protocolVersion: string - version of the ZKsync protocol the block was committed under.

BlockTag

Pipe-delimited list of block labels that includes block number in binary and hex plus block statuses.

  • BigNumberish
  • string // block hash
  • committed
  • finalized
  • latest
  • earliest
  • pending

ContractAccountInfo

Interface representation for contract account information containing information on account abstraction version and nonce ordering format.

  • supportedAAVersion: AccountAbstractionVersion - The supported account abstraction version.
  • nonceOrdering: AccountNonceOrdering - The nonce ordering format.

DeploymentInfo

Interface representation of deployment information.

  • sender: Address - The account responsible for deployment.
  • bytecodeHash: string - The hash of the contract/account bytecode.
  • deployedAddress: Address - The deployed address of the contract/address.

DeploymentType

Pipe-delimited choice of two deployment types that support all create2 variants.

  • create
  • createAccount

Eip712Meta

Contains EIP712 transaction metadata.

  • gasPerPubdata?: BigNumberish - The maximum amount of gas the user is willing to pay for a single byte of pubdata.
  • factoryDeps?: BytesLike[] - An array of bytes containing the bytecode of the contract being deployed and any related contracts it can deploy.
  • customSignature?: BytesLike - Custom signature used for cases where the signer's account is not an EOA.
  • paymasterParams?: PaymasterParams - Parameters for configuring the custom paymaster for the transaction.

EthereumSignature

Interface representation of an Ethereum signature.

  • v: number - The recovery id.
  • r: BytesLike - The "r" value of the signature.
  • s: BytesLike - The "s" value of the signature.

Fee

Interface representation of transaction fee parameters.

  • gasLimit: bigint - The maximum amount of gas that can be used.
  • gasPerPubdataLimit: bigint - The gas limit per unit of public data.
  • maxPriorityFeePerGas: bigint - The maximum priority fee per unit of gas to incentivize miners.
  • maxFeePerGas: bigint - The maximum fee per unit of gas that the sender is willing to pay.

FeeParams

Interface representation of fee parameter configuration.

  • V2: - Fee parameter configuration for the current version of the ZKsync protocol.
    • config: - Settings related to transaction fee computation.
      • minimal_l2_gas_price: bigint - Minimal gas price on L2.
      • compute_overhead_part: bigint - Compute overhead part in fee calculation.
      • pubdata_overhead_part: bigint - Public data overhead part in fee calculation.
      • batch_overhead_l1_gas: bigint - Overhead in L1 gas for a batch of transactions.
      • max_gas_per_batch: bigint - Maximum gas allowed per batch.
      • max_pubdata_per_batch: bigint - Maximum amount of public data allowed per batch.
    • l1_gas_price: bigint - Current L1 gas price.
    • l1_pubdata_price: bigint - Price of storing public data on L1.

FinalizeWithdrawalParams

Interface representation of finalize withdrawal parameters.

  • l1BatchNumber: number | null - The L2 batch number where the withdrawal was processed.
  • l2MessageIndex: number - The position in the L2 logs Merkle tree of the l2Log that was sent with the message.
  • l2TxNumberInBlock: number | null - The L2 transaction number in the batch, in which the log was sent.
  • message: any - The L2 withdraw data, stored in an L2 -> L1 message.
  • sender: string - The L2 address which sent the log.
  • proof: string[] - The Merkle proof of the inclusion L2 -> L1 message about withdrawal initialization.

FullDepositFee

Interface representation of full deposit fee containing fees for both L1 and L2 transactions.

  • maxFeePerGas?: bigint - The maximum fee per gas for L1 transaction.
  • maxPriorityFeePerGas?: bigint - The maximum priority fee per gas for L1 transaction.
  • gasPrice?: bigint - The gas price for L2 transaction.
  • baseCost: bigint - The base cost of the deposit transaction on L2.
  • l1GasLimit: bigint - The gas limit for L1 transaction.
  • l2GasLimit: bigint - The gas limit for L2 transaction.

GeneralPaymasterInput

Interface representation of general paymaster input.

  • type: 'General' - The type of the paymaster input.
  • innerInput: BytesLike - The additional input data.

L2ToL1Log

Interface representation of a layer 2 to layer 1 transaction log.

  • blockNumber: number - The block number.
  • blockHash: string - The block hash.
  • l1BatchNumber: number - The batch number on L1.
  • transactionIndex: number - The L2 transaction number in a block, in which the log was sent.
  • transactionLogIndex: number - The transaction log index.
  • txIndexInL1Batch?: number - The transaction index in L1 batch.
  • shardId: number - The shard identifier, 0 - rollup, 1 - porter.
  • isService: boolean - A boolean flag that is part of the log along with key, value, and sender address. This field is required formally but does not have any special meaning.
  • sender: string- The L2 address which sent the log.
  • key: string - The 32 bytes of information that was sent in the log.
  • value: string - The 32 bytes of information that was sent in the log.
  • transactionHash: string - The transaction hash.
  • logIndex: number - The log index.

Log

Interface representation of log that extends Ethers providers.Log and supplies the layer 1 batch number.

  • l1BatchNumber: number - The batch number on L1.

LogProof

Interface representation of message proof.

  • id: number - Identifier of the log within the transaction.
  • proof: string[] - Each element represents a piece of the proof for the specified log.
  • root: string - Root hash of the proof, anchoring it to a specific state in the blockchain.

MessageProof

Deprecated in favor of [LogProof](#logproof)

Interface representation of message proof.

  • id: number - Identifier of the log within the transaction.
  • proof: string[] - Each element represents a piece of the proof for the specified log.
  • root: string - Root hash of the proof, anchoring it to a specific state in the blockchain.

Network

Enumerated list of networks and their ids.

  • Mainnet = 1
  • Ropsten = 3
  • Rinkeby = 4
  • Sepolia = 6,
  • localhost = 9,
  • EraTestNode = 10,

PaymasterInput

Type definition for a paymaster input specified as either approval based or general.

  • ApprovalBasedPaymasterInput | GeneralPaymasterInput

PaymasterParams

Type defining a paymaster by address and the bytestream input.

  • paymaster: Address - The address of the paymaster.
  • paymasterInput: BytesLike - The bytestream input for the paymaster.

PayloadSigner

Signs various types of payloads, optionally using a some kind of secret.

  • payload: BytesLike - The payload that needs to be sign.
  • secret: any - The secret used for signing the payload.
  • provider null | Provider - The provider is used to fetch data from the network if it is required for signing.

PriorityOpResponse

Interface representation of priority op response that extends TransactionResponse and adds a function that waits to commit a layer 1 transaction, including when given on optional confirmation number.

  • waitL1Commit(confirmation?: number): Promise<providers.TransactionReceipt> -Waits for the L1 transaction to be committed, including waiting for the specified number of confirmations.

PriorityOpTree

Enumerated list of priority operation tree types.

  • Full = 0,
  • Rollup = 1,

PriorityQueueType

Enumerated list of priority queue types.

  • Deque = 0,
  • HeapBuffer = 1,
  • Heap = 2,

ProtocolVersion

Interface representation of protocol version.

  • version_id: number - Protocol version ID.
  • timestamp: number - Unix timestamp of the version's activation.
  • verification_keys_hashes: object - Contains the hashes of various verification keys used in the protocol.
  • base_system_contracts: object - Addresses of the base system contracts.
  • l2_system_upgrade_tx_hash: string | null - Hash of the transaction used for the system upgrade, if any.

RawBlockTransaction

Interface representation of raw block with transactions.

  • common_data - General information about the L2 transaction.
    • L2:
      • nonce: number;
      • fee:
        • gas_limit: bigint;
        • max_fee_per_gas: bigint;
        • max_priority_fee_per_gas: bigint;
        • gas_per_pubdata_limit: bigint;
      • initiatorAddress: Address;
      • signature: Uint8Array;
      • transactionType: string;
      • input
        • hash: string;
        • data: Uint8Array;
      • paymasterParams:
        • paymaster: Address;
        • paymasterInput: Uint8Array;
  • execute: - Details regarding the execution of the transaction.
    • calldata: string;
    • contractAddress: Address;
    • factoryDeps: BytesLike[];
    • value: bigint;
  • received_timestamp_ms: number - Timestamp when the transaction was received, in milliseconds.
  • raw_bytes: string - Raw bytes of the transaction as a hexadecimal string.

Signature

0x-prefixed, hex-encoded, ECDSA signature as string.

SmartAccountSigner

Encapsulates the required input parameters for creating a signer for SmartAccount.

  • address: string - Address to which the SmartAccount is bound.
  • secret: any - Secret in any form that can be used for signing different payloads.
  • payloadSigner: PayloadSigner - Custom method for signing different payloads.
  • transactionBuilder: TransactionBuilder - Custom method for populating transaction requests.

StorageProof

Interface representation of Merkle proofs for storage values.

  • address: string - Account address associated with the storage proofs.
  • storageProof (Array): - Array of objects, each representing a storage proof for the requested keys.
    • key: string - Storage key for which the proof is provided.
    • value: string - Value stored in the specified storage key at the time of the specified l1BatchNumber.
    • index: number - A 1-based index representing the position of the tree entry within the Merkle tree. This index is used to help reconstruct the Merkle path during verification.
    • proof: string[] - An array of 32-byte hashes that constitute the Merkle path from the leaf node (representing the storage key-value pair) to the root of the Merkle tree.

Token

Interface representation of bridged token.

  • l1Address: Address - Token address on L1.
  • l2Address: Address - Token address on L2.
  • name: string - Token name.
  • symbol: string - Token symbol.
  • decimals: number - Token decimals.

TransactionBuilder

Populates missing fields in a transaction with default values.

  • transaction: TransactionRequest - The transaction that needs to be populated.
  • secret: any - The secret used for populating the transaction.
  • provider: null | Provider - The provider is used to fetch data from the network if it is required for signing.

TransactionDetails

Interface representation of transaction details.

  • isL1Originated: boolean - Indicates whether the transaction originated on Layer 1.
  • status: string - Current status of the transaction (e.g., verified).
  • fee: BigNumberish - Transaction fee.
  • gasPerPubdata: BigNumberish - Gas amount per unit of public data for this transaction.
  • initiatorAddress: Address - Address of the transaction initiator.
  • receivedAt: Date - Timestamp when the transaction was received.
  • ethCommitTxHash?: string - Transaction hash of the commit operation.
  • ethProveTxHash?: string - Transaction hash of the proof submission.
  • ethExecuteTxHash?: string - Transaction hash of the execution.

TransactionReceipt

Interface representation of transaction receipt that extends from Ethers providers.TransactionReceipt with additional fields.

  • l1BatchNumber: number - The batch number on the L1 network.
  • l1BatchTxIndex: number - The transaction index within the batch on the L1 network.
  • logs: Array<Log> - All logs included in the transaction receipt.
  • l2ToL1Logs: Array<L2ToL1Log> - The logs of L2 to L1 messages.

TransactionRequest

Interface representation of transaction request that extends from Ethers providers.TransactionRequest which adds an optional field for EIP-712 transactions.

  • customData?: Eip712Meta - The custom data for EIP712 transaction metadata.

TransactionResponse

Interface representation of transaction response that extends from Ethers providers.TransactionResponse with additional fields.

  • l1BatchNumber: number - The batch number on the L1 network.
  • l1BatchTxIndex: number - The transaction index within the batch on the L1 network.
  • wait(): Promise<TransactionReceipt> - Waits for transaction to be mined.
  • waitFinalize(): Promise<TransactionReceipt> - Waits for transaction to be finalized.

TransactionStatus

Enumerated list of transaction statuses.

  • NotFound = not-found - Transaction not found.
  • Processing = processing - Transaction is processing.
  • Committed = committed - Transaction has been committed.
  • Finalized = finalized - Transaction has been finalized.

TransactionWithDetailedOutput

Interface representation of transaction with detailed output.

  • transactionHash: string - Transaction hash.
  • storageLogs: Array<object> - Storage slots
  • events: Array<event> - Generated events.

Made with ❤️ by the ZKsync Community