Skip to content

Provider: add getStorageProof wrapper on top of eth_getProof#5101

Open
Amxx wants to merge 1 commit intoethers-io:mainfrom
Amxx:feature/provider/getStorageProof
Open

Provider: add getStorageProof wrapper on top of eth_getProof#5101
Amxx wants to merge 1 commit intoethers-io:mainfrom
Amxx:feature/provider/getStorageProof

Conversation

@Amxx
Copy link

@Amxx Amxx commented Feb 5, 2026

I did some testing against real nodes. Not sure how to add unit tests following the ethers.js format.

Note that v0.12.0-next.23 of EDR now supports this method.

address: string, position: bigint, blockTag: BlockTag
} | {
method: "getStorageProof",
address: string, storageKeys: Array<bigint>, blockTag: BlockTag
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I used bigint to match the position or getStorage.

const storageKeys = _storageKeys.map(key => getBigInt(key, "storageKey"));
const result = await this.#getAccountValue({ method: "getStorageProof", storageKeys }, address, blockTag);

const cleanup = (v: string) => v === "0x0" ? "0x00": v;
Copy link
Author

@Amxx Amxx Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen nodes return 0x0 for empty nonce, keys and values. This cleanup avoids an "invalide BytesLike value" error

accountProof: string[];
balance: bigint;
codeHash: string;
nonce: number;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using number here to match the return type of Provider.getTransactionCount

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant