Skip to main content

Track Universal Transaction

Overview

Track the status of a universal transaction using the hash of the chain where it was originally submitted, whether that transaction started on Push Chain or an external chain.

This is useful for re-checking transaction progress, restoring status after a page refresh, polling from a backend, or tracking a transaction created in a different session.

Note: trackTransaction() can be used independently of sendTransaction(). You can pass any previously stored transaction hash and origin chain to resume tracking.

Track Universal Transaction

pushChainClient.universal.trackTransaction(txHash, {options}): Promise<UniversalTxResponse>

const response = await pushChainClient.universal.trackTransaction(
'0xbd765a6b60da077eaa89a382cd59c0469a4eaabcaca2707d3e6dcdeafc497a39',
{
progressHook: (progress) => {
console.log(`${progress.id}: ${progress.message}`);
},
}
);

TheseArgumentsare mandatory

ArgumentsTypeDefaultDescription
txHashstring-Transaction hash or signature to track on the origin chain. Format depends on the chain where the transaction was originally submitted.
options.chainCHAINCHAIN.PUSH_TESTNET_DONUTThe chain on which the transaction was submitted.
options.progressHook(event: ProgressEvent) => voidundefinedCallback invoked at each tracking step showing progress.

Progress hook follows the same structure as Send Universal Transaction - Progress Hook.
options.waitForCompletionbooleantrueWhen true, waits for on-chain confirmation before resolving. When false, returns immediately after the first status check.
Advanced Arguments
ArgumentsTypeDefaultDescription
options.advanced.pollingIntervalMsnumber2000Milliseconds between polling attempts. Minimum: 500.
options.advanced.timeoutnumber60000Maximum milliseconds to wait before throwing a timeout error.
options.advanced.rpcUrlsPartial<Record<CHAIN, string[]>>{}Custom RPC URLs to use when querying status.
Returns `UniversalTxResponse` <object>

The returned UniversalTxResponse contains the latest resolved transaction state, including Push Chain execution details and external-chain details when applicable.

For the full response shape, see Send Universal Transaction - TxResponse object.

Live Playground

VIRTUAL NODE IDE
Copy playground link
Copy code

Using tx.wait() vs trackTransaction()

Both methods return identical TransactionReceipt objects. The difference is how you call them:

tx.wait() — Chain off sendTransaction()

Use when you just sent a transaction in the same session and want to wait inline:

const tx = await pushChainClient.universal.sendTransaction({
to: '0x35B84d6848D16415177c64D64504663b998A6ab4',
value: BigInt(1000),
});

// Inline wait — no separate hash lookup needed
const receipt = await tx.wait();
console.log('Confirmed at block:', receipt.blockNumber.toString());

trackTransaction() — Track any hash independently

Use when you have a hash from somewhere else — stored in a database, received from a user, or from a previous session:

// Works with any valid Push Chain tx hash
const response = await pushChainClient.universal.trackTransaction(
'0xbd765a6b60da077eaa89a382cd59c0469a4eaabcaca2707d3e6dcdeafc497a39',
{
waitForCompletion: true,
progressHook: (event) => console.log(`${event.id}: ${event.message}`),
}
);

Error Handling

try {
const response = await pushChainClient.universal.trackTransaction(txHash, {
waitForCompletion: true,
advanced: { timeout: 30000 },
});

// Get the receipt to check status
const receipt = await response.wait();
if (receipt.status === 0) {
console.error('Transaction reverted on-chain');
} else {
console.log('Transaction confirmed:', response.hash);
}
} catch (error) {
if (error.message.includes('Timeout')) {
console.error('Timed out — try increasing advanced.timeout');
} else if (error.message.includes('Invalid')) {
console.error('Invalid hash — must be 0x-prefixed 32-byte hex');
} else {
console.error('Tracking error:', error.message);
}
}
ErrorCauseFix
Invalid hash formatNot a valid 32-byte hex with 0x prefixHash must be 66 characters starting with 0x
TimeoutTransaction not confirmed within advanced.timeoutIncrease timeout or check network congestion
Transaction not foundHash doesn't exist on the specified chainVerify hash and options.chain value
Network errorRPC unreachableSupply custom URLs via advanced.rpcUrls

Next Steps