Gateway represents the connection of a specific client identity to a Fabric Gateway. A Gateway is obtained using the connect function.

This type implements the Disposable interface, allowing instances to be disposed of with ECMAScript explicit resource management and the using keyword instead of calling close directly.

interface Gateway {
    "[dispose]"(): void;
    close(): void;
    getIdentity(): Identity;
    getNetwork(channelName: string): Network;
    newBlockAndPrivateDataEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
    ): BlockAndPrivateDataEventsRequest;
    newBlockEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
    ): BlockEventsRequest;
    newChaincodeEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
    ): ChaincodeEventsRequest;
    newCommit(bytes: Uint8Array<ArrayBufferLike>): Commit;
    newFilteredBlockEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
    ): FilteredBlockEventsRequest;
    newProposal(bytes: Uint8Array<ArrayBufferLike>): Proposal;
    newSignedBlockAndPrivateDataEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
        signature: Uint8Array<ArrayBufferLike>,
    ): BlockAndPrivateDataEventsRequest;
    newSignedBlockEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
        signature: Uint8Array<ArrayBufferLike>,
    ): BlockEventsRequest;
    newSignedChaincodeEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
        signature: Uint8Array<ArrayBufferLike>,
    ): ChaincodeEventsRequest;
    newSignedCommit(
        bytes: Uint8Array<ArrayBufferLike>,
        signature: Uint8Array<ArrayBufferLike>,
    ): Commit;
    newSignedFilteredBlockEventsRequest(
        bytes: Uint8Array<ArrayBufferLike>,
        signature: Uint8Array<ArrayBufferLike>,
    ): FilteredBlockEventsRequest;
    newSignedProposal(
        bytes: Uint8Array<ArrayBufferLike>,
        signature: Uint8Array<ArrayBufferLike>,
    ): Proposal;
    newSignedTransaction(
        bytes: Uint8Array<ArrayBufferLike>,
        signature: Uint8Array<ArrayBufferLike>,
    ): Transaction;
    newTransaction(bytes: Uint8Array<ArrayBufferLike>): Transaction;
}

Methods

  • Close the gateway when it is no longer required. This releases all resources associated with networks and contracts obtained using the Gateway, including removing event listeners.

    Returns void

  • Get a network representing the named Fabric channel.

    Parameters

    • channelName: string

      Fabric channel name.

    Returns Network

  • Recreate a block events request from serialized data.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized block events request.

    Returns BlockEventsRequest

    A block events request.

  • Recreate a chaincode events request from serialized data.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized chaincode events request.

    Returns ChaincodeEventsRequest

    A chaincode events request.

  • Recreate a commit status request from serialized data.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized commit status request.

    Returns Commit

    A commit status request.

  • Recreate a proposal from serialized data.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized proposal.

    Returns Proposal

    A proposal.

  • Create a block and private data events request with the specified digital signature. Supports off-line signing flow.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized block and private data events request.

    • signature: Uint8Array<ArrayBufferLike>

      Digital signature.

    Returns BlockAndPrivateDataEventsRequest

    A signed block and private data events request.

  • Create a block events request with the specified digital signature. Supports off-line signing flow.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized block events request.

    • signature: Uint8Array<ArrayBufferLike>

      Digital signature.

    Returns BlockEventsRequest

    A signed block events request.

  • Create a chaincode events request with the specified digital signature. Supports off-line signing flow.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized chaincode events request.

    • signature: Uint8Array<ArrayBufferLike>

      Digital signature.

    Returns ChaincodeEventsRequest

    A signed chaincode events request.

  • Create a commit with the specified digital signature, which can be used to access information about a transaction that is committed to the ledger. Supports off-line signing flow.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized commit status request.

    • signature: Uint8Array<ArrayBufferLike>

      Digital signature.

    Returns Commit

    A signed commit status request.

  • Create a filtered block events request with the specified digital signature. Supports off-line signing flow.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized filtered block events request.

    • signature: Uint8Array<ArrayBufferLike>

      Digital signature.

    Returns FilteredBlockEventsRequest

    A signed filtered block events request.

  • Create a proposal with the specified digital signature. Supports off-line signing flow.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized proposal.

    • signature: Uint8Array<ArrayBufferLike>

      Digital signature.

    Returns Proposal

    A signed proposal.

  • Create a transaction with the specified digital signature. Supports off-line signing flow.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized proposal.

    • signature: Uint8Array<ArrayBufferLike>

      Digital signature.

    Returns Transaction

    A signed transaction.

  • Recreate a transaction from serialized data.

    Parameters

    • bytes: Uint8Array<ArrayBufferLike>

      Serialized proposal.

    Returns Transaction

    A transaction.