getTransactionReceipt
Action for getting a Starknet transaction receipt.
Import
import { getTransactionReceipt } from "starkweb/core";
Usage
index.ts
import { getTransactionReceipt } from "starkweb/core";
import { config } from "./config";
const receipt = await getTransactionReceipt(config, {
transactionHash: "0x123...",
});
Parameters
import { type GetTransactionReceiptParameters } from "starkweb/core";
transactionHash
Hex
The hash of the transaction to get the receipt for.
index.ts
import { getTransactionReceipt } from "starkweb/core";
import { config } from "./config";
const receipt = await getTransactionReceipt(config, {
transactionHash: "0x123...",
});
chainId (optional)
Hex | undefined
The chain ID to get the receipt from. If not provided, uses the current chain.
index.ts
import { getTransactionReceipt } from "starkweb/core";
import { mainnet } from "starkweb/chains";
import { config } from "./config";
const receipt = await getTransactionReceipt(config, {
transactionHash: "0x123...",
chainId: mainnet.chain_id,
});
Return Type
import { type GetTransactionReceiptReturnType } from "starkweb/core";
Returns the transaction receipt information including:
chainId
Hex
The chain ID of the network.
transaction_hash
Hex
The hash of the transaction.
status
TransactionStatus
The status of the transaction (e.g., 'ACCEPTED_ON_L2', 'PENDING').
block_number
bigint
The block number where the transaction was included.
events
Event[]
Array of events emitted by the transaction.
Example
example.ts
import { getTransactionReceipt } from "starkweb/core";
import { mainnet, testnet } from "starkweb/chains";
import { config } from "./config";
// Get receipt on current chain
const receipt = await getTransactionReceipt(config, {
transactionHash: "0x123...",
});
console.log("Transaction status:", receipt.status);
// Get receipt on specific chain
const mainnetReceipt = await getTransactionReceipt(config, {
transactionHash: "0x456...",
chainId: mainnet.chain_id,
});
Error
import { type GetTransactionReceiptErrorType } from "starkweb/core";
TanStack Query
import {
type GetTransactionReceiptData,
type GetTransactionReceiptQueryFnData,
type GetTransactionReceiptQueryKey,
getTransactionReceiptQueryKey,
getTransactionReceiptQueryOptions,
} from "starkweb/query";