The Block type is used to represent a block in the NEAR Lake Framework.

Important Notes on Block:

  • All the entities located on different shards were merged into one single list without differentiation.
  • Block is not the fairest name for this structure either. NEAR Protocol is a sharded blockchain, so its block is actually an ephemeral structure that represents a collection of real blocks called chunks in NEAR Protocol.

Constructors

  • Parameters

    • streamerMessage: StreamerMessage

      Low-level structure for backward compatibility. As implemented in previous versions of near-lake-framework.

    • executedReceipts: Receipt[]
    • postponedReceipts: Receipt[]

      Receipts included on the chain but not executed yet marked as “postponed”: they are represented by the same structure Receipt (see the corresponding section in this doc for more details).

    • transactions: Transaction[]

      List of included Transactions, converted into Receipts.

      NOTE: Heads up! You might want to know about Transactions to know where the action chain has begun. Unlike Ethereum, where a Transaction contains everything you may want to know about a particular interaction on the Ethereum blockchain, Near Protocol because of its asynchronous nature converts a Transaction into a Receipt before executing it. Thus, On NEAR, Receipts are more important for figuring out what happened on-chain as a result of a Transaction signed by a user. Read more about Transactions on Near here.

    • _actions: Map<string, Action>
    • _events: Map<string, Event[]>
    • _stateChanges: StateChange[]

    Returns Block

Properties

_actions: any
_events: any
_stateChanges: any
buildActionsHashmap: any
buildEventsHashmap: any
executedReceipts: any
postponedReceipts: Receipt[]

Receipts included on the chain but not executed yet marked as “postponed”: they are represented by the same structure Receipt (see the corresponding section in this doc for more details).

streamerMessage: StreamerMessage

Low-level structure for backward compatibility. As implemented in previous versions of near-lake-framework.

transactions: Transaction[]

List of included Transactions, converted into Receipts.

NOTE: Heads up! You might want to know about Transactions to know where the action chain has begun. Unlike Ethereum, where a Transaction contains everything you may want to know about a particular interaction on the Ethereum blockchain, Near Protocol because of its asynchronous nature converts a Transaction into a Receipt before executing it. Thus, On NEAR, Receipts are more important for figuring out what happened on-chain as a result of a Transaction signed by a user. Read more about Transactions on Near here.

Accessors

  • get blockDate(): string
  • Returns the block date in ISO format, e.g. 2022-01-01.

    Returns string

  • get blockHash(): string
  • Returns the block hash. A shortcut to get the data from the block header.

    Returns string

  • get blockHeight(): number
  • Returns the block height. A shortcut to get the data from the block header.

    Returns number

  • get prevBlockHash(): string
  • Returns the previous block hash. A shortcut to get the data from the block header.

    Returns string

Methods

  • Returns Action of the provided receipt_id from the block if any. Returns undefined if there is no corresponding Action.

    This method uses the internal Block action field which is empty by default and will be filled with the block’s actions on the first call to optimize memory usage.

    The result is either Action | undefined since there might be a request for an Action by receipt_id from another block, in which case this method will be unable to find the Action in the current block. In the other case, the request might be for an Action for a receipt_id that belongs to a DataReceipt where an action does not exist.

    Parameters

    • receipt_id: string

    Returns Action

  • Returns an Array of Actions executed in the block.

    Returns Action[]

  • Returns Events emitted in the block.

    Returns Event[]

  • Returns an Array of Events emitted by ExecutionOutcome for the given account_id. There might be more than one Event for the Receipt or there might be none of them. In the latter case, this method returns an empty Array.

    Parameters

    • account_id: string

    Returns Event[]

  • Returns an Array of Events emitted by ExecutionOutcome for the given receipt_id. There might be more than one Event for the Receipt or there might be none of them. In the latter case, this method returns an empty Array.

    Parameters

    • receipt_id: string

    Returns Event[]

  • Returns an Array of function calls executed in the block matching provided filters.

    Parameters

    • Optional receiverFilter: string

      filter by contract name (e.g. *.pool.near,*.poolv1.near). Default is * (all contracts).

    • Optional statusFilter: ReceiptStatusFilter

      filter by receipt status (all|onlySuccessful|onlyFailed). Default is onlySuccessful.

    Returns FunctionCallView[]

  • Returns an Array of function calls to receivers matching receiverFilter.

    Parameters

    • Optional receiverFilter: string

      filter by contract name (e.g. *.pool.near,*.poolv1.near). Default is * (all contracts).

    • Optional method: string

      name of the method to filter by. Returns all function calls to receiverFilter if not provided.

    • Optional statusFilter: ReceiptStatusFilter

      filter by receipt status (all|onlySuccessful|onlyFailed). Default is onlySuccessful.

    Returns FunctionCallView[]

  • Returns a BlockHeader structure of the block See BlockHeader structure sections for details.

    Returns BlockHeader

  • Returns raw logs regardless of the fact that they are standard events or not.

    Returns Log[]

  • Returns a slice of Receipts executed in the block. Basically is a getter for the executedReceipts field.

    Returns Receipt[]

  • Returns an Array of StateChange occurred in the block.

    Returns StateChange[]

  • Parameters

    Returns Block

Generated using TypeDoc