Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions dist/ethers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15049,12 +15049,12 @@ class TransactionReceipt {
* Returns a JSON-compatible representation.
*/
toJSON() {
const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium,
const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium,
status, root } = this;
return {
_type: "TransactionReceipt",
blockHash, blockNumber,
//byzantium,
//byzantium,
contractAddress,
cumulativeGasUsed: toJson(this.cumulativeGasUsed),
from,
Expand Down Expand Up @@ -19211,6 +19211,24 @@ class AbstractProvider {
const position = getBigInt(_position, "position");
return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag));
}
async getStorageProof(address, _storageKeys, blockTag) {
const storageKeys = _storageKeys.map(key => getBigInt(key, "storageKey"));
const result = await this.#getAccountValue({ method: "getStorageProof", storageKeys }, address, blockTag);
const cleanup = (v) => v === "0x0" ? "0x00" : v;
return {
address: hexlify(result.address),
accountProof: result.accountProof.map(hexlify),
balance: getBigInt(result.balance, "%response"),
codeHash: hexlify(result.codeHash),
nonce: getNumber(cleanup(result.nonce), "%response"),
storageHash: hexlify(result.storageHash),
storageProof: result.storageProof.map((p) => ({
key: getBigInt(cleanup(p.key), "storageKey"),
value: hexlify(cleanup(p.value)),
proof: p.proof.map(hexlify)
}))
};
}
// Write
async broadcastTransaction(signedTx) {
const { blockNumber, hash, network } = await resolveProperties({
Expand Down Expand Up @@ -20925,6 +20943,15 @@ class JsonRpcApiProvider extends AbstractProvider {
req.blockTag
]
};
case "getStorageProof":
return {
method: "eth_getProof",
args: [
getLowerCase(req.address),
req.storageKeys.map(storageKey => "0x" + storageKey.toString(16)),
req.blockTag
]
};
case "broadcastTransaction":
return {
method: "eth_sendRawTransaction",
Expand Down Expand Up @@ -22115,6 +22142,10 @@ class EtherscanProvider extends AbstractProvider {
position: req.position,
tag: req.blockTag
});
case "getStorageProof":
assert(false, "getStorageProof not supported by Etherscan", "UNSUPPORTED_OPERATION", {
operation: "getStorageProof(account,storageKeys,tag)"
});
case "broadcastTransaction":
return this.fetch("proxy", {
action: "eth_sendRawTransaction",
Expand Down Expand Up @@ -23257,6 +23288,8 @@ class FallbackProvider extends AbstractProvider {
return await provider.getLogs(req.filter);
case "getStorage":
return await provider.getStorage(req.address, req.position, req.blockTag);
case "getStorageProof":
return await provider.getStorageProof(req.address, req.storageKeys, req.blockTag);
case "getTransaction":
return await provider.getTransaction(req.hash);
case "getTransactionCount":
Expand Down Expand Up @@ -23414,6 +23447,7 @@ class FallbackProvider extends AbstractProvider {
case "getTransactionCount":
case "getCode":
case "getStorage":
case "getStorageProof":
case "getTransaction":
case "getTransactionReceipt":
case "getLogs":
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.min.js

Large diffs are not rendered by default.

38 changes: 36 additions & 2 deletions dist/ethers.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -15055,12 +15055,12 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
* Returns a JSON-compatible representation.
*/
toJSON() {
const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium,
const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium,
status, root } = this;
return {
_type: "TransactionReceipt",
blockHash, blockNumber,
//byzantium,
//byzantium,
contractAddress,
cumulativeGasUsed: toJson(this.cumulativeGasUsed),
from,
Expand Down Expand Up @@ -19217,6 +19217,24 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
const position = getBigInt(_position, "position");
return hexlify(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag));
}
async getStorageProof(address, _storageKeys, blockTag) {
const storageKeys = _storageKeys.map(key => getBigInt(key, "storageKey"));
const result = await this.#getAccountValue({ method: "getStorageProof", storageKeys }, address, blockTag);
const cleanup = (v) => v === "0x0" ? "0x00" : v;
return {
address: hexlify(result.address),
accountProof: result.accountProof.map(hexlify),
balance: getBigInt(result.balance, "%response"),
codeHash: hexlify(result.codeHash),
nonce: getNumber(cleanup(result.nonce), "%response"),
storageHash: hexlify(result.storageHash),
storageProof: result.storageProof.map((p) => ({
key: getBigInt(cleanup(p.key), "storageKey"),
value: hexlify(cleanup(p.value)),
proof: p.proof.map(hexlify)
}))
};
}
// Write
async broadcastTransaction(signedTx) {
const { blockNumber, hash, network } = await resolveProperties({
Expand Down Expand Up @@ -20931,6 +20949,15 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
req.blockTag
]
};
case "getStorageProof":
return {
method: "eth_getProof",
args: [
getLowerCase(req.address),
req.storageKeys.map(storageKey => "0x" + storageKey.toString(16)),
req.blockTag
]
};
case "broadcastTransaction":
return {
method: "eth_sendRawTransaction",
Expand Down Expand Up @@ -22121,6 +22148,10 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
position: req.position,
tag: req.blockTag
});
case "getStorageProof":
assert(false, "getStorageProof not supported by Etherscan", "UNSUPPORTED_OPERATION", {
operation: "getStorageProof(account,storageKeys,tag)"
});
case "broadcastTransaction":
return this.fetch("proxy", {
action: "eth_sendRawTransaction",
Expand Down Expand Up @@ -23263,6 +23294,8 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
return await provider.getLogs(req.filter);
case "getStorage":
return await provider.getStorage(req.address, req.position, req.blockTag);
case "getStorageProof":
return await provider.getStorageProof(req.address, req.storageKeys, req.blockTag);
case "getTransaction":
return await provider.getTransaction(req.hash);
case "getTransactionCount":
Expand Down Expand Up @@ -23420,6 +23453,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
case "getTransactionCount":
case "getCode":
case "getStorage":
case "getStorageProof":
case "getTransaction":
case "getTransactionReceipt":
case "getLogs":
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.umd.min.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion lib.commonjs/providers/abstract-provider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { BigNumberish } from "../utils/index.js";
import type { Listener } from "../utils/index.js";
import type { Networkish } from "./network.js";
import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js";
import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js";
import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, StorageProof, TransactionRequest } from "./provider.js";
/**
* The types of additional event values that can be emitted for the
* ``"debug"`` event.
Expand Down Expand Up @@ -215,6 +215,11 @@ export type PerformActionRequest = {
address: string;
position: bigint;
blockTag: BlockTag;
} | {
method: "getStorageProof";
address: string;
storageKeys: Array<bigint>;
blockTag: BlockTag;
} | {
method: "getTransaction";
hash: string;
Expand Down Expand Up @@ -355,6 +360,7 @@ export declare class AbstractProvider implements Provider {
getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise<number>;
getCode(address: AddressLike, blockTag?: BlockTag): Promise<string>;
getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise<string>;
getStorageProof(address: AddressLike, _storageKeys: Array<BigNumberish>, blockTag?: BlockTag): Promise<StorageProof>;
broadcastTransaction(signedTx: string): Promise<TransactionResponse>;
getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise<null | Block>;
getTransaction(hash: string): Promise<null | TransactionResponse>;
Expand Down
2 changes: 1 addition & 1 deletion lib.commonjs/providers/abstract-provider.d.ts.map

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions lib.commonjs/providers/abstract-provider.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/providers/abstract-provider.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib.commonjs/providers/provider-etherscan.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib.commonjs/providers/provider-etherscan.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading