eth_getTransactionByHash

Retrieves a transaction by its hash.

Example

import { getRpcClient, eth_getTransactionByHash } from "thirdweb/rpc";
const rpcRequest = getRpcClient({ client, chain });
const transaction = await eth_getTransactionByHash(rpcRequest, {
hash: "0x...",
});
function eth_getTransactionByHash(
request: EIP1193RequestFn<
[
{
Method: "web3_clientVersion";
Parameters?: undefined;
ReturnType: string;
},
{
Method: "web3_sha3";
Parameters: [data: `0x${string}`];
ReturnType: string;
},
{
Method: "net_listening";
Parameters?: undefined;
ReturnType: boolean;
},
{
Method: "net_peerCount";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
{
Method: "net_version";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
]
>,
params: GetTransactionByHashParameters,
): Promise<Transaction>;

Parameters

The EIP1193 request function.

Type

let request: EIP1193RequestFn<
[
{
Method: "web3_clientVersion";
Parameters?: undefined;
ReturnType: string;
},
{
Method: "web3_sha3";
Parameters: [data: `0x${string}`];
ReturnType: string;
},
{
Method: "net_listening";
Parameters?: undefined;
ReturnType: boolean;
},
{
Method: "net_peerCount";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
{
Method: "net_version";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
]
>;

The parameters for retrieving the transaction.

Type

let params: GetTransactionByHashParameters;

Returns

let returnType: Promise<Transaction>;

A promise that resolves to the transaction.