Skip to content

Commit

Permalink
Fixed EIP-2930 transactions for EtherscanProvider (#1364).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 14, 2021
1 parent 2534b1b commit b655089
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions packages/providers/src.ts/etherscan-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BlockTag, TransactionRequest, TransactionResponse } from "@ethersprojec
import { hexlify, hexValue, isHexString } from "@ethersproject/bytes";
import { Network, Networkish } from "@ethersproject/networks";
import { deepCopy, defineReadOnly } from "@ethersproject/properties";
import { accessListify } from "@ethersproject/transactions";
import { ConnectionInfo, fetchJson } from "@ethersproject/web";

import { showThrottleMessage } from "./formatter";
Expand All @@ -25,7 +26,10 @@ function getTransactionPostData(transaction: TransactionRequest): Record<string,
if ((<any>{ type: true, gasLimit: true, gasPrice: true, nonce: true, value: true })[key]) {
value = hexValue(hexlify(value));
} else if (key === "accessList") {
value = value;
const sets = accessListify(value);
value = '[' + sets.map((set) => {
return `{address:"${ set.address }",storageKeys:["${ set.storageKeys.join('","') }"]}`;
}).join(",") + "]";
} else {
value = hexlify(value);
}
Expand Down Expand Up @@ -297,13 +301,6 @@ export class EtherscanProvider extends BaseProvider{


case "call": {
if (params.transaction.type != null) {
logger.throwError("Etherscan does not currently support Berlin", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "call",
transaction: params.transaction
});
}

if (params.blockTag !== "latest") {
throw new Error("EtherscanProvider does not support blockTag for call");
}
Expand All @@ -321,13 +318,6 @@ export class EtherscanProvider extends BaseProvider{
}

case "estimateGas": {
if (params.transaction.type != null) {
logger.throwError("Etherscan does not currently support Berlin", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "estimateGas",
transaction: params.transaction
});
}

const postData = getTransactionPostData(params.transaction);
postData.module = "proxy";
postData.action = "eth_estimateGas";
Expand Down

0 comments on commit b655089

Please sign in to comment.