Skip to content

getTransactionStatus

Action for getting a Starknet transaction status.

Import

import { getTransactionStatus } from "starkweb/core";

Usage

index.ts
import { getTransactionStatus } from "starkweb/core";
import { config } from "./config";
 
const status = await getTransactionStatus(config, {
  transactionHash: "0x123...", 
});

Parameters

import { type GetTransactionStatusParameters } from "starkweb/core";

transactionHash

Hex

The hash of the transaction to get the status for.

index.ts
import { getTransactionStatus } from "starkweb/core";
import { config } from "./config";
 
const status = await getTransactionStatus(config, {
  transactionHash: "0x123...", 
});

chainId (optional)

Hex | undefined

The chain ID to get the status from. If not provided, uses the current chain.

index.ts
import { getTransactionStatus } from "starkweb/core";
import { mainnet } from "starkweb/chains"; 
import { config } from "./config";
 
const status = await getTransactionStatus(config, {
  transactionHash: "0x123...",
  chainId: mainnet.chain_id, 
});

Return Type

import { type GetTransactionStatusReturnType } from "starkweb/core";

Returns the transaction status information including:

chainId

Hex

The chain ID of the network.

status

TransactionStatus

The current status of the transaction (e.g., 'ACCEPTED_ON_L2', 'PENDING').

block_hash

Hex | null

The hash of the block containing the transaction, if available.

Example

example.ts
import { getTransactionStatus } from "starkweb/core";
import { mainnet, testnet } from "starkweb/chains"; 
import { config } from "./config";
 
// Get status on current chain
const status = await getTransactionStatus(config, {
  transactionHash: "0x123...", 
});
console.log("Transaction status:", status.status);
 
// Get status on specific chain
const mainnetStatus = await getTransactionStatus(config, {
  transactionHash: "0x456...",
  chainId: mainnet.chain_id, 
});

Error

import { type GetTransactionStatusErrorType } from "starkweb/core";