Coerce value into BigInt when checking for value.

This commit is contained in:
Richard Moore 2023-05-18 17:26:59 -04:00
parent 50ffd5950c
commit 83d7f43b9c
50 changed files with 707 additions and 510 deletions

@ -3,9 +3,17 @@ Change Log
This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.
ethers/v6.4.0 (2023-04-27 21:17)
ethers/v6.4.0 (2023-05-18 17:12)
--------------------------------
- Better errors when junk passed as Contract target ([#3947](https://github.com/ethers-io/ethers.js/issues/3947), [#4053](https://github.com/ethers-io/ethers.js/issues/4053); [219b16d](https://github.com/ethers-io/ethers.js/commit/219b16dc284b0c6a532c8c49e824d8234f94222b)).
- More robust message checking in socket providers ([#4051](https://github.com/ethers-io/ethers.js/issues/4051); [f58990b](https://github.com/ethers-io/ethers.js/commit/f58990b80cfd83579014339315e58663c0aa6ae3)).
- More robust defaultProvider start-up when a backend fails on bootstrap ([#3979](https://github.com/ethers-io/ethers.js/issues/3979); [984f6fa](https://github.com/ethers-io/ethers.js/commit/984f6fa155fca08ebec2353c75ee0a0b974e8568)).
- Fix Result.map when Array contains zero elements ([#4036](https://github.com/ethers-io/ethers.js/issues/4036), [#4048](https://github.com/ethers-io/ethers.js/issues/4048); [2e5935b](https://github.com/ethers-io/ethers.js/commit/2e5935b91cff462165a054b33c8b8413f51e3f39)).
- Fixed error handling for contracts with receive and non-payable fallback ([6db7458](https://github.com/ethers-io/ethers.js/commit/6db7458cf0a09e8e8a2abb712239972ab81dc9df)).
- Remove superfluous logging in defaultProvider ([f87f6ef](https://github.com/ethers-io/ethers.js/commit/f87f6ef9a01ca399664f9fe106b0a677dba0c8e8)).
- Removed superfluous logging ([1bc8b55](https://github.com/ethers-io/ethers.js/commit/1bc8b55d502a95c4ae58352bdcfce9e5f9ea72d3)).
- Fix receipt gas price when effectiveGasPrice is 0 on testnets ([#4014](https://github.com/ethers-io/ethers.js/issues/4014); [2b0fe61](https://github.com/ethers-io/ethers.js/commit/2b0fe611335432aee334d777a64d8c7827881618)).
- Added error event to provider ([#3970](https://github.com/ethers-io/ethers.js/issues/3970), [#3982](https://github.com/ethers-io/ethers.js/issues/3982); [af0291c](https://github.com/ethers-io/ethers.js/commit/af0291c01639674658f5049343da88a84da763a1)).
- Removed superfluous parameters for internal transaction functions ([e848978](https://github.com/ethers-io/ethers.js/commit/e8489787585c2e69a23f6cdec6901f22b096aebe)).
- More aggresive tree-shaking ([076edad](https://github.com/ethers-io/ethers.js/commit/076edad81ef62474f48f2b4c8af0edc6e4fd64f2)).

419
dist/ethers.js vendored

@ -2720,6 +2720,20 @@ class Result extends Array {
}
return new Result(_guard$4, result, names);
}
/**
* @_ignore
*/
map(callback, thisArg) {
const result = [];
for (let i = 0; i < this.length; i++) {
const item = this[i];
if (item instanceof Error) {
throwError(`index ${i}`, item);
}
result.push(callback.call(thisArg, item, i, this));
}
return result;
}
/**
* Returns the value for %%name%%.
*
@ -2961,6 +2975,8 @@ const assert = {
};
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
// The import here is via the package name. This is to ensure
// that exports mapping/resolution does fall into place.
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
// Cast array to view
const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
@ -4573,7 +4589,7 @@ var _nodeResolve_empty = {};
var nodeCrypto = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': _nodeResolve_empty
default: _nodeResolve_empty
});
/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
@ -5029,7 +5045,7 @@ function parseDERSignature(data) {
}
return { r, s };
}
class Signature$1 {
let Signature$1 = class Signature {
constructor(r, s) {
this.r = r;
this.s = s;
@ -5043,14 +5059,14 @@ class Signature$1 {
const str = arr ? bytesToHex(hex) : hex;
if (str.length !== 128)
throw new Error(`${name}: Expected 64-byte hex`);
return new Signature$1(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128)));
return new Signature(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128)));
}
static fromDER(hex) {
const arr = hex instanceof Uint8Array;
if (typeof hex !== 'string' && !arr)
throw new TypeError(`Signature.fromDER: Expected string or Uint8Array`);
const { r, s } = parseDERSignature(arr ? hex : hexToBytes(hex));
return new Signature$1(r, s);
return new Signature(r, s);
}
static fromHex(hex) {
return this.fromDER(hex);
@ -5067,7 +5083,7 @@ class Signature$1 {
return this.s > HALF;
}
normalizeS() {
return this.hasHighS() ? new Signature$1(this.r, mod(-this.s, CURVE.n)) : this;
return this.hasHighS() ? new Signature(this.r, mod(-this.s, CURVE.n)) : this;
}
toDERRawBytes() {
return hexToBytes(this.toDERHex());
@ -5094,7 +5110,7 @@ class Signature$1 {
toCompactHex() {
return numTo32bStr(this.r) + numTo32bStr(this.s);
}
}
};
function concatBytes(...arrays) {
if (!arrays.every((b) => b instanceof Uint8Array))
throw new Error('Uint8Array list expected');
@ -10745,6 +10761,7 @@ class StructFragment extends NamedFragment {
*
* @_section api/abi/abi-coder:ABI Encoding
*/
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
// https://docs.soliditylang.org/en/v0.8.17/control-structures.html
const PanicReasons$1 = new Map();
PanicReasons$1.set(0x00, "GENERIC_PANIC");
@ -12932,6 +12949,7 @@ function createRemovedLogFilter(log) {
}
// import from provider.ts instead of index.ts to prevent circular dep
// from EtherscanProvider
class EventLog extends Log {
interface;
fragment;
@ -13111,11 +13129,17 @@ function buildWrappedFallback(contract) {
const tx = (await copyOverrides(overrides, ["data"]));
tx.to = await contract.getAddress();
const iface = contract.interface;
const noValue = ((tx.value || BN_0$1) === BN_0$1);
const noData = ((tx.data || "0x") === "0x");
if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {
assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides);
}
assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
// Only allow payable contracts to set non-zero value
const payable = iface.receive || (iface.fallback && iface.fallback.payable);
assertArgument(payable || (tx.value || BN_0$1) === BN_0$1, "cannot send value to non-payable contract", "overrides.value", tx.value);
assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value);
// Only allow fallback contracts to set non-empty data
assertArgument(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data);
assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
return tx;
};
const staticCall = async function (overrides) {
@ -13471,6 +13495,7 @@ class BaseContract {
[internal];
fallback;
constructor(target, abi, runner, _deployTx) {
assertArgument(typeof (target) === "string" || isAddressable(target), "invalid value for Contract target", "target", target);
if (runner == null) {
runner = null;
}
@ -15208,6 +15233,13 @@ class PollingEventSubscriber {
*
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
*/
// @TODO
// Event coalescence
// When we register an event with an async value (e.g. address is a Signer
// or ENS name), we need to add it immeidately for the Event API, but also
// need time to resolve the address. Upon resolving the address, we need to
// migrate the listener to the static event. We also need to maintain a map
// of Signer/ENS name to address so we can sync respond to listenerCount.
// Constants
const BN_2$1 = BigInt(2);
const MAX_CCIP_REDIRECTS = 10;
@ -16770,6 +16802,9 @@ class FilterIdPendingSubscriber extends FilterIdSubscriber {
*
* @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider]
*/
// @TODO:
// - Add the batching API
// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false
const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g);
//const Methods = "getAddress,then".split(/,/g);
function deepCopy(value) {
@ -18452,7 +18487,7 @@ class SocketProvider extends JsonRpcApiProvider {
// Sub-classes must call this for each message
async _processMessage(message) {
const result = (JSON.parse(message));
if ("id" in result) {
if (result && typeof (result) === "object" && "id" in result) {
const callback = this.#callbacks.get(result.id);
if (callback == null) {
this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", {
@ -18464,7 +18499,7 @@ class SocketProvider extends JsonRpcApiProvider {
this.#callbacks.delete(result.id);
callback.resolve(result);
}
else if (result.method === "eth_subscription") {
else if (result && result.method === "eth_subscription") {
const filterId = result.params.subscription;
const subscriber = this.#subs.get(filterId);
if (subscriber) {
@ -18479,6 +18514,13 @@ class SocketProvider extends JsonRpcApiProvider {
pending.push(result.params.result);
}
}
else {
this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", {
reasonCode: "UNEXPECTED_MESSAGE",
result
}));
return;
}
}
async _write(message) {
throw new Error("sub-classes must override this");
@ -18843,21 +18885,32 @@ const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };
const defaultState = {
blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,
outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,
_network: null, _updateNumber: null, _totalTime: 0
_network: null, _updateNumber: null, _totalTime: 0,
_lastFatalError: null, _lastFatalErrorTimestamp: 0
};
async function waitForSync(config, blockNumber) {
while (config.blockNumber < 0 || config.blockNumber < blockNumber) {
if (!config._updateNumber) {
config._updateNumber = (async () => {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
try {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
}
}
catch (error) {
config.blockNumber = -2;
config._lastFatalError = error;
config._lastFatalErrorTimestamp = getTime();
}
config._updateNumber = null;
})();
}
await config._updateNumber;
config.outOfSync++;
if (config._lastFatalError) {
break;
}
}
}
function _normalize(value) {
@ -19091,6 +19144,9 @@ class FallbackProvider extends AbstractProvider {
shuffle(allConfigs);
allConfigs.sort((a, b) => (b.priority - a.priority));
for (const config of allConfigs) {
if (config._lastFatalError) {
continue;
}
if (configs.indexOf(config) === -1) {
return config;
}
@ -19142,9 +19198,11 @@ class FallbackProvider extends AbstractProvider {
if (!initialSync) {
const promises = [];
this.#configs.forEach((config) => {
promises.push(waitForSync(config, 0));
promises.push((async () => {
config._network = await config.provider.getNetwork();
await waitForSync(config, 0);
if (!config._lastFatalError) {
config._network = await config.provider.getNetwork();
}
})());
});
this.#initialSyncPromise = initialSync = (async () => {
@ -19153,6 +19211,9 @@ class FallbackProvider extends AbstractProvider {
// Check all the networks match
let chainId = null;
for (const config of this.#configs) {
if (config._lastFatalError) {
continue;
}
const network = (config._network);
if (chainId == null) {
chainId = network.chainId;
@ -19184,7 +19245,7 @@ class FallbackProvider extends AbstractProvider {
case "getBlockNumber": {
// We need to get the bootstrap block height
if (this.#height === -2) {
this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({
this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({
value: c.blockNumber,
tag: getNumber(c.blockNumber).toString(),
weight: c.weight
@ -19345,33 +19406,25 @@ function getDefaultProvider(network, options) {
try {
providers.push(new AlchemyProvider(network, options.alchemy));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.ankr !== "-" && options.ankr != null) {
try {
providers.push(new AnkrProvider(network, options.ankr));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.cloudflare !== "-") {
try {
providers.push(new CloudflareProvider(network));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.etherscan !== "-") {
try {
providers.push(new EtherscanProvider(network, options.etherscan));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.infura !== "-") {
try {
@ -19383,9 +19436,7 @@ function getDefaultProvider(network, options) {
}
providers.push(new InfuraProvider(network, projectId, projectSecret));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
/*
if (options.pocket !== "-") {
@ -19407,9 +19458,7 @@ function getDefaultProvider(network, options) {
let token = options.quicknode;
providers.push(new QuickNodeProvider(network, token));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
assert$1(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", {
operation: "getDefaultProvider"
@ -19851,6 +19900,7 @@ class Wordlist {
}
// Use the encode-latin.js script to create the necessary
// data files to be consumed by this class
/**
* An OWL format Wordlist is an encoding method that exploits
* the general locality of alphabetically sorted words to
@ -21649,194 +21699,195 @@ const wordlists = {
};
/////////////////////////////
//
var ethers = /*#__PURE__*/Object.freeze({
__proto__: null,
version: version,
decodeBytes32String: decodeBytes32String,
encodeBytes32String: encodeBytes32String,
AbiCoder: AbiCoder,
ConstructorFragment: ConstructorFragment,
ErrorFragment: ErrorFragment,
EventFragment: EventFragment,
Fragment: Fragment,
FallbackFragment: FallbackFragment,
FunctionFragment: FunctionFragment,
NamedFragment: NamedFragment,
ParamType: ParamType,
StructFragment: StructFragment,
checkResultErrors: checkResultErrors,
ErrorDescription: ErrorDescription,
Indexed: Indexed,
Interface: Interface,
LogDescription: LogDescription,
Result: Result,
TransactionDescription: TransactionDescription,
Typed: Typed,
getAddress: getAddress,
getIcapAddress: getIcapAddress,
getCreateAddress: getCreateAddress,
getCreate2Address: getCreate2Address,
isAddressable: isAddressable,
isAddress: isAddress,
resolveAddress: resolveAddress,
ZeroAddress: ZeroAddress,
WeiPerEther: WeiPerEther,
MaxUint256: MaxUint256,
MinInt256: MinInt256,
MaxInt256: MaxInt256,
N: N$1,
ZeroHash: ZeroHash,
EtherSymbol: EtherSymbol,
MessagePrefix: MessagePrefix,
AbstractProvider: AbstractProvider,
AbstractSigner: AbstractSigner,
AlchemyProvider: AlchemyProvider,
AnkrProvider: AnkrProvider,
BaseContract: BaseContract,
BaseWallet: BaseWallet,
Block: Block,
BrowserProvider: BrowserProvider,
CloudflareProvider: CloudflareProvider,
ConstructorFragment: ConstructorFragment,
Contract: Contract,
ContractFactory: ContractFactory,
ContractEventPayload: ContractEventPayload,
ContractFactory: ContractFactory,
ContractTransactionReceipt: ContractTransactionReceipt,
ContractTransactionResponse: ContractTransactionResponse,
ContractUnknownEventPayload: ContractUnknownEventPayload,
EnsPlugin: EnsPlugin,
EnsResolver: EnsResolver,
ErrorDescription: ErrorDescription,
ErrorFragment: ErrorFragment,
EtherSymbol: EtherSymbol,
EtherscanPlugin: EtherscanPlugin,
EtherscanProvider: EtherscanProvider,
EventFragment: EventFragment,
EventLog: EventLog,
computeHmac: computeHmac,
randomBytes: randomBytes,
keccak256: keccak256,
ripemd160: ripemd160,
sha256: sha256,
sha512: sha512,
pbkdf2: pbkdf2,
scrypt: scrypt,
scryptSync: scryptSync,
lock: lock,
Signature: Signature,
SigningKey: SigningKey,
id: id,
ensNormalize: ensNormalize,
isValidName: isValidName,
namehash: namehash,
dnsEncode: dnsEncode,
hashMessage: hashMessage,
verifyMessage: verifyMessage,
solidityPacked: solidityPacked,
solidityPackedKeccak256: solidityPackedKeccak256,
solidityPackedSha256: solidityPackedSha256,
TypedDataEncoder: TypedDataEncoder,
verifyTypedData: verifyTypedData,
getDefaultProvider: getDefaultProvider,
Block: Block,
FeeData: FeeData,
Log: Log,
TransactionReceipt: TransactionReceipt,
TransactionResponse: TransactionResponse,
AbstractSigner: AbstractSigner,
NonceManager: NonceManager,
VoidSigner: VoidSigner,
AbstractProvider: AbstractProvider,
EventPayload: EventPayload,
FallbackFragment: FallbackFragment,
FallbackProvider: FallbackProvider,
FeeData: FeeData,
FeeDataNetworkPlugin: FeeDataNetworkPlugin,
FetchCancelSignal: FetchCancelSignal,
FetchRequest: FetchRequest,
FetchResponse: FetchResponse,
FixedNumber: FixedNumber,
Fragment: Fragment,
FunctionFragment: FunctionFragment,
GasCostPlugin: GasCostPlugin,
HDNodeVoidWallet: HDNodeVoidWallet,
HDNodeWallet: HDNodeWallet,
Indexed: Indexed,
InfuraProvider: InfuraProvider,
InfuraWebSocketProvider: InfuraWebSocketProvider,
Interface: Interface,
IpcSocketProvider: IpcSocketProvider,
JsonRpcApiProvider: JsonRpcApiProvider,
JsonRpcProvider: JsonRpcProvider,
JsonRpcSigner: JsonRpcSigner,
BrowserProvider: BrowserProvider,
AlchemyProvider: AlchemyProvider,
AnkrProvider: AnkrProvider,
CloudflareProvider: CloudflareProvider,
EtherscanProvider: EtherscanProvider,
InfuraProvider: InfuraProvider,
InfuraWebSocketProvider: InfuraWebSocketProvider,
LangEn: LangEn,
Log: Log,
LogDescription: LogDescription,
MaxInt256: MaxInt256,
MaxUint256: MaxUint256,
MessagePrefix: MessagePrefix,
MinInt256: MinInt256,
Mnemonic: Mnemonic,
N: N$1,
NamedFragment: NamedFragment,
Network: Network,
NetworkPlugin: NetworkPlugin,
NonceManager: NonceManager,
ParamType: ParamType,
PocketProvider: PocketProvider,
QuickNodeProvider: QuickNodeProvider,
IpcSocketProvider: IpcSocketProvider,
SocketProvider: SocketProvider,
WebSocketProvider: WebSocketProvider,
EnsResolver: EnsResolver,
Network: Network,
EnsPlugin: EnsPlugin,
EtherscanPlugin: EtherscanPlugin,
FeeDataNetworkPlugin: FeeDataNetworkPlugin,
GasCostPlugin: GasCostPlugin,
NetworkPlugin: NetworkPlugin,
Result: Result,
Signature: Signature,
SigningKey: SigningKey,
SocketBlockSubscriber: SocketBlockSubscriber,
SocketEventSubscriber: SocketEventSubscriber,
SocketPendingSubscriber: SocketPendingSubscriber,
SocketProvider: SocketProvider,
SocketSubscriber: SocketSubscriber,
UnmanagedSubscriber: UnmanagedSubscriber,
copyRequest: copyRequest,
showThrottleMessage: showThrottleMessage,
accessListify: accessListify,
computeAddress: computeAddress,
recoverAddress: recoverAddress,
StructFragment: StructFragment,
Transaction: Transaction,
decodeBase58: decodeBase58,
encodeBase58: encodeBase58,
decodeBase64: decodeBase64,
encodeBase64: encodeBase64,
concat: concat,
dataLength: dataLength,
dataSlice: dataSlice,
getBytes: getBytes,
getBytesCopy: getBytesCopy,
hexlify: hexlify,
isHexString: isHexString,
isBytesLike: isBytesLike,
stripZerosLeft: stripZerosLeft,
zeroPadBytes: zeroPadBytes,
zeroPadValue: zeroPadValue,
defineProperties: defineProperties,
resolveProperties: resolveProperties,
TransactionDescription: TransactionDescription,
TransactionReceipt: TransactionReceipt,
TransactionResponse: TransactionResponse,
Typed: Typed,
TypedDataEncoder: TypedDataEncoder,
UnmanagedSubscriber: UnmanagedSubscriber,
Utf8ErrorFuncs: Utf8ErrorFuncs,
VoidSigner: VoidSigner,
Wallet: Wallet,
WebSocketProvider: WebSocketProvider,
WeiPerEther: WeiPerEther,
Wordlist: Wordlist,
WordlistOwl: WordlistOwl,
WordlistOwlA: WordlistOwlA,
ZeroAddress: ZeroAddress,
ZeroHash: ZeroHash,
accessListify: accessListify,
assert: assert$1,
assertArgument: assertArgument,
assertArgumentCount: assertArgumentCount,
assertNormalize: assertNormalize,
assertPrivate: assertPrivate,
makeError: makeError,
isCallException: isCallException,
isError: isError,
EventPayload: EventPayload,
FetchRequest: FetchRequest,
FetchResponse: FetchResponse,
FetchCancelSignal: FetchCancelSignal,
FixedNumber: FixedNumber,
checkResultErrors: checkResultErrors,
computeAddress: computeAddress,
computeHmac: computeHmac,
concat: concat,
copyRequest: copyRequest,
dataLength: dataLength,
dataSlice: dataSlice,
decodeBase58: decodeBase58,
decodeBase64: decodeBase64,
decodeBytes32String: decodeBytes32String,
decodeRlp: decodeRlp,
decryptCrowdsaleJson: decryptCrowdsaleJson,
decryptKeystoreJson: decryptKeystoreJson,
decryptKeystoreJsonSync: decryptKeystoreJsonSync,
defaultPath: defaultPath,
defineProperties: defineProperties,
dnsEncode: dnsEncode,
encodeBase58: encodeBase58,
encodeBase64: encodeBase64,
encodeBytes32String: encodeBytes32String,
encodeRlp: encodeRlp,
encryptKeystoreJson: encryptKeystoreJson,
encryptKeystoreJsonSync: encryptKeystoreJsonSync,
ensNormalize: ensNormalize,
formatEther: formatEther,
formatUnits: formatUnits,
fromTwos: fromTwos,
getAccountPath: getAccountPath,
getAddress: getAddress,
getBigInt: getBigInt,
getBytes: getBytes,
getBytesCopy: getBytesCopy,
getCreate2Address: getCreate2Address,
getCreateAddress: getCreateAddress,
getDefaultProvider: getDefaultProvider,
getIcapAddress: getIcapAddress,
getIndexedAccountPath: getIndexedAccountPath,
getNumber: getNumber,
getUint: getUint,
hashMessage: hashMessage,
hexlify: hexlify,
id: id,
isAddress: isAddress,
isAddressable: isAddressable,
isBytesLike: isBytesLike,
isCallException: isCallException,
isCrowdsaleJson: isCrowdsaleJson,
isError: isError,
isHexString: isHexString,
isKeystoreJson: isKeystoreJson,
isValidName: isValidName,
keccak256: keccak256,
lock: lock,
makeError: makeError,
mask: mask,
namehash: namehash,
parseEther: parseEther,
parseUnits: parseUnits,
pbkdf2: pbkdf2,
randomBytes: randomBytes,
recoverAddress: recoverAddress,
resolveAddress: resolveAddress,
resolveProperties: resolveProperties,
ripemd160: ripemd160,
scrypt: scrypt,
scryptSync: scryptSync,
sha256: sha256,
sha512: sha512,
showThrottleMessage: showThrottleMessage,
solidityPacked: solidityPacked,
solidityPackedKeccak256: solidityPackedKeccak256,
solidityPackedSha256: solidityPackedSha256,
stripZerosLeft: stripZerosLeft,
toBeArray: toBeArray,
toBigInt: toBigInt,
toBeHex: toBeHex,
toBigInt: toBigInt,
toNumber: toNumber,
toQuantity: toQuantity,
fromTwos: fromTwos,
toTwos: toTwos,
mask: mask,
formatEther: formatEther,
parseEther: parseEther,
formatUnits: formatUnits,
parseUnits: parseUnits,
toUtf8Bytes: toUtf8Bytes,
toUtf8CodePoints: toUtf8CodePoints,
toUtf8String: toUtf8String,
Utf8ErrorFuncs: Utf8ErrorFuncs,
decodeRlp: decodeRlp,
encodeRlp: encodeRlp,
uuidV4: uuidV4,
Mnemonic: Mnemonic,
BaseWallet: BaseWallet,
HDNodeWallet: HDNodeWallet,
HDNodeVoidWallet: HDNodeVoidWallet,
Wallet: Wallet,
defaultPath: defaultPath,
getAccountPath: getAccountPath,
getIndexedAccountPath: getIndexedAccountPath,
isCrowdsaleJson: isCrowdsaleJson,
isKeystoreJson: isKeystoreJson,
decryptCrowdsaleJson: decryptCrowdsaleJson,
decryptKeystoreJsonSync: decryptKeystoreJsonSync,
decryptKeystoreJson: decryptKeystoreJson,
encryptKeystoreJson: encryptKeystoreJson,
encryptKeystoreJsonSync: encryptKeystoreJsonSync,
Wordlist: Wordlist,
LangEn: LangEn,
WordlistOwl: WordlistOwl,
WordlistOwlA: WordlistOwlA,
wordlists: wordlists
verifyMessage: verifyMessage,
verifyTypedData: verifyTypedData,
version: version,
wordlists: wordlists,
zeroPadBytes: zeroPadBytes,
zeroPadValue: zeroPadValue
});
export { AbiCoder, AbstractProvider, AbstractSigner, AlchemyProvider, AnkrProvider, BaseContract, BaseWallet, Block, BrowserProvider, CloudflareProvider, ConstructorFragment, Contract, ContractEventPayload, ContractFactory, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EnsPlugin, EnsResolver, ErrorDescription, ErrorFragment, EtherSymbol, EtherscanPlugin, EtherscanProvider, EventFragment, EventLog, EventPayload, FallbackFragment, FallbackProvider, FeeData, FeeDataNetworkPlugin, FetchCancelSignal, FetchRequest, FetchResponse, FixedNumber, Fragment, FunctionFragment, GasCostPlugin, HDNodeVoidWallet, HDNodeWallet, Indexed, InfuraProvider, InfuraWebSocketProvider, Interface, IpcSocketProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, LangEn, Log, LogDescription, MaxInt256, MaxUint256, MessagePrefix, MinInt256, Mnemonic, N$1 as N, NamedFragment, Network, NetworkPlugin, NonceManager, ParamType, PocketProvider, QuickNodeProvider, Result, Signature, SigningKey, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketProvider, SocketSubscriber, StructFragment, Transaction, TransactionDescription, TransactionReceipt, TransactionResponse, Typed, TypedDataEncoder, UnmanagedSubscriber, Utf8ErrorFuncs, VoidSigner, Wallet, WebSocketProvider, WeiPerEther, Wordlist, WordlistOwl, WordlistOwlA, ZeroAddress, ZeroHash, accessListify, assert$1 as assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, checkResultErrors, computeAddress, computeHmac, concat, copyRequest, dataLength, dataSlice, decodeBase58, decodeBase64, decodeBytes32String, decodeRlp, decryptCrowdsaleJson, decryptKeystoreJson, decryptKeystoreJsonSync, defaultPath, defineProperties, dnsEncode, encodeBase58, encodeBase64, encodeBytes32String, encodeRlp, encryptKeystoreJson, encryptKeystoreJsonSync, ensNormalize, ethers, formatEther, formatUnits, fromTwos, getAccountPath, getAddress, getBigInt, getBytes, getBytesCopy, getCreate2Address, getCreateAddress, getDefaultProvider, getIcapAddress, getIndexedAccountPath, getNumber, getUint, hashMessage, hexlify, id, isAddress, isAddressable, isBytesLike, isCallException, isCrowdsaleJson, isError, isHexString, isKeystoreJson, isValidName, keccak256, lock, makeError, mask, namehash, parseEther, parseUnits, pbkdf2, randomBytes, recoverAddress, resolveAddress, resolveProperties, ripemd160, scrypt, scryptSync, sha256, sha512, showThrottleMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, stripZerosLeft, toBeArray, toBeHex, toBigInt, toNumber, toQuantity, toTwos, toUtf8Bytes, toUtf8CodePoints, toUtf8String, uuidV4, verifyMessage, verifyTypedData, version, wordlists, zeroPadBytes, zeroPadValue };

2
dist/ethers.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/ethers.min.js vendored

File diff suppressed because one or more lines are too long

421
dist/ethers.umd.js vendored

@ -2726,6 +2726,20 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
}
return new Result(_guard$4, result, names);
}
/**
* @_ignore
*/
map(callback, thisArg) {
const result = [];
for (let i = 0; i < this.length; i++) {
const item = this[i];
if (item instanceof Error) {
throwError(`index ${i}`, item);
}
result.push(callback.call(thisArg, item, i, this));
}
return result;
}
/**
* Returns the value for %%name%%.
*
@ -2967,6 +2981,8 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
};
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
// The import here is via the package name. This is to ensure
// that exports mapping/resolution does fall into place.
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
// Cast array to view
const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
@ -4579,7 +4595,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
var nodeCrypto = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': _nodeResolve_empty
default: _nodeResolve_empty
});
/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
@ -5035,7 +5051,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
}
return { r, s };
}
class Signature$1 {
let Signature$1 = class Signature {
constructor(r, s) {
this.r = r;
this.s = s;
@ -5049,14 +5065,14 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
const str = arr ? bytesToHex(hex) : hex;
if (str.length !== 128)
throw new Error(`${name}: Expected 64-byte hex`);
return new Signature$1(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128)));
return new Signature(hexToNumber(str.slice(0, 64)), hexToNumber(str.slice(64, 128)));
}
static fromDER(hex) {
const arr = hex instanceof Uint8Array;
if (typeof hex !== 'string' && !arr)
throw new TypeError(`Signature.fromDER: Expected string or Uint8Array`);
const { r, s } = parseDERSignature(arr ? hex : hexToBytes(hex));
return new Signature$1(r, s);
return new Signature(r, s);
}
static fromHex(hex) {
return this.fromDER(hex);
@ -5073,7 +5089,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
return this.s > HALF;
}
normalizeS() {
return this.hasHighS() ? new Signature$1(this.r, mod(-this.s, CURVE.n)) : this;
return this.hasHighS() ? new Signature(this.r, mod(-this.s, CURVE.n)) : this;
}
toDERRawBytes() {
return hexToBytes(this.toDERHex());
@ -5100,7 +5116,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
toCompactHex() {
return numTo32bStr(this.r) + numTo32bStr(this.s);
}
}
};
function concatBytes(...arrays) {
if (!arrays.every((b) => b instanceof Uint8Array))
throw new Error('Uint8Array list expected');
@ -10751,6 +10767,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
*
* @_section api/abi/abi-coder:ABI Encoding
*/
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
// https://docs.soliditylang.org/en/v0.8.17/control-structures.html
const PanicReasons$1 = new Map();
PanicReasons$1.set(0x00, "GENERIC_PANIC");
@ -12938,6 +12955,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
}
// import from provider.ts instead of index.ts to prevent circular dep
// from EtherscanProvider
class EventLog extends Log {
interface;
fragment;
@ -13117,11 +13135,17 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
const tx = (await copyOverrides(overrides, ["data"]));
tx.to = await contract.getAddress();
const iface = contract.interface;
const noValue = ((tx.value || BN_0$1) === BN_0$1);
const noData = ((tx.data || "0x") === "0x");
if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {
assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides);
}
assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
// Only allow payable contracts to set non-zero value
const payable = iface.receive || (iface.fallback && iface.fallback.payable);
assertArgument(payable || (tx.value || BN_0$1) === BN_0$1, "cannot send value to non-payable contract", "overrides.value", tx.value);
assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value);
// Only allow fallback contracts to set non-empty data
assertArgument(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data);
assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
return tx;
};
const staticCall = async function (overrides) {
@ -13477,6 +13501,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
[internal];
fallback;
constructor(target, abi, runner, _deployTx) {
assertArgument(typeof (target) === "string" || isAddressable(target), "invalid value for Contract target", "target", target);
if (runner == null) {
runner = null;
}
@ -15214,6 +15239,13 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
*
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
*/
// @TODO
// Event coalescence
// When we register an event with an async value (e.g. address is a Signer
// or ENS name), we need to add it immeidately for the Event API, but also
// need time to resolve the address. Upon resolving the address, we need to
// migrate the listener to the static event. We also need to maintain a map
// of Signer/ENS name to address so we can sync respond to listenerCount.
// Constants
const BN_2$1 = BigInt(2);
const MAX_CCIP_REDIRECTS = 10;
@ -16776,6 +16808,9 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
*
* @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider]
*/
// @TODO:
// - Add the batching API
// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false
const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g);
//const Methods = "getAddress,then".split(/,/g);
function deepCopy(value) {
@ -18458,7 +18493,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
// Sub-classes must call this for each message
async _processMessage(message) {
const result = (JSON.parse(message));
if ("id" in result) {
if (result && typeof (result) === "object" && "id" in result) {
const callback = this.#callbacks.get(result.id);
if (callback == null) {
this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", {
@ -18470,7 +18505,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
this.#callbacks.delete(result.id);
callback.resolve(result);
}
else if (result.method === "eth_subscription") {
else if (result && result.method === "eth_subscription") {
const filterId = result.params.subscription;
const subscriber = this.#subs.get(filterId);
if (subscriber) {
@ -18485,6 +18520,13 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
pending.push(result.params.result);
}
}
else {
this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", {
reasonCode: "UNEXPECTED_MESSAGE",
result
}));
return;
}
}
async _write(message) {
throw new Error("sub-classes must override this");
@ -18849,21 +18891,32 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
const defaultState = {
blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,
outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,
_network: null, _updateNumber: null, _totalTime: 0
_network: null, _updateNumber: null, _totalTime: 0,
_lastFatalError: null, _lastFatalErrorTimestamp: 0
};
async function waitForSync(config, blockNumber) {
while (config.blockNumber < 0 || config.blockNumber < blockNumber) {
if (!config._updateNumber) {
config._updateNumber = (async () => {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
try {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
}
}
catch (error) {
config.blockNumber = -2;
config._lastFatalError = error;
config._lastFatalErrorTimestamp = getTime();
}
config._updateNumber = null;
})();
}
await config._updateNumber;
config.outOfSync++;
if (config._lastFatalError) {
break;
}
}
}
function _normalize(value) {
@ -19097,6 +19150,9 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
shuffle(allConfigs);
allConfigs.sort((a, b) => (b.priority - a.priority));
for (const config of allConfigs) {
if (config._lastFatalError) {
continue;
}
if (configs.indexOf(config) === -1) {
return config;
}
@ -19148,9 +19204,11 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
if (!initialSync) {
const promises = [];
this.#configs.forEach((config) => {
promises.push(waitForSync(config, 0));
promises.push((async () => {
config._network = await config.provider.getNetwork();
await waitForSync(config, 0);
if (!config._lastFatalError) {
config._network = await config.provider.getNetwork();
}
})());
});
this.#initialSyncPromise = initialSync = (async () => {
@ -19159,6 +19217,9 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
// Check all the networks match
let chainId = null;
for (const config of this.#configs) {
if (config._lastFatalError) {
continue;
}
const network = (config._network);
if (chainId == null) {
chainId = network.chainId;
@ -19190,7 +19251,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
case "getBlockNumber": {
// We need to get the bootstrap block height
if (this.#height === -2) {
this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({
this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({
value: c.blockNumber,
tag: getNumber(c.blockNumber).toString(),
weight: c.weight
@ -19351,33 +19412,25 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
try {
providers.push(new AlchemyProvider(network, options.alchemy));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.ankr !== "-" && options.ankr != null) {
try {
providers.push(new AnkrProvider(network, options.ankr));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.cloudflare !== "-") {
try {
providers.push(new CloudflareProvider(network));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.etherscan !== "-") {
try {
providers.push(new EtherscanProvider(network, options.etherscan));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.infura !== "-") {
try {
@ -19389,9 +19442,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
}
providers.push(new InfuraProvider(network, projectId, projectSecret));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
/*
if (options.pocket !== "-") {
@ -19413,9 +19464,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
let token = options.quicknode;
providers.push(new QuickNodeProvider(network, token));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
assert$1(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", {
operation: "getDefaultProvider"
@ -19857,6 +19906,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
}
// Use the encode-latin.js script to create the necessary
// data files to be consumed by this class
/**
* An OWL format Wordlist is an encoding method that exploits
* the general locality of alphabetically sorted words to
@ -21655,194 +21705,195 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
};
/////////////////////////////
//
var ethers = /*#__PURE__*/Object.freeze({
__proto__: null,
version: version,
decodeBytes32String: decodeBytes32String,
encodeBytes32String: encodeBytes32String,
AbiCoder: AbiCoder,
ConstructorFragment: ConstructorFragment,
ErrorFragment: ErrorFragment,
EventFragment: EventFragment,
Fragment: Fragment,
FallbackFragment: FallbackFragment,
FunctionFragment: FunctionFragment,
NamedFragment: NamedFragment,
ParamType: ParamType,
StructFragment: StructFragment,
checkResultErrors: checkResultErrors,
ErrorDescription: ErrorDescription,
Indexed: Indexed,
Interface: Interface,
LogDescription: LogDescription,
Result: Result,
TransactionDescription: TransactionDescription,
Typed: Typed,
getAddress: getAddress,
getIcapAddress: getIcapAddress,
getCreateAddress: getCreateAddress,
getCreate2Address: getCreate2Address,
isAddressable: isAddressable,
isAddress: isAddress,
resolveAddress: resolveAddress,
ZeroAddress: ZeroAddress,
WeiPerEther: WeiPerEther,
MaxUint256: MaxUint256,
MinInt256: MinInt256,
MaxInt256: MaxInt256,
N: N$1,
ZeroHash: ZeroHash,
EtherSymbol: EtherSymbol,
MessagePrefix: MessagePrefix,
AbstractProvider: AbstractProvider,
AbstractSigner: AbstractSigner,
AlchemyProvider: AlchemyProvider,
AnkrProvider: AnkrProvider,
BaseContract: BaseContract,
BaseWallet: BaseWallet,
Block: Block,
BrowserProvider: BrowserProvider,
CloudflareProvider: CloudflareProvider,
ConstructorFragment: ConstructorFragment,
Contract: Contract,
ContractFactory: ContractFactory,
ContractEventPayload: ContractEventPayload,
ContractFactory: ContractFactory,
ContractTransactionReceipt: ContractTransactionReceipt,
ContractTransactionResponse: ContractTransactionResponse,
ContractUnknownEventPayload: ContractUnknownEventPayload,
EnsPlugin: EnsPlugin,
EnsResolver: EnsResolver,
ErrorDescription: ErrorDescription,
ErrorFragment: ErrorFragment,
EtherSymbol: EtherSymbol,
EtherscanPlugin: EtherscanPlugin,
EtherscanProvider: EtherscanProvider,
EventFragment: EventFragment,
EventLog: EventLog,
computeHmac: computeHmac,
randomBytes: randomBytes,
keccak256: keccak256,
ripemd160: ripemd160,
sha256: sha256,
sha512: sha512,
pbkdf2: pbkdf2,
scrypt: scrypt,
scryptSync: scryptSync,
lock: lock,
Signature: Signature,
SigningKey: SigningKey,
id: id,
ensNormalize: ensNormalize,
isValidName: isValidName,
namehash: namehash,
dnsEncode: dnsEncode,
hashMessage: hashMessage,
verifyMessage: verifyMessage,
solidityPacked: solidityPacked,
solidityPackedKeccak256: solidityPackedKeccak256,
solidityPackedSha256: solidityPackedSha256,
TypedDataEncoder: TypedDataEncoder,
verifyTypedData: verifyTypedData,
getDefaultProvider: getDefaultProvider,
Block: Block,
FeeData: FeeData,
Log: Log,
TransactionReceipt: TransactionReceipt,
TransactionResponse: TransactionResponse,
AbstractSigner: AbstractSigner,
NonceManager: NonceManager,
VoidSigner: VoidSigner,
AbstractProvider: AbstractProvider,
EventPayload: EventPayload,
FallbackFragment: FallbackFragment,
FallbackProvider: FallbackProvider,
FeeData: FeeData,
FeeDataNetworkPlugin: FeeDataNetworkPlugin,
FetchCancelSignal: FetchCancelSignal,
FetchRequest: FetchRequest,
FetchResponse: FetchResponse,
FixedNumber: FixedNumber,
Fragment: Fragment,
FunctionFragment: FunctionFragment,
GasCostPlugin: GasCostPlugin,
HDNodeVoidWallet: HDNodeVoidWallet,
HDNodeWallet: HDNodeWallet,
Indexed: Indexed,
InfuraProvider: InfuraProvider,
InfuraWebSocketProvider: InfuraWebSocketProvider,
Interface: Interface,
IpcSocketProvider: IpcSocketProvider,
JsonRpcApiProvider: JsonRpcApiProvider,
JsonRpcProvider: JsonRpcProvider,
JsonRpcSigner: JsonRpcSigner,
BrowserProvider: BrowserProvider,
AlchemyProvider: AlchemyProvider,
AnkrProvider: AnkrProvider,
CloudflareProvider: CloudflareProvider,
EtherscanProvider: EtherscanProvider,
InfuraProvider: InfuraProvider,
InfuraWebSocketProvider: InfuraWebSocketProvider,
LangEn: LangEn,
Log: Log,
LogDescription: LogDescription,
MaxInt256: MaxInt256,
MaxUint256: MaxUint256,
MessagePrefix: MessagePrefix,
MinInt256: MinInt256,
Mnemonic: Mnemonic,
N: N$1,
NamedFragment: NamedFragment,
Network: Network,
NetworkPlugin: NetworkPlugin,
NonceManager: NonceManager,
ParamType: ParamType,
PocketProvider: PocketProvider,
QuickNodeProvider: QuickNodeProvider,
IpcSocketProvider: IpcSocketProvider,
SocketProvider: SocketProvider,
WebSocketProvider: WebSocketProvider,
EnsResolver: EnsResolver,
Network: Network,
EnsPlugin: EnsPlugin,
EtherscanPlugin: EtherscanPlugin,
FeeDataNetworkPlugin: FeeDataNetworkPlugin,
GasCostPlugin: GasCostPlugin,
NetworkPlugin: NetworkPlugin,
Result: Result,
Signature: Signature,
SigningKey: SigningKey,
SocketBlockSubscriber: SocketBlockSubscriber,
SocketEventSubscriber: SocketEventSubscriber,
SocketPendingSubscriber: SocketPendingSubscriber,
SocketProvider: SocketProvider,
SocketSubscriber: SocketSubscriber,
UnmanagedSubscriber: UnmanagedSubscriber,
copyRequest: copyRequest,
showThrottleMessage: showThrottleMessage,
accessListify: accessListify,
computeAddress: computeAddress,
recoverAddress: recoverAddress,
StructFragment: StructFragment,
Transaction: Transaction,
decodeBase58: decodeBase58,
encodeBase58: encodeBase58,
decodeBase64: decodeBase64,
encodeBase64: encodeBase64,
concat: concat,
dataLength: dataLength,
dataSlice: dataSlice,
getBytes: getBytes,
getBytesCopy: getBytesCopy,
hexlify: hexlify,
isHexString: isHexString,
isBytesLike: isBytesLike,
stripZerosLeft: stripZerosLeft,
zeroPadBytes: zeroPadBytes,
zeroPadValue: zeroPadValue,
defineProperties: defineProperties,
resolveProperties: resolveProperties,
TransactionDescription: TransactionDescription,
TransactionReceipt: TransactionReceipt,
TransactionResponse: TransactionResponse,
Typed: Typed,
TypedDataEncoder: TypedDataEncoder,
UnmanagedSubscriber: UnmanagedSubscriber,
Utf8ErrorFuncs: Utf8ErrorFuncs,
VoidSigner: VoidSigner,
Wallet: Wallet,
WebSocketProvider: WebSocketProvider,
WeiPerEther: WeiPerEther,
Wordlist: Wordlist,
WordlistOwl: WordlistOwl,
WordlistOwlA: WordlistOwlA,
ZeroAddress: ZeroAddress,
ZeroHash: ZeroHash,
accessListify: accessListify,
assert: assert$1,
assertArgument: assertArgument,
assertArgumentCount: assertArgumentCount,
assertNormalize: assertNormalize,
assertPrivate: assertPrivate,
makeError: makeError,
isCallException: isCallException,
isError: isError,
EventPayload: EventPayload,
FetchRequest: FetchRequest,
FetchResponse: FetchResponse,
FetchCancelSignal: FetchCancelSignal,
FixedNumber: FixedNumber,
checkResultErrors: checkResultErrors,
computeAddress: computeAddress,
computeHmac: computeHmac,
concat: concat,
copyRequest: copyRequest,
dataLength: dataLength,
dataSlice: dataSlice,
decodeBase58: decodeBase58,
decodeBase64: decodeBase64,
decodeBytes32String: decodeBytes32String,
decodeRlp: decodeRlp,
decryptCrowdsaleJson: decryptCrowdsaleJson,
decryptKeystoreJson: decryptKeystoreJson,
decryptKeystoreJsonSync: decryptKeystoreJsonSync,
defaultPath: defaultPath,
defineProperties: defineProperties,
dnsEncode: dnsEncode,
encodeBase58: encodeBase58,
encodeBase64: encodeBase64,
encodeBytes32String: encodeBytes32String,
encodeRlp: encodeRlp,
encryptKeystoreJson: encryptKeystoreJson,
encryptKeystoreJsonSync: encryptKeystoreJsonSync,
ensNormalize: ensNormalize,
formatEther: formatEther,
formatUnits: formatUnits,
fromTwos: fromTwos,
getAccountPath: getAccountPath,
getAddress: getAddress,
getBigInt: getBigInt,
getBytes: getBytes,
getBytesCopy: getBytesCopy,
getCreate2Address: getCreate2Address,
getCreateAddress: getCreateAddress,
getDefaultProvider: getDefaultProvider,
getIcapAddress: getIcapAddress,
getIndexedAccountPath: getIndexedAccountPath,
getNumber: getNumber,
getUint: getUint,
hashMessage: hashMessage,
hexlify: hexlify,
id: id,
isAddress: isAddress,
isAddressable: isAddressable,
isBytesLike: isBytesLike,
isCallException: isCallException,
isCrowdsaleJson: isCrowdsaleJson,
isError: isError,
isHexString: isHexString,
isKeystoreJson: isKeystoreJson,
isValidName: isValidName,
keccak256: keccak256,
lock: lock,
makeError: makeError,
mask: mask,
namehash: namehash,
parseEther: parseEther,
parseUnits: parseUnits,
pbkdf2: pbkdf2,
randomBytes: randomBytes,
recoverAddress: recoverAddress,
resolveAddress: resolveAddress,
resolveProperties: resolveProperties,
ripemd160: ripemd160,
scrypt: scrypt,
scryptSync: scryptSync,
sha256: sha256,
sha512: sha512,
showThrottleMessage: showThrottleMessage,
solidityPacked: solidityPacked,
solidityPackedKeccak256: solidityPackedKeccak256,
solidityPackedSha256: solidityPackedSha256,
stripZerosLeft: stripZerosLeft,
toBeArray: toBeArray,
toBigInt: toBigInt,
toBeHex: toBeHex,
toBigInt: toBigInt,
toNumber: toNumber,
toQuantity: toQuantity,
fromTwos: fromTwos,
toTwos: toTwos,
mask: mask,
formatEther: formatEther,
parseEther: parseEther,
formatUnits: formatUnits,
parseUnits: parseUnits,
toUtf8Bytes: toUtf8Bytes,
toUtf8CodePoints: toUtf8CodePoints,
toUtf8String: toUtf8String,
Utf8ErrorFuncs: Utf8ErrorFuncs,
decodeRlp: decodeRlp,
encodeRlp: encodeRlp,
uuidV4: uuidV4,
Mnemonic: Mnemonic,
BaseWallet: BaseWallet,
HDNodeWallet: HDNodeWallet,
HDNodeVoidWallet: HDNodeVoidWallet,
Wallet: Wallet,
defaultPath: defaultPath,
getAccountPath: getAccountPath,
getIndexedAccountPath: getIndexedAccountPath,
isCrowdsaleJson: isCrowdsaleJson,
isKeystoreJson: isKeystoreJson,
decryptCrowdsaleJson: decryptCrowdsaleJson,
decryptKeystoreJsonSync: decryptKeystoreJsonSync,
decryptKeystoreJson: decryptKeystoreJson,
encryptKeystoreJson: encryptKeystoreJson,
encryptKeystoreJsonSync: encryptKeystoreJsonSync,
Wordlist: Wordlist,
LangEn: LangEn,
WordlistOwl: WordlistOwl,
WordlistOwlA: WordlistOwlA,
wordlists: wordlists
verifyMessage: verifyMessage,
verifyTypedData: verifyTypedData,
version: version,
wordlists: wordlists,
zeroPadBytes: zeroPadBytes,
zeroPadValue: zeroPadValue
});
exports.AbiCoder = AbiCoder;
@ -22032,7 +22083,5 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
exports.zeroPadBytes = zeroPadBytes;
exports.zeroPadValue = zeroPadValue;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=ethers.umd.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -41,6 +41,8 @@ const assert$1 = {
};
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
// The import here is via the package name. This is to ensure
// that exports mapping/resolution does fall into place.
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
// There is almost no big endian hardware, but js typed arrays uses platform specific endianness.
@ -955,6 +957,7 @@ class Wordlist {
}
// Use the encode-latin.js script to create the necessary
// data files to be consumed by this class
/**
* An OWL format Wordlist is an encoding method that exploits
* the general locality of alphabetically sorted words to

File diff suppressed because one or more lines are too long

@ -296,13 +296,13 @@ describe("Test Contract Fallback", function () {
name: "receive and non-payable fallback",
address: "0x5b59d934f0d22b15e73b5d6b9ae83486b70df67e",
abi: [
"fallback() payable",
"fallback()",
"receive()"
],
sendNone: { data: "0x" },
sendData: { data: "0x" },
sendValue: { data: "0x" },
sendDataAndValue: { error: "overrides.value" },
sendDataAndValue: { error: "overrides" },
},
];
const provider = (0, create_provider_js_1.getProvider)("InfuraProvider", "goerli");
@ -345,7 +345,7 @@ describe("Test Contract Fallback", function () {
assert_1.default.ok(true);
}
else {
assert_1.default.rejects(func, function (error) {
await assert_1.default.rejects(func, function (error) {
if (error.message === send.error) {
return true;
}

File diff suppressed because one or more lines are too long

@ -469,9 +469,9 @@ describe("tests ECDH shared secret", function () {
it(`tests shared secrets match: ${name}`, function () {
const signA = new index_js_2.SigningKey(keyA);
const signB = new index_js_2.SigningKey(keyB);
assert_1.default.equal(shared, signA.computeSharedSecret(signB.publicKey), "privA + pubB");
assert_1.default.equal(shared, signB.computeSharedSecret(signA.publicKey), "pubA + privB");
assert_1.default.equal(shared, signA.computeSharedSecret(signB.privateKey), "privA + privB");
assert_1.default.equal(signA.computeSharedSecret(signB.publicKey), shared, "privA + pubB");
assert_1.default.equal(signB.computeSharedSecret(signA.publicKey), shared, "pubA + privB");
assert_1.default.equal(signA.computeSharedSecret(signB.privateKey), shared, "privA + privB");
});
}
});

File diff suppressed because one or more lines are too long

@ -39,6 +39,10 @@ export declare class Result extends Array<any> {
* @_ignore
*/
filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result;
/**
* @_ignore
*/
map<T extends any = any>(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array<T>;
/**
* Returns the value for %%name%%.
*

@ -1 +1 @@
{"version":3,"file":"abstract-coder.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AAenC;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,GAAG,CAAC;;IAGlC,CAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAI,GAAG,CAAA;IAE3B;;OAEG;gBACS,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAyF/B;;;;;OAKG;IACH,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC;IASrB;;;;;OAKG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAe/B;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAA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 0; i < this.length; i++) {
const item = this[i];
if (item instanceof Error) {
throwError(`index ${i}`, item);
}
result.push(callback.call(thisArg, item, i, this));
}
return result;
}
/**
* Returns the value for %%name%%.
*

File diff suppressed because one or more lines are too long

@ -1 +1 @@
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAInD,OAAO,EAAe,GAAG,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMjF,OAAO,EAEH,2BAA2B,EAC3B,QAAQ,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAU,MAAM,iBAAiB,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACR,QAAQ,EAAE,cAAc,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAER,iBAAiB,EACjB,iBAAiB,EAEjB,cAAc,EAEd,aAAa,EACb,mBAAmB,EAEnB,eAAe,EAClB,MAAM,YAAY,CAAC;AA6FpB;;GAEG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,CAgB9I;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,IAAI,GAAG,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GA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EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;CAKpJ;;AAMD,qBAAa,QAAS,SAAQ,aAAe;CAAI"}

@ -115,11 +115,17 @@ function buildWrappedFallback(contract) {
const tx = (await copyOverrides(overrides, ["data"]));
tx.to = await contract.getAddress();
const iface = contract.interface;
const noValue = ((tx.value || BN_0) === BN_0);
const noData = ((tx.data || "0x") === "0x");
if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {
(0, index_js_3.assertArgument)(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides);
}
(0, index_js_3.assertArgument)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
// Only allow payable contracts to set non-zero value
const payable = iface.receive || (iface.fallback && iface.fallback.payable);
(0, index_js_3.assertArgument)(payable || (tx.value || BN_0) === BN_0, "cannot send value to non-payable contract", "overrides.value", tx.value);
(0, index_js_3.assertArgument)(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value);
// Only allow fallback contracts to set non-empty data
(0, index_js_3.assertArgument)(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data);
(0, index_js_3.assertArgument)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
return tx;
};
const staticCall = async function (overrides) {
@ -475,6 +481,7 @@ class BaseContract {
[internal];
fallback;
constructor(target, abi, runner, _deployTx) {
(0, index_js_3.assertArgument)(typeof (target) === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
if (runner == null) {
runner = null;
}

File diff suppressed because one or more lines are too long

@ -31,33 +31,25 @@ function getDefaultProvider(network, options) {
try {
providers.push(new provider_alchemy_js_1.AlchemyProvider(network, options.alchemy));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.ankr !== "-" && options.ankr != null) {
try {
providers.push(new provider_ankr_js_1.AnkrProvider(network, options.ankr));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.cloudflare !== "-") {
try {
providers.push(new provider_cloudflare_js_1.CloudflareProvider(network));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.etherscan !== "-") {
try {
providers.push(new provider_etherscan_js_1.EtherscanProvider(network, options.etherscan));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.infura !== "-") {
try {
@ -69,9 +61,7 @@ function getDefaultProvider(network, options) {
}
providers.push(new provider_infura_js_1.InfuraProvider(network, projectId, projectSecret));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
/*
if (options.pocket !== "-") {
@ -93,9 +83,7 @@ function getDefaultProvider(network, options) {
let token = options.quicknode;
providers.push(new provider_quicknode_js_1.QuickNodeProvider(network, token));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
(0, index_js_1.assert)(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", {
operation: "getDefaultProvider"

@ -1 +1 @@
{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":";;;AACA,gDAA2C;AAE3C,yDAAkD;AAClD,+DAAwD;AACxD,qEAA8D;AAC9D,mEAA4D;AAC5D,6DAAsD;AACtD,wDAAwD;AACxD,mEAA4D;AAE5D,iEAA0D;AAC1D,+DAAwD;AACxD,mEAA4D;AAM5D,SAAS,eAAe,CAAC,KAAU;IAC/B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU;QAC9C,OAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAA4C,EAAE,OAAa;IAC1F,IAAI,OAAO,IAAI,IAAI,EAAE;QAAE,OAAO,GAAG,EAAG,CAAC;KAAE;IAEvC,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,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AAM,CAAC;IAGvB,aAAa,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,MAAM,CAAC;IAGlB,iBAAiB,EAAE,MAAM,CAAC;IAG1B,eAAe,EAAE,MAAM,CAAC;IAGxB,KAAK,EAAE,MAAM,CAAC;CACjB;AAyCD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAGlC,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,MAAM,CAAC;IAKpB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AAwKF;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,gBAAgB;;IAElD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAOlB,SAAS,EAAE,KAAK,CAAC,gBAAgB,GAAG,sBAAsB,CAAC,EAAE,OAAO,CAAC,EAAE,UAAU;IAqB7F,IAAI,eAAe,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAQlD;IAEK,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASlC,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA0QtF,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IA4CxD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMjC"}

@ -36,21 +36,32 @@ const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };
const defaultState = {
blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,
outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,
_network: null, _updateNumber: null, _totalTime: 0
_network: null, _updateNumber: null, _totalTime: 0,
_lastFatalError: null, _lastFatalErrorTimestamp: 0
};
async function waitForSync(config, blockNumber) {
while (config.blockNumber < 0 || config.blockNumber < blockNumber) {
if (!config._updateNumber) {
config._updateNumber = (async () => {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
try {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
}
}
catch (error) {
config.blockNumber = -2;
config._lastFatalError = error;
config._lastFatalErrorTimestamp = getTime();
}
config._updateNumber = null;
})();
}
await config._updateNumber;
config.outOfSync++;
if (config._lastFatalError) {
break;
}
}
}
function _normalize(value) {
@ -284,6 +295,9 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider {
shuffle(allConfigs);
allConfigs.sort((a, b) => (b.priority - a.priority));
for (const config of allConfigs) {
if (config._lastFatalError) {
continue;
}
if (configs.indexOf(config) === -1) {
return config;
}
@ -335,9 +349,11 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider {
if (!initialSync) {
const promises = [];
this.#configs.forEach((config) => {
promises.push(waitForSync(config, 0));
promises.push((async () => {
config._network = await config.provider.getNetwork();
await waitForSync(config, 0);
if (!config._lastFatalError) {
config._network = await config.provider.getNetwork();
}
})());
});
this.#initialSyncPromise = initialSync = (async () => {
@ -346,6 +362,9 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider {
// Check all the networks match
let chainId = null;
for (const config of this.#configs) {
if (config._lastFatalError) {
continue;
}
const network = (config._network);
if (chainId == null) {
chainId = network.chainId;
@ -377,7 +396,7 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider {
case "getBlockNumber": {
// We need to get the bootstrap block height
if (this.#height === -2) {
this.#height = Math.ceil((0, index_js_1.getNumber)(getMedian(this.quorum, this.#configs.map((c) => ({
this.#height = Math.ceil((0, index_js_1.getNumber)(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({
value: c.blockNumber,
tag: (0, index_js_1.getNumber)(c.blockNumber).toString(),
weight: c.weight

File diff suppressed because one or more lines are too long

@ -1 +1 @@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OAAO,CAAC,IAAI,CAAC;IAuC/C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"}

@ -192,7 +192,7 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider {
// Sub-classes must call this for each message
async _processMessage(message) {
const result = (JSON.parse(message));
if ("id" in result) {
if (result && typeof (result) === "object" && "id" in result) {
const callback = this.#callbacks.get(result.id);
if (callback == null) {
this.emit("error", (0, index_js_1.makeError)("received result for unknown id", "UNKNOWN_ERROR", {
@ -204,7 +204,7 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider {
this.#callbacks.delete(result.id);
callback.resolve(result);
}
else if (result.method === "eth_subscription") {
else if (result && result.method === "eth_subscription") {
const filterId = result.params.subscription;
const subscriber = this.#subs.get(filterId);
if (subscriber) {
@ -219,6 +219,13 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider {
pending.push(result.params.result);
}
}
else {
this.emit("error", (0, index_js_1.makeError)("received unexpected message", "UNKNOWN_ERROR", {
reasonCode: "UNEXPECTED_MESSAGE",
result
}));
return;
}
}
async _write(message) {
throw new Error("sub-classes must override this");

File diff suppressed because one or more lines are too long

@ -293,13 +293,13 @@ describe("Test Contract Fallback", function () {
name: "receive and non-payable fallback",
address: "0x5b59d934f0d22b15e73b5d6b9ae83486b70df67e",
abi: [
"fallback() payable",
"fallback()",
"receive()"
],
sendNone: { data: "0x" },
sendData: { data: "0x" },
sendValue: { data: "0x" },
sendDataAndValue: { error: "overrides.value" },
sendDataAndValue: { error: "overrides" },
},
];
const provider = getProvider("InfuraProvider", "goerli");
@ -342,7 +342,7 @@ describe("Test Contract Fallback", function () {
assert.ok(true);
}
else {
assert.rejects(func, function (error) {
await assert.rejects(func, function (error) {
if (error.message === send.error) {
return true;
}

File diff suppressed because one or more lines are too long

@ -466,9 +466,9 @@ describe("tests ECDH shared secret", function () {
it(`tests shared secrets match: ${name}`, function () {
const signA = new SigningKey(keyA);
const signB = new SigningKey(keyB);
assert.equal(shared, signA.computeSharedSecret(signB.publicKey), "privA + pubB");
assert.equal(shared, signB.computeSharedSecret(signA.publicKey), "pubA + privB");
assert.equal(shared, signA.computeSharedSecret(signB.privateKey), "privA + privB");
assert.equal(signA.computeSharedSecret(signB.publicKey), shared, "privA + pubB");
assert.equal(signB.computeSharedSecret(signA.publicKey), shared, "pubA + privB");
assert.equal(signA.computeSharedSecret(signB.privateKey), shared, "privA + privB");
});
}
});

File diff suppressed because one or more lines are too long

@ -39,6 +39,10 @@ export declare class Result extends Array<any> {
* @_ignore
*/
filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result;
/**
* @_ignore
*/
map<T extends any = any>(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array<T>;
/**
* Returns the value for %%name%%.
*

@ -1 +1 @@
{"version":3,"file":"abstract-coder.d.ts","sourceRoot":"","sources":["../../../src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AAenC;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,GAAG,CAAC;;IAGlC,CAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAI,GAAG,CAAA;IAE3B;;OAEG;gBACS,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAyF/B;;;;;OAKG;IACH,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC;IASrB;;;;;OAKG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAe/B;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAuBnE;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,CAAC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E,OAAO;IAM3E,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK;IAI/C,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IACnD,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;IAEpC,QAAQ,CAAC,YAAY,IAAI,GAAG;CAC/B;AAED;;GAEG;AACH,qBAAa,MAAM;;;IAUf,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,MAAM,IAAI,MAAM,CAA6B;IAQjD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKpC,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAUpC,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM;IAMvC,mBAAmB,IAAI,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI;CAQvD;AAED;;GAEG;AACH,qBAAa,MAAM;;IAKf,QAAQ,CAAC,UAAU,EAAG,OAAO,CAAC;gBAKlB,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO;IAQjD,IAAI,IAAI,IAAI,MAAM,CAAgC;IAClD,IAAI,UAAU,IAAI,MAAM,CAA8B;IACtD,IAAI,QAAQ,IAAI,MAAM,CAAyB;IAC/C,IAAI,KAAK,IAAI,UAAU,CAAuC;IAmB9D,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU;IAQtD,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;CAGtB"}

@ -185,6 +185,20 @@ export class Result extends Array {
}
return new Result(_guard, result, names);
}
/**
* @_ignore
*/
map(callback, thisArg) {
const result = [];
for (let i = 0; i < this.length; i++) {
const item = this[i];
if (item instanceof Error) {
throwError(`index ${i}`, item);
}
result.push(callback.call(thisArg, item, i, this));
}
return result;
}
/**
* Returns the value for %%name%%.
*

File diff suppressed because one or more lines are too long

@ -1 +1 @@
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAInD,OAAO,EAAe,GAAG,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMjF,OAAO,EAEH,2BAA2B,EAC3B,QAAQ,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAU,MAAM,iBAAiB,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACR,QAAQ,EAAE,cAAc,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAER,iBAAiB,EACjB,iBAAiB,EAEjB,cAAc,EAEd,aAAa,EACb,mBAAmB,EAEnB,eAAe,EAClB,MAAM,YAAY,CAAC;AA6FpB;;GAEG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,CAgB9I;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,IAAI,GAAG,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAWzI;AAiPD,QAAA,MAAM,QAAQ,eAAyC,CAAC;AAoMxD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G,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;CAKpJ;;AAMD,qBAAa,QAAS,SAAQ,aAAe;CAAI"}

@ -1,5 +1,5 @@
import { Interface, Typed } from "../abi/index.js";
import { resolveAddress } from "../address/index.js";
import { isAddressable, resolveAddress } from "../address/index.js";
// import from provider.ts instead of index.ts to prevent circular dep
// from EtherscanProvider
import { copyRequest, Log } from "../providers/provider.js";
@ -110,11 +110,17 @@ function buildWrappedFallback(contract) {
const tx = (await copyOverrides(overrides, ["data"]));
tx.to = await contract.getAddress();
const iface = contract.interface;
const noValue = ((tx.value || BN_0) === BN_0);
const noData = ((tx.data || "0x") === "0x");
if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {
assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides);
}
assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
// Only allow payable contracts to set non-zero value
const payable = iface.receive || (iface.fallback && iface.fallback.payable);
assertArgument(payable || (tx.value || BN_0) === BN_0, "cannot send value to non-payable contract", "overrides.value", tx.value);
assertArgument(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value);
// Only allow fallback contracts to set non-empty data
assertArgument(iface.fallback || (tx.data || "0x") === "0x", "cannot send data to receive-only contract", "overrides.data", tx.data);
assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
return tx;
};
const staticCall = async function (overrides) {
@ -470,6 +476,7 @@ export class BaseContract {
[internal];
fallback;
constructor(target, abi, runner, _deployTx) {
assertArgument(typeof (target) === "string" || isAddressable(target), "invalid value for Contract target", "target", target);
if (runner == null) {
runner = null;
}

File diff suppressed because one or more lines are too long

@ -28,33 +28,25 @@ export function getDefaultProvider(network, options) {
try {
providers.push(new AlchemyProvider(network, options.alchemy));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.ankr !== "-" && options.ankr != null) {
try {
providers.push(new AnkrProvider(network, options.ankr));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.cloudflare !== "-") {
try {
providers.push(new CloudflareProvider(network));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.etherscan !== "-") {
try {
providers.push(new EtherscanProvider(network, options.etherscan));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
if (options.infura !== "-") {
try {
@ -66,9 +58,7 @@ export function getDefaultProvider(network, options) {
}
providers.push(new InfuraProvider(network, projectId, projectSecret));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
/*
if (options.pocket !== "-") {
@ -90,9 +80,7 @@ export function getDefaultProvider(network, options) {
let token = options.quicknode;
providers.push(new QuickNodeProvider(network, token));
}
catch (error) {
console.log(error);
}
catch (error) { }
}
assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", {
operation: "getDefaultProvider"

@ -1 +1 @@
{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,wDAAwD;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAM5D,SAAS,eAAe,CAAC,KAAU;IAC/B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU;Q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KAAK,CAAC,qBAAqB,CAAC,CAQlD;IAEK,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASlC,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA0QtF,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IA4CxD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMjC"}

@ -33,21 +33,32 @@ const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };
const defaultState = {
blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,
outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,
_network: null, _updateNumber: null, _totalTime: 0
_network: null, _updateNumber: null, _totalTime: 0,
_lastFatalError: null, _lastFatalErrorTimestamp: 0
};
async function waitForSync(config, blockNumber) {
while (config.blockNumber < 0 || config.blockNumber < blockNumber) {
if (!config._updateNumber) {
config._updateNumber = (async () => {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
try {
const blockNumber = await config.provider.getBlockNumber();
if (blockNumber > config.blockNumber) {
config.blockNumber = blockNumber;
}
}
catch (error) {
config.blockNumber = -2;
config._lastFatalError = error;
config._lastFatalErrorTimestamp = getTime();
}
config._updateNumber = null;
})();
}
await config._updateNumber;
config.outOfSync++;
if (config._lastFatalError) {
break;
}
}
}
function _normalize(value) {
@ -281,6 +292,9 @@ export class FallbackProvider extends AbstractProvider {
shuffle(allConfigs);
allConfigs.sort((a, b) => (b.priority - a.priority));
for (const config of allConfigs) {
if (config._lastFatalError) {
continue;
}
if (configs.indexOf(config) === -1) {
return config;
}
@ -332,9 +346,11 @@ export class FallbackProvider extends AbstractProvider {
if (!initialSync) {
const promises = [];
this.#configs.forEach((config) => {
promises.push(waitForSync(config, 0));
promises.push((async () => {
config._network = await config.provider.getNetwork();
await waitForSync(config, 0);
if (!config._lastFatalError) {
config._network = await config.provider.getNetwork();
}
})());
});
this.#initialSyncPromise = initialSync = (async () => {
@ -343,6 +359,9 @@ export class FallbackProvider extends AbstractProvider {
// Check all the networks match
let chainId = null;
for (const config of this.#configs) {
if (config._lastFatalError) {
continue;
}
const network = (config._network);
if (chainId == null) {
chainId = network.chainId;
@ -374,7 +393,7 @@ export class FallbackProvider extends AbstractProvider {
case "getBlockNumber": {
// We need to get the bootstrap block height
if (this.#height === -2) {
this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.map((c) => ({
this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({
value: c.blockNumber,
tag: getNumber(c.blockNumber).toString(),
weight: c.weight

File diff suppressed because one or more lines are too long

@ -1 +1 @@
{"version":3,"file":"provider-socket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW/C,qBAAa,gBAAiB,YAAW,UAAU;;IAI/C,IAAI,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAqC;gBAOjD,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;IAQxD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAMtC,MAAM,IAAI,IAAI;IAId,cA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AAc,EAAE,MAAM,EAAE,WAAW;IAKnD,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;;gBAUtC,OAAO,CAAC,EAAE,UAAU;IAiBhC,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU;IAoB7C,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAWlE,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAoCpG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuC/C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"}

@ -185,7 +185,7 @@ export class SocketProvider extends JsonRpcApiProvider {
// Sub-classes must call this for each message
async _processMessage(message) {
const result = (JSON.parse(message));
if ("id" in result) {
if (result && typeof (result) === "object" && "id" in result) {
const callback = this.#callbacks.get(result.id);
if (callback == null) {
this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", {
@ -197,7 +197,7 @@ export class SocketProvider extends JsonRpcApiProvider {
this.#callbacks.delete(result.id);
callback.resolve(result);
}
else if (result.method === "eth_subscription") {
else if (result && result.method === "eth_subscription") {
const filterId = result.params.subscription;
const subscriber = this.#subs.get(filterId);
if (subscriber) {
@ -212,6 +212,13 @@ export class SocketProvider extends JsonRpcApiProvider {
pending.push(result.params.result);
}
}
else {
this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", {
reasonCode: "UNEXPECTED_MESSAGE",
result
}));
return;
}
}
async _write(message) {
throw new Error("sub-classes must override this");

File diff suppressed because one or more lines are too long

80
package-lock.json generated

@ -28,12 +28,12 @@
"ws": "8.5.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-node-resolve": "15.0.2",
"@types/mocha": "9.1.1",
"@types/semver": "7.3.12",
"c8": "7.12.0",
"mocha": "10.0.0",
"rollup": "2.78.1",
"rollup": "3.21.5",
"semver": "7.3.7",
"typescript": "5.0.4",
"uglify-js": "3.17.0"
@ -110,46 +110,56 @@
]
},
"node_modules/@rollup/plugin-node-resolve": {
"version": "13.3.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz",
"integrity": "sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==",
"version": "15.0.2",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.2.tgz",
"integrity": "sha512-Y35fRGUjC3FaurG722uhUuG8YHOJRJQbI6/CkbRkdPotSpDj9NtIN85z1zrcyDcCQIW4qp5mgG72U+gJ0TAFEg==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^3.1.0",
"@types/resolve": "1.17.1",
"@rollup/pluginutils": "^5.0.1",
"@types/resolve": "1.20.2",
"deepmerge": "^4.2.2",
"is-builtin-module": "^3.1.0",
"is-builtin-module": "^3.2.1",
"is-module": "^1.0.0",
"resolve": "^1.19.0"
"resolve": "^1.22.1"
},
"engines": {
"node": ">= 10.0.0"
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^2.42.0"
"rollup": "^2.78.0||^3.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/pluginutils": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
"integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==",
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz",
"integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==",
"dev": true,
"dependencies": {
"@types/estree": "0.0.39",
"estree-walker": "^1.0.1",
"picomatch": "^2.2.2"
"@types/estree": "^1.0.0",
"estree-walker": "^2.0.2",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">= 8.0.0"
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0"
"rollup": "^1.20.0||^2.0.0||^3.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@types/estree": {
"version": "0.0.39",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
"integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz",
"integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==",
"dev": true
},
"node_modules/@types/istanbul-lib-coverage": {
@ -170,13 +180,10 @@
"integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q=="
},
"node_modules/@types/resolve": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz",
"integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
"version": "1.20.2",
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz",
"integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
"dev": true
},
"node_modules/@types/semver": {
"version": "7.3.12",
@ -518,9 +525,9 @@
}
},
"node_modules/estree-walker": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
"integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"node_modules/fill-range": {
@ -1191,15 +1198,16 @@
}
},
"node_modules/rollup": {
"version": "2.78.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.78.1.tgz",
"integrity": "sha512-VeeCgtGi4P+o9hIg+xz4qQpRl6R401LWEXBmxYKOV4zlF82lyhgh2hTZnheFUbANE8l2A41F458iwj2vEYaXJg==",
"version": "3.21.5",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.5.tgz",
"integrity": "sha512-a4NTKS4u9PusbUJcfF4IMxuqjFzjm6ifj76P54a7cKnvVzJaG12BLVR+hgU2YDGHzyMMQNxLAZWuALsn8q2oQg==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
},
"engines": {
"node": ">=10.0.0"
"node": ">=14.18.0",
"npm": ">=8.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"

@ -19,12 +19,12 @@
},
"description": "A complete and compact Ethereum library, for dapps, wallets and any other tools.",
"devDependencies": {
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-node-resolve": "15.0.2",
"@types/mocha": "9.1.1",
"@types/semver": "7.3.12",
"c8": "7.12.0",
"mocha": "10.0.0",
"rollup": "2.78.1",
"rollup": "3.21.5",
"semver": "7.3.7",
"typescript": "5.0.4",
"uglify-js": "3.17.0"
@ -93,7 +93,7 @@
"url": "https://www.buymeacoffee.com/ricmoo"
}
],
"gitHead": "1bc8b55d502a95c4ae58352bdcfce9e5f9ea72d3",
"gitHead": "219b16dc284b0c6a532c8c49e824d8234f94222b",
"homepage": "https://ethers.org",
"keywords": [
"ethereum",

@ -4,7 +4,7 @@ import { isAddressable, resolveAddress } from "../address/index.js";
// from EtherscanProvider
import { copyRequest, Log, TransactionResponse } from "../providers/provider.js";
import {
defineProperties, isCallException, isHexString, resolveProperties,
defineProperties, getBigInt, isCallException, isHexString, resolveProperties,
makeError, assert, assertArgument
} from "../utils/index.js";
@ -172,7 +172,7 @@ function buildWrappedFallback(contract: BaseContract): WrappedFallback {
const iface = contract.interface;
const noValue = ((tx.value || BN_0) === BN_0);
const noValue = (getBigInt((tx.value || BN_0), "overrides.value") === BN_0);
const noData = ((tx.data || "0x") === "0x");
if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {