getProof
Returns the account and storage values of the specified account including the Merkle-proof.
Usage
ts
import { publicClient } from './client'
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
})
import { publicClient } from './client'
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
})
ts
import { createPublicClient, http } from 'viem'
import { optimism } from 'viem/chains'
export const publicClient = createPublicClient({
chain: optimism,
transport: http()
})
import { createPublicClient, http } from 'viem'
import { optimism } from 'viem/chains'
export const publicClient = createPublicClient({
chain: optimism,
transport: http()
})
Returns
Proof
Proof data.
Parameters
address
- Type:
bigint
Account address.
ts
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockNumber: 42069n
})
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockNumber: 42069n
})
storageKeys
- Type:
Hash[]
Array of storage-keys that should be proofed and included.
ts
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockNumber: 42069n
})
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockNumber: 42069n
})
blockNumber (optional)
- Type:
bigint
Proof at a given block number.
ts
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockNumber: 42069n
})
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockNumber: 42069n
})
blockTag (optional)
- Type:
'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'
- Default:
'latest'
Proof at a given block tag.
ts
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockTag: 'latest'
})
const proof = await publicClient.getProof({
address: '0x4200000000000000000000000000000000000016',
storageKeys: [
'0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99',
],
blockTag: 'latest'
})
JSON-RPC Method
- Calls
eth_getProof
.