IncludedTransaction
type IncludedTransaction = Pick<PendingTransaction, "transaction" | "toJSON" | "toPretty" | "hash" | "data"> & {
inclusionBlockHeight?: number;
status: "included";
getDepth: Promise<TransactionDepthInfo>;
safeGetDepth: Promise<TransactionDepthInfo | null>;
waitForFinality: Promise<TransactionDepthInfo>;
};
Defined in: lib/mina/v1/transaction.ts:311
Represents a transaction that has been successfully included in a block.
Type Declaration
inclusionBlockHeight?
optional inclusionBlockHeight?: number;
The block height at which this transaction was included. May be undefined if not tracked (e.g., when using LocalBlockchain without block height simulation).
status
status: "included";
Example
try {
const includedTx: IncludedTransaction = await pendingTransaction.wait();
// If wait() resolves, it means the transaction was successfully included.
console.log(`Transaction ${includedTx.hash} included in a block.`);
} catch (error) {
// If wait() throws, the transaction was not included in a block.
console.error('Transaction failed to be included in a block:', error);
}
getDepth()
getDepth(options?: DepthOptions): Promise<TransactionDepthInfo>;
Fetches the current depth (confirmation count) of this transaction. Depth represents the number of blocks built on top of the block containing this transaction.
Parameters
options?
Optional configuration for the depth query
Returns
Promise<TransactionDepthInfo>
TransactionDepthInfo with depth, block heights, and finality status
Throws
Error if the transaction cannot be found in recent blocks or a network error occurs
Example
const included = await pendingTransaction.wait();
const depthInfo = await included.getDepth();
console.log(`Depth: ${depthInfo.depth}, Finalized: ${depthInfo.isFinalized}`);
See
https://docs.minaprotocol.com/mina-protocol/lifecycle-of-a-payment
safeGetDepth()
safeGetDepth(options?: DepthOptions): Promise<TransactionDepthInfo | null>;
Safe variant of IncludedTransaction.getDepth that returns null instead of throwing.
Parameters
options?
Optional configuration for the depth query
Returns
Promise<TransactionDepthInfo | null>
TransactionDepthInfo if found, null otherwise
Example
const depthInfo = await included.safeGetDepth();
if (depthInfo?.isFinalized) {
console.log('Transaction has reached finality!');
}
waitForFinality()
waitForFinality(options?: WaitForFinalityOptions): Promise<TransactionDepthInfo>;
Polls the network until the transaction reaches the specified finality threshold. Returns the final TransactionDepthInfo once finality is reached.
Use the onProgress callback to receive updates on each poll — useful for
updating UIs with confirmation progress.
Parameters
options?
WaitForFinalityOptions
Configuration for the finality wait
Returns
Promise<TransactionDepthInfo>
TransactionDepthInfo once finality is reached
Throws
Error if max attempts exceeded or transaction not found
Example
// Simple usage — fire and forget
included.waitForFinality().then(info => {
console.log(`Finalized at depth: ${info.depth}`);
});
// With progress callback for UI updates
included.waitForFinality({
finalityThreshold: 10,
onProgress: (info) => {
console.log(`${info.depth}/${info.finalityThreshold} confirmations`);
},
});
See
https://docs.minaprotocol.com/mina-protocol/lifecycle-of-a-payment