UNPKG

postchain-client

Version:

Client library for accessing a Postchain node through REST.

52 lines (51 loc) 3.81 kB
/// <reference types="node" /> import { IClient } from "../blockchainClient/interface"; import { PubKey, ConfirmationProof } from "../blockchainClient/types"; import { IccfProof, AnchoringTransaction } from "./types"; /** * Creates an ICCF (Inter-Chain Communication Framework) proof transaction. * This function generates a proof that a specific transaction has occurred on the source blockchain * and constructs an ICCF proof transaction that can be posted to the target blockchain. * * @param {IClient} client - The client configured to communicate with the management chain. * @param {Buffer} txToProveRid - The RID of the transaction to be proven. * @param {Buffer} txToProveHash - The hash of the transaction to be proven. * @param {PubKey[]} txToProveSigners - An array of public keys representing signers of the transaction to be proven. * @param {string} sourceBlockchainRid - The RID of the source blockchain. * @param {string} targetBlockchainRid - The RID of the target blockchain. * @param {PubKey[]} iccfTxSigners - An array of public keys representing signers of the ICCF proof transaction (optional, default: []). * @param {boolean} forceIntraNetworkIccfOperation - Whether to force the ICCF operation to be performed within the same network (optional, default: false). * @returns {Promise<IccfProof>} A promise that resolves to an ICCF proof object containing the ICCF proof transaction. */ export declare function createIccfProofTx(client: IClient, txToProveRid: Buffer, txToProveHash: Buffer, txToProveSigners: PubKey[], sourceBlockchainRid: string, targetBlockchainRid: string, iccfTxSigners?: PubKey[], forceIntraNetworkIccfOperation?: boolean): Promise<IccfProof>; /** * Checks whether a given transaction is included in the cluster anchoring chain and returns the * block anchoring transaction. If `txProof` is not provided, it fetches the confirmation proof * using the `sourceClient`. * * @param sourceClient - A client configured to the blockchain where the transaction was made. * @param anchoringClient - The client responsible for querying the anchoring blockchain. * @param txRid - The transaction RID to check for anchoring. * @param txProof - (Optional) The transaction proof for the specified `txRid`. * @returns A Promise that resolves to the anchored transaction response object. */ export declare function getBlockAnchoringTransaction(sourceClient: IClient, anchoringClient: IClient, txRid?: Buffer, txProof?: ConfirmationProof): Promise<AnchoringTransaction>; /** * Checks whether a given transaction is included in the anchoring blockchain. * * @param sourceClient - A client configured to the blockchain where the transaction was made. * @param anchoringClient - The client responsible for querying the anchoring blockchain. * @param txRid - The transaction RID to check for anchoring. * @param txProof - (Optional) The transaction proof for the specified `txRid`. * @returns A Promise that resolves to `true` if the transaction is anchored, `false` otherwise. */ export declare function isBlockAnchored(sourceClient: IClient, anchoringClient: IClient, txRid: Buffer, txProof?: ConfirmationProof): Promise<boolean>; /** * Gets a client configured for the cluster anchoring blockchain of a cluster. Takes a specific * cluster name or blockchain RID to determine the cluster. * @param client - The client configured to communicate with the management chain. * @param dappBlockchainRid - (Optional) The RID of a blockchain which anchoring wants to be checked. * @param cluster - (Optional) The cluster of interest. * @returns A Promise that resolves to the client configured to a cluster anchoring chain. */ export declare function getAnchoringClient(client: IClient, dappBlockchainRid?: string, cluster?: string): Promise<IClient>;