eth_getStorageAt

Retrieves the value stored at a specific position in the storage of a contract.

Example

import { getRpcClient, eth_getStorageAt } from "thirdweb/rpc";
const rpcRequest = getRpcClient({ client, chain });
const storageValue = await eth_getStorageAt(rpcRequest, {
address: "0x...",
position: 0n,
});
function eth_getStorageAt(
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: GetStorageAtParams,
): Promise<Hex>;

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 the eth_getStorageAt method.

Type

let params: GetStorageAtParams;

Returns

let returnType: `0x${string}`;

A promise that resolves to the value stored at the specified position.