Interface BlockApi

Block API

interface BlockApi {
    getBlockByHeight: ((height: number, includeTransactions: boolean) => Promise<Block>);
    getBlockById: ((blockId: string, includeTransactions: boolean) => Promise<Block>);
    getBlockByTimestamp: ((timestamp: number, includeTransactions: boolean) => Promise<Block>);
    getBlockId: ((height: number) => Promise<BlockId>);
    getBlocks: ((firstIndex?: number, lastIndex?: number, includeTransactions?: boolean) => Promise<BlockList>);
}

Properties

getBlockByHeight: ((height: number, includeTransactions: boolean) => Promise<Block>)

Get a block by given height

Type declaration

    • (height, includeTransactions): Promise<Block>
    • Parameters

      • height: number

        The block height

      • includeTransactions: boolean

        true, if transactions shall be included

      Returns Promise<Block>

      The Block

getBlockById: ((blockId: string, includeTransactions: boolean) => Promise<Block>)

Get a block by given id

Type declaration

    • (blockId, includeTransactions): Promise<Block>
    • Parameters

      • blockId: string

        The block id

      • includeTransactions: boolean

        true, if transactions shall be included

      Returns Promise<Block>

      The Block

getBlockByTimestamp: ((timestamp: number, includeTransactions: boolean) => Promise<Block>)

Get a block from a given timestamp

Type declaration

    • (timestamp, includeTransactions): Promise<Block>
    • Parameters

      • timestamp: number

        The timestamp in seconds since genesis block

      • includeTransactions: boolean

        true, if transactions shall be included

      Returns Promise<Block>

      The Block

getBlockId: ((height: number) => Promise<BlockId>)

Get a block id by given height

Type declaration

    • (height): Promise<BlockId>
    • Parameters

      • height: number

        The block height

      Returns Promise<BlockId>

      The Block Id

getBlocks: ((firstIndex?: number, lastIndex?: number, includeTransactions?: boolean) => Promise<BlockList>)

Get blocks from the blockchain in reverse block height order.

Type declaration

    • (firstIndex?, lastIndex?, includeTransactions?): Promise<BlockList>
    • Parameters

      • OptionalfirstIndex: number

        first block to retrieve (optional, default is zero or the last block on the blockchain)

      • OptionallastIndex: number

        the last block to retrieve (optional, default is firstIndex + 99)

      • OptionalincludeTransactions: boolean

        true, if transactions shall be included

      Returns Promise<BlockList>

      the array of blocks retrieved