Skip to content

getTraceTransaction

Action for getting a Starknet transaction trace.

Import

import { getTraceTransaction } from "starkweb/core";

Usage

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

Parameters

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

transactionHash

Hex

The hash of the transaction to get the trace for.

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

chainId (optional)

Hex | undefined

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

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

Return Type

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

Returns the transaction trace information including:

chainId

Hex

The chain ID of the network.

trace

TransactionTrace

The detailed trace of the transaction execution.

Example

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

Error

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