@ethersproject/providers
Advanced tools
Comparing version 5.4.5 to 5.5.0
@@ -1,2 +0,2 @@ | ||
export declare const version = "providers/5.4.5"; | ||
export declare const version = "providers/5.5.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = "providers/5.4.5"; | ||
export const version = "providers/5.5.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -22,11 +22,18 @@ /// <reference types="node" /> | ||
readonly address: string; | ||
getAddress(coinType?: 60): Promise<string>; | ||
getContentHash(): Promise<string>; | ||
getText(key: string): Promise<string>; | ||
getAddress(coinType?: 60): Promise<null | string>; | ||
getContentHash(): Promise<null | string>; | ||
getText(key: string): Promise<null | string>; | ||
} | ||
export interface EnsProvider { | ||
resolveName(name: string): Promise<string>; | ||
lookupAddress(address: string): Promise<string>; | ||
getResolver(name: string): Promise<EnsResolver>; | ||
resolveName(name: string): Promise<null | string>; | ||
lookupAddress(address: string): Promise<null | string>; | ||
getResolver(name: string): Promise<null | EnsResolver>; | ||
} | ||
export interface Avatar { | ||
url: string; | ||
linkage: Array<{ | ||
type: string; | ||
content: string; | ||
}>; | ||
} | ||
export declare class Resolver implements EnsResolver { | ||
@@ -36,6 +43,8 @@ readonly provider: BaseProvider; | ||
readonly address: string; | ||
constructor(provider: BaseProvider, address: string, name: string); | ||
_fetchBytes(selector: string, parameters?: string): Promise<string>; | ||
readonly _resolvedAddress: null | string; | ||
constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string); | ||
_fetchBytes(selector: string, parameters?: string): Promise<null | string>; | ||
_getAddress(coinType: number, hexBytes: string): string; | ||
getAddress(coinType?: number): Promise<string>; | ||
getAvatar(): Promise<null | Avatar>; | ||
getContentHash(): Promise<string>; | ||
@@ -123,6 +132,7 @@ getText(key: string): Promise<string>; | ||
_getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag>; | ||
getResolver(name: string): Promise<Resolver>; | ||
getResolver(name: string): Promise<null | Resolver>; | ||
_getResolver(name: string): Promise<string>; | ||
resolveName(name: string | Promise<string>): Promise<string>; | ||
lookupAddress(address: string | Promise<string>): Promise<string>; | ||
resolveName(name: string | Promise<string>): Promise<null | string>; | ||
lookupAddress(address: string | Promise<string>): Promise<null | string>; | ||
getAvatar(nameOrAddress: string): Promise<null | string>; | ||
perform(method: string, params: any): Promise<any>; | ||
@@ -129,0 +139,0 @@ _startEvent(event: Event): void; |
@@ -385,3 +385,3 @@ "use strict"; | ||
// Note: The `page` page parameter only allows pagination within the | ||
// 10,000 window abailable without a page and offset parameter | ||
// 10,000 window available without a page and offset parameter | ||
// Error: Result window is too large, PageNo x Offset size must | ||
@@ -388,0 +388,0 @@ // be less than or equal to 10000 |
@@ -246,3 +246,7 @@ "use strict"; | ||
} | ||
return Formatter.check(format, value); | ||
// The difficulty may need to come from _difficulty in recursed blocks | ||
const difficulty = (value._difficulty != null) ? value._difficulty : value.difficulty; | ||
const result = Formatter.check(format, value); | ||
result._difficulty = ((difficulty == null) ? null : BigNumber.from(difficulty)); | ||
return result; | ||
} | ||
@@ -249,0 +253,0 @@ block(value) { |
@@ -8,3 +8,3 @@ import { Block, BlockTag, EventType, FeeData, Filter, Log, Listener, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { EtherscanProvider } from "./etherscan-provider"; | ||
import { FallbackProvider } from "./fallback-provider"; | ||
import { FallbackProvider, FallbackProviderConfig } from "./fallback-provider"; | ||
import { IpcProvider } from "./ipc-provider"; | ||
@@ -21,4 +21,4 @@ import { InfuraProvider, InfuraWebSocketProvider } from "./infura-provider"; | ||
import { CommunityResourcable, Formatter, isCommunityResourcable, isCommunityResource, showThrottleMessage } from "./formatter"; | ||
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, FeeData, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
declare function getDefaultProvider(network?: Networkish, 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, FeeData, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, FallbackProviderConfig, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -70,3 +70,3 @@ "use strict"; | ||
/////////////////////// | ||
// Concreate Providers | ||
// Concrete Providers | ||
FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, JsonRpcBatchProvider, NodesmithProvider, PocketProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, | ||
@@ -73,0 +73,0 @@ /////////////////////// |
@@ -21,2 +21,3 @@ import { Provider, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
signMessage(message: Bytes | string): Promise<string>; | ||
_legacySignMessage(message: Bytes | string): Promise<string>; | ||
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>; | ||
@@ -23,0 +24,0 @@ unlock(password: string): Promise<boolean>; |
@@ -226,2 +226,9 @@ "use strict"; | ||
const address = yield this.getAddress(); | ||
return yield this.provider.send("personal_sign", [hexlify(data), address.toLowerCase()]); | ||
}); | ||
} | ||
_legacySignMessage(message) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const data = ((typeof (message) === "string") ? toUtf8Bytes(message) : message); | ||
const address = yield this.getAddress(); | ||
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign | ||
@@ -228,0 +235,0 @@ return yield this.provider.send("eth_sign", [address.toLowerCase(), hexlify(data)]); |
@@ -7,3 +7,3 @@ "use strict"; | ||
import { UrlJsonRpcProvider } from "./url-json-rpc-provider"; | ||
// These are load-balancer-based applicatoin IDs | ||
// These are load-balancer-based application IDs | ||
const defaultApplicationIds = { | ||
@@ -20,3 +20,3 @@ homestead: "6004bcd10040261633ade990", | ||
if (apiKey == null) { | ||
const n = getStatic((new.target), "getNetwork")(network); | ||
const n = getStatic(new.target, "getNetwork")(network); | ||
if (n) { | ||
@@ -23,0 +23,0 @@ const applicationId = defaultApplicationIds[n.name]; |
@@ -54,5 +54,5 @@ "use strict"; | ||
// Normalize the Network and API Key | ||
network = getStatic((new.target), "getNetwork")(network); | ||
apiKey = getStatic((new.target), "getApiKey")(apiKey); | ||
const connection = getStatic((new.target), "getUrl")(network, apiKey); | ||
network = getStatic(new.target, "getNetwork")(network); | ||
apiKey = getStatic(new.target, "getApiKey")(apiKey); | ||
const connection = getStatic(new.target, "getUrl")(network, apiKey); | ||
super(connection, network); | ||
@@ -59,0 +59,0 @@ if (typeof (apiKey) === "string") { |
@@ -11,8 +11,2 @@ "use strict"; | ||
return function (method, params) { | ||
// Metamask complains about eth_sign (and on some versions hangs) | ||
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) { | ||
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign | ||
method = "personal_sign"; | ||
params = [params[1], params[0]]; | ||
} | ||
const request = { | ||
@@ -65,8 +59,2 @@ method: method, | ||
} | ||
// Metamask complains about eth_sign (and on some versions hangs) | ||
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) { | ||
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign | ||
method = "personal_sign"; | ||
params = [params[1], params[0]]; | ||
} | ||
const request = { method, params }; | ||
@@ -73,0 +61,0 @@ this.emit("debug", { |
@@ -26,3 +26,3 @@ "use strict"; | ||
* | ||
* For example, if a polling provider emits an event which indicats | ||
* For example, if a polling provider emits an event which indicates | ||
* the event occurred in blockhash XXX, a call to fetch that block by | ||
@@ -29,0 +29,0 @@ * its hash XXX, if not present will retry until it is present. This |
@@ -1,2 +0,2 @@ | ||
export declare const version = "providers/5.4.5"; | ||
export declare const version = "providers/5.5.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = "providers/5.4.5"; | ||
exports.version = "providers/5.5.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -39,3 +39,3 @@ "use strict"; | ||
_this = _super.call(this, url, provider.network) || this; | ||
properties_1.defineReadOnly(_this, "apiKey", provider.apiKey); | ||
(0, properties_1.defineReadOnly)(_this, "apiKey", provider.apiKey); | ||
return _this; | ||
@@ -98,3 +98,3 @@ } | ||
if (apiKey === defaultApiKey) { | ||
formatter_1.showThrottleMessage(); | ||
(0, formatter_1.showThrottleMessage)(); | ||
} | ||
@@ -101,0 +101,0 @@ return Promise.resolve(true); |
@@ -22,11 +22,18 @@ /// <reference types="node" /> | ||
readonly address: string; | ||
getAddress(coinType?: 60): Promise<string>; | ||
getContentHash(): Promise<string>; | ||
getText(key: string): Promise<string>; | ||
getAddress(coinType?: 60): Promise<null | string>; | ||
getContentHash(): Promise<null | string>; | ||
getText(key: string): Promise<null | string>; | ||
} | ||
export interface EnsProvider { | ||
resolveName(name: string): Promise<string>; | ||
lookupAddress(address: string): Promise<string>; | ||
getResolver(name: string): Promise<EnsResolver>; | ||
resolveName(name: string): Promise<null | string>; | ||
lookupAddress(address: string): Promise<null | string>; | ||
getResolver(name: string): Promise<null | EnsResolver>; | ||
} | ||
export interface Avatar { | ||
url: string; | ||
linkage: Array<{ | ||
type: string; | ||
content: string; | ||
}>; | ||
} | ||
export declare class Resolver implements EnsResolver { | ||
@@ -36,6 +43,8 @@ readonly provider: BaseProvider; | ||
readonly address: string; | ||
constructor(provider: BaseProvider, address: string, name: string); | ||
_fetchBytes(selector: string, parameters?: string): Promise<string>; | ||
readonly _resolvedAddress: null | string; | ||
constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string); | ||
_fetchBytes(selector: string, parameters?: string): Promise<null | string>; | ||
_getAddress(coinType: number, hexBytes: string): string; | ||
getAddress(coinType?: number): Promise<string>; | ||
getAvatar(): Promise<null | Avatar>; | ||
getContentHash(): Promise<string>; | ||
@@ -123,6 +132,7 @@ getText(key: string): Promise<string>; | ||
_getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag>; | ||
getResolver(name: string): Promise<Resolver>; | ||
getResolver(name: string): Promise<null | Resolver>; | ||
_getResolver(name: string): Promise<string>; | ||
resolveName(name: string | Promise<string>): Promise<string>; | ||
lookupAddress(address: string | Promise<string>): Promise<string>; | ||
resolveName(name: string | Promise<string>): Promise<null | string>; | ||
lookupAddress(address: string | Promise<string>): Promise<null | string>; | ||
getAvatar(nameOrAddress: string): Promise<null | string>; | ||
perform(method: string, params: any): Promise<any>; | ||
@@ -129,0 +139,0 @@ _startEvent(event: Event): void; |
@@ -77,6 +77,6 @@ "use strict"; | ||
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { | ||
value = bytes_1.hexValue(bytes_1.hexlify(value)); | ||
value = (0, bytes_1.hexValue)((0, bytes_1.hexlify)(value)); | ||
} | ||
else if (key === "accessList") { | ||
value = "[" + transactions_1.accessListify(value).map(function (set) { | ||
value = "[" + (0, transactions_1.accessListify)(value).map(function (set) { | ||
return "{address:\"" + set.address + "\",storageKeys:[\"" + set.storageKeys.join('","') + "\"]}"; | ||
@@ -86,3 +86,3 @@ }).join(",") + "]"; | ||
else { | ||
value = bytes_1.hexlify(value); | ||
value = (0, bytes_1.hexlify)(value); | ||
} | ||
@@ -158,3 +158,3 @@ result[key] = value; | ||
} | ||
if (bytes_1.isHexString(data)) { | ||
if ((0, bytes_1.isHexString)(data)) { | ||
return data; | ||
@@ -185,3 +185,5 @@ } | ||
logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -192,3 +194,5 @@ } | ||
logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -199,3 +203,5 @@ } | ||
logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -205,3 +211,5 @@ } | ||
logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -218,4 +226,4 @@ } | ||
_this = _super.call(this, network) || this; | ||
properties_1.defineReadOnly(_this, "baseUrl", _this.getBaseUrl()); | ||
properties_1.defineReadOnly(_this, "apiKey", apiKey || defaultApiKey); | ||
(0, properties_1.defineReadOnly)(_this, "baseUrl", _this.getBaseUrl()); | ||
(0, properties_1.defineReadOnly)(_this, "apiKey", apiKey || defaultApiKey); | ||
return _this; | ||
@@ -278,3 +286,3 @@ } | ||
if (_this.isCommunityResource()) { | ||
formatter_1.showThrottleMessage(); | ||
(0, formatter_1.showThrottleMessage)(); | ||
} | ||
@@ -291,3 +299,3 @@ return Promise.resolve(true); | ||
} | ||
return [4 /*yield*/, web_1.fetchJson(connection, payloadStr, procFunc || getJsonResult)]; | ||
return [4 /*yield*/, (0, web_1.fetchJson)(connection, payloadStr, procFunc || getJsonResult)]; | ||
case 1: | ||
@@ -298,3 +306,3 @@ result = _a.sent(); | ||
request: url, | ||
response: properties_1.deepCopy(result), | ||
response: (0, properties_1.deepCopy)(result), | ||
provider: this | ||
@@ -478,3 +486,3 @@ }); | ||
// Note: The `page` page parameter only allows pagination within the | ||
// 10,000 window abailable without a page and offset parameter | ||
// 10,000 window available without a page and offset parameter | ||
// Error: Result window is too large, PageNo x Offset size must | ||
@@ -481,0 +489,0 @@ // be less than or equal to 10000 |
@@ -278,3 +278,3 @@ "use strict"; | ||
} | ||
tx = properties_1.shallowCopy(tx); | ||
tx = (0, properties_1.shallowCopy)(tx); | ||
tx.confirmations = -1; | ||
@@ -292,5 +292,5 @@ return serialize(tx); | ||
} | ||
block = properties_1.shallowCopy(block); | ||
block = (0, properties_1.shallowCopy)(block); | ||
block.transactions = block.transactions.map(function (tx) { | ||
tx = properties_1.shallowCopy(tx); | ||
tx = (0, properties_1.shallowCopy)(tx); | ||
tx.confirmations = -1; | ||
@@ -328,3 +328,3 @@ return tx; | ||
} | ||
return [2 /*return*/, web_1.poll(function () { | ||
return [2 /*return*/, (0, web_1.poll)(function () { | ||
return new Promise(function (resolve, reject) { | ||
@@ -379,3 +379,3 @@ setTimeout(function () { | ||
case 3: | ||
if (!(params.blockTag && bytes_1.isHexString(params.blockTag))) return [3 /*break*/, 5]; | ||
if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3 /*break*/, 5]; | ||
return [4 /*yield*/, waitForSync(config, currentBlockNumber)]; | ||
@@ -387,3 +387,3 @@ case 4: | ||
case 6: | ||
if (!(params.blockTag && bytes_1.isHexString(params.blockTag))) return [3 /*break*/, 8]; | ||
if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, waitForSync(config, currentBlockNumber)]; | ||
@@ -395,3 +395,3 @@ case 7: | ||
case 9: | ||
if (!(params.blockTag && bytes_1.isHexString(params.blockTag))) return [3 /*break*/, 11]; | ||
if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3 /*break*/, 11]; | ||
return [4 /*yield*/, waitForSync(config, currentBlockNumber)]; | ||
@@ -403,3 +403,3 @@ case 10: | ||
case 12: | ||
if (!(params.blockTag && bytes_1.isHexString(params.blockTag))) return [3 /*break*/, 14]; | ||
if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3 /*break*/, 14]; | ||
return [4 /*yield*/, waitForSync(config, currentBlockNumber)]; | ||
@@ -413,3 +413,3 @@ case 13: | ||
filter = params.filter; | ||
if (!((filter.fromBlock && bytes_1.isHexString(filter.fromBlock)) || (filter.toBlock && bytes_1.isHexString(filter.toBlock)))) return [3 /*break*/, 18]; | ||
if (!((filter.fromBlock && (0, bytes_1.isHexString)(filter.fromBlock)) || (filter.toBlock && (0, bytes_1.isHexString)(filter.toBlock)))) return [3 /*break*/, 18]; | ||
return [4 /*yield*/, waitForSync(config, currentBlockNumber)]; | ||
@@ -439,7 +439,7 @@ case 17: | ||
if (abstract_provider_1.Provider.isProvider(configOrProvider)) { | ||
var stallTimeout = formatter_1.isCommunityResource(configOrProvider) ? 2000 : 750; | ||
var stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2000 : 750; | ||
var priority = 1; | ||
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: stallTimeout, priority: priority }); | ||
} | ||
var config = properties_1.shallowCopy(configOrProvider); | ||
var config = (0, properties_1.shallowCopy)(configOrProvider); | ||
if (config.priority == null) { | ||
@@ -449,3 +449,3 @@ config.priority = 1; | ||
if (config.stallTimeout == null) { | ||
config.stallTimeout = formatter_1.isCommunityResource(configOrProvider) ? 2000 : 750; | ||
config.stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2000 : 750; | ||
} | ||
@@ -480,4 +480,4 @@ if (config.weight == null) { | ||
// Preserve a copy, so we do not get mutated | ||
properties_1.defineReadOnly(_this, "providerConfigs", Object.freeze(providerConfigs)); | ||
properties_1.defineReadOnly(_this, "quorum", quorum); | ||
(0, properties_1.defineReadOnly)(_this, "providerConfigs", Object.freeze(providerConfigs)); | ||
(0, properties_1.defineReadOnly)(_this, "quorum", quorum); | ||
_this._highestBlockNumber = -1; | ||
@@ -533,3 +533,3 @@ return _this; | ||
processFunc = getProcessFunc(this, method, params); | ||
configs = random_1.shuffled(this.providerConfigs.map(properties_1.shallowCopy)); | ||
configs = (0, random_1.shuffled)(this.providerConfigs.map(properties_1.shallowCopy)); | ||
configs.sort(function (a, b) { return (a.priority - b.priority); }); | ||
@@ -561,3 +561,3 @@ currentBlockNumber = this._highestBlockNumber; | ||
backend: exposeDebugConfig(config, now()), | ||
request: { method: method, params: properties_1.deepCopy(params) }, | ||
request: { method: method, params: (0, properties_1.deepCopy)(params) }, | ||
provider: _this | ||
@@ -574,3 +574,3 @@ }); | ||
backend: exposeDebugConfig(config, now()), | ||
request: { method: method, params: properties_1.deepCopy(params) }, | ||
request: { method: method, params: (0, properties_1.deepCopy)(params) }, | ||
provider: _this | ||
@@ -585,3 +585,3 @@ }); | ||
backend: exposeDebugConfig(config, null), | ||
request: { method: method, params: properties_1.deepCopy(params) }, | ||
request: { method: method, params: (0, properties_1.deepCopy)(params) }, | ||
provider: this_1 | ||
@@ -588,0 +588,0 @@ }); |
@@ -112,3 +112,3 @@ "use strict"; | ||
}; | ||
formats.blockWithTransactions = properties_1.shallowCopy(formats.block); | ||
formats.blockWithTransactions = (0, properties_1.shallowCopy)(formats.block); | ||
formats.blockWithTransactions.transactions = Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this))); | ||
@@ -136,3 +136,3 @@ formats.filter = { | ||
Formatter.prototype.accessList = function (accessList) { | ||
return transactions_1.accessListify(accessList || []); | ||
return (0, transactions_1.accessListify)(accessList || []); | ||
}; | ||
@@ -178,3 +178,3 @@ // Requires a BigNumberish that is within the IEEE754 safe integer range; returns a number | ||
} | ||
if (bytes_1.isHexString(value)) { | ||
if ((0, bytes_1.isHexString)(value)) { | ||
return value.toLowerCase(); | ||
@@ -195,13 +195,13 @@ } | ||
Formatter.prototype.address = function (value) { | ||
return address_1.getAddress(value); | ||
return (0, address_1.getAddress)(value); | ||
}; | ||
Formatter.prototype.callAddress = function (value) { | ||
if (!bytes_1.isHexString(value, 32)) { | ||
if (!(0, bytes_1.isHexString)(value, 32)) { | ||
return null; | ||
} | ||
var address = address_1.getAddress(bytes_1.hexDataSlice(value, 12)); | ||
var address = (0, address_1.getAddress)((0, bytes_1.hexDataSlice)(value, 12)); | ||
return (address === constants_1.AddressZero) ? null : address; | ||
}; | ||
Formatter.prototype.contractAddress = function (value) { | ||
return address_1.getContractAddress(value); | ||
return (0, address_1.getContractAddress)(value); | ||
}; | ||
@@ -219,4 +219,4 @@ // Strict! Used on input. | ||
} | ||
if (typeof (blockTag) === "number" || bytes_1.isHexString(blockTag)) { | ||
return bytes_1.hexValue(blockTag); | ||
if (typeof (blockTag) === "number" || (0, bytes_1.isHexString)(blockTag)) { | ||
return (0, bytes_1.hexValue)(blockTag); | ||
} | ||
@@ -228,3 +228,3 @@ throw new Error("invalid blockTag"); | ||
var result = this.hex(value, strict); | ||
if (bytes_1.hexDataLength(result) !== 32) { | ||
if ((0, bytes_1.hexDataLength)(result) !== 32) { | ||
return logger.throwArgumentError("invalid hash", "value", value); | ||
@@ -247,6 +247,6 @@ } | ||
Formatter.prototype.uint256 = function (value) { | ||
if (!bytes_1.isHexString(value)) { | ||
if (!(0, bytes_1.isHexString)(value)) { | ||
throw new Error("invalid uint256"); | ||
} | ||
return bytes_1.hexZeroPad(value, 32); | ||
return (0, bytes_1.hexZeroPad)(value, 32); | ||
}; | ||
@@ -257,3 +257,7 @@ Formatter.prototype._block = function (value, format) { | ||
} | ||
return Formatter.check(format, value); | ||
// The difficulty may need to come from _difficulty in recursed blocks | ||
var difficulty = (value._difficulty != null) ? value._difficulty : value.difficulty; | ||
var result = Formatter.check(format, value); | ||
result._difficulty = ((difficulty == null) ? null : bignumber_1.BigNumber.from(difficulty)); | ||
return result; | ||
}; | ||
@@ -294,3 +298,3 @@ Formatter.prototype.block = function (value) { | ||
var chainId = transaction.chainId; | ||
if (bytes_1.isHexString(chainId)) { | ||
if ((0, bytes_1.isHexString)(chainId)) { | ||
chainId = bignumber_1.BigNumber.from(chainId).toNumber(); | ||
@@ -306,3 +310,3 @@ } | ||
} | ||
if (bytes_1.isHexString(chainId)) { | ||
if ((0, bytes_1.isHexString)(chainId)) { | ||
chainId = bignumber_1.BigNumber.from(chainId).toNumber(); | ||
@@ -329,3 +333,3 @@ } | ||
Formatter.prototype.transaction = function (value) { | ||
return transactions_1.parse(value); | ||
return (0, transactions_1.parse)(value); | ||
}; | ||
@@ -332,0 +336,0 @@ Formatter.prototype.receiptLog = function (value) { |
@@ -8,3 +8,3 @@ import { Block, BlockTag, EventType, FeeData, Filter, Log, Listener, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
import { EtherscanProvider } from "./etherscan-provider"; | ||
import { FallbackProvider } from "./fallback-provider"; | ||
import { FallbackProvider, FallbackProviderConfig } from "./fallback-provider"; | ||
import { IpcProvider } from "./ipc-provider"; | ||
@@ -21,4 +21,4 @@ import { InfuraProvider, InfuraWebSocketProvider } from "./infura-provider"; | ||
import { CommunityResourcable, Formatter, isCommunityResourcable, isCommunityResource, showThrottleMessage } from "./formatter"; | ||
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, FeeData, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
declare function getDefaultProvider(network?: Networkish, 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, FeeData, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, FallbackProviderConfig, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -71,3 +71,3 @@ "use strict"; | ||
} | ||
var n = networks_1.getNetwork(network); | ||
var n = (0, networks_1.getNetwork)(network); | ||
if (!n || !n._defaultProvider) { | ||
@@ -74,0 +74,0 @@ logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, { |
@@ -40,5 +40,5 @@ "use strict"; | ||
_this = _super.call(this, url, network) || this; | ||
properties_1.defineReadOnly(_this, "apiKey", provider.projectId); | ||
properties_1.defineReadOnly(_this, "projectId", provider.projectId); | ||
properties_1.defineReadOnly(_this, "projectSecret", provider.projectSecret); | ||
(0, properties_1.defineReadOnly)(_this, "apiKey", provider.projectId); | ||
(0, properties_1.defineReadOnly)(_this, "projectId", provider.projectId); | ||
(0, properties_1.defineReadOnly)(_this, "projectSecret", provider.projectSecret); | ||
return _this; | ||
@@ -119,3 +119,3 @@ } | ||
if (apiKey.projectId === defaultProjectId) { | ||
formatter_1.showThrottleMessage(); | ||
(0, formatter_1.showThrottleMessage)(); | ||
} | ||
@@ -122,0 +122,0 @@ return Promise.resolve(true); |
@@ -35,3 +35,3 @@ "use strict"; | ||
_this = _super.call(this, "ipc://" + path, network) || this; | ||
properties_1.defineReadOnly(_this, "path", path); | ||
(0, properties_1.defineReadOnly)(_this, "path", path); | ||
return _this; | ||
@@ -54,3 +54,3 @@ } | ||
var response = Buffer.alloc(0); | ||
var stream = net_1.connect(_this.path); | ||
var stream = (0, net_1.connect)(_this.path); | ||
stream.on("data", function (data) { | ||
@@ -57,0 +57,0 @@ response = Buffer.concat([response, data]); |
@@ -57,6 +57,6 @@ "use strict"; | ||
action: "requestBatch", | ||
request: properties_1.deepCopy(request), | ||
request: (0, properties_1.deepCopy)(request), | ||
provider: _this | ||
}); | ||
return web_1.fetchJson(_this.connection, JSON.stringify(request)).then(function (result) { | ||
return (0, web_1.fetchJson)(_this.connection, JSON.stringify(request)).then(function (result) { | ||
_this.emit("debug", { | ||
@@ -63,0 +63,0 @@ action: "response", |
@@ -21,2 +21,3 @@ import { Provider, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; | ||
signMessage(message: Bytes | string): Promise<string>; | ||
_legacySignMessage(message: Bytes | string): Promise<string>; | ||
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>; | ||
@@ -23,0 +24,0 @@ unlock(password: string): Promise<boolean>; |
@@ -73,3 +73,3 @@ "use strict"; | ||
var e = error.error; | ||
if (e && e.message.match("reverted") && bytes_1.isHexString(e.data)) { | ||
if (e && e.message.match("reverted") && (0, bytes_1.isHexString)(e.data)) { | ||
return e.data; | ||
@@ -97,3 +97,5 @@ } | ||
logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -104,3 +106,5 @@ } | ||
logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -111,3 +115,5 @@ } | ||
logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -118,3 +124,5 @@ } | ||
logger.throwError("legacy pre-eip-155 transactions not supported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -124,3 +132,5 @@ } | ||
logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { | ||
error: error, method: method, transaction: transaction | ||
error: error, | ||
method: method, | ||
transaction: transaction | ||
}); | ||
@@ -162,3 +172,3 @@ } | ||
} | ||
properties_1.defineReadOnly(_this, "provider", provider); | ||
(0, properties_1.defineReadOnly)(_this, "provider", provider); | ||
if (addressOrIndex == null) { | ||
@@ -168,8 +178,8 @@ addressOrIndex = 0; | ||
if (typeof (addressOrIndex) === "string") { | ||
properties_1.defineReadOnly(_this, "_address", _this.provider.formatter.address(addressOrIndex)); | ||
properties_1.defineReadOnly(_this, "_index", null); | ||
(0, properties_1.defineReadOnly)(_this, "_address", _this.provider.formatter.address(addressOrIndex)); | ||
(0, properties_1.defineReadOnly)(_this, "_index", null); | ||
} | ||
else if (typeof (addressOrIndex) === "number") { | ||
properties_1.defineReadOnly(_this, "_index", addressOrIndex); | ||
properties_1.defineReadOnly(_this, "_address", null); | ||
(0, properties_1.defineReadOnly)(_this, "_index", addressOrIndex); | ||
(0, properties_1.defineReadOnly)(_this, "_address", null); | ||
} | ||
@@ -205,3 +215,3 @@ else { | ||
var _this = this; | ||
transaction = properties_1.shallowCopy(transaction); | ||
transaction = (0, properties_1.shallowCopy)(transaction); | ||
var fromAddress = this.getAddress().then(function (address) { | ||
@@ -217,3 +227,3 @@ if (address) { | ||
if (transaction.gasLimit == null) { | ||
var estimate = properties_1.shallowCopy(transaction); | ||
var estimate = (0, properties_1.shallowCopy)(transaction); | ||
estimate.from = fromAddress; | ||
@@ -242,4 +252,4 @@ transaction.gasLimit = this.provider.estimateGas(estimate); | ||
} | ||
return properties_1.resolveProperties({ | ||
tx: properties_1.resolveProperties(transaction), | ||
return (0, properties_1.resolveProperties)({ | ||
tx: (0, properties_1.resolveProperties)(transaction), | ||
sender: fromAddress | ||
@@ -284,3 +294,3 @@ }).then(function (_a) { | ||
_a.trys.push([3, 5, , 6]); | ||
return [4 /*yield*/, web_1.poll(function () { return __awaiter(_this, void 0, void 0, function () { | ||
return [4 /*yield*/, (0, web_1.poll)(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var tx; | ||
@@ -319,7 +329,23 @@ return __generator(this, function (_a) { | ||
case 0: | ||
data = ((typeof (message) === "string") ? strings_1.toUtf8Bytes(message) : message); | ||
data = ((typeof (message) === "string") ? (0, strings_1.toUtf8Bytes)(message) : message); | ||
return [4 /*yield*/, this.getAddress()]; | ||
case 1: | ||
address = _a.sent(); | ||
return [4 /*yield*/, this.provider.send("eth_sign", [address.toLowerCase(), bytes_1.hexlify(data)])]; | ||
return [4 /*yield*/, this.provider.send("personal_sign", [(0, bytes_1.hexlify)(data), address.toLowerCase()])]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
JsonRpcSigner.prototype._legacySignMessage = function (message) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var data, address; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
data = ((typeof (message) === "string") ? (0, strings_1.toUtf8Bytes)(message) : message); | ||
return [4 /*yield*/, this.getAddress()]; | ||
case 1: | ||
address = _a.sent(); | ||
return [4 /*yield*/, this.provider.send("eth_sign", [address.toLowerCase(), (0, bytes_1.hexlify)(data)])]; | ||
case 2: | ||
@@ -424,6 +450,6 @@ // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign | ||
if (!url) { | ||
url = properties_1.getStatic(_this.constructor, "defaultUrl")(); | ||
url = (0, properties_1.getStatic)(_this.constructor, "defaultUrl")(); | ||
} | ||
if (typeof (url) === "string") { | ||
properties_1.defineReadOnly(_this, "connection", Object.freeze({ | ||
(0, properties_1.defineReadOnly)(_this, "connection", Object.freeze({ | ||
url: url | ||
@@ -433,3 +459,3 @@ })); | ||
else { | ||
properties_1.defineReadOnly(_this, "connection", Object.freeze(properties_1.shallowCopy(url))); | ||
(0, properties_1.defineReadOnly)(_this, "connection", Object.freeze((0, properties_1.shallowCopy)(url))); | ||
} | ||
@@ -494,3 +520,3 @@ _this._nextId = 42; | ||
if (chainId != null) { | ||
getNetwork = properties_1.getStatic(this.constructor, "getNetwork"); | ||
getNetwork = (0, properties_1.getStatic)(this.constructor, "getNetwork"); | ||
try { | ||
@@ -536,3 +562,3 @@ return [2 /*return*/, getNetwork(bignumber_1.BigNumber.from(chainId).toNumber())]; | ||
action: "request", | ||
request: properties_1.deepCopy(request), | ||
request: (0, properties_1.deepCopy)(request), | ||
provider: this | ||
@@ -546,3 +572,3 @@ }); | ||
} | ||
var result = web_1.fetchJson(this.connection, JSON.stringify(request), getResult).then(function (result) { | ||
var result = (0, web_1.fetchJson)(this.connection, JSON.stringify(request), getResult).then(function (result) { | ||
_this.emit("debug", { | ||
@@ -602,7 +628,7 @@ action: "response", | ||
case "call": { | ||
var hexlifyTransaction = properties_1.getStatic(this.constructor, "hexlifyTransaction"); | ||
var hexlifyTransaction = (0, properties_1.getStatic)(this.constructor, "hexlifyTransaction"); | ||
return ["eth_call", [hexlifyTransaction(params.transaction, { from: true }), params.blockTag]]; | ||
} | ||
case "estimateGas": { | ||
var hexlifyTransaction = properties_1.getStatic(this.constructor, "hexlifyTransaction"); | ||
var hexlifyTransaction = (0, properties_1.getStatic)(this.constructor, "hexlifyTransaction"); | ||
return ["eth_estimateGas", [hexlifyTransaction(params.transaction, { from: true })]]; | ||
@@ -635,4 +661,4 @@ } | ||
// Network doesn't know about EIP-1559 (and hence type) | ||
params = properties_1.shallowCopy(params); | ||
params.transaction = properties_1.shallowCopy(tx); | ||
params = (0, properties_1.shallowCopy)(params); | ||
params.transaction = (0, properties_1.shallowCopy)(tx); | ||
delete params.transaction.type; | ||
@@ -722,3 +748,3 @@ } | ||
// Check only allowed properties are given | ||
var allowed = properties_1.shallowCopy(allowedTransactionKeys); | ||
var allowed = (0, properties_1.shallowCopy)(allowedTransactionKeys); | ||
if (allowExtra) { | ||
@@ -731,3 +757,3 @@ for (var key in allowExtra) { | ||
} | ||
properties_1.checkProperties(transaction, allowed); | ||
(0, properties_1.checkProperties)(transaction, allowed); | ||
var result = {}; | ||
@@ -739,3 +765,3 @@ // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. | ||
} | ||
var value = bytes_1.hexValue(transaction[key]); | ||
var value = (0, bytes_1.hexValue)(transaction[key]); | ||
if (key === "gasLimit") { | ||
@@ -750,6 +776,6 @@ key = "gas"; | ||
} | ||
result[key] = bytes_1.hexlify(transaction[key]); | ||
result[key] = (0, bytes_1.hexlify)(transaction[key]); | ||
}); | ||
if (transaction.accessList) { | ||
result["accessList"] = transactions_1.accessListify(transaction.accessList); | ||
result["accessList"] = (0, transactions_1.accessListify)(transaction.accessList); | ||
} | ||
@@ -756,0 +782,0 @@ return result; |
@@ -24,3 +24,3 @@ "use strict"; | ||
var url_json_rpc_provider_1 = require("./url-json-rpc-provider"); | ||
// These are load-balancer-based applicatoin IDs | ||
// These are load-balancer-based application IDs | ||
var defaultApplicationIds = { | ||
@@ -40,3 +40,3 @@ homestead: "6004bcd10040261633ade990", | ||
if (apiKey == null) { | ||
var n = properties_1.getStatic((_newTarget), "getNetwork")(network); | ||
var n = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); | ||
if (n) { | ||
@@ -43,0 +43,0 @@ var applicationId = defaultApplicationIds[n.name]; |
@@ -93,3 +93,3 @@ "use strict"; | ||
// A static network does not support "any" | ||
properties_1.defineReadOnly(this, "_network", network); | ||
(0, properties_1.defineReadOnly)(this, "_network", network); | ||
this.emit("network", network, null); | ||
@@ -113,12 +113,12 @@ } | ||
// Normalize the Network and API Key | ||
network = properties_1.getStatic((_newTarget), "getNetwork")(network); | ||
apiKey = properties_1.getStatic((_newTarget), "getApiKey")(apiKey); | ||
var connection = properties_1.getStatic((_newTarget), "getUrl")(network, apiKey); | ||
network = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); | ||
apiKey = (0, properties_1.getStatic)(_newTarget, "getApiKey")(apiKey); | ||
var connection = (0, properties_1.getStatic)(_newTarget, "getUrl")(network, apiKey); | ||
_this = _super.call(this, connection, network) || this; | ||
if (typeof (apiKey) === "string") { | ||
properties_1.defineReadOnly(_this, "apiKey", apiKey); | ||
(0, properties_1.defineReadOnly)(_this, "apiKey", apiKey); | ||
} | ||
else if (apiKey != null) { | ||
Object.keys(apiKey).forEach(function (key) { | ||
properties_1.defineReadOnly(_this, key, apiKey[key]); | ||
(0, properties_1.defineReadOnly)(_this, key, apiKey[key]); | ||
}); | ||
@@ -125,0 +125,0 @@ } |
@@ -29,8 +29,2 @@ "use strict"; | ||
var _this = this; | ||
// Metamask complains about eth_sign (and on some versions hangs) | ||
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) { | ||
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign | ||
method = "personal_sign"; | ||
params = [params[1], params[0]]; | ||
} | ||
var request = { | ||
@@ -46,3 +40,3 @@ method: method, | ||
fetcher: fetcher, | ||
request: properties_1.deepCopy(request), | ||
request: (0, properties_1.deepCopy)(request), | ||
provider: _this | ||
@@ -85,8 +79,2 @@ }); | ||
} | ||
// Metamask complains about eth_sign (and on some versions hangs) | ||
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) { | ||
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign | ||
method = "personal_sign"; | ||
params = [params[1], params[0]]; | ||
} | ||
var request = { method: method, params: params }; | ||
@@ -96,3 +84,3 @@ this.emit("debug", { | ||
fetcher: "Eip1193Fetcher", | ||
request: properties_1.deepCopy(request), | ||
request: (0, properties_1.deepCopy)(request), | ||
provider: this | ||
@@ -163,4 +151,4 @@ }); | ||
_this = _super.call(this, path, network) || this; | ||
properties_1.defineReadOnly(_this, "jsonRpcFetchFunc", jsonRpcFetchFunc); | ||
properties_1.defineReadOnly(_this, "provider", subprovider); | ||
(0, properties_1.defineReadOnly)(_this, "jsonRpcFetchFunc", jsonRpcFetchFunc); | ||
(0, properties_1.defineReadOnly)(_this, "provider", subprovider); | ||
return _this; | ||
@@ -167,0 +155,0 @@ } |
@@ -70,3 +70,3 @@ "use strict"; | ||
* | ||
* For example, if a polling provider emits an event which indicats | ||
* For example, if a polling provider emits an event which indicates | ||
* the event occurred in blockhash XXX, a call to fetch that block by | ||
@@ -93,7 +93,7 @@ * its hash XXX, if not present will retry until it is present. This | ||
_this._wsReady = false; | ||
properties_1.defineReadOnly(_this, "_websocket", new ws_1.WebSocket(_this.connection.url)); | ||
properties_1.defineReadOnly(_this, "_requests", {}); | ||
properties_1.defineReadOnly(_this, "_subs", {}); | ||
properties_1.defineReadOnly(_this, "_subIds", {}); | ||
properties_1.defineReadOnly(_this, "_detectNetwork", _super.prototype.detectNetwork.call(_this)); | ||
(0, properties_1.defineReadOnly)(_this, "_websocket", new ws_1.WebSocket(_this.connection.url)); | ||
(0, properties_1.defineReadOnly)(_this, "_requests", {}); | ||
(0, properties_1.defineReadOnly)(_this, "_subs", {}); | ||
(0, properties_1.defineReadOnly)(_this, "_subIds", {}); | ||
(0, properties_1.defineReadOnly)(_this, "_detectNetwork", _super.prototype.detectNetwork.call(_this)); | ||
// Stall sending requests until the socket is open... | ||
@@ -126,4 +126,4 @@ _this._websocket.onopen = function () { | ||
error = new Error(result.error.message || "unknown error"); | ||
properties_1.defineReadOnly(error, "code", result.error.code || null); | ||
properties_1.defineReadOnly(error, "response", data); | ||
(0, properties_1.defineReadOnly)(error, "code", result.error.code || null); | ||
(0, properties_1.defineReadOnly)(error, "response", data); | ||
} | ||
@@ -130,0 +130,0 @@ else { |
@@ -17,19 +17,19 @@ { | ||
"dependencies": { | ||
"@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", | ||
"@ethersproject/abstract-provider": "^5.5.0", | ||
"@ethersproject/abstract-signer": "^5.5.0", | ||
"@ethersproject/address": "^5.5.0", | ||
"@ethersproject/basex": "^5.5.0", | ||
"@ethersproject/bignumber": "^5.5.0", | ||
"@ethersproject/bytes": "^5.5.0", | ||
"@ethersproject/constants": "^5.5.0", | ||
"@ethersproject/hash": "^5.5.0", | ||
"@ethersproject/logger": "^5.5.0", | ||
"@ethersproject/networks": "^5.5.0", | ||
"@ethersproject/properties": "^5.5.0", | ||
"@ethersproject/random": "^5.5.0", | ||
"@ethersproject/rlp": "^5.5.0", | ||
"@ethersproject/sha2": "^5.5.0", | ||
"@ethersproject/strings": "^5.5.0", | ||
"@ethersproject/transactions": "^5.5.0", | ||
"@ethersproject/web": "^5.5.0", | ||
"bech32": "1.1.4", | ||
@@ -50,3 +50,3 @@ "ws": "7.4.6" | ||
], | ||
"gitHead": "c41b89a0c120893062de025a17928a5f092c64b0", | ||
"gitHead": "d3079745c5c5c41e3ce26d7632b8a6657d91d0b5", | ||
"keywords": [ | ||
@@ -72,5 +72,5 @@ "Ethereum", | ||
"sideEffects": false, | ||
"tarballHash": "0xf97d95aa87ac5e952d42f0cb05d9c87851fb99a98010cdc4ca66e4034fcf9ae7", | ||
"tarballHash": "0x2582ad9a43f5113ef9143cf4f5b35cc5fe0cc709861834d5f5236ab06b2f4476", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.4.5" | ||
"version": "5.5.0" | ||
} |
@@ -7,3 +7,3 @@ Ethereum Providers | ||
It contains common Provider classes, utility functions for dealing with providers | ||
and re-exports many of the classes and types needed implement a custom Provider. | ||
and re-exports many of the classes and types needed to implement a custom Provider. | ||
@@ -10,0 +10,0 @@ For more information, see the [documentation](https://docs.ethers.io/v5/api/providers/). |
@@ -1,1 +0,1 @@ | ||
export const version = "providers/5.4.5"; | ||
export const version = "providers/5.5.0"; |
@@ -420,3 +420,3 @@ "use strict"; | ||
// Note: The `page` page parameter only allows pagination within the | ||
// 10,000 window abailable without a page and offset parameter | ||
// 10,000 window available without a page and offset parameter | ||
// Error: Result window is too large, PageNo x Offset size must | ||
@@ -423,0 +423,0 @@ // be less than or equal to 10000 |
@@ -108,3 +108,3 @@ "use strict"; | ||
// - lower values will cause more network traffic but may result in a | ||
// faster retult. | ||
// faster result. | ||
stallTimeout?: number; | ||
@@ -111,0 +111,0 @@ |
@@ -252,3 +252,3 @@ "use strict"; | ||
if (blockTag === "earliest") { return "0x0"; } | ||
if (blockTag === "earliest") { return "0x0"; } | ||
@@ -299,3 +299,7 @@ if (blockTag === "latest" || blockTag === "pending") { | ||
} | ||
return Formatter.check(format, value); | ||
// The difficulty may need to come from _difficulty in recursed blocks | ||
const difficulty = (value._difficulty != null) ? value._difficulty: value.difficulty; | ||
const result = Formatter.check(format, value); | ||
result._difficulty = ((difficulty == null) ? null: BigNumber.from(difficulty)); | ||
return result; | ||
} | ||
@@ -302,0 +306,0 @@ |
@@ -25,3 +25,3 @@ "use strict"; | ||
import { EtherscanProvider } from "./etherscan-provider"; | ||
import { FallbackProvider } from "./fallback-provider"; | ||
import { FallbackProvider, FallbackProviderConfig } from "./fallback-provider"; | ||
import { IpcProvider } from "./ipc-provider"; | ||
@@ -47,3 +47,3 @@ import { InfuraProvider, InfuraWebSocketProvider } from "./infura-provider"; | ||
function getDefaultProvider(network?: Network | string, options?: any): BaseProvider { | ||
function getDefaultProvider(network?: Networkish, options?: any): BaseProvider { | ||
if (network == null) { network = "homestead"; } | ||
@@ -107,3 +107,3 @@ | ||
/////////////////////// | ||
// Concreate Providers | ||
// Concrete Providers | ||
@@ -168,2 +168,4 @@ FallbackProvider, | ||
FallbackProviderConfig, | ||
Network, | ||
@@ -170,0 +172,0 @@ Networkish, |
@@ -252,2 +252,9 @@ "use strict"; | ||
return await this.provider.send("personal_sign", [ hexlify(data), address.toLowerCase() ]); | ||
} | ||
async _legacySignMessage(message: Bytes | string): Promise<string> { | ||
const data = ((typeof(message) === "string") ? toUtf8Bytes(message): message); | ||
const address = await this.getAddress(); | ||
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign | ||
@@ -615,3 +622,2 @@ return await this.provider.send("eth_sign", [ address.toLowerCase(), hexlify(data) ]); | ||
// Convert an ethers.js transaction into a JSON-RPC transaction | ||
@@ -618,0 +624,0 @@ // - gasLimit => gas |
@@ -13,3 +13,3 @@ "use strict"; | ||
// These are load-balancer-based applicatoin IDs | ||
// These are load-balancer-based application IDs | ||
const defaultApplicationIds: Record<string, string> = { | ||
@@ -16,0 +16,0 @@ homestead: "6004bcd10040261633ade990", |
@@ -33,10 +33,2 @@ "use strict"; | ||
return function(method: string, params: Array<any>): Promise<any> { | ||
// Metamask complains about eth_sign (and on some versions hangs) | ||
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) { | ||
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign | ||
method = "personal_sign"; | ||
params = [ params[1], params[0] ]; | ||
} | ||
const request = { | ||
@@ -96,9 +88,2 @@ method: method, | ||
// Metamask complains about eth_sign (and on some versions hangs) | ||
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) { | ||
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign | ||
method = "personal_sign"; | ||
params = [ params[1], params[0] ]; | ||
} | ||
const request = { method, params }; | ||
@@ -105,0 +90,0 @@ |
@@ -23,3 +23,3 @@ "use strict"; | ||
* | ||
* For example, if a polling provider emits an event which indicats | ||
* For example, if a polling provider emits an event which indicates | ||
* the event occurred in blockhash XXX, a call to fetch that block by | ||
@@ -26,0 +26,0 @@ * its hash XXX, if not present will retry until it is present. This |
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 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 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
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
1107172
16506
Updated@ethersproject/basex@^5.5.0
Updated@ethersproject/bytes@^5.5.0
Updated@ethersproject/hash@^5.5.0
Updated@ethersproject/logger@^5.5.0
Updated@ethersproject/random@^5.5.0
Updated@ethersproject/rlp@^5.5.0
Updated@ethersproject/sha2@^5.5.0
Updated@ethersproject/web@^5.5.0