@ethersproject/providers
Advanced tools
Comparing version 5.3.1 to 5.4.0
@@ -1,2 +0,2 @@ | ||
export declare const version = "providers/5.3.1"; | ||
export declare const version = "providers/5.4.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = "providers/5.3.1"; | ||
export const version = "providers/5.4.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -15,4 +15,5 @@ import { Network, Networkish } from "@ethersproject/networks"; | ||
static getUrl(network: Network, apiKey: string): ConnectionInfo; | ||
perform(method: string, params: any): Promise<any>; | ||
isCommunityResource(): boolean; | ||
} | ||
//# sourceMappingURL=alchemy-provider.d.ts.map |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
import { defineReadOnly } from "@ethersproject/properties"; | ||
@@ -71,2 +80,16 @@ import { showThrottleMessage } from "./formatter"; | ||
} | ||
perform(method, params) { | ||
const _super = Object.create(null, { | ||
perform: { get: () => super.perform } | ||
}); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if ((method === "estimateGas" && params.transaction.type === 2) || (method === "sendTransaction" && params.signedTransaction.substring(0, 4) === "0x02")) { | ||
logger.throwError("AlchemyProvider does not currently support EIP-1559", Logger.errors.UNSUPPORTED_OPERATION, { | ||
operation: method, | ||
transaction: params.transaction | ||
}); | ||
} | ||
return _super.perform.call(this, method, params); | ||
}); | ||
} | ||
isCommunityResource() { | ||
@@ -73,0 +96,0 @@ return (this.apiKey === defaultApiKey); |
@@ -28,4 +28,7 @@ "use strict"; | ||
let value = transaction[key]; | ||
if (key === "type" && value === 0) { | ||
continue; | ||
} | ||
// Quantity-types require no leading zero, unless 0 | ||
if ({ type: true, gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) { | ||
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { | ||
value = hexValue(hexlify(value)); | ||
@@ -103,4 +106,15 @@ } | ||
const e = error.error; | ||
if (e && e.message.match("reverted") && isHexString(e.data)) { | ||
return e.data; | ||
// Etherscan keeps changing their string | ||
if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { | ||
// Etherscan prefixes the data like "Reverted 0x1234" | ||
let data = e.data; | ||
if (data) { | ||
data = "0x" + data.replace(/^.*0x/i, ""); | ||
} | ||
if (isHexString(data)) { | ||
return data; | ||
} | ||
logger.throwError("missing revert data in call exception", Logger.errors.CALL_EXCEPTION, { | ||
error, data: "0x" | ||
}); | ||
} | ||
@@ -107,0 +121,0 @@ } |
@@ -24,2 +24,3 @@ import { Block, TransactionReceipt, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
number(number: any): number; | ||
type(number: any): number; | ||
bigNumber(value: any): BigNumber; | ||
@@ -26,0 +27,0 @@ boolean(value: any): boolean; |
@@ -25,6 +25,7 @@ "use strict"; | ||
const number = this.number.bind(this); | ||
const type = this.type.bind(this); | ||
const strictData = (v) => { return this.data(v, true); }; | ||
formats.transaction = { | ||
hash: hash, | ||
type: Formatter.allowNull(number, null), | ||
type: type, | ||
accessList: Formatter.allowNull(this.accessList.bind(this), null), | ||
@@ -36,3 +37,7 @@ blockHash: Formatter.allowNull(hash, null), | ||
from: address, | ||
gasPrice: bigNumber, | ||
// either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) | ||
// must be set | ||
gasPrice: Formatter.allowNull(bigNumber), | ||
maxPriorityFeePerGas: Formatter.allowNull(bigNumber), | ||
maxFeePerGas: Formatter.allowNull(bigNumber), | ||
gasLimit: bigNumber, | ||
@@ -54,2 +59,4 @@ to: Formatter.allowNull(address, null), | ||
gasPrice: Formatter.allowNull(bigNumber), | ||
maxPriorityFeePerGas: Formatter.allowNull(bigNumber), | ||
maxFeePerGas: Formatter.allowNull(bigNumber), | ||
to: Formatter.allowNull(address), | ||
@@ -86,3 +93,5 @@ value: Formatter.allowNull(bigNumber), | ||
cumulativeGasUsed: bigNumber, | ||
status: Formatter.allowNull(number) | ||
effectiveGasPrice: Formatter.allowNull(bigNumber), | ||
status: Formatter.allowNull(number), | ||
type: type | ||
}; | ||
@@ -101,2 +110,3 @@ formats.block = { | ||
transactions: Formatter.allowNull(Formatter.arrayOf(hash)), | ||
baseFeePerGas: Formatter.allowNull(bigNumber) | ||
}; | ||
@@ -136,2 +146,8 @@ formats.blockWithTransactions = shallowCopy(formats.block); | ||
} | ||
type(number) { | ||
if (number === "0x" || number == null) { | ||
return 0; | ||
} | ||
return BigNumber.from(number).toNumber(); | ||
} | ||
// Strict! Used on input. | ||
@@ -138,0 +154,0 @@ bigNumber(value) { |
@@ -1,2 +0,2 @@ | ||
import { Block, BlockTag, EventType, Filter, Log, Listener, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { Block, BlockTag, EventType, FeeData, Filter, Log, Listener, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { getNetwork } from "@ethersproject/networks"; | ||
@@ -21,3 +21,3 @@ import { Network, Networkish } from "@ethersproject/networks"; | ||
declare function getDefaultProvider(network?: Network | string, options?: any): BaseProvider; | ||
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, JsonRpcBatchProvider, NodesmithProvider, PocketProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, JsonRpcBatchProvider, NodesmithProvider, PocketProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage, Formatter, Block, BlockTag, EventType, FeeData, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -32,2 +32,5 @@ "use strict"; | ||
} | ||
logger.throwError("missing revert data in call exception", Logger.errors.CALL_EXCEPTION, { | ||
error, data: "0x" | ||
}); | ||
} | ||
@@ -159,2 +162,14 @@ let message = error.message; | ||
} | ||
if (transaction.to != null) { | ||
transaction.to = Promise.resolve(transaction.to).then((to) => __awaiter(this, void 0, void 0, function* () { | ||
if (to == null) { | ||
return null; | ||
} | ||
const address = yield this.provider.resolveName(to); | ||
if (address == null) { | ||
logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); | ||
} | ||
return address; | ||
})); | ||
} | ||
return resolveProperties({ | ||
@@ -530,3 +545,3 @@ tx: resolveProperties(transaction), | ||
// Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. | ||
["gasLimit", "gasPrice", "type", "nonce", "value"].forEach(function (key) { | ||
["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { | ||
if (transaction[key] == null) { | ||
@@ -533,0 +548,0 @@ return; |
@@ -1,2 +0,2 @@ | ||
export declare const version = "providers/5.3.1"; | ||
export declare const version = "providers/5.4.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = "providers/5.3.1"; | ||
exports.version = "providers/5.4.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -15,4 +15,5 @@ import { Network, Networkish } from "@ethersproject/networks"; | ||
static getUrl(network: Network, apiKey: string): ConnectionInfo; | ||
perform(method: string, params: any): Promise<any>; | ||
isCommunityResource(): boolean; | ||
} | ||
//# sourceMappingURL=alchemy-provider.d.ts.map |
@@ -17,2 +17,38 @@ "use strict"; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -98,2 +134,15 @@ exports.AlchemyProvider = exports.AlchemyWebSocketProvider = void 0; | ||
}; | ||
AlchemyProvider.prototype.perform = function (method, params) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if ((method === "estimateGas" && params.transaction.type === 2) || (method === "sendTransaction" && params.signedTransaction.substring(0, 4) === "0x02")) { | ||
logger.throwError("AlchemyProvider does not currently support EIP-1559", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { | ||
operation: method, | ||
transaction: params.transaction | ||
}); | ||
} | ||
return [2 /*return*/, _super.prototype.perform.call(this, method, params)]; | ||
}); | ||
}); | ||
}; | ||
AlchemyProvider.prototype.isCommunityResource = function () { | ||
@@ -100,0 +149,0 @@ return (this.apiKey === defaultApiKey); |
@@ -72,4 +72,7 @@ "use strict"; | ||
var value = transaction[key]; | ||
if (key === "type" && value === 0) { | ||
continue; | ||
} | ||
// Quantity-types require no leading zero, unless 0 | ||
if ({ type: true, gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) { | ||
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { | ||
value = bytes_1.hexValue(bytes_1.hexlify(value)); | ||
@@ -147,4 +150,16 @@ } | ||
var e = error.error; | ||
if (e && e.message.match("reverted") && bytes_1.isHexString(e.data)) { | ||
return e.data; | ||
// Etherscan keeps changing their string | ||
if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { | ||
// Etherscan prefixes the data like "Reverted 0x1234" | ||
var data = e.data; | ||
if (data) { | ||
data = "0x" + data.replace(/^.*0x/i, ""); | ||
} | ||
if (bytes_1.isHexString(data)) { | ||
return data; | ||
} | ||
logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { | ||
error: error, | ||
data: "0x" | ||
}); | ||
} | ||
@@ -151,0 +166,0 @@ } |
@@ -24,2 +24,3 @@ import { Block, TransactionReceipt, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
number(number: any): number; | ||
type(number: any): number; | ||
bigNumber(value: any): BigNumber; | ||
@@ -26,0 +27,0 @@ boolean(value: any): boolean; |
@@ -29,6 +29,7 @@ "use strict"; | ||
var number = this.number.bind(this); | ||
var type = this.type.bind(this); | ||
var strictData = function (v) { return _this.data(v, true); }; | ||
formats.transaction = { | ||
hash: hash, | ||
type: Formatter.allowNull(number, null), | ||
type: type, | ||
accessList: Formatter.allowNull(this.accessList.bind(this), null), | ||
@@ -40,3 +41,7 @@ blockHash: Formatter.allowNull(hash, null), | ||
from: address, | ||
gasPrice: bigNumber, | ||
// either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) | ||
// must be set | ||
gasPrice: Formatter.allowNull(bigNumber), | ||
maxPriorityFeePerGas: Formatter.allowNull(bigNumber), | ||
maxFeePerGas: Formatter.allowNull(bigNumber), | ||
gasLimit: bigNumber, | ||
@@ -58,2 +63,4 @@ to: Formatter.allowNull(address, null), | ||
gasPrice: Formatter.allowNull(bigNumber), | ||
maxPriorityFeePerGas: Formatter.allowNull(bigNumber), | ||
maxFeePerGas: Formatter.allowNull(bigNumber), | ||
to: Formatter.allowNull(address), | ||
@@ -90,3 +97,5 @@ value: Formatter.allowNull(bigNumber), | ||
cumulativeGasUsed: bigNumber, | ||
status: Formatter.allowNull(number) | ||
effectiveGasPrice: Formatter.allowNull(bigNumber), | ||
status: Formatter.allowNull(number), | ||
type: type | ||
}; | ||
@@ -105,2 +114,3 @@ formats.block = { | ||
transactions: Formatter.allowNull(Formatter.arrayOf(hash)), | ||
baseFeePerGas: Formatter.allowNull(bigNumber) | ||
}; | ||
@@ -140,2 +150,8 @@ formats.blockWithTransactions = properties_1.shallowCopy(formats.block); | ||
}; | ||
Formatter.prototype.type = function (number) { | ||
if (number === "0x" || number == null) { | ||
return 0; | ||
} | ||
return bignumber_1.BigNumber.from(number).toNumber(); | ||
}; | ||
// Strict! Used on input. | ||
@@ -142,0 +158,0 @@ Formatter.prototype.bigNumber = function (value) { |
@@ -1,2 +0,2 @@ | ||
import { Block, BlockTag, EventType, Filter, Log, Listener, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { Block, BlockTag, EventType, FeeData, Filter, Log, Listener, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { getNetwork } from "@ethersproject/networks"; | ||
@@ -21,3 +21,3 @@ import { Network, Networkish } from "@ethersproject/networks"; | ||
declare function getDefaultProvider(network?: Network | string, options?: any): BaseProvider; | ||
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, JsonRpcBatchProvider, NodesmithProvider, PocketProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, JsonRpcBatchProvider, NodesmithProvider, PocketProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage, Formatter, Block, BlockTag, EventType, FeeData, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -76,2 +76,6 @@ "use strict"; | ||
} | ||
logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { | ||
error: error, | ||
data: "0x" | ||
}); | ||
} | ||
@@ -209,2 +213,22 @@ var message = error.message; | ||
} | ||
if (transaction.to != null) { | ||
transaction.to = Promise.resolve(transaction.to).then(function (to) { return __awaiter(_this, void 0, void 0, function () { | ||
var address; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (to == null) { | ||
return [2 /*return*/, null]; | ||
} | ||
return [4 /*yield*/, this.provider.resolveName(to)]; | ||
case 1: | ||
address = _a.sent(); | ||
if (address == null) { | ||
logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); | ||
} | ||
return [2 /*return*/, address]; | ||
} | ||
}); | ||
}); }); | ||
} | ||
return properties_1.resolveProperties({ | ||
@@ -675,3 +699,3 @@ tx: properties_1.resolveProperties(transaction), | ||
// Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. | ||
["gasLimit", "gasPrice", "type", "nonce", "value"].forEach(function (key) { | ||
["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { | ||
if (transaction[key] == null) { | ||
@@ -678,0 +702,0 @@ return; |
@@ -17,19 +17,19 @@ { | ||
"dependencies": { | ||
"@ethersproject/abstract-provider": "^5.3.0", | ||
"@ethersproject/abstract-signer": "^5.3.0", | ||
"@ethersproject/address": "^5.3.0", | ||
"@ethersproject/basex": "^5.3.0", | ||
"@ethersproject/bignumber": "^5.3.0", | ||
"@ethersproject/bytes": "^5.3.0", | ||
"@ethersproject/constants": "^5.3.0", | ||
"@ethersproject/hash": "^5.3.0", | ||
"@ethersproject/logger": "^5.3.0", | ||
"@ethersproject/networks": "^5.3.0", | ||
"@ethersproject/properties": "^5.3.0", | ||
"@ethersproject/random": "^5.3.0", | ||
"@ethersproject/rlp": "^5.3.0", | ||
"@ethersproject/sha2": "^5.3.0", | ||
"@ethersproject/strings": "^5.3.0", | ||
"@ethersproject/transactions": "^5.3.0", | ||
"@ethersproject/web": "^5.3.0", | ||
"@ethersproject/abstract-provider": "^5.4.0", | ||
"@ethersproject/abstract-signer": "^5.4.0", | ||
"@ethersproject/address": "^5.4.0", | ||
"@ethersproject/basex": "^5.4.0", | ||
"@ethersproject/bignumber": "^5.4.0", | ||
"@ethersproject/bytes": "^5.4.0", | ||
"@ethersproject/constants": "^5.4.0", | ||
"@ethersproject/hash": "^5.4.0", | ||
"@ethersproject/logger": "^5.4.0", | ||
"@ethersproject/networks": "^5.4.0", | ||
"@ethersproject/properties": "^5.4.0", | ||
"@ethersproject/random": "^5.4.0", | ||
"@ethersproject/rlp": "^5.4.0", | ||
"@ethersproject/sha2": "^5.4.0", | ||
"@ethersproject/strings": "^5.4.0", | ||
"@ethersproject/transactions": "^5.4.0", | ||
"@ethersproject/web": "^5.4.0", | ||
"bech32": "1.1.4", | ||
@@ -50,3 +50,3 @@ "ws": "7.4.6" | ||
], | ||
"gitHead": "412bbe29394661192d7279094783401d300a1f81", | ||
"gitHead": "71b7547f10229f50d8b701611c5e6041b8ed966b", | ||
"keywords": [ | ||
@@ -72,5 +72,5 @@ "Ethereum", | ||
"sideEffects": false, | ||
"tarballHash": "0xcc7b538634c932a19b36f816b83b91016d62c5ba71c052e4e0f41bd8c8f181c2", | ||
"tarballHash": "0xf24d2da6e3944e40f09572573bea0a2e39ae22cff4fb944c7d25fee43eb1c9dc", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.3.1" | ||
"version": "5.4.0" | ||
} |
@@ -1,1 +0,1 @@ | ||
export const version = "providers/5.3.1"; | ||
export const version = "providers/5.4.0"; |
@@ -89,2 +89,13 @@ "use strict"; | ||
async perform(method: string, params: any): Promise<any> { | ||
if ((method === "estimateGas" && params.transaction.type === 2) || (method === "sendTransaction" && params.signedTransaction.substring(0, 4) === "0x02")) { | ||
logger.throwError("AlchemyProvider does not currently support EIP-1559", Logger.errors.UNSUPPORTED_OPERATION, { | ||
operation: method, | ||
transaction: params.transaction | ||
}); | ||
} | ||
return super.perform(method, params); | ||
} | ||
isCommunityResource(): boolean { | ||
@@ -91,0 +102,0 @@ return (this.apiKey === defaultApiKey); |
@@ -253,3 +253,2 @@ "use strict"; | ||
async _fetchBytes(selector: string, parameters?: string): Promise<string> { | ||
// keccak256("addr(bytes32,uint256)") | ||
@@ -261,8 +260,13 @@ const transaction = { | ||
const result = await this.provider.call(transaction); | ||
if (result === "0x") { return null; } | ||
try { | ||
const result = await this.provider.call(transaction); | ||
if (result === "0x") { return null; } | ||
const offset = BigNumber.from(hexDataSlice(result, 0, 32)).toNumber(); | ||
const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber(); | ||
return hexDataSlice(result, offset + 32, offset + 32 + length); | ||
const offset = BigNumber.from(hexDataSlice(result, 0, 32)).toNumber(); | ||
const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber(); | ||
return hexDataSlice(result, offset + 32, offset + 32 + length); | ||
} catch (error) { | ||
if (error.code === Logger.errors.CALL_EXCEPTION) { return null; } | ||
return null; | ||
} | ||
} | ||
@@ -337,13 +341,18 @@ | ||
if (coinType === 60) { | ||
// keccak256("addr(bytes32)") | ||
const transaction = { | ||
to: this.address, | ||
data: ("0x3b3b57de" + namehash(this.name).substring(2)) | ||
}; | ||
const hexBytes = await this.provider.call(transaction); | ||
try { | ||
// keccak256("addr(bytes32)") | ||
const transaction = { | ||
to: this.address, | ||
data: ("0x3b3b57de" + namehash(this.name).substring(2)) | ||
}; | ||
const hexBytes = await this.provider.call(transaction); | ||
// No address | ||
if (hexBytes === "0x" || hexBytes === HashZero) { return null; } | ||
// No address | ||
if (hexBytes === "0x" || hexBytes === HashZero) { return null; } | ||
return this.provider.formatter.callAddress(hexBytes); | ||
return this.provider.formatter.callAddress(hexBytes); | ||
} catch (error) { | ||
if (error.code === Logger.errors.CALL_EXCEPTION) { return null; } | ||
throw error; | ||
} | ||
} | ||
@@ -1505,5 +1514,10 @@ | ||
async getResolver(name: string): Promise<Resolver> { | ||
const address = await this._getResolver(name); | ||
if (address == null) { return null; } | ||
return new Resolver(this, address, name); | ||
try { | ||
const address = await this._getResolver(name); | ||
if (address == null) { return null; } | ||
return new Resolver(this, address, name); | ||
} catch (error) { | ||
if (error.code === Logger.errors.CALL_EXCEPTION) { return null; } | ||
return null; | ||
} | ||
} | ||
@@ -1530,3 +1544,8 @@ | ||
return this.formatter.callAddress(await this.call(transaction)); | ||
try { | ||
return this.formatter.callAddress(await this.call(transaction)); | ||
} catch (error) { | ||
if (error.code === Logger.errors.CALL_EXCEPTION) { return null; } | ||
throw error; | ||
} | ||
} | ||
@@ -1533,0 +1552,0 @@ |
@@ -25,4 +25,6 @@ "use strict"; | ||
let value = (<any>transaction)[key]; | ||
if (key === "type" && value === 0) { continue; } | ||
// Quantity-types require no leading zero, unless 0 | ||
if ((<any>{ type: true, gasLimit: true, gasPrice: true, nonce: true, value: true })[key]) { | ||
if ((<any>{ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true })[key]) { | ||
value = hexValue(hexlify(value)); | ||
@@ -102,4 +104,14 @@ } else if (key === "accessList") { | ||
const e = error.error; | ||
if (e && e.message.match("reverted") && isHexString(e.data)) { | ||
return e.data; | ||
// Etherscan keeps changing their string | ||
if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { | ||
// Etherscan prefixes the data like "Reverted 0x1234" | ||
let data = e.data; | ||
if (data) { data = "0x" + data.replace(/^.*0x/i, ""); } | ||
if (isHexString(data)) { return data; } | ||
logger.throwError("missing revert data in call exception", Logger.errors.CALL_EXCEPTION, { | ||
error, data: "0x" | ||
}); | ||
} | ||
@@ -106,0 +118,0 @@ } |
@@ -101,3 +101,3 @@ "use strict"; | ||
// The priority to favour this Provider; higher values are used first | ||
// The priority to favour this Provider; lower values are used first (higher priority) | ||
priority?: number; | ||
@@ -104,0 +104,0 @@ |
@@ -48,2 +48,3 @@ "use strict"; | ||
const number = this.number.bind(this); | ||
const type = this.type.bind(this); | ||
@@ -55,3 +56,3 @@ const strictData = (v: any) => { return this.data(v, true); }; | ||
type: Formatter.allowNull(number, null), | ||
type: type, | ||
accessList: Formatter.allowNull(this.accessList.bind(this), null), | ||
@@ -67,3 +68,8 @@ | ||
gasPrice: bigNumber, | ||
// either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) | ||
// must be set | ||
gasPrice: Formatter.allowNull(bigNumber), | ||
maxPriorityFeePerGas: Formatter.allowNull(bigNumber), | ||
maxFeePerGas: Formatter.allowNull(bigNumber), | ||
gasLimit: bigNumber, | ||
@@ -89,2 +95,4 @@ to: Formatter.allowNull(address, null), | ||
gasPrice: Formatter.allowNull(bigNumber), | ||
maxPriorityFeePerGas: Formatter.allowNull(bigNumber), | ||
maxFeePerGas: Formatter.allowNull(bigNumber), | ||
to: Formatter.allowNull(address), | ||
@@ -123,3 +131,5 @@ value: Formatter.allowNull(bigNumber), | ||
cumulativeGasUsed: bigNumber, | ||
status: Formatter.allowNull(number) | ||
effectiveGasPrice: Formatter.allowNull(bigNumber), | ||
status: Formatter.allowNull(number), | ||
type: type | ||
}; | ||
@@ -143,2 +153,4 @@ | ||
transactions: Formatter.allowNull(Formatter.arrayOf(hash)), | ||
baseFeePerGas: Formatter.allowNull(bigNumber) | ||
}; | ||
@@ -187,2 +199,7 @@ | ||
type(number: any): number { | ||
if (number === "0x" || number == null) { return 0; } | ||
return BigNumber.from(number).toNumber(); | ||
} | ||
// Strict! Used on input. | ||
@@ -189,0 +206,0 @@ bigNumber(value: any): BigNumber { |
@@ -7,2 +7,3 @@ "use strict"; | ||
EventType, | ||
FeeData, | ||
Filter, | ||
@@ -154,2 +155,3 @@ Log, | ||
EventType, | ||
FeeData, | ||
Filter, | ||
@@ -156,0 +158,0 @@ Log, |
@@ -33,2 +33,6 @@ "use strict"; | ||
} | ||
logger.throwError("missing revert data in call exception", Logger.errors.CALL_EXCEPTION, { | ||
error, data: "0x" | ||
}); | ||
} | ||
@@ -183,2 +187,13 @@ | ||
if (transaction.to != null) { | ||
transaction.to = Promise.resolve(transaction.to).then(async (to) => { | ||
if (to == null) { return null; } | ||
const address = await this.provider.resolveName(to); | ||
if (address == null) { | ||
logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); | ||
} | ||
return address; | ||
}); | ||
} | ||
return resolveProperties({ | ||
@@ -188,2 +203,3 @@ tx: resolveProperties(transaction), | ||
}).then(({ tx, sender }) => { | ||
if (tx.from != null) { | ||
@@ -606,3 +622,3 @@ if (tx.from.toLowerCase() !== sender) { | ||
// Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. | ||
["gasLimit", "gasPrice", "type", "nonce", "value"].forEach(function(key) { | ||
["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function(key) { | ||
if ((<any>transaction)[key] == null) { return; } | ||
@@ -609,0 +625,0 @@ const value = hexValue((<any>transaction)[key]); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1068493
16000
Updated@ethersproject/basex@^5.4.0
Updated@ethersproject/bytes@^5.4.0
Updated@ethersproject/hash@^5.4.0
Updated@ethersproject/logger@^5.4.0
Updated@ethersproject/random@^5.4.0
Updated@ethersproject/rlp@^5.4.0
Updated@ethersproject/sha2@^5.4.0
Updated@ethersproject/web@^5.4.0