Constructors

Properties

requestManager: Web3RequestManager<unknown>

Methods

  • Returns the fee for the transaction.

    Parameters

    • transaction: Partial<TransactionWithSenderAPI>

      Transaction object.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<EstimateFee>

  • Returns an estimate of the gas required for a L1 to L2 transaction.

    Parameters

    • transaction: Partial<DeepWriteable<Transaction & {
          customData?: null | Eip712Meta;
          type?: Numbers;
      }>>

      Transaction object.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<Numbers>

  • Returns all balances for confirmed tokens given by an account address.

    Parameters

    • address: string

      The account address.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<WalletBalances>

  • Returns the L1 base token address.

    Returns Promise<string>

  • Returns additional ZKsync-specific information about the L2 block.

    committed: The batch is closed and the state transition it creates exists on layer 1. proven: The batch proof has been created, submitted, and accepted on layer 1. executed: The batch state transition has been executed on L1; meaning the root state has been updated.

    Parameters

    • number: Numbers

      The number of the block.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<BlockDetails>

  • Retrieves the bridge hub contract address

    Parameters

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<string>

  • Returns bytecode of a transaction given by its hash.

    Parameters

    • bytecodeHash: Bytes

      Bytecode hash as string.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<Uint8Array>

  • Lists confirmed tokens. Confirmed in the method name means any token bridged to ZKsync Era via the official bridge. The tokens are returned in alphabetical order by their symbol. This means the token id is its position in an alphabetically sorted array of tokens.

    Parameters

    • fromTokenId: number

      The token id to start from.

    • limit: number

      The number of tokens to return.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<Token[]>

  • Retrieves the current fee parameters.

    Parameters

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<FeeParams>

  • Returns the range of blocks contained within a batch given by batch number. The range is given by beginning/end block numbers in hexadecimal.

    Parameters

    • number: Numbers

      The layer 1 batch number.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<Bytes[]>

  • Returns data pertaining to a given batch.

    Parameters

    • number: Numbers

      The layer 1 batch number.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<BatchDetails>

  • Returns the latest L1 batch number.

    Parameters

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<bigint>

  • Retrieves the current L1 gas price.

    Parameters

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<BigInt>

  • Given a transaction hash, and an index of the L2 to L1 log produced within the transaction, it returns the proof for the corresponding L2 to L1 log.

    The index of the log that can be obtained from the transaction receipt (it includes a list of every log produced by the transaction)

    Parameters

    • txHash: string

      Hash of the L2 transaction the L2 to L1 log was produced within.

    • Optionall2ToL1LogIndex: Numbers

      The index of the L2 to L1 log in the transaction (optional).

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<L2ToL1Proof>

  • Retrieves the proof for an L2 to L1 message.

    Parameters

    • l2BlockNumber: number

      The L2 block number.

    • senderAddress: string

      The sender address.

    • messageHash: Bytes

      The message hash.

    • Optionall2LogPosition: number

      The log position in L2.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<MessageProof>

  • Returns the address of the ZKsync Era contract.

    Parameters

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<string>

  • Returns Merkle proofs for one or more storage values at the specified account along with a Merkle proof of their authenticity. This allows to verify that the values have not been tampered with. More details: https://docs.zksync.io/build/api.html#zks-getproof

    Parameters

    • address: string

      The account to fetch storage values and proofs for.

    • keys: string[]

      Vector of storage keys in the account.

    • l1BatchNumber: Numbers

      Number of the L1 batch specifying the point in time at which the requested values are returned.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<StorageProof>

  • Gets the protocol version.

    Parameters

    • OptionalversionId: number

      The version ID.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<ProtocolVersion>

  • Returns data from a specific transaction given by the transaction hash.

    Parameters

    • txHash: Bytes

      Transaction hash as string.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<TransactionDetails>

  • Returns the chain id of the underlying L1.

    Parameters

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<bigint>

  • Executes a transaction and returns its hash, storage logs, and events that would have been generated if the transaction had already been included in the block. The API has a similar behaviour to eth_sendRawTransaction but with some extra data returned from it. With this API Consumer apps can apply "optimistic" events in their applications instantly without having to wait for ZKsync block confirmation time. It’s expected that the optimistic logs of two uncommitted transactions that modify the same state will not have causal relationships between each other.

    Parameters

    • data: Bytes

      The transaction data.

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      The format of the return value.

    Returns Promise<RawTransactionWithDetailedOutput>