Skip to content

waitForTransaction

waitForTransaction(config, txId, confirmations, params): Promise<number>

Waits for a transaction to be confirmed with the given parameters.

Import

ts
import { waitForTransaction } from "@midl-xyz/midl-js-core";

Example

ts
const confirmations = await waitForTransaction(config, "txid", 1);
console.log(confirmations);

Parameters

NameTypeDescription
configConfigThe configuration object
txIdstringThe transaction ID
confirmationsnumberThe number of confirmations to wait for
paramsWaitForTransactionParamsThe parameters for the request

WaitForTransactionParams

NameTypeDescription
maxAttemptsnumberThe maximum number of attempts
intervalMsnumberThe interval in milliseconds

Returns

Promise<number> - The number of confirmations