From d1feed3cb3354ae279968afc9d8f844c881b8c4d Mon Sep 17 00:00:00 2001 From: Sebastian Pape Date: Thu, 19 May 2022 10:40:36 +0200 Subject: [PATCH] v6.30.0: upgrade to depay/widgets v6.30.0 --- dist/esm/index.bundle.js | 8143 +++++++++++++++++++++++--------------- dist/umd/index.bundle.js | 8143 +++++++++++++++++++++++--------------- package.json | 8 +- yarn.lock | 748 ++-- 4 files changed, 10296 insertions(+), 6746 deletions(-) diff --git a/dist/esm/index.bundle.js b/dist/esm/index.bundle.js index 89e187b..545201b 100644 --- a/dist/esm/index.bundle.js +++ b/dist/esm/index.bundle.js @@ -1303,12 +1303,12 @@ var bsc = { name: 'bsc', id: '0x38', networkId: '56', - label: 'Binance Smart Chain', - fullName: 'Binance Smart Chain Mainnet', + label: 'BNB Smart Chain', + fullName: 'BNB Smart Chain Mainnet', logo: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAElBMVEVHcEz+8MH+5Zr8z0L7xin6uAAnV2YyAAAABXRSTlMAKUuw0AGI+EgAAAjjSURBVHja7d2NbeQ4DAVg5yo4nKeAwZUQYAs4A6lgM/23ssgFQf5mJhbFZ/KRjwUQkvWNR7YlalkUCoVCoVAoFAqFQqFQKBQKhUKhUCgUCoVCoVAoFAqFQqFQKBQKSKzn3v1/eNp6X4DT5fncG8DlsvUGcGlN4K+ny6U1gRcAnQk8/A+gMYFXAH0JvAFoS+ANQFcC7wCaEngH0JPARwAtCXwE0JHAZwANCXwG0I/AVwDtCHwF0I3AdwDNCHwH0IvANQCtCFwD0InAdQCNCFwH0IfALQBtCNwC0IXAbQBNCNwG0IPAPQAtCNwD0IHAw6+7F6A+gfV+/8sT+AlAeQI/AahO4GcAxQmcfu5/aQL35wANCOwBUJnAPgCFCewDUJfAXgBlCax7+1+UwJ45QGkC+wHUJDACoCSBEQAVCYwBKEhgDEA9AvvnAEUJnEb7X4zAOIBiBMYB1CJgAVCKgAVAJQKjc4ByBF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CkChAPWNHAG5jdkEnAEQKUM/UFQDtR+1tnQKQKUA9pSsA2rVPrU4ByBSg2W+dALS/N77ZngMgVIDmusgVAC3amjkFIFWApgxdARxnLXOKUwBiBagnbwfQ9iVoUtJ5AHIFqGfsBsCigoLeASBYgHoKVwBUWwmeApAsQOMObgFgH8IyeheAZAGaY5grAJpbRtFTAKIFaFrMCsB2FdMNvQ9AtgD1ZC0AzHHMnElZAAgXoJ7cBsBisoJsAKQLUM/UFQA9GH/lCGAvU4B6CicAZmf+QHYA4gVo9mZXADR3PVpfvgBNGboCOEwcj9YPQICm0VsAGD3a5Wj9EASoJ3MFQDu3o/WDEKCesSsAWquC2gGEIUA9n1wB0F/kACAQARrrIlcA5AIgEAGaH09gAYQhQHNdBAUQiABNGQIBBCNAPTkOQEAC1PMbCsBvIQlQDwrAj5IIIAKIACKACCACiAAigAggAogAIoAIIAKIAPoH4CcC1Z4INgWkGlvASSpYle5Ak27EVULwnOHWpQzZj5xcXiUEz5m2CeAH//8bFcirhOA3SdVHAZrvjUVvBPWQm14KUE8ueyOoh0x7KUDjEyLZG0H5k676KEA9g21/VkDnk/VSgHrGPVoBnU/RSwEaKujRCugdFfRRgObjkf6sgM4n76UA/22/DokAgGEgCE7dxEp5/WspDQgO+V0TN9dV0AHNbmQAm/MyAwAAAAAAAAAAsOgDnoXGy163DjEAAAAASUVORK5CYII=', currency: { - name: 'Binance Coin', + name: 'BNB', symbol: 'BNB', decimals: 18 }, @@ -1335,7 +1335,7 @@ var polygon = { id: '0x89', networkId: '137', label: 'Polygon', - fullName: 'Matic(Polygon) Mainnet', + fullName: 'Polygon Mainnet', logo: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAGFBMVEVHcEzZvfrQr/nEmvevdvShXvGSRO+NPO5VmlSmAAAAB3RSTlMAGThfi7/qvWAYyAAADJxJREFUeNrsnU1z2zYURUFB6dpTs107tTnZqp1K2kZeSNtGnpjbZKwY+9YU/n6p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suMlWgA1BWGcrAMgHXb4CQFZBDYzT48MyjfB5YJGxAJBQKZuxAIhSqMCFqnJiucZY0U3WAmzifQAYrMzJVgCWYrDERWuzYrmy9WzmAoTPXDeZchFg8xr6mUp+AoTvV+iP1TITIHy5Qn+umJkA4T38g9XMBAjvIV9pZSzA5i/wAjhCAdbwmAFlwbPGeLmDB03UYUoChG9XQAPAbbbg+BWctmY4hm9zssDm7WnPMHmZlTIgA5cKxzJ/npMi+sL1kQFwzB1mxgMzd44NgHFqPhIbHzpx+uoR104LmpvEk8xGZgJEJSp7e+nDA/jB09woRPLAowHkuAQQrRHZE7u7WlkuAUQLSPpIE3bkVgZtUR6QP7MKIdc3gOhVfALRoQPKrBNq1+8x5YAJQ03ywXAXmUKm/WhybJlTiMKX0waY+T8AURWTRKgsKMZqSGKeoQblGA5K4XqnsVaoHMNh0b5nHJ/xoBzDoTEXKIAQbnxUoSvff6c9SwfKMRwDq9CVzf1L2qJWfgIG0CuZc/Phnz/+fOdRQb4jAT/CKQcDBMRUQ/aTxgF4hNOeb+M2QLYRTpkUANCpFagj9gGBjXDKygA5JzpmYYD4EU5JZrkxoZBWwDrLjQtgOTDqDjj6kGtiBshghpkZINwM2We5cYKYZzjSPfBkZphdAQCeZ5hglhsv2s3RAGHzDLM1QJAZZmyAEDNMNMuNn9X4pnknppmjAUZvFGeyBczWGWazBcxkhhMoAI4xPgBnueVIFQJsllueVBPeAkb3xhMywGMznO4WMNQMs9wCBprhaL8CRFD6eXTA5zEz6YDPU83SANus5miAbVQzRwNso9w8OuCnyoG5dIDn0H6OBtjG+Hl0wOepZtIBn6eeYQHwkxnO0QCPT03naIDHZjjdLeCOCnz6uud+js8vCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCP+1B4cEAAAAAIL+v7a7AQAAAAAAAAAAACZ3ytyh8egOIwAAAABJRU5ErkJggg==', currency: { @@ -1348,7 +1348,17 @@ var polygon = { if(transaction) { return `https://polygonscan.com/tx/${transaction.id}` } if(token) { return `https://polygonscan.com/token/${token}` } }, - rpc: 'https://rpc-mainnet.matic.network' + rpc: 'https://rpc-mainnet.matic.network', + tokens: [ // only major tokens + {"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "symbol": "MATIC", "name": "Polygon", "decimals": 18, "logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAGFBMVEVHcEzZvfrQr/nEmvevdvShXvGSRO+NPO5VmlSmAAAAB3RSTlMAGThfi7/qvWAYyAAADJxJREFUeNrsnU1z2zYURUFB6dpTs107tTnZqp1K2kZeSNtGnpjbZKwY+9YU/n6pTOIh04qmiQsQj7hnmUUmPKF48fDxoAghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQghRKls+fuNWpchsa5+5U+kxK22DvUqNbGdbbFRirGyb40IlRWF/pLpSCXFjbdIGLo39Hw4XKhFmX5//vzyoNGgHYHphmG3tOY5JhGErABMMw0YAJhkFue3maeJRMDf2BQ5qyuizAZBGZdgOwPTC8GsF+DLH39VEaQVggmHYCsAEw/BcAKZSF+kzAZhKXdQMgBSjIOvx/JOeJNza13J8rybE0r6eakJhWNghPE0mDM8GYCKVYTsA0wvDdgWYXhi2BwDpheG5KdBk6qIzFWAydVFhXalER0Fu3ZE8SVgHIAC5k4R1AECQGoYZ6PnFhuHWopAZhkuLQ2IYugeg7LoIEYBNHoQZwASg3ChABWCTD0oOs53FI2j7SLayPpAzSdg/AB5rpheGvZ//yx8X9etyfT+xMMxNz9/07ffHuS6nNEmoez9/86M5ncqwdwBuhsVm7IdLsr7/l/uhA6fIo2A19MecTyMMl8M/58UUouDGJdBX8qMgd3qLs95REOvC+cy4rfzPSuEz5WvXGT5tRBeGc/fCPhf9CuwAY7lC8FdAQ9Z5ekbBPyo+3kFe3r5REGFhXGIq+p5R8JeKDY1a4NBG5m/gV9isXt5LpYqNHW5mu5BYFGYGOIbvEwWf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X4pnknppmjAUZvFGeyBczWGWazBcxkhhMoAI4xPgBnueVIFQJsllueVBPeAkb3xhMywGMznO4WMNQMs9wCBprhaL8CRFD6eXTA5zEz6YDPU83SANus5miAbVQzRwNso9w8OuCnyoG5dIDn0H6OBtjG+Hl0wOepZtIBn6eeYQHwkxnO0QCPT03naIDHZjjdLeCOCnz6uud+js8vCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCP+1B4cEAAAAAIL+v7a7AQAAAAAAAAAAACZ3ytyh8egOIwAAAABJRU5ErkJggg==", "type": "NATIVE"}, + {"address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", "symbol": "WMATIC", "name": "Wrapped Matic", "decimals": 18, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0/logo.png", "type": "20"}, + {"address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", "symbol": "WETH", "name": "Wrapped Ether", "decimals": 18, "logo": "https://info.quickswap.exchange/static/media/eth.5fc0c9bd.png", "type": "20"}, + {"address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", "symbol": "USDC", "name": "USD Coin", "decimals": 6, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png", "type": "20"}, + {"address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", "symbol": "USDT", "name": "Tether USD", "decimals": 6, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png", "type": "20"}, + {"address": "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1", "symbol": "miMATIC", "name": "miMATIC", "decimals": 18, "logo": "https://raw.githubusercontent.com/0xlaozi/qidao/main/images/mimatic-red.png", "type": "20"}, + {"address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", "symbol": "DAI", "name": "Dai Stablecoin", "decimals": 18, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png", "type": "20"}, + {"address": "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", "symbol": "WBTC", "name": "Wrapped BTC", "decimals": 8, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png", "type": "20"} + ] }; var unknown = { @@ -1404,7 +1414,8 @@ let CONSTANTS = { SYMBOL: 'ETH', CURRENCY: 'Ether', NAME: 'Ethereum', - USD: '0x6B175474E89094C44Da98b954EedeAC495271d0F' + USD: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + TRANSFER_GAS: 21000 }; let CONSTANTS$1 = { @@ -1414,15 +1425,30 @@ let CONSTANTS$1 = { NATIVE: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', DECIMALS: 18, SYMBOL: 'BNB', - CURRENCY: 'Binance Coin', - NAME: 'Binance Smart Chain', - USD: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56' + CURRENCY: 'BNB', + NAME: 'BNB Smart Chain', + USD: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + TRANSFER_GAS: 21000 +}; + +let CONSTANTS$2 = { + ZERO: '0x0000000000000000000000000000000000000000', + MAXINT: '115792089237316195423570985008687907853269984665640564039457584007913129639935', + WRAPPED: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + NATIVE: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', + DECIMALS: 18, + SYMBOL: 'MATIC', + CURRENCY: 'Polygon', + NAME: 'Polygon', + USD: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + TRANSFER_GAS: 21000 }; -let CONSTANTS$2 = {}; +let CONSTANTS$3 = {}; -CONSTANTS$2['ethereum'] = CONSTANTS; -CONSTANTS$2['bsc'] = CONSTANTS$1; +CONSTANTS$3['ethereum'] = CONSTANTS; +CONSTANTS$3['bsc'] = CONSTANTS$1; +CONSTANTS$3['polygon'] = CONSTANTS$2; var byteLength_1 = byteLength; var toByteArray_1 = toByteArray; @@ -9474,7 +9500,7 @@ var bn = createCommonjsModule(function (module) { })( module, commonjsGlobal); }); -const version$2 = "logger/5.5.0"; +const version$2 = "logger/5.6.0"; let _permanentCensorErrors = false; let _censorErrors = false; @@ -9653,6 +9679,40 @@ class Logger { messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode.CALL_EXCEPTION: + case ErrorCode.INSUFFICIENT_FUNDS: + case ErrorCode.MISSING_NEW: + case ErrorCode.NONCE_EXPIRED: + case ErrorCode.REPLACEMENT_UNDERPRICED: + case ErrorCode.TRANSACTION_REPLACED: + case ErrorCode.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -9787,7 +9847,7 @@ Logger.errors = ErrorCode; Logger.levels = LogLevel; //# sourceMappingURL=index.js.map -const version$3 = "bytes/5.5.0"; +const version$3 = "bytes/5.6.1"; const logger = new Logger(version$3); /////////////////////////////// @@ -9857,7 +9917,7 @@ function arrayify(value, options) { let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -10022,7 +10082,7 @@ function hexZeroPad(value, length) { return value; } -const version$4 = "bignumber/5.5.0"; +const version$4 = "bignumber/5.6.1"; var BN = bn.BN; const logger$1 = new Logger(version$4); @@ -10040,7 +10100,6 @@ function isBigNumberish(value) { let _warnedToStringRadix = false; class BigNumber { constructor(constructorGuard, hex) { - logger$1.checkNew(new.target, BigNumber); if (constructorGuard !== _constructorGuard) { logger$1.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { operation: "new (BigNumber)" @@ -10071,7 +10130,7 @@ class BigNumber { div(other) { const o = BigNumber.from(other); if (o.isZero()) { - throwFault("division by zero", "div"); + throwFault("division-by-zero", "div"); } return toBigNumber(toBN(this).div(toBN(other))); } @@ -10081,53 +10140,53 @@ class BigNumber { mod(other) { const value = toBN(other); if (value.isNeg()) { - throwFault("cannot modulo negative values", "mod"); + throwFault("division-by-zero", "mod"); } return toBigNumber(toBN(this).umod(value)); } pow(other) { const value = toBN(other); if (value.isNeg()) { - throwFault("cannot raise to negative values", "pow"); + throwFault("negative-power", "pow"); } return toBigNumber(toBN(this).pow(value)); } and(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'and' negative values", "and"); + throwFault("unbound-bitwise-result", "and"); } return toBigNumber(toBN(this).and(value)); } or(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'or' negative values", "or"); + throwFault("unbound-bitwise-result", "or"); } return toBigNumber(toBN(this).or(value)); } xor(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'xor' negative values", "xor"); + throwFault("unbound-bitwise-result", "xor"); } return toBigNumber(toBN(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault("cannot mask negative values", "mask"); + throwFault("negative-width", "mask"); } return toBigNumber(toBN(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shl"); + throwFault("negative-width", "shl"); } return toBigNumber(toBN(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shr"); + throwFault("negative-width", "shr"); } return toBigNumber(toBN(this).shrn(value)); } @@ -10488,7 +10547,6 @@ class FixedFormat { } class FixedNumber { constructor(constructorGuard, hex, value, format) { - logger$2.checkNew(new.target, FixedNumber); if (constructorGuard !== _constructorGuard$1) { logger$2.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" @@ -10669,7 +10727,7 @@ class FixedNumber { const ONE = FixedNumber.from(1); const BUMP = FixedNumber.from("0.5"); -const version$5 = "properties/5.5.0"; +const version$5 = "properties/5.6.0"; var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -10784,7 +10842,7 @@ class Description { } } -const version$6 = "abi/5.5.0"; +const version$6 = "abi/5.6.2"; const logger$4 = new Logger(version$6); const _constructorGuard$2 = {}; @@ -12423,7 +12481,7 @@ function keccak256(data) { return '0x' + sha3.keccak_256(arrayify(data)); } -const version$7 = "rlp/5.5.0"; +const version$7 = "rlp/5.6.0"; const logger$6 = new Logger(version$7); function arrayifyInteger(value) { @@ -12467,7 +12525,7 @@ function encode(object) { return hexlify(_encode(object)); } -const version$8 = "address/5.5.0"; +const version$8 = "address/5.6.0"; const logger$7 = new Logger(version$8); function getChecksumAddress(address) { @@ -12939,7 +12997,7 @@ class NumberCoder extends Coder { } } -const version$9 = "strings/5.5.0"; +const version$9 = "strings/5.6.0"; const logger$9 = new Logger(version$9); /////////////////////////////// @@ -13227,7 +13285,6 @@ const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); class AbiCoder { constructor(coerceFunc) { - logger$a.checkNew(new.target, AbiCoder); defineReadOnly(this, "coerceFunc", coerceFunc || null); } _getCoder(param) { @@ -13342,7 +13399,6 @@ function checkNames(fragment: Fragment, type: "input" | "output", params: Array< */ class Interface { constructor(fragments) { - logger$b.checkNew(new.target, Interface); let abi = []; if (typeof (fragments) === "string") { abi = JSON.parse(fragments); @@ -13598,6 +13654,7 @@ class Interface { } let bytes = arrayify(data); let reason = null; + let message = ""; let errorArgs = null; let errorName = null; let errorSignature = null; @@ -13618,6 +13675,12 @@ class Interface { if (builtin.reason) { reason = errorArgs[0]; } + if (errorName === "Error") { + message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`; + } + else if (errorName === "Panic") { + message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`; + } } else { try { @@ -13626,16 +13689,14 @@ class Interface { errorName = error.name; errorSignature = error.format(); } - catch (error) { - console.log(error); - } + catch (error) { } } break; } } - return logger$b.throwError("call revert exception", Logger.errors.CALL_EXCEPTION, { + return logger$b.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, { method: functionFragment.format(), - errorArgs, errorName, errorSignature, reason + data: hexlify(data), errorArgs, errorName, errorSignature, reason }); } // Encode the result for a function call (e.g. for eth_call) @@ -13892,8 +13953,9 @@ class Interface { return !!(value && value._isInterface); } } +//# sourceMappingURL=interface.js.map -const version$a = "abstract-provider/5.5.1"; +const version$a = "abstract-provider/5.6.0"; var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -13927,7 +13989,7 @@ class Provider { // We may want to compute this more accurately in the future, // using the formula "check if the base fee is correct". // See: https://eips.ethereum.org/EIPS/eip-1559 - maxPriorityFeePerGas = BigNumber.from("2500000000"); + maxPriorityFeePerGas = BigNumber.from("1500000000"); maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); } return { maxFeePerGas, maxPriorityFeePerGas, gasPrice }; @@ -13946,7 +14008,7 @@ class Provider { } } -const version$b = "abstract-signer/5.5.0"; +const version$b = "abstract-signer/5.6.1"; var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -13959,7 +14021,7 @@ var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _argu }; const logger$d = new Logger(version$b); const allowedTransactionKeys = [ - "accessList", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" + "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors = [ Logger.errors.INSUFFICIENT_FUNDS, @@ -14219,7 +14281,6 @@ class Signer { } class VoidSigner extends Signer { constructor(address, provider) { - logger$d.checkNew(new.target, VoidSigner); super(); defineReadOnly(this, "address", address); defineReadOnly(this, "provider", provider || null); @@ -14246,7 +14307,7 @@ class VoidSigner extends Signer { } } -const version$c = "transactions/5.5.0"; +const version$c = "transactions/5.6.0"; const logger$e = new Logger(version$c); var TransactionTypes; @@ -14289,7 +14350,7 @@ function accessListify(value) { return result; } -const version$d = "contracts/5.5.0"; +const version$d = "contracts/5.6.1"; var __awaiter$3 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -14457,6 +14518,9 @@ function populateTransaction(contract, fragment, args) { if (ro.customData) { tx.customData = shallowCopy(ro.customData); } + if (ro.ccipReadEnabled) { + tx.ccipReadEnabled = !!ro.ccipReadEnabled; + } // Remove the overrides delete overrides.nonce; delete overrides.gasLimit; @@ -14468,6 +14532,7 @@ function populateTransaction(contract, fragment, args) { delete overrides.maxFeePerGas; delete overrides.maxPriorityFeePerGas; delete overrides.customData; + delete overrides.ccipReadEnabled; // Make sure there are no stray overrides, which may indicate a // typo or using an unsupported key. const leftovers = Object.keys(overrides).filter((key) => (overrides[key] != null)); @@ -14744,7 +14809,6 @@ class WildcardRunningEvent extends RunningEvent { } class BaseContract { constructor(addressOrName, contractInterface, signerOrProvider) { - logger$f.checkNew(new.target, Contract); // @TODO: Maybe still check the addressOrName looks like a valid address or name? //address = getAddress(address); defineReadOnly(this, "interface", getStatic(new.target, "getInterface")(contractInterface)); @@ -14813,6 +14877,8 @@ class BaseContract { }); } } + // Swallow bad ENS names to prevent Unhandled Exceptions + this.resolvedAddress.catch((e) => { }); const uniqueNames = {}; const uniqueSignatures = {}; Object.keys(this.interface.functions).forEach((signature) => { @@ -15166,7 +15232,7 @@ class BaseContract { class Contract extends BaseContract { } -const version$e = "units/5.5.0"; +const version$e = "units/5.6.0"; const logger$g = new Logger(version$e); const names = [ @@ -15200,114 +15266,7 @@ function parseUnits(value, unitName) { return parseFixed(value, (unitName != null) ? unitName : 18); } -function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }let getWindow = () => { - if (typeof global$1 == 'object') return global$1 - return window -}; - -let getCacheStore = () => { - if (getWindow()._cacheStore == undefined) { - resetCache(); - } - return getWindow()._cacheStore -}; - -let getPromiseStore = () => { - if (getWindow()._promiseStore == undefined) { - resetCache(); - } - return getWindow()._promiseStore -}; - -let resetCache = () => { - getWindow()._cacheStore = {}; - getWindow()._promiseStore = {}; -}; - -let set = function ({ key, value, expires }) { - getCacheStore()[key] = { - expiresAt: Date.now() + expires, - value, - }; -}; - -let get = function ({ key, expires }) { - let cachedEntry = getCacheStore()[key]; - if (_optionalChain([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) { - return cachedEntry.value - } -}; - -let getPromise = function({ key }) { - return getPromiseStore()[key] -}; - -let setPromise = function({ key, promise }) { - getPromiseStore()[key] = promise; - return promise -}; - -let deletePromise = function({ key }) { - getPromiseStore()[key] = undefined; -}; - -let cache = function ({ call, key, expires = 0 }) { - return new Promise((resolve, reject)=>{ - let value; - key = JSON.stringify(key); - - // get existing promise (of a previous pending request asking for the exact same thing) - let existingPromise = getPromise({ key }); - if(existingPromise) { - return existingPromise - .then(resolve) - .catch(reject) - } - - setPromise({ key, promise: new Promise((resolveQueue, rejectQueue)=>{ - if (expires === 0) { - return call() - .then((value)=>{ - resolve(value); - resolveQueue(value); - }) - .catch((error)=>{ - reject(error); - rejectQueue(error); - }) - } - - // get cached value - value = get({ key, expires }); - if (value) { - resolve(value); - resolveQueue(value); - return value - } - - // set new cache value - call() - .then((value)=>{ - if (value) { - set({ key, value, expires }); - } - resolve(value); - resolveQueue(value); - }) - .catch((error)=>{ - reject(error); - rejectQueue(error); - }); - }) - }).then(()=>{ - deletePromise({ key }); - }).catch(()=>{ - deletePromise({ key }); - }); - }) -}; - -const version$f = "logger/5.4.1"; +const version$f = "logger/5.6.0"; let _permanentCensorErrors$1 = false; let _censorErrors$1 = false; @@ -15404,7 +15363,7 @@ var ErrorCode$1; // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficien funds (< value + gasLimit * gasPrice) + // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used @@ -15486,6 +15445,40 @@ class Logger$1 { messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$1.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$1.CALL_EXCEPTION: + case ErrorCode$1.INSUFFICIENT_FUNDS: + case ErrorCode$1.MISSING_NEW: + case ErrorCode$1.NONCE_EXPIRED: + case ErrorCode$1.REPLACEMENT_UNDERPRICED: + case ErrorCode$1.TRANSACTION_REPLACED: + case ErrorCode$1.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -15619,7 +15612,7 @@ class Logger$1 { Logger$1.errors = ErrorCode$1; Logger$1.levels = LogLevel$1; -const version$e$1 = "properties/5.4.1"; +const version$e$1 = "properties/5.6.0"; var __awaiter$7 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -15744,7 +15737,7 @@ class Description$1 { } } -const version$d$1 = "bytes/5.4.0"; +const version$d$1 = "bytes/5.6.1"; const logger$f$1 = new Logger$1(version$d$1); /////////////////////////////// @@ -15764,6 +15757,9 @@ function addSlice$1(array) { function isBytesLike$1(value) { return ((isHexString$1(value) && !(value.length % 2)) || isBytes$1(value)); } +function isInteger$1(value) { + return (typeof (value) === "number" && value == value && (value % 1) === 0); +} function isBytes$1(value) { if (value == null) { return false; @@ -15774,12 +15770,12 @@ function isBytes$1(value) { if (typeof (value) === "string") { return false; } - if (value.length == null) { + if (!isInteger$1(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (typeof (v) !== "number" || v < 0 || v >= 256 || (v % 1)) { + if (!isInteger$1(v) || v < 0 || v >= 256) { return false; } } @@ -15811,7 +15807,7 @@ function arrayify$1(value, options) { let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -16011,17 +16007,28 @@ function splitSignature(signature) { s: "0x", _vs: "0x", recoveryParam: 0, - v: 0 + v: 0, + yParityAndS: "0x", + compact: "0x" }; if (isBytesLike$1(signature)) { - const bytes = arrayify$1(signature); - if (bytes.length !== 65) { - logger$f$1.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature); - } + let bytes = arrayify$1(signature); // Get the r, s and v - result.r = hexlify$1(bytes.slice(0, 32)); - result.s = hexlify$1(bytes.slice(32, 64)); - result.v = bytes[64]; + if (bytes.length === 64) { + // EIP-2098; pull the v from the top bit of s and clear it + result.v = 27 + (bytes[32] >> 7); + bytes[32] &= 0x7f; + result.r = hexlify$1(bytes.slice(0, 32)); + result.s = hexlify$1(bytes.slice(32, 64)); + } + else if (bytes.length === 65) { + result.r = hexlify$1(bytes.slice(0, 32)); + result.s = hexlify$1(bytes.slice(32, 64)); + result.v = bytes[64]; + } + else { + logger$f$1.throwArgumentError("invalid signature string", "signature", signature); + } // Allow a recid to be used as the v if (result.v < 27) { if (result.v === 0 || result.v === 1) { @@ -16084,8 +16091,11 @@ function splitSignature(signature) { if (result.v == null) { result.v = 27 + result.recoveryParam; } - else if (result.recoveryParam !== (1 - (result.v % 2))) { - logger$f$1.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + else { + const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2)); + if (result.recoveryParam !== recId) { + logger$f$1.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + } } } if (result.r == null || !isHexString$1(result.r)) { @@ -16122,9 +16132,19 @@ function splitSignature(signature) { logger$f$1.throwArgumentError("signature _vs mismatch v and s", "signature", signature); } } + result.yParityAndS = result._vs; + result.compact = result.r + result.yParityAndS.substring(2); return result; } +function decode$2(textData) { + textData = atob(textData); + const data = []; + for (let i = 0; i < textData.length; i++) { + data.push(textData.charCodeAt(i)); + } + return arrayify$1(data); +} function encode$2(data) { data = arrayify$1(data); let textData = ""; @@ -19589,7 +19609,7 @@ var bn$1 = createCommonjsModule$1(function (module) { })(module, commonjsGlobal$1); }); -const version$c$1 = "bignumber/5.4.1"; +const version$c$1 = "bignumber/5.6.0"; var BN$1 = bn$1.BN; const logger$e$1 = new Logger$1(version$c$1); @@ -19630,7 +19650,7 @@ class BigNumber$1 { div(other) { const o = BigNumber$1.from(other); if (o.isZero()) { - throwFault$2("division by zero", "div"); + throwFault$2("division-by-zero", "div"); } return toBigNumber$1(toBN$1(this).div(toBN$1(other))); } @@ -19640,53 +19660,53 @@ class BigNumber$1 { mod(other) { const value = toBN$1(other); if (value.isNeg()) { - throwFault$2("cannot modulo negative values", "mod"); + throwFault$2("division-by-zero", "mod"); } return toBigNumber$1(toBN$1(this).umod(value)); } pow(other) { const value = toBN$1(other); if (value.isNeg()) { - throwFault$2("cannot raise to negative values", "pow"); + throwFault$2("negative-power", "pow"); } return toBigNumber$1(toBN$1(this).pow(value)); } and(other) { const value = toBN$1(other); if (this.isNegative() || value.isNeg()) { - throwFault$2("cannot 'and' negative values", "and"); + throwFault$2("unbound-bitwise-result", "and"); } return toBigNumber$1(toBN$1(this).and(value)); } or(other) { const value = toBN$1(other); if (this.isNegative() || value.isNeg()) { - throwFault$2("cannot 'or' negative values", "or"); + throwFault$2("unbound-bitwise-result", "or"); } return toBigNumber$1(toBN$1(this).or(value)); } xor(other) { const value = toBN$1(other); if (this.isNegative() || value.isNeg()) { - throwFault$2("cannot 'xor' negative values", "xor"); + throwFault$2("unbound-bitwise-result", "xor"); } return toBigNumber$1(toBN$1(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$2("cannot mask negative values", "mask"); + throwFault$2("negative-width", "mask"); } return toBigNumber$1(toBN$1(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$2("cannot shift negative values", "shl"); + throwFault$2("negative-width", "shl"); } return toBigNumber$1(toBN$1(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$2("cannot shift negative values", "shr"); + throwFault$2("negative-width", "shr"); } return toBigNumber$1(toBN$1(this).shrn(value)); } @@ -19783,7 +19803,7 @@ class BigNumber$1 { return BigNumber$1.from(hexlify$1(anyValue)); } if (anyValue) { - // Hexable interface (takes piority) + // Hexable interface (takes priority) if (anyValue.toHexString) { const hex = anyValue.toHexString(); if (typeof (hex) === "string") { @@ -19820,7 +19840,7 @@ function toHex$1$1(value) { if (value[0] === "-") { // Strip off the negative sign value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") + // Cannot have multiple negative signs (e.g. "--0x04") if (value[0] === "-") { logger$e$1.throwArgumentError("invalid hex", "value", value); } @@ -19877,7 +19897,7 @@ const Zero$1$1 = ( /*#__PURE__*/BigNumber$1.from(0)); const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; -const version$b$1 = "strings/5.4.0"; +const version$b$1 = "strings/5.6.0"; const logger$d$1 = new Logger$1(version$b$1); /////////////////////////////// @@ -19911,7 +19931,7 @@ var Utf8ErrorReason$1; // - offset = start of this codepoint // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate"; - // The string is an overlong reperesentation + // The string is an overlong representation // - offset = start of this codepoint // - badCodepoint = the computed codepoint; already bounds checked Utf8ErrorReason["OVERLONG"] = "overlong representation"; @@ -20017,7 +20037,7 @@ function getUtf8CodePoints$1(bytes, onError) { res = (res << 6) | (nextChar & 0x3f); i++; } - // See above loop for invalid contimuation byte + // See above loop for invalid continuation byte if (res === null) { continue; } @@ -20279,7 +20299,7 @@ function nameprep(value) { return name; } -const version$a$1 = "web/5.4.0"; +const version$a$1 = "web/5.6.0"; var __awaiter$6 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -20299,12 +20319,14 @@ function getUrl(href, options) { method: (options.method || "GET"), headers: (options.headers || {}), body: (options.body || undefined), - mode: "cors", - cache: "no-cache", - credentials: "same-origin", - redirect: "follow", - referrer: "client", // no-referrer, *client }; + if (options.skipFetchSetup !== true) { + request.mode = "cors"; // no-cors, cors, *same-origin + request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached + request.credentials = "same-origin"; // include, *same-origin, omit + request.redirect = "follow"; // manual, *follow, error + request.referrer = "client"; // no-referrer, *client + } const response = yield fetch(href, request); const body = yield response.arrayBuffer(); const headers = {}; @@ -20373,6 +20395,7 @@ function _fetchData(connection, body, processFunc) { const throttleCallback = ((typeof (connection) === "object") ? connection.throttleCallback : null); const throttleSlotInterval = ((typeof (connection) === "object" && typeof (connection.throttleSlotInterval) === "number") ? connection.throttleSlotInterval : 100); logger$c$1.assertArgument((throttleSlotInterval > 0 && (throttleSlotInterval % 1) === 0), "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval); + const errorPassThrough = ((typeof (connection) === "object") ? !!(connection.errorPassThrough) : false); const headers = {}; let url = null; // @TODO: Allow ConnectionInfo to override some of these values @@ -20411,6 +20434,35 @@ function _fetchData(connection, body, processFunc) { value: "Basic " + encode$2(toUtf8Bytes$1(authorization)) }; } + if (connection.skipFetchSetup != null) { + options.skipFetchSetup = !!connection.skipFetchSetup; + } + } + const reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i"); + const dataMatch = ((url) ? url.match(reData) : null); + if (dataMatch) { + try { + const response = { + statusCode: 200, + statusMessage: "OK", + headers: { "content-type": dataMatch[1] }, + body: decode$2(dataMatch[2]) + }; + let result = response.body; + if (processFunc) { + result = processFunc(response.body, response); + } + return Promise.resolve(result); + } + catch (error) { + logger$c$1.throwError("processing response error", Logger$1.errors.SERVER_ERROR, { + body: bodyify(dataMatch[1], dataMatch[2]), + error: error, + requestBody: null, + requestMethod: "GET", + url: url + }); + } } if (body) { options.method = "POST"; @@ -20461,24 +20513,34 @@ function _fetchData(connection, body, processFunc) { let response = null; try { response = yield getUrl(url, options); - // Exponential back-off throttling - if (response.statusCode === 429 && attempt < attemptLimit) { - let tryAgain = true; - if (throttleCallback) { - tryAgain = yield throttleCallback(attempt, url); + if (attempt < attemptLimit) { + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirection; for now we only support absolute locataions + const location = response.headers.location || ""; + if (options.method === "GET" && location.match(/^https:/)) { + url = response.headers.location; + continue; + } } - if (tryAgain) { - let stall = 0; - const retryAfter = response.headers["retry-after"]; - if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { - stall = parseInt(retryAfter) * 1000; + else if (response.statusCode === 429) { + // Exponential back-off throttling + let tryAgain = true; + if (throttleCallback) { + tryAgain = yield throttleCallback(attempt, url); } - else { - stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + if (tryAgain) { + let stall = 0; + const retryAfter = response.headers["retry-after"]; + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1000; + } + else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + //console.log("Stalling 429"); + yield staller(stall); + continue; } - //console.log("Stalling 429"); - yield staller(stall); - continue; } } } @@ -20498,7 +20560,7 @@ function _fetchData(connection, body, processFunc) { if (allow304 && response.statusCode === 304) { body = null; } - else if (response.statusCode < 200 || response.statusCode >= 300) { + else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) { runningTimeout.cancel(); logger$c$1.throwError("bad response", Logger$1.errors.SERVER_ERROR, { status: response.statusCode, @@ -20540,7 +20602,7 @@ function _fetchData(connection, body, processFunc) { } } runningTimeout.cancel(); - // If we had a processFunc, it eitehr returned a T or threw above. + // If we had a processFunc, it either returned a T or threw above. // The "body" is now a Uint8Array. return body; } @@ -20674,7 +20736,7 @@ function poll(func, options) { }); } -const version$9$1 = "abstract-provider/5.4.1"; +const version$9$1 = "abstract-provider/5.6.0"; var __awaiter$4 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -20716,7 +20778,7 @@ class Provider$1 { // We may want to compute this more accurately in the future, // using the formula "check if the base fee is correct". // See: https://eips.ethereum.org/EIPS/eip-1559 - maxPriorityFeePerGas = BigNumber$1.from("2500000000"); + maxPriorityFeePerGas = BigNumber$1.from("1500000000"); maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); } return { maxFeePerGas, maxPriorityFeePerGas, gasPrice }; @@ -20735,7 +20797,7 @@ class Provider$1 { } } -const version$8$1 = "networks/5.4.2"; +const version$8$1 = "networks/5.6.2"; const logger$a$1 = new Logger$1(version$8$1); function isRenetworkable(value) { @@ -20747,44 +20809,50 @@ function ethDefaultProvider(network) { options = {}; } const providerList = []; - if (providers.InfuraProvider) { + if (providers.InfuraProvider && options.infura !== "-") { try { providerList.push(new providers.InfuraProvider(network, options.infura)); } catch (error) { } } - if (providers.EtherscanProvider) { + if (providers.EtherscanProvider && options.etherscan !== "-") { try { providerList.push(new providers.EtherscanProvider(network, options.etherscan)); } catch (error) { } } - if (providers.AlchemyProvider) { + if (providers.AlchemyProvider && options.alchemy !== "-") { try { providerList.push(new providers.AlchemyProvider(network, options.alchemy)); } catch (error) { } } - if (providers.PocketProvider) { + if (providers.PocketProvider && options.pocket !== "-") { // These networks are currently faulty on Pocket as their // network does not handle the Berlin hardfork, which is // live on these ones. // @TODO: This goes away once Pocket has upgraded their nodes const skip = ["goerli", "ropsten", "rinkeby"]; try { - const provider = new providers.PocketProvider(network); + const provider = new providers.PocketProvider(network, options.pocket); if (provider.network && skip.indexOf(provider.network.name) === -1) { providerList.push(provider); } } catch (error) { } } - if (providers.CloudflareProvider) { + if (providers.CloudflareProvider && options.cloudflare !== "-") { try { providerList.push(new providers.CloudflareProvider(network)); } catch (error) { } } + if (providers.AnkrProvider && options.ankr !== "-") { + try { + providerList.push(new providers.AnkrProvider(network, options.ankr)); + } + catch (error) { } + } if (providerList.length === 0) { return null; } @@ -20834,6 +20902,7 @@ const classicMordor = { name: "classicMordor", _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor") }; +// See: https://chainlist.org const networks = { unspecified: { chainId: 0, name: "unspecified" }, homestead: homestead, @@ -20858,6 +20927,7 @@ const networks = { name: "goerli", _defaultProvider: ethDefaultProvider("goerli") }, + kintsugi: { chainId: 1337702, name: "kintsugi" }, // ETC (See: #351) classic: { chainId: 61, @@ -20875,6 +20945,11 @@ const networks = { xdai: { chainId: 100, name: "xdai" }, matic: { chainId: 137, name: "matic" }, maticmum: { chainId: 80001, name: "maticmum" }, + optimism: { chainId: 10, name: "optimism" }, + "optimism-kovan": { chainId: 69, name: "optimism-kovan" }, + "optimism-goerli": { chainId: 420, name: "optimism-goerli" }, + arbitrum: { chainId: 42161, name: "arbitrum" }, + "arbitrum-rinkeby": { chainId: 421611, name: "arbitrum-rinkeby" }, bnb: { chainId: 56, name: "bnb" }, bnbt: { chainId: 97, name: "bnbt" }, }; @@ -21066,553 +21141,737 @@ const Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuv //console.log(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj")) //console.log(Base58.encode(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj"))) -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.5.7 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2016 - * @license MIT +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT */ var sha3$1 = createCommonjsModule$1(function (module) { -/*jslint bitwise: true */ -(function () { - - var root = typeof window === 'object' ? window : {}; - var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; - if (NODE_JS) { - root = commonjsGlobal$1; - } - var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; - var HEX_CHARS = '0123456789abcdef'.split(''); - var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; - var KECCAK_PADDING = [1, 256, 65536, 16777216]; - var PADDING = [6, 1536, 393216, 100663296]; - var SHIFT = [0, 8, 16, 24]; - var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, - 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, - 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, - 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, - 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; - var BITS = [224, 256, 384, 512]; - var SHAKE_BITS = [128, 256]; - var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; - - var createOutputMethod = function (bits, padding, outputType) { - return function (message) { - return new Keccak(bits, padding, bits).update(message)[outputType](); - }; - }; - - var createShakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits) { - return new Keccak(bits, padding, outputBits).update(message)[outputType](); - }; - }; - - var createMethod = function (bits, padding) { - var method = createOutputMethod(bits, padding, 'hex'); - method.create = function () { - return new Keccak(bits, padding, bits); - }; - method.update = function (message) { - return method.create().update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createOutputMethod(bits, padding, type); - } - return method; - }; - - var createShakeMethod = function (bits, padding) { - var method = createShakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits) { - return new Keccak(bits, padding, outputBits); - }; - method.update = function (message, outputBits) { - return method.create(outputBits).update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createShakeOutputMethod(bits, padding, type); - } - return method; - }; - - var algorithms = [ - {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod}, - {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod}, - {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod} - ]; - - var methods = {}, methodNames = []; - - for (var i = 0; i < algorithms.length; ++i) { - var algorithm = algorithms[i]; - var bits = algorithm.bits; - for (var j = 0; j < bits.length; ++j) { - var methodName = algorithm.name +'_' + bits[j]; - methodNames.push(methodName); - methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); - } - } - - function Keccak(bits, padding, outputBits) { - this.blocks = []; - this.s = []; - this.padding = padding; - this.outputBits = outputBits; - this.reset = true; - this.block = 0; - this.start = 0; - this.blockCount = (1600 - (bits << 1)) >> 5; - this.byteCount = this.blockCount << 2; - this.outputBlocks = outputBits >> 5; - this.extraBytes = (outputBits & 31) >> 3; - - for (var i = 0; i < 50; ++i) { - this.s[i] = 0; - } - } - - Keccak.prototype.update = function (message) { - var notString = typeof message !== 'string'; - if (notString && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } - var length = message.length, blocks = this.blocks, byteCount = this.byteCount, - blockCount = this.blockCount, index = 0, s = this.s, i, code; - - while (index < length) { - if (this.reset) { - this.reset = false; - blocks[0] = this.block; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - if (notString) { - for (i = this.start; index < length && i < byteCount; ++index) { - blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index < length && i < byteCount; ++index) { - code = message.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - if (i >= byteCount) { - this.start = i - byteCount; - this.block = blocks[blockCount]; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - this.reset = true; - } else { - this.start = i; - } - } - return this; - }; - - Keccak.prototype.finalize = function () { - var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; - blocks[i >> 2] |= this.padding[i & 3]; - if (this.lastByteIndex === this.byteCount) { - blocks[0] = blocks[blockCount]; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - blocks[blockCount - 1] |= 0x80000000; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - }; - - Keccak.prototype.toString = Keccak.prototype.hex = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var hex = '', block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + - HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + - HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + - HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; - } - if (j % blockCount === 0) { - f(s); - i = 0; - } - } - if (extraBytes) { - block = s[i]; - if (extraBytes > 0) { - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; - } - if (extraBytes > 1) { - hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; - } - if (extraBytes > 2) { - hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; - } - } - return hex; - }; - - Keccak.prototype.arrayBuffer = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var bytes = this.outputBits >> 3; - var buffer; - if (extraBytes) { - buffer = new ArrayBuffer((outputBlocks + 1) << 2); - } else { - buffer = new ArrayBuffer(bytes); - } - var array = new Uint32Array(buffer); - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - array[j] = s[i]; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - array[i] = s[i]; - buffer = buffer.slice(0, bytes); - } - return buffer; - }; - - Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - - Keccak.prototype.digest = Keccak.prototype.array = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var array = [], offset, block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - array[offset + 1] = (block >> 8) & 0xFF; - array[offset + 2] = (block >> 16) & 0xFF; - array[offset + 3] = (block >> 24) & 0xFF; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - offset = j << 2; - block = s[i]; - if (extraBytes > 0) { - array[offset] = block & 0xFF; - } - if (extraBytes > 1) { - array[offset + 1] = (block >> 8) & 0xFF; - } - if (extraBytes > 2) { - array[offset + 2] = (block >> 16) & 0xFF; - } - } - return array; - }; - - var f = function (s) { - var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, - b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, - b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; - for (n = 0; n < 48; n += 2) { - c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; - c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; - c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; - c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; - c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; - c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; - c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; - c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; - c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; - c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; - - h = c8 ^ ((c2 << 1) | (c3 >>> 31)); - l = c9 ^ ((c3 << 1) | (c2 >>> 31)); - s[0] ^= h; - s[1] ^= l; - s[10] ^= h; - s[11] ^= l; - s[20] ^= h; - s[21] ^= l; - s[30] ^= h; - s[31] ^= l; - s[40] ^= h; - s[41] ^= l; - h = c0 ^ ((c4 << 1) | (c5 >>> 31)); - l = c1 ^ ((c5 << 1) | (c4 >>> 31)); - s[2] ^= h; - s[3] ^= l; - s[12] ^= h; - s[13] ^= l; - s[22] ^= h; - s[23] ^= l; - s[32] ^= h; - s[33] ^= l; - s[42] ^= h; - s[43] ^= l; - h = c2 ^ ((c6 << 1) | (c7 >>> 31)); - l = c3 ^ ((c7 << 1) | (c6 >>> 31)); - s[4] ^= h; - s[5] ^= l; - s[14] ^= h; - s[15] ^= l; - s[24] ^= h; - s[25] ^= l; - s[34] ^= h; - s[35] ^= l; - s[44] ^= h; - s[45] ^= l; - h = c4 ^ ((c8 << 1) | (c9 >>> 31)); - l = c5 ^ ((c9 << 1) | (c8 >>> 31)); - s[6] ^= h; - s[7] ^= l; - s[16] ^= h; - s[17] ^= l; - s[26] ^= h; - s[27] ^= l; - s[36] ^= h; - s[37] ^= l; - s[46] ^= h; - s[47] ^= l; - h = c6 ^ ((c0 << 1) | (c1 >>> 31)); - l = c7 ^ ((c1 << 1) | (c0 >>> 31)); - s[8] ^= h; - s[9] ^= l; - s[18] ^= h; - s[19] ^= l; - s[28] ^= h; - s[29] ^= l; - s[38] ^= h; - s[39] ^= l; - s[48] ^= h; - s[49] ^= l; - - b0 = s[0]; - b1 = s[1]; - b32 = (s[11] << 4) | (s[10] >>> 28); - b33 = (s[10] << 4) | (s[11] >>> 28); - b14 = (s[20] << 3) | (s[21] >>> 29); - b15 = (s[21] << 3) | (s[20] >>> 29); - b46 = (s[31] << 9) | (s[30] >>> 23); - b47 = (s[30] << 9) | (s[31] >>> 23); - b28 = (s[40] << 18) | (s[41] >>> 14); - b29 = (s[41] << 18) | (s[40] >>> 14); - b20 = (s[2] << 1) | (s[3] >>> 31); - b21 = (s[3] << 1) | (s[2] >>> 31); - b2 = (s[13] << 12) | (s[12] >>> 20); - b3 = (s[12] << 12) | (s[13] >>> 20); - b34 = (s[22] << 10) | (s[23] >>> 22); - b35 = (s[23] << 10) | (s[22] >>> 22); - b16 = (s[33] << 13) | (s[32] >>> 19); - b17 = (s[32] << 13) | (s[33] >>> 19); - b48 = (s[42] << 2) | (s[43] >>> 30); - b49 = (s[43] << 2) | (s[42] >>> 30); - b40 = (s[5] << 30) | (s[4] >>> 2); - b41 = (s[4] << 30) | (s[5] >>> 2); - b22 = (s[14] << 6) | (s[15] >>> 26); - b23 = (s[15] << 6) | (s[14] >>> 26); - b4 = (s[25] << 11) | (s[24] >>> 21); - b5 = (s[24] << 11) | (s[25] >>> 21); - b36 = (s[34] << 15) | (s[35] >>> 17); - b37 = (s[35] << 15) | (s[34] >>> 17); - b18 = (s[45] << 29) | (s[44] >>> 3); - b19 = (s[44] << 29) | (s[45] >>> 3); - b10 = (s[6] << 28) | (s[7] >>> 4); - b11 = (s[7] << 28) | (s[6] >>> 4); - b42 = (s[17] << 23) | (s[16] >>> 9); - b43 = (s[16] << 23) | (s[17] >>> 9); - b24 = (s[26] << 25) | (s[27] >>> 7); - b25 = (s[27] << 25) | (s[26] >>> 7); - b6 = (s[36] << 21) | (s[37] >>> 11); - b7 = (s[37] << 21) | (s[36] >>> 11); - b38 = (s[47] << 24) | (s[46] >>> 8); - b39 = (s[46] << 24) | (s[47] >>> 8); - b30 = (s[8] << 27) | (s[9] >>> 5); - b31 = (s[9] << 27) | (s[8] >>> 5); - b12 = (s[18] << 20) | (s[19] >>> 12); - b13 = (s[19] << 20) | (s[18] >>> 12); - b44 = (s[29] << 7) | (s[28] >>> 25); - b45 = (s[28] << 7) | (s[29] >>> 25); - b26 = (s[38] << 8) | (s[39] >>> 24); - b27 = (s[39] << 8) | (s[38] >>> 24); - b8 = (s[48] << 14) | (s[49] >>> 18); - b9 = (s[49] << 14) | (s[48] >>> 18); - - s[0] = b0 ^ (~b2 & b4); - s[1] = b1 ^ (~b3 & b5); - s[10] = b10 ^ (~b12 & b14); - s[11] = b11 ^ (~b13 & b15); - s[20] = b20 ^ (~b22 & b24); - s[21] = b21 ^ (~b23 & b25); - s[30] = b30 ^ (~b32 & b34); - s[31] = b31 ^ (~b33 & b35); - s[40] = b40 ^ (~b42 & b44); - s[41] = b41 ^ (~b43 & b45); - s[2] = b2 ^ (~b4 & b6); - s[3] = b3 ^ (~b5 & b7); - s[12] = b12 ^ (~b14 & b16); - s[13] = b13 ^ (~b15 & b17); - s[22] = b22 ^ (~b24 & b26); - s[23] = b23 ^ (~b25 & b27); - s[32] = b32 ^ (~b34 & b36); - s[33] = b33 ^ (~b35 & b37); - s[42] = b42 ^ (~b44 & b46); - s[43] = b43 ^ (~b45 & b47); - s[4] = b4 ^ (~b6 & b8); - s[5] = b5 ^ (~b7 & b9); - s[14] = b14 ^ (~b16 & b18); - s[15] = b15 ^ (~b17 & b19); - s[24] = b24 ^ (~b26 & b28); - s[25] = b25 ^ (~b27 & b29); - s[34] = b34 ^ (~b36 & b38); - s[35] = b35 ^ (~b37 & b39); - s[44] = b44 ^ (~b46 & b48); - s[45] = b45 ^ (~b47 & b49); - s[6] = b6 ^ (~b8 & b0); - s[7] = b7 ^ (~b9 & b1); - s[16] = b16 ^ (~b18 & b10); - s[17] = b17 ^ (~b19 & b11); - s[26] = b26 ^ (~b28 & b20); - s[27] = b27 ^ (~b29 & b21); - s[36] = b36 ^ (~b38 & b30); - s[37] = b37 ^ (~b39 & b31); - s[46] = b46 ^ (~b48 & b40); - s[47] = b47 ^ (~b49 & b41); - s[8] = b8 ^ (~b0 & b2); - s[9] = b9 ^ (~b1 & b3); - s[18] = b18 ^ (~b10 & b12); - s[19] = b19 ^ (~b11 & b13); - s[28] = b28 ^ (~b20 & b22); - s[29] = b29 ^ (~b21 & b23); - s[38] = b38 ^ (~b30 & b32); - s[39] = b39 ^ (~b31 & b33); - s[48] = b48 ^ (~b40 & b42); - s[49] = b49 ^ (~b41 & b43); - - s[0] ^= RC[n]; - s[1] ^= RC[n + 1]; - } - }; - - if (COMMON_JS) { - module.exports = methods; - } else { - for (var i = 0; i < methodNames.length; ++i) { - root[methodNames[i]] = methods[methodNames[i]]; - } - } -})(); -}); +/*jslint bitwise: true */ +(function () { -var sha3$1$1 = sha3$1; + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; + if (NODE_JS) { + root = commonjsGlobal$1; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; -function keccak256$1(data) { - return '0x' + sha3$1$1.keccak_256(arrayify$1(data)); -} + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } -function id$2(text) { - return keccak256$1(toUtf8Bytes$1(text)); -} + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } -const version$7$1 = "hash/5.4.0"; + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; -const logger$9$1 = new Logger$1(version$7$1); -const Zeros = new Uint8Array(32); -Zeros.fill(0); -const Partition = new RegExp("^((.*)\\.)?([^.]+)$"); -function namehash(name) { - /* istanbul ignore if */ - if (typeof (name) !== "string") { - logger$9$1.throwArgumentError("invalid ENS name; not a string", "name", name); + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); } - let current = name; - let result = Zeros; - while (current.length) { - const partition = current.match(Partition); - if (partition == null || partition[2] === "") { - logger$9$1.throwArgumentError("invalid ENS address; missing component", "name", name); - } - const label = toUtf8Bytes$1(nameprep(partition[3])); - result = keccak256$1(concat$1([result, keccak256$1(label)])); - current = partition[2] || ""; + return method; + }; + + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + + var methods = {}, methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } } - return hexlify$1(result); -} + } -const version$6$1 = "rlp/5.4.0"; + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; -const logger$8$1 = new Logger$1(version$6$1); -function arrayifyInteger$1(value) { - const result = []; - while (value) { - result.unshift(value & 0xff); - value >>= 8; + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; } - return result; -} -function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = (result * 256) + data[offset + i]; + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); } - return result; -} -function _encode$1(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode$1(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } } - const length = arrayifyInteger$1(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - if (!isBytesLike$1(object)) { - logger$8$1.throwArgumentError("RLP object must be BytesLike", "object", object); + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); + } + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } + } + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } + } + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); + } + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); + } + return buffer; + }; + + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; + + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } + + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } +})(); +}); + +var sha3$1$1 = sha3$1; + +function keccak256$1(data) { + return '0x' + sha3$1$1.keccak_256(arrayify$1(data)); +} + +function id$2(text) { + return keccak256$1(toUtf8Bytes$1(text)); +} + +const version$7$1 = "hash/5.6.0"; + +const logger$9$1 = new Logger$1(version$7$1); +const Zeros = new Uint8Array(32); +Zeros.fill(0); +const Partition = new RegExp("^((.*)\\.)?([^.]+)$"); +function namehash(name) { + /* istanbul ignore if */ + if (typeof (name) !== "string") { + logger$9$1.throwArgumentError("invalid ENS name; not a string", "name", name); + } + let current = name; + let result = Zeros; + while (current.length) { + const partition = current.match(Partition); + if (partition == null || partition[2] === "") { + logger$9$1.throwArgumentError("invalid ENS address; missing component", "name", name); + } + const label = toUtf8Bytes$1(nameprep(partition[3])); + result = keccak256$1(concat$1([result, keccak256$1(label)])); + current = partition[2] || ""; + } + return hexlify$1(result); +} +function dnsEncode(name) { + return hexlify$1(concat$1(name.split(".").map((comp) => { + // We jam in an _ prefix to fill in with the length later + // Note: Nameprep throws if the component is over 63 bytes + const bytes = toUtf8Bytes$1("_" + nameprep(comp)); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} + +const version$6$1 = "rlp/5.6.0"; + +const logger$8$1 = new Logger$1(version$6$1); +function arrayifyInteger$1(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} +function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; +} +function _encode$1(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode$1(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger$1(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + if (!isBytesLike$1(object)) { + logger$8$1.throwArgumentError("RLP object must be BytesLike", "object", object); } const data = Array.prototype.slice.call(arrayify$1(object)); if (data.length === 1 && data[0] <= 0x7f) { @@ -21696,7 +21955,7 @@ function decode$1(data) { return decoded.result; } -const version$5$1 = "address/5.4.0"; +const version$5$1 = "address/5.6.0"; const logger$7$1 = new Logger$1(version$5$1); function getChecksumAddress$1(address) { @@ -23511,7 +23770,7 @@ hash.ripemd160 = hash.ripemd.ripemd160; var hash = hash_1; -const version$4$1 = "sha2/5.4.0"; +const version$4$1 = "sha2/5.6.0"; new Logger$1(version$4$1); function sha256(data) { @@ -23700,7 +23959,7 @@ var bech32 = { fromWords: fromWords }; -const version$3$1 = "providers/5.4.5"; +const version$3$1 = "providers/5.6.5"; function createCommonjsModule$2(fn, basedir, module) { return module = { @@ -26128,7 +26387,7 @@ elliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null); var EC$1 = elliptic_1.ec; -const version$2$1 = "signing-key/5.4.0"; +const version$2$1 = "signing-key/5.6.1"; const logger$5$1 = new Logger$1(version$2$1); let _curve = null; @@ -26142,6 +26401,9 @@ class SigningKey { constructor(privateKey) { defineReadOnly$1(this, "curve", "secp256k1"); defineReadOnly$1(this, "privateKey", hexlify$1(privateKey)); + if (hexDataLength$1(this.privateKey) !== 32) { + logger$5$1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + } const keyPair = getCurve().keyFromPrivate(arrayify$1(this.privateKey)); defineReadOnly$1(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); defineReadOnly$1(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); @@ -26203,7 +26465,7 @@ function computePublicKey(key, compressed) { return logger$5$1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -const version$1$1 = "transactions/5.4.0"; +const version$1$1 = "transactions/5.6.0"; const logger$4$1 = new Logger$1(version$1$1); var TransactionTypes$1; @@ -26433,7 +26695,7 @@ function _parse(rawTransaction) { tx.v = 0; } else { - // Signed Tranasaction + // Signed Transaction tx.chainId = Math.floor((tx.v - 35) / 2); if (tx.chainId < 0) { tx.chainId = 0; @@ -26562,7 +26824,7 @@ class Formatter { type: type }; formats.block = { - hash: hash, + hash: Formatter.allowNull(hash), parentHash: hash, number: number, timestamp: number, @@ -26570,7 +26832,7 @@ class Formatter { difficulty: this.difficulty.bind(this), gasLimit: bigNumber, gasUsed: bigNumber, - miner: address, + miner: Formatter.allowNull(address), extraData: data, transactions: Formatter.allowNull(Formatter.arrayOf(hash)), baseFeePerGas: Formatter.allowNull(bigNumber) @@ -26713,7 +26975,11 @@ class Formatter { if (value.author != null && value.miner == null) { value.miner = value.author; } - 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$1.from(difficulty)); + return result; } block(value) { return this._block(value, this.formats.block); @@ -26891,6 +27157,7 @@ var __awaiter$2$1 = function (thisArg, _arguments, P, generator) { }); }; const logger$2$1 = new Logger$1(version$3$1); +const MAX_CCIP_REDIRECTS = 10; ////////////////////////////// // Event Serializeing function checkTopic(topic) { @@ -26991,6 +27258,8 @@ class Event { defineReadOnly$1(this, "tag", tag); defineReadOnly$1(this, "listener", listener); defineReadOnly$1(this, "once", once); + this._lastBlockNumber = -2; + this._inflight = false; } get event() { switch (this.type) { @@ -27047,36 +27316,149 @@ function bytes32ify(value) { function base58Encode(data) { return Base58.encode(concat$1([data, hexDataSlice$1(sha256(sha256(data)), 0, 4)])); } +const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; +function _parseString(result, start) { + try { + return toUtf8String$1(_parseBytes(result, start)); + } + catch (error) { } + return null; +} +function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + const offset = BigNumber$1.from(hexDataSlice$1(result, start, start + 32)).toNumber(); + const length = BigNumber$1.from(hexDataSlice$1(result, offset, offset + 32)).toNumber(); + return hexDataSlice$1(result, offset + 32, offset + 32 + length); +} +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + logger$2$1.throwArgumentError("unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; +} +function numPad(value) { + const result = arrayify$1(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} +function bytesPad(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} +// ABI Encodes a series of (bytes, bytes, ...) +function encodeBytes(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(null); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = arrayify$1(datas[i]); + // Update the bytes offset + result[i] = numPad(byteCount); + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return hexConcat$1(result); +} class Resolver { - constructor(provider, address, name) { + // The resolvedAddress is only for creating a ReverseLookup resolver + constructor(provider, address, name, resolvedAddress) { defineReadOnly$1(this, "provider", provider); defineReadOnly$1(this, "name", name); defineReadOnly$1(this, "address", provider.formatter.address(address)); + defineReadOnly$1(this, "_resolvedAddress", resolvedAddress); } - _fetchBytes(selector, parameters) { + supportsWildcard() { + if (!this._supportsEip2544) { + // supportsInterface(bytes4 = selector("resolve(bytes,bytes)")) + this._supportsEip2544 = this.provider.call({ + to: this.address, + data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000" + }).then((result) => { + return BigNumber$1.from(result).eq(1); + }).catch((error) => { + if (error.code === Logger$1.errors.CALL_EXCEPTION) { + return false; + } + // Rethrow the error: link is down, etc. Let future attempts retry. + this._supportsEip2544 = null; + throw error; + }); + } + return this._supportsEip2544; + } + _fetch(selector, parameters) { return __awaiter$2$1(this, void 0, void 0, function* () { - // keccak256("addr(bytes32,uint256)") - const transaction = { + // e.g. keccak256("addr(bytes32,uint256)") + const tx = { to: this.address, + ccipReadEnabled: true, data: hexConcat$1([selector, namehash(this.name), (parameters || "0x")]) }; + // Wildcard support; use EIP-2544 to resolve the request + let parseBytes = false; + if (yield this.supportsWildcard()) { + parseBytes = true; + // selector("resolve(bytes,bytes)") + tx.data = hexConcat$1(["0x9061b923", encodeBytes([dnsEncode(this.name), tx.data])]); + } try { - const result = yield this.provider.call(transaction); - if (result === "0x") { - return null; + let result = yield this.provider.call(tx); + if ((arrayify$1(result).length % 32) === 4) { + logger$2$1.throwError("resolver threw error", Logger$1.errors.CALL_EXCEPTION, { + transaction: tx, data: result + }); + } + if (parseBytes) { + result = _parseBytes(result, 0); } - const offset = BigNumber$1.from(hexDataSlice$1(result, 0, 32)).toNumber(); - const length = BigNumber$1.from(hexDataSlice$1(result, offset, offset + 32)).toNumber(); - return hexDataSlice$1(result, offset + 32, offset + 32 + length); + return result; } catch (error) { if (error.code === Logger$1.errors.CALL_EXCEPTION) { return null; } - return null; + throw error; } }); } + _fetchBytes(selector, parameters) { + return __awaiter$2$1(this, void 0, void 0, function* () { + const result = yield this._fetch(selector, parameters); + if (result != null) { + return _parseBytes(result, 0); + } + return null; + }); + } _getAddress(coinType, hexBytes) { const coinInfo = coinInfos[String(coinType)]; if (coinInfo == null) { @@ -27138,16 +27520,12 @@ class Resolver { if (coinType === 60) { try { // keccak256("addr(bytes32)") - const transaction = { - to: this.address, - data: ("0x3b3b57de" + namehash(this.name).substring(2)) - }; - const hexBytes = yield this.provider.call(transaction); + const result = yield this._fetch("0x3b3b57de"); // No address - if (hexBytes === "0x" || hexBytes === HashZero) { + if (result === "0x" || result === HashZero) { return null; } - return this.provider.formatter.callAddress(hexBytes); + return this.provider.formatter.callAddress(result); } catch (error) { if (error.code === Logger$1.errors.CALL_EXCEPTION) { @@ -27174,6 +27552,119 @@ class Resolver { return address; }); } + getAvatar() { + return __awaiter$2$1(this, void 0, void 0, function* () { + const linkage = [{ type: "name", content: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = yield this.getText("avatar"); + if (avatar == null) { + return null; + } + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + linkage.push({ type: "url", content: avatar }); + return { linkage, url: avatar }; + case "data": + linkage.push({ type: "data", content: avatar }); + return { linkage, url: avatar }; + case "ipfs": + linkage.push({ type: "ipfs", content: avatar }); + return { linkage, url: getIpfsLink(avatar) }; + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: scheme, content: avatar }); + // The owner of this name + const owner = (this._resolvedAddress || (yield this.getAddress())); + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return null; + } + const addr = yield this.provider.formatter.address(comps[0]); + const tokenId = hexZeroPad$1(BigNumber$1.from(comps[1]).toHexString(), 32); + // Check that this account owns the token + if (scheme === "erc721") { + // ownerOf(uint256 tokenId) + const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({ + to: addr, data: hexConcat$1(["0x6352211e", tokenId]) + })); + if (owner !== tokenOwner) { + return null; + } + linkage.push({ type: "owner", content: tokenOwner }); + } + else if (scheme === "erc1155") { + // balanceOf(address owner, uint256 tokenId) + const balance = BigNumber$1.from(yield this.provider.call({ + to: addr, data: hexConcat$1(["0x00fdd58e", hexZeroPad$1(owner, 32), tokenId]) + })); + if (balance.isZero()) { + return null; + } + linkage.push({ type: "balance", content: balance.toString() }); + } + // Call the token contract for the metadata URL + const tx = { + to: this.provider.formatter.address(comps[0]), + data: hexConcat$1([selector, tokenId]) + }; + let metadataUrl = _parseString(yield this.provider.call(tx), 0); + if (metadataUrl == null) { + return null; + } + linkage.push({ type: "metadata-url-base", content: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + linkage.push({ type: "metadata-url-expanded", content: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + // Get the token metadata + const metadata = yield fetchJson(metadataUrl); + if (!metadata) { + return null; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + return null; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + return null; + } + linkage.push({ type: "url-ipfs", content: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", content: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return null; + }); + } getContentHash() { return __awaiter$2$1(this, void 0, void 0, function* () { // keccak256("contenthash()") @@ -27190,6 +27681,14 @@ class Resolver { return "ipfs:/\/" + Base58.encode("0x" + ipfs[1]); } } + // IPNS (CID: 1, Type: libp2p-key) + const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipns) { + const length = parseInt(ipns[3], 16); + if (ipns[4].length === length * 2) { + return "ipns:/\/" + Base58.encode("0x" + ipns[1]); + } + } // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); if (swarm) { @@ -27240,6 +27739,7 @@ class BaseProvider extends Provider$1 { // Events being listened to this._events = []; this._emitted = { block: -2 }; + this.disableCcipRead = false; this.formatter = new.target.getFormatter(); // If network is any, this Provider allows the underlying // network to change dynamically, and we auto-detect the @@ -27256,7 +27756,7 @@ class BaseProvider extends Provider$1 { this._ready().catch((error) => { }); } else { - const knownNetwork = getStatic$1((new.target), "getNetwork")(network); + const knownNetwork = getStatic$1(new.target, "getNetwork")(network); if (knownNetwork) { defineReadOnly$1(this, "_network", knownNetwork); this.emit("network", knownNetwork, null); @@ -27267,6 +27767,7 @@ class BaseProvider extends Provider$1 { } this._maxInternalBlockNumber = -1024; this._lastBlockNumber = -2; + this._maxFilterBlockRange = 10; this._pollingInterval = 4000; this._fastQueryDate = 0; } @@ -27305,7 +27806,7 @@ class BaseProvider extends Provider$1 { } // This will always return the most recently established network. // For "any", this can change (a "network" event is emitted before - // any change is refelcted); otherwise this cannot change + // any change is reflected); otherwise this cannot change get ready() { return poll(() => { return this._ready().then((network) => { @@ -27330,6 +27831,40 @@ class BaseProvider extends Provider$1 { static getNetwork(network) { return getNetwork((network == null) ? "homestead" : network); } + ccipReadFetch(tx, calldata, urls) { + return __awaiter$2$1(this, void 0, void 0, function* () { + if (this.disableCcipRead || urls.length === 0) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + const json = (url.indexOf("{data}") >= 0) ? null : JSON.stringify({ data, sender }); + const result = yield fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + value.status = response.statusCode; + return value; + }); + if (result.data) { + return result.data; + } + const errorMessage = (result.message || "unknown error"); + // 4xx indicates the result is not present; stop + if (result.status >= 400 && result.status < 500) { + return logger$2$1.throwError(`response not found during CCIP fetch: ${errorMessage}`, Logger$1.errors.SERVER_ERROR, { url, errorMessage }); + } + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + return logger$2$1.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, Logger$1.errors.SERVER_ERROR, { + urls, errorMessages + }); + }); + } // Fetches the blockNumber, but will reuse any result that is less // than maxAge old or has been requested since the last request _getInternalBlockNumber(maxAge) { @@ -27477,20 +28012,44 @@ class BaseProvider extends Provider$1 { break; } case "filter": { - const filter = event.filter; - filter.fromBlock = this._lastBlockNumber + 1; - filter.toBlock = blockNumber; - const runner = this.getLogs(filter).then((logs) => { - if (logs.length === 0) { - return; + // We only allow a single getLogs to be in-flight at a time + if (!event._inflight) { + event._inflight = true; + // Filter from the last known event; due to load-balancing + // and some nodes returning updated block numbers before + // indexing events, a logs result with 0 entries cannot be + // trusted and we must retry a range which includes it again + const filter = event.filter; + filter.fromBlock = event._lastBlockNumber + 1; + filter.toBlock = blockNumber; + // Prevent fitler ranges from growing too wild + if (filter.toBlock - this._maxFilterBlockRange > filter.fromBlock) { + filter.fromBlock = filter.toBlock - this._maxFilterBlockRange; } - logs.forEach((log) => { - this._emitted["b:" + log.blockHash] = log.blockNumber; - this._emitted["t:" + log.transactionHash] = log.blockNumber; - this.emit(filter, log); + const runner = this.getLogs(filter).then((logs) => { + // Allow the next getLogs + event._inflight = false; + if (logs.length === 0) { + return; + } + logs.forEach((log) => { + // Only when we get an event for a given block number + // can we trust the events are indexed + if (log.blockNumber > event._lastBlockNumber) { + event._lastBlockNumber = log.blockNumber; + } + // Make sure we stall requests to fetch blocks and txs + this._emitted["b:" + log.blockHash] = log.blockNumber; + this._emitted["t:" + log.transactionHash] = log.blockNumber; + this.emit(filter, log); + }); + }).catch((error) => { + this.emit("error", error); + // Allow another getLogs (the range was not updated) + event._inflight = false; }); - }).catch((error) => { this.emit("error", error); }); - runners.push(runner); + runners.push(runner); + } break; } } @@ -28002,25 +28561,99 @@ class BaseProvider extends Provider$1 { return this.formatter.filter(yield resolveProperties$1(result)); }); } - call(transaction, blockTag) { + _call(transaction, blockTag, attempt) { return __awaiter$2$1(this, void 0, void 0, function* () { - yield this.getNetwork(); - const params = yield resolveProperties$1({ - transaction: this._getTransactionRequest(transaction), - blockTag: this._getBlockTag(blockTag) - }); - const result = yield this.perform("call", params); + if (attempt >= MAX_CCIP_REDIRECTS) { + logger$2$1.throwError("CCIP read exceeded maximum redirections", Logger$1.errors.SERVER_ERROR, { + redirects: attempt, transaction + }); + } + const txSender = transaction.to; + const result = yield this.perform("call", { transaction, blockTag }); + // CCIP Read request via OffchainLookup(address,string[],bytes,bytes4,bytes) + if (attempt >= 0 && blockTag === "latest" && txSender != null && result.substring(0, 10) === "0x556f1830" && (hexDataLength$1(result) % 32 === 4)) { + try { + const data = hexDataSlice$1(result, 4); + // Check the sender of the OffchainLookup matches the transaction + const sender = hexDataSlice$1(data, 0, 32); + if (!BigNumber$1.from(sender).eq(txSender)) { + logger$2$1.throwError("CCIP Read sender did not match", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + // Read the URLs from the response + const urls = []; + const urlsOffset = BigNumber$1.from(hexDataSlice$1(data, 32, 64)).toNumber(); + const urlsLength = BigNumber$1.from(hexDataSlice$1(data, urlsOffset, urlsOffset + 32)).toNumber(); + const urlsData = hexDataSlice$1(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + logger$2$1.throwError("CCIP Read contained corrupt URL string", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + urls.push(url); + } + // Get the CCIP calldata to forward + const calldata = _parseBytes(data, 64); + // Get the callbackSelector (bytes4) + if (!BigNumber$1.from(hexDataSlice$1(data, 100, 128)).isZero()) { + logger$2$1.throwError("CCIP Read callback selector included junk", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const callbackSelector = hexDataSlice$1(data, 96, 100); + // Get the extra data to send back to the contract as context + const extraData = _parseBytes(data, 128); + const ccipResult = yield this.ccipReadFetch(transaction, calldata, urls); + if (ccipResult == null) { + logger$2$1.throwError("CCIP Read disabled or provided no URLs", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const tx = { + to: txSender, + data: hexConcat$1([callbackSelector, encodeBytes([ccipResult, extraData])]) + }; + return this._call(tx, blockTag, attempt + 1); + } + catch (error) { + if (error.code === Logger$1.errors.SERVER_ERROR) { + throw error; + } + } + } try { return hexlify$1(result); } catch (error) { return logger$2$1.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "call", - params, result, error + params: { transaction, blockTag }, result, error }); } }); } + call(transaction, blockTag) { + return __awaiter$2$1(this, void 0, void 0, function* () { + yield this.getNetwork(); + const resolved = yield resolveProperties$1({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag), + ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled) + }); + return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0 : -1); + }); + } estimateGas(transaction) { return __awaiter$2$1(this, void 0, void 0, function* () { yield this.getNetwork(); @@ -28041,6 +28674,10 @@ class BaseProvider extends Provider$1 { } _getAddress(addressOrName) { return __awaiter$2$1(this, void 0, void 0, function* () { + addressOrName = yield addressOrName; + if (typeof (addressOrName) !== "string") { + logger$2$1.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } const address = yield this.resolveName(addressOrName); if (address == null) { logger$2$1.throwError("ENS name not configured", Logger$1.errors.UNSUPPORTED_OPERATION, { @@ -28064,7 +28701,7 @@ class BaseProvider extends Provider$1 { } else { try { - params.blockTag = this.formatter.blockTag(yield this._getBlockTag(blockHashOrBlockTag)); + params.blockTag = yield this._getBlockTag(blockHashOrBlockTag); if (isHexString$1(params.blockTag)) { blockNumber = parseInt(params.blockTag.substring(2), 16); } @@ -28230,43 +28867,54 @@ class BaseProvider extends Provider$1 { } getResolver(name) { return __awaiter$2$1(this, void 0, void 0, function* () { - try { - const address = yield this._getResolver(name); - if (address == null) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { return null; } - return new Resolver(this, address, name); - } - catch (error) { - if (error.code === Logger$1.errors.CALL_EXCEPTION) { + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { return null; } - return null; + // Check the current node for a resolver + const addr = yield this._getResolver(currentName, "getResolver"); + // Found a resolver! + if (addr != null) { + const resolver = new Resolver(this, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(yield resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); } }); } - _getResolver(name) { + _getResolver(name, operation) { return __awaiter$2$1(this, void 0, void 0, function* () { - // Get the resolver from the blockchain + if (operation == null) { + operation = "ENS"; + } const network = yield this.getNetwork(); // No ENS... if (!network.ensAddress) { - logger$2$1.throwError("network does not support ENS", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name }); + logger$2$1.throwError("network does not support ENS", Logger$1.errors.UNSUPPORTED_OPERATION, { operation, network: network.name }); } - // keccak256("resolver(bytes32)") - const transaction = { - to: network.ensAddress, - data: ("0x0178b8bf" + namehash(name).substring(2)) - }; try { - return this.formatter.callAddress(yield this.call(transaction)); + // keccak256("resolver(bytes32)") + const addrData = yield this.call({ + to: network.ensAddress, + data: ("0x0178b8bf" + namehash(name).substring(2)) + }); + return this.formatter.callAddress(addrData); } catch (error) { - if (error.code === Logger$1.errors.CALL_EXCEPTION) { - return null; - } - throw error; + // ENS registry cannot throw errors on resolver(bytes32) } + return null; }); } resolveName(name) { @@ -28285,7 +28933,7 @@ class BaseProvider extends Provider$1 { if (typeof (name) !== "string") { logger$2$1.throwArgumentError("invalid ENS name", "name", name); } - // Get the addr from the resovler + // Get the addr from the resolver const resolver = yield this.getResolver(name); if (!resolver) { return null; @@ -28297,39 +28945,75 @@ class BaseProvider extends Provider$1 { return __awaiter$2$1(this, void 0, void 0, function* () { address = yield address; address = this.formatter.address(address); - const reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; - const resolverAddress = yield this._getResolver(reverseName); - if (!resolverAddress) { + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddr = yield this._getResolver(node, "lookupAddress"); + if (resolverAddr == null) { return null; } // keccak("name(bytes32)") - let bytes = arrayify$1(yield this.call({ - to: resolverAddress, - data: ("0x691f3431" + namehash(reverseName).substring(2)) - })); - // Strip off the dynamic string pointer (0x20) - if (bytes.length < 32 || !BigNumber$1.from(bytes.slice(0, 32)).eq(32)) { + const name = _parseString(yield this.call({ + to: resolverAddr, + data: ("0x691f3431" + namehash(node).substring(2)) + }), 0); + const addr = yield this.resolveName(name); + if (addr != address) { return null; } - bytes = bytes.slice(32); - // Not a length-prefixed string - if (bytes.length < 32) { - return null; + return name; + }); + } + getAvatar(nameOrAddress) { + return __awaiter$2$1(this, void 0, void 0, function* () { + let resolver = null; + if (isHexString$1(nameOrAddress)) { + // Address; reverse lookup + const address = this.formatter.address(nameOrAddress); + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddress = yield this._getResolver(node, "getAvatar"); + if (!resolverAddress) { + return null; + } + // Try resolving the avatar against the addr.reverse resolver + resolver = new Resolver(this, resolverAddress, node); + try { + const avatar = yield resolver.getAvatar(); + if (avatar) { + return avatar.url; + } + } + catch (error) { + if (error.code !== Logger$1.errors.CALL_EXCEPTION) { + throw error; + } + } + // Try getting the name and performing forward lookup; allowing wildcards + try { + // keccak("name(bytes32)") + const name = _parseString(yield this.call({ + to: resolverAddress, + data: ("0x691f3431" + namehash(node).substring(2)) + }), 0); + resolver = yield this.getResolver(name); + } + catch (error) { + if (error.code !== Logger$1.errors.CALL_EXCEPTION) { + throw error; + } + return null; + } } - // Get the length of the string (from the length-prefix) - const length = BigNumber$1.from(bytes.slice(0, 32)).toNumber(); - bytes = bytes.slice(32); - // Length longer than available data - if (length > bytes.length) { - return null; + else { + // ENS name; forward lookup with wildcard + resolver = yield this.getResolver(nameOrAddress); + if (!resolver) { + return null; + } } - const name = toUtf8String$1(bytes.slice(0, length)); - // Make sure the reverse record matches the foward record - const addr = yield this.resolveName(name); - if (addr != address) { + const avatar = yield resolver.getAvatar(); + if (avatar == null) { return null; } - return name; + return avatar.url; }); } perform(method, params) { @@ -28434,7 +29118,7 @@ class BaseProvider extends Provider$1 { } } -const version$g = "abstract-signer/5.4.1"; +const version$g = "abstract-signer/5.6.0"; var __awaiter$1$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -28447,7 +29131,7 @@ var __awaiter$1$1 = function (thisArg, _arguments, P, generator) { }; const logger$1$1 = new Logger$1(version$g); const allowedTransactionKeys$1 = [ - "accessList", "chainId", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" + "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors$1 = [ Logger$1.errors.INSUFFICIENT_FUNDS, @@ -28475,7 +29159,7 @@ class Signer$1 { return yield this.provider.getTransactionCount(this.getAddress(), blockTag); }); } - // Populates "from" if unspecified, and estimates the gas for the transation + // Populates "from" if unspecified, and estimates the gas for the transaction estimateGas(transaction) { return __awaiter$1$1(this, void 0, void 0, function* () { this._checkProvider("estimateGas"); @@ -28483,7 +29167,7 @@ class Signer$1 { return yield this.provider.estimateGas(tx); }); } - // Populates "from" if unspecified, and calls with the transation + // Populates "from" if unspecified, and calls with the transaction call(transaction, blockTag) { return __awaiter$1$1(this, void 0, void 0, function* () { this._checkProvider("call"); @@ -28582,7 +29266,7 @@ class Signer$1 { // Prevent this error from causing an UnhandledPromiseException tx.to.catch((error) => { }); } - // Do not allow mixing pre-eip-1559 and eip-1559 proerties + // Do not allow mixing pre-eip-1559 and eip-1559 properties const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null); if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { logger$1$1.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); @@ -28717,18 +29401,46 @@ var __awaiter$8 = function (thisArg, _arguments, P, generator) { }; const logger$h = new Logger$1(version$3$1); const errorGas = ["call", "estimateGas"]; +function spelunk(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match("reverted") && isHexString$1(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunk(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunk(JSON.parse(value)); + } + catch (error) { } + } + return null; +} function checkError(method, error, params) { // Undo the "convenience" some nodes are attempting to prevent backwards // incompatibility; maybe for v6 consider forwarding reverts as errors - if (method === "call" && error.code === Logger$1.errors.SERVER_ERROR) { - const e = error.error; - if (e && e.message.match("reverted") && isHexString$1(e.data)) { - return e.data; + if (method === "call") { + const result = spelunk(error); + if (result) { + return result.data; } - logger$h.throwError("missing revert data in call exception", Logger$1.errors.CALL_EXCEPTION, { + logger$h.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger$1.errors.CALL_EXCEPTION, { error, data: "0x" }); } + // @TODO: Should we spelunk for message too? let message = error.message; if (error.code === Logger$1.errors.SERVER_ERROR && error.error && typeof (error.error.message) === "string") { message = error.error.message; @@ -28742,25 +29454,25 @@ function checkError(method, error, params) { message = (message || "").toLowerCase(); const transaction = params.transaction || params.signedTransaction; // "insufficient funds for gas * price + value + cost(data)" - if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { logger$h.throwError("insufficient funds for intrinsic transaction cost", Logger$1.errors.INSUFFICIENT_FUNDS, { error, method, transaction }); } // "nonce too low" - if (message.match(/nonce too low/)) { + if (message.match(/nonce (is )?too low/i)) { logger$h.throwError("nonce has already been used", Logger$1.errors.NONCE_EXPIRED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/replacement transaction underpriced/)) { + if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) { logger$h.throwError("replacement fee too low", Logger$1.errors.REPLACEMENT_UNDERPRICED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/only replay-protected/)) { + if (message.match(/only replay-protected/i)) { logger$h.throwError("legacy pre-eip-155 transactions not supported", Logger$1.errors.UNSUPPORTED_OPERATION, { error, method, transaction }); @@ -28916,6 +29628,13 @@ class JsonRpcSigner extends Signer$1 { }); } signMessage(message) { + return __awaiter$8(this, void 0, void 0, function* () { + const data = ((typeof (message) === "string") ? toUtf8Bytes$1(message) : message); + const address = yield this.getAddress(); + return yield this.provider.send("personal_sign", [hexlify$1(data), address.toLowerCase()]); + }); + } + _legacySignMessage(message) { return __awaiter$8(this, void 0, void 0, function* () { const data = ((typeof (message) === "string") ? toUtf8Bytes$1(message) : message); const address = yield this.getAddress(); @@ -29154,7 +29873,7 @@ class JsonRpcProvider extends BaseProvider { if (method === "call" || method === "estimateGas") { const tx = params.transaction; if (tx && tx.type != null && BigNumber$1.from(tx.type).isZero()) { - // If there are no EIP-1559 properties, it might be non-EIP-a559 + // If there are no EIP-1559 properties, it might be non-EIP-1559 if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { const feeData = yield this.getFeeData(); if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { @@ -29251,12 +29970,12 @@ class JsonRpcProvider extends BaseProvider { } checkProperties(transaction, allowed); const result = {}; - // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. - ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { if (transaction[key] == null) { return; } - const value = hexValue(transaction[key]); + const value = hexValue(BigNumber$1.from(transaction[key])); if (key === "gasLimit") { key = "gas"; } @@ -29430,6 +30149,63 @@ class StaticJsonRpcBatchProvider extends JsonRpcBatchProvider { } } +let provider$3; + +const getProvider$2 = ()=> { + + if(provider$3) { return provider$3 } + + setProviderEndpoints$3(['https://bsc-dataseed.binance.org']); + + return provider$3 +}; + +const setProviderEndpoints$3 = (endpoints)=> { + setProvider$3( + new StaticJsonRpcBatchProvider( + endpoints[0], 'bsc' + ) + ); +}; + +const setProvider$3 = (givenProvider)=> { + provider$3 = givenProvider; +}; + +const getContractArguments = ({ contract, method, params })=>{ + let fragment = contract.interface.fragments.find((fragment) => { + return fragment.name == method + }); + + if(params instanceof Array) { + return params + } else if (params instanceof Object) { + return fragment.inputs.map((input) => { + return params[input.name] + }) + } else { + throw 'Contract params have wrong type!' + } +}; + +var estimate$1 = async ({ provider, from, to, value, method, api, params }) => { + let contract = new Contract(to, api, provider); + return contract.estimateGas[method](...getContractArguments({ contract, method, params }), { from, value }) +}; + +var estimateBsc = async ({ from, to, value, method, api, params }) => { + let provider = getProvider$2(); + return estimate$1({ + provider, + from, + to, + value, + method, + api, + params + }) +}; + let provider$2; const getProvider$1 = ()=> { @@ -29453,6 +30229,207 @@ const setProvider$2 = (givenProvider)=> { provider$2 = givenProvider; }; +var estimateEthereum = async ({ from, to, value, method, api, params }) => { + let provider = getProvider$1(); + return estimate$1({ + provider, + from, + to, + value, + method, + api, + params + }) +}; + +let provider$1; + +const getProvider = ()=> { + + if(provider$1) { return provider$1 } + + setProviderEndpoints$1(['https://polygon-rpc.com']); + + return provider$1 +}; + +const setProviderEndpoints$1 = (endpoints)=> { + setProvider$1( + new StaticJsonRpcBatchProvider( + endpoints[0], 'polygon' + ) + ); +}; + +const setProvider$1 = (givenProvider)=> { + provider$1 = givenProvider; +}; + +var estimatePolygon = async ({ from, to, value, method, api, params }) => { + let provider = getProvider(); + return estimate$1({ + provider, + from, + to, + value, + method, + api, + params + }) +}; + +function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }let getWindow = () => { + if (typeof global$1 == 'object') return global$1 + return window +}; + +let getCacheStore = () => { + if (getWindow()._cacheStore == undefined) { + resetCache(); + } + return getWindow()._cacheStore +}; + +let getPromiseStore = () => { + if (getWindow()._promiseStore == undefined) { + resetCache(); + } + return getWindow()._promiseStore +}; + +let resetCache = () => { + getWindow()._cacheStore = {}; + getWindow()._promiseStore = {}; +}; + +let set = function ({ key, value, expires }) { + getCacheStore()[key] = { + expiresAt: Date.now() + expires, + value, + }; +}; + +let get = function ({ key, expires }) { + let cachedEntry = getCacheStore()[key]; + if (_optionalChain([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) { + return cachedEntry.value + } +}; + +let getPromise = function({ key }) { + return getPromiseStore()[key] +}; + +let setPromise = function({ key, promise }) { + getPromiseStore()[key] = promise; + return promise +}; + +let deletePromise = function({ key }) { + getPromiseStore()[key] = undefined; +}; + +let cache = function ({ call, key, expires = 0 }) { + return new Promise((resolve, reject)=>{ + let value; + key = JSON.stringify(key); + + // get existing promise (of a previous pending request asking for the exact same thing) + let existingPromise = getPromise({ key }); + if(existingPromise) { + return existingPromise + .then(resolve) + .catch(reject) + } + + setPromise({ key, promise: new Promise((resolveQueue, rejectQueue)=>{ + if (expires === 0) { + return call() + .then((value)=>{ + resolve(value); + resolveQueue(value); + }) + .catch((error)=>{ + reject(error); + rejectQueue(error); + }) + } + + // get cached value + value = get({ key, expires }); + if (value) { + resolve(value); + resolveQueue(value); + return value + } + + // set new cache value + call() + .then((value)=>{ + if (value) { + set({ key, value, expires }); + } + resolve(value); + resolveQueue(value); + }) + .catch((error)=>{ + reject(error); + rejectQueue(error); + }); + }) + }).then(()=>{ + deletePromise({ key }); + }).catch(()=>{ + deletePromise({ key }); + }); + }) +}; + +let estimate = async function ({ blockchain, from, to, value, method, api, params, cache: cache$1 }) { + if(!['ethereum', 'bsc', 'polygon'].includes(blockchain)) { throw 'Unknown blockchain: ' + blockchain } + if(typeof value == 'undefined') { value = '0'; } + + let result = await cache({ + expires: cache$1 || 0, + key: [blockchain, from, to, value, method, params], + call: async () => { + switch (blockchain) { + + case 'ethereum': + return estimateEthereum({ from, to, value, method, api, params }) + + case 'bsc': + return estimateBsc({ from, to, value, method, api, params }) + + case 'polygon': + return estimatePolygon({ from, to, value, method, api, params }) + + } + }, + }); + return result +}; + +var parseUrl = (url) => { + if (typeof url == 'object') { + return url + } + let deconstructed = url.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+))?/); + + if(deconstructed.groups.part2 == undefined) { + return { + blockchain: deconstructed.groups.blockchain, + method: deconstructed.groups.part1 + } + } else { + return { + blockchain: deconstructed.groups.blockchain, + address: deconstructed.groups.part1, + method: deconstructed.groups.part2 + } + } +}; + let paramsToContractArgs = ({ contract, method, params }) => { let fragment = contract.interface.fragments.find((fragment) => { return fragment.name == method @@ -29487,8 +30464,8 @@ var request$1 = async ({ provider, address, api, method, params }) => { } }; -var requestEthereum = async ({ address, api, method, params }) => { - let provider = getProvider$1(); +var requestBsc = async ({ address, api, method, params }) => { + let provider = getProvider$2(); return request$1({ provider, @@ -29499,30 +30476,19 @@ var requestEthereum = async ({ address, api, method, params }) => { }) }; -let provider$1; - -const getProvider = ()=> { - - if(provider$1) { return provider$1 } - - setProviderEndpoints$1(['https://bsc-dataseed.binance.org']); - - return provider$1 -}; - -const setProviderEndpoints$1 = (endpoints)=> { - setProvider$1( - new StaticJsonRpcBatchProvider( - endpoints[0], 'bsc' - ) - ); -}; +var requestEthereum = async ({ address, api, method, params }) => { + let provider = getProvider$1(); -const setProvider$1 = (givenProvider)=> { - provider$1 = givenProvider; + return request$1({ + provider, + address, + api, + method, + params + }) }; -var requestBsc = async ({ address, api, method, params }) => { +var requestPolygon = async ({ address, api, method, params }) => { let provider = getProvider(); return request$1({ @@ -29534,30 +30500,10 @@ var requestBsc = async ({ address, api, method, params }) => { }) }; -var parseUrl = (url) => { - if (typeof url == 'object') { - return url - } - let deconstructed = url.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+))?/); - - if(deconstructed.groups.part2 == undefined) { - return { - blockchain: deconstructed.groups.blockchain, - method: deconstructed.groups.part1 - } - } else { - return { - blockchain: deconstructed.groups.blockchain, - address: deconstructed.groups.part1, - method: deconstructed.groups.part2 - } - } -}; - let request = async function (url, options) { let { blockchain, address, method } = parseUrl(url); let { api, params, cache: cache$1 } = options || {}; - if(!['ethereum', 'bsc'].includes(blockchain)) { throw 'Unknown blockchain: ' + blockchain } + if(!['ethereum', 'bsc', 'polygon'].includes(blockchain)) { throw 'Unknown blockchain: ' + blockchain } let result = await cache({ expires: cache$1 || 0, key: [blockchain, address, method, params], @@ -29569,6 +30515,9 @@ let request = async function (url, options) { case 'bsc': return requestBsc({ address, api, method, params }) + + case 'polygon': + return requestPolygon({ address, api, method, params }) } }, @@ -29584,6 +30533,9 @@ const provider = (blockchain)=>{ return getProvider$1() case 'bsc': + return getProvider$2() + + case 'polygon': return getProvider() default: @@ -29599,6 +30551,9 @@ const setProviderEndpoints = (blockchain, endpoints)=>{ return setProviderEndpoints$2(endpoints) case 'bsc': + return setProviderEndpoints$3(endpoints) + + case 'polygon': return setProviderEndpoints$1(endpoints) default: @@ -33114,7 +34069,7 @@ var bn$2 = createCommonjsModule$1$1(function (module) { })(module, commonjsGlobal$2); }); -const version$j = "logger/5.4.1"; +const version$i = "logger/5.6.0"; let _permanentCensorErrors$2 = false; let _censorErrors$2 = false; @@ -33211,7 +34166,7 @@ var ErrorCode$2; // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficien funds (< value + gasLimit * gasPrice) + // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used @@ -33293,6 +34248,40 @@ class Logger$2 { messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$2.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$2.CALL_EXCEPTION: + case ErrorCode$2.INSUFFICIENT_FUNDS: + case ErrorCode$2.MISSING_NEW: + case ErrorCode$2.NONCE_EXPIRED: + case ErrorCode$2.REPLACEMENT_UNDERPRICED: + case ErrorCode$2.TRANSACTION_REPLACED: + case ErrorCode$2.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -33390,7 +34379,7 @@ class Logger$2 { } static globalLogger() { if (!_globalLogger$2) { - _globalLogger$2 = new Logger$2(version$j); + _globalLogger$2 = new Logger$2(version$i); } return _globalLogger$2; } @@ -33426,9 +34415,9 @@ class Logger$2 { Logger$2.errors = ErrorCode$2; Logger$2.levels = LogLevel$2; -const version$i = "bytes/5.4.0"; +const version$h = "bytes/5.6.1"; -const logger$q = new Logger$2(version$i); +const logger$p = new Logger$2(version$h); /////////////////////////////// function isHexable$2(value) { return !!(value.toHexString); @@ -33446,6 +34435,9 @@ function addSlice$2(array) { function isBytesLike$2(value) { return ((isHexString$2(value) && !(value.length % 2)) || isBytes$2(value)); } +function isInteger$2(value) { + return (typeof (value) === "number" && value == value && (value % 1) === 0); +} function isBytes$2(value) { if (value == null) { return false; @@ -33456,12 +34448,12 @@ function isBytes$2(value) { if (typeof (value) === "string") { return false; } - if (value.length == null) { + if (!isInteger$2(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (typeof (v) !== "number" || v < 0 || v >= 256 || (v % 1)) { + if (!isInteger$2(v) || v < 0 || v >= 256) { return false; } } @@ -33472,7 +34464,7 @@ function arrayify$2(value, options) { options = {}; } if (typeof (value) === "number") { - logger$q.checkSafeUint53(value, "invalid arrayify value"); + logger$p.checkSafeUint53(value, "invalid arrayify value"); const result = []; while (value) { result.unshift(value & 0xff); @@ -33493,13 +34485,13 @@ function arrayify$2(value, options) { let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; } else { - logger$q.throwArgumentError("hex data is odd-length", "value", value); + logger$p.throwArgumentError("hex data is odd-length", "value", value); } } const result = []; @@ -33511,7 +34503,7 @@ function arrayify$2(value, options) { if (isBytes$2(value)) { return addSlice$2(new Uint8Array(value)); } - return logger$q.throwArgumentError("invalid arrayify value", "value", value); + return logger$p.throwArgumentError("invalid arrayify value", "value", value); } function concat$2(items) { const objects = items.map(item => arrayify$2(item)); @@ -33542,7 +34534,7 @@ function stripZeros$2(value) { function zeroPad$1(value, length) { value = arrayify$2(value); if (value.length > length) { - logger$q.throwArgumentError("value out of range", "value", arguments[0]); + logger$p.throwArgumentError("value out of range", "value", arguments[0]); } const result = new Uint8Array(length); result.set(value, length - value.length); @@ -33563,7 +34555,7 @@ function hexlify$2(value, options) { options = {}; } if (typeof (value) === "number") { - logger$q.checkSafeUint53(value, "invalid hexlify value"); + logger$p.checkSafeUint53(value, "invalid hexlify value"); let hex = ""; while (value) { hex = HexCharacters$2[value & 0xf] + hex; @@ -33599,7 +34591,7 @@ function hexlify$2(value, options) { value += "0"; } else { - logger$q.throwArgumentError("hex data is odd-length", "value", value); + logger$p.throwArgumentError("hex data is odd-length", "value", value); } } return value.toLowerCase(); @@ -33612,7 +34604,7 @@ function hexlify$2(value, options) { } return result; } - return logger$q.throwArgumentError("invalid hexlify value", "value", value); + return logger$p.throwArgumentError("invalid hexlify value", "value", value); } /* function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number { @@ -33636,7 +34628,7 @@ function hexDataSlice$2(data, offset, endOffset) { data = hexlify$2(data); } else if (!isHexString$2(data) || (data.length % 2)) { - logger$q.throwArgumentError("invalid hexData", "value", data); + logger$p.throwArgumentError("invalid hexData", "value", data); } offset = 2 + 2 * offset; if (endOffset != null) { @@ -33663,7 +34655,7 @@ function hexStripZeros$1(value) { value = hexlify$2(value); } if (!isHexString$2(value)) { - logger$q.throwArgumentError("invalid hex string", "value", value); + logger$p.throwArgumentError("invalid hex string", "value", value); } value = value.substring(2); let offset = 0; @@ -33677,10 +34669,10 @@ function hexZeroPad$2(value, length) { value = hexlify$2(value); } else if (!isHexString$2(value)) { - logger$q.throwArgumentError("invalid hex string", "value", value); + logger$p.throwArgumentError("invalid hex string", "value", value); } if (value.length > 2 * length + 2) { - logger$q.throwArgumentError("value out of range", "value", arguments[1]); + logger$p.throwArgumentError("value out of range", "value", arguments[1]); } while (value.length < 2 * length + 2) { value = "0x0" + value.substring(2); @@ -33693,24 +34685,35 @@ function splitSignature$1(signature) { s: "0x", _vs: "0x", recoveryParam: 0, - v: 0 + v: 0, + yParityAndS: "0x", + compact: "0x" }; if (isBytesLike$2(signature)) { - const bytes = arrayify$2(signature); - if (bytes.length !== 65) { - logger$q.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature); - } + let bytes = arrayify$2(signature); // Get the r, s and v - result.r = hexlify$2(bytes.slice(0, 32)); - result.s = hexlify$2(bytes.slice(32, 64)); - result.v = bytes[64]; + if (bytes.length === 64) { + // EIP-2098; pull the v from the top bit of s and clear it + result.v = 27 + (bytes[32] >> 7); + bytes[32] &= 0x7f; + result.r = hexlify$2(bytes.slice(0, 32)); + result.s = hexlify$2(bytes.slice(32, 64)); + } + else if (bytes.length === 65) { + result.r = hexlify$2(bytes.slice(0, 32)); + result.s = hexlify$2(bytes.slice(32, 64)); + result.v = bytes[64]; + } + else { + logger$p.throwArgumentError("invalid signature string", "signature", signature); + } // Allow a recid to be used as the v if (result.v < 27) { if (result.v === 0 || result.v === 1) { result.v += 27; } else { - logger$q.throwArgumentError("signature invalid v byte", "signature", signature); + logger$p.throwArgumentError("signature invalid v byte", "signature", signature); } } // Compute recoveryParam from v @@ -33738,7 +34741,7 @@ function splitSignature$1(signature) { result.recoveryParam = recoveryParam; } else if (result.recoveryParam !== recoveryParam) { - logger$q.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); + logger$p.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); } // Set or check the s vs[0] &= 0x7f; @@ -33747,13 +34750,13 @@ function splitSignature$1(signature) { result.s = s; } else if (result.s !== s) { - logger$q.throwArgumentError("signature v mismatch _vs", "signature", signature); + logger$p.throwArgumentError("signature v mismatch _vs", "signature", signature); } } // Use recid and v to populate each other if (result.recoveryParam == null) { if (result.v == null) { - logger$q.throwArgumentError("signature missing v and recoveryParam", "signature", signature); + logger$p.throwArgumentError("signature missing v and recoveryParam", "signature", signature); } else if (result.v === 0 || result.v === 1) { result.recoveryParam = result.v; @@ -33766,25 +34769,28 @@ function splitSignature$1(signature) { if (result.v == null) { result.v = 27 + result.recoveryParam; } - else if (result.recoveryParam !== (1 - (result.v % 2))) { - logger$q.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + else { + const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2)); + if (result.recoveryParam !== recId) { + logger$p.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + } } } if (result.r == null || !isHexString$2(result.r)) { - logger$q.throwArgumentError("signature missing or invalid r", "signature", signature); + logger$p.throwArgumentError("signature missing or invalid r", "signature", signature); } else { result.r = hexZeroPad$2(result.r, 32); } if (result.s == null || !isHexString$2(result.s)) { - logger$q.throwArgumentError("signature missing or invalid s", "signature", signature); + logger$p.throwArgumentError("signature missing or invalid s", "signature", signature); } else { result.s = hexZeroPad$2(result.s, 32); } const vs = arrayify$2(result.s); if (vs[0] >= 128) { - logger$q.throwArgumentError("signature s out of range", "signature", signature); + logger$p.throwArgumentError("signature s out of range", "signature", signature); } if (result.recoveryParam) { vs[0] |= 0x80; @@ -33792,7 +34798,7 @@ function splitSignature$1(signature) { const _vs = hexlify$2(vs); if (result._vs) { if (!isHexString$2(result._vs)) { - logger$q.throwArgumentError("signature invalid _vs", "signature", signature); + logger$p.throwArgumentError("signature invalid _vs", "signature", signature); } result._vs = hexZeroPad$2(result._vs, 32); } @@ -33801,20 +34807,22 @@ function splitSignature$1(signature) { result._vs = _vs; } else if (result._vs !== _vs) { - logger$q.throwArgumentError("signature _vs mismatch v and s", "signature", signature); + logger$p.throwArgumentError("signature _vs mismatch v and s", "signature", signature); } } + result.yParityAndS = result._vs; + result.compact = result.r + result.yParityAndS.substring(2); return result; } -const version$h = "bignumber/5.4.1"; +const version$g$1 = "bignumber/5.6.0"; -var BN$1$1 = bn$2.BN; -const logger$p = new Logger$2(version$h); -const _constructorGuard$4 = {}; -const MAX_SAFE$1$1 = 0x1fffffffffffff; +var BN$2 = bn$2.BN; +const logger$o = new Logger$2(version$g$1); +const _constructorGuard$3$1 = {}; +const MAX_SAFE$2 = 0x1fffffffffffff; function isBigNumberish$1(value) { - return (value != null) && (BigNumber$1$1.isBigNumber(value) || + return (value != null) && (BigNumber$2.isBigNumber(value) || (typeof (value) === "number" && (value % 1) === 0) || (typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) || isHexString$2(value) || @@ -33822,12 +34830,12 @@ function isBigNumberish$1(value) { isBytes$2(value)); } // Only warn about passing 10 into radix once -let _warnedToStringRadix$1$1 = false; -class BigNumber$1$1 { +let _warnedToStringRadix$2 = false; +class BigNumber$2 { constructor(constructorGuard, hex) { - logger$p.checkNew(new.target, BigNumber$1$1); - if (constructorGuard !== _constructorGuard$4) { - logger$p.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$o.checkNew(new.target, BigNumber$2); + if (constructorGuard !== _constructorGuard$3$1) { + logger$o.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new (BigNumber)" }); } @@ -33836,113 +34844,113 @@ class BigNumber$1$1 { Object.freeze(this); } fromTwos(value) { - return toBigNumber$1$1(toBN$1$1(this).fromTwos(value)); + return toBigNumber$2(toBN$2(this).fromTwos(value)); } toTwos(value) { - return toBigNumber$1$1(toBN$1$1(this).toTwos(value)); + return toBigNumber$2(toBN$2(this).toTwos(value)); } abs() { if (this._hex[0] === "-") { - return BigNumber$1$1.from(this._hex.substring(1)); + return BigNumber$2.from(this._hex.substring(1)); } return this; } add(other) { - return toBigNumber$1$1(toBN$1$1(this).add(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).add(toBN$2(other))); } sub(other) { - return toBigNumber$1$1(toBN$1$1(this).sub(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).sub(toBN$2(other))); } div(other) { - const o = BigNumber$1$1.from(other); + const o = BigNumber$2.from(other); if (o.isZero()) { - throwFault$2$1("division by zero", "div"); + throwFault$1$1("division-by-zero", "div"); } - return toBigNumber$1$1(toBN$1$1(this).div(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).div(toBN$2(other))); } mul(other) { - return toBigNumber$1$1(toBN$1$1(this).mul(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).mul(toBN$2(other))); } mod(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (value.isNeg()) { - throwFault$2$1("cannot modulo negative values", "mod"); + throwFault$1$1("division-by-zero", "mod"); } - return toBigNumber$1$1(toBN$1$1(this).umod(value)); + return toBigNumber$2(toBN$2(this).umod(value)); } pow(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (value.isNeg()) { - throwFault$2$1("cannot raise to negative values", "pow"); + throwFault$1$1("negative-power", "pow"); } - return toBigNumber$1$1(toBN$1$1(this).pow(value)); + return toBigNumber$2(toBN$2(this).pow(value)); } and(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (this.isNegative() || value.isNeg()) { - throwFault$2$1("cannot 'and' negative values", "and"); + throwFault$1$1("unbound-bitwise-result", "and"); } - return toBigNumber$1$1(toBN$1$1(this).and(value)); + return toBigNumber$2(toBN$2(this).and(value)); } or(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (this.isNegative() || value.isNeg()) { - throwFault$2$1("cannot 'or' negative values", "or"); + throwFault$1$1("unbound-bitwise-result", "or"); } - return toBigNumber$1$1(toBN$1$1(this).or(value)); + return toBigNumber$2(toBN$2(this).or(value)); } xor(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (this.isNegative() || value.isNeg()) { - throwFault$2$1("cannot 'xor' negative values", "xor"); + throwFault$1$1("unbound-bitwise-result", "xor"); } - return toBigNumber$1$1(toBN$1$1(this).xor(value)); + return toBigNumber$2(toBN$2(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$2$1("cannot mask negative values", "mask"); + throwFault$1$1("negative-width", "mask"); } - return toBigNumber$1$1(toBN$1$1(this).maskn(value)); + return toBigNumber$2(toBN$2(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$2$1("cannot shift negative values", "shl"); + throwFault$1$1("negative-width", "shl"); } - return toBigNumber$1$1(toBN$1$1(this).shln(value)); + return toBigNumber$2(toBN$2(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$2$1("cannot shift negative values", "shr"); + throwFault$1$1("negative-width", "shr"); } - return toBigNumber$1$1(toBN$1$1(this).shrn(value)); + return toBigNumber$2(toBN$2(this).shrn(value)); } eq(other) { - return toBN$1$1(this).eq(toBN$1$1(other)); + return toBN$2(this).eq(toBN$2(other)); } lt(other) { - return toBN$1$1(this).lt(toBN$1$1(other)); + return toBN$2(this).lt(toBN$2(other)); } lte(other) { - return toBN$1$1(this).lte(toBN$1$1(other)); + return toBN$2(this).lte(toBN$2(other)); } gt(other) { - return toBN$1$1(this).gt(toBN$1$1(other)); + return toBN$2(this).gt(toBN$2(other)); } gte(other) { - return toBN$1$1(this).gte(toBN$1$1(other)); + return toBN$2(this).gte(toBN$2(other)); } isNegative() { return (this._hex[0] === "-"); } isZero() { - return toBN$1$1(this).isZero(); + return toBN$2(this).isZero(); } toNumber() { try { - return toBN$1$1(this).toNumber(); + return toBN$2(this).toNumber(); } catch (error) { - throwFault$2$1("overflow", "toNumber", this.toString()); + throwFault$1$1("overflow", "toNumber", this.toString()); } return null; } @@ -33951,7 +34959,7 @@ class BigNumber$1$1 { return BigInt(this.toString()); } catch (e) { } - return logger$p.throwError("this platform does not support BigInt", Logger$2.errors.UNSUPPORTED_OPERATION, { + return logger$o.throwError("this platform does not support BigInt", Logger$2.errors.UNSUPPORTED_OPERATION, { value: this.toString() }); } @@ -33959,19 +34967,19 @@ class BigNumber$1$1 { // Lots of people expect this, which we do not support, so check (See: #889) if (arguments.length > 0) { if (arguments[0] === 10) { - if (!_warnedToStringRadix$1$1) { - _warnedToStringRadix$1$1 = true; - logger$p.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); + if (!_warnedToStringRadix$2) { + _warnedToStringRadix$2 = true; + logger$o.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); } } else if (arguments[0] === 16) { - logger$p.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); + logger$o.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); } else { - logger$p.throwError("BigNumber.toString does not accept parameters", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); + logger$o.throwError("BigNumber.toString does not accept parameters", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); } } - return toBN$1$1(this).toString(10); + return toBN$2(this).toString(10); } toHexString() { return this._hex; @@ -33980,40 +34988,40 @@ class BigNumber$1$1 { return { type: "BigNumber", hex: this.toHexString() }; } static from(value) { - if (value instanceof BigNumber$1$1) { + if (value instanceof BigNumber$2) { return value; } if (typeof (value) === "string") { if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber$1$1(_constructorGuard$4, toHex$2$1(value)); + return new BigNumber$2(_constructorGuard$3$1, toHex$1$2(value)); } if (value.match(/^-?[0-9]+$/)) { - return new BigNumber$1$1(_constructorGuard$4, toHex$2$1(new BN$1$1(value))); + return new BigNumber$2(_constructorGuard$3$1, toHex$1$2(new BN$2(value))); } - return logger$p.throwArgumentError("invalid BigNumber string", "value", value); + return logger$o.throwArgumentError("invalid BigNumber string", "value", value); } if (typeof (value) === "number") { if (value % 1) { - throwFault$2$1("underflow", "BigNumber.from", value); + throwFault$1$1("underflow", "BigNumber.from", value); } - if (value >= MAX_SAFE$1$1 || value <= -MAX_SAFE$1$1) { - throwFault$2$1("overflow", "BigNumber.from", value); + if (value >= MAX_SAFE$2 || value <= -MAX_SAFE$2) { + throwFault$1$1("overflow", "BigNumber.from", value); } - return BigNumber$1$1.from(String(value)); + return BigNumber$2.from(String(value)); } const anyValue = value; if (typeof (anyValue) === "bigint") { - return BigNumber$1$1.from(anyValue.toString()); + return BigNumber$2.from(anyValue.toString()); } if (isBytes$2(anyValue)) { - return BigNumber$1$1.from(hexlify$2(anyValue)); + return BigNumber$2.from(hexlify$2(anyValue)); } if (anyValue) { - // Hexable interface (takes piority) + // Hexable interface (takes priority) if (anyValue.toHexString) { const hex = anyValue.toHexString(); if (typeof (hex) === "string") { - return BigNumber$1$1.from(hex); + return BigNumber$2.from(hex); } } else { @@ -34025,33 +35033,33 @@ class BigNumber$1$1 { } if (typeof (hex) === "string") { if (isHexString$2(hex) || (hex[0] === "-" && isHexString$2(hex.substring(1)))) { - return BigNumber$1$1.from(hex); + return BigNumber$2.from(hex); } } } } - return logger$p.throwArgumentError("invalid BigNumber value", "value", value); + return logger$o.throwArgumentError("invalid BigNumber value", "value", value); } static isBigNumber(value) { return !!(value && value._isBigNumber); } } // Normalize the hex string -function toHex$2$1(value) { +function toHex$1$2(value) { // For BN, call on the hex string if (typeof (value) !== "string") { - return toHex$2$1(value.toString(16)); + return toHex$1$2(value.toString(16)); } // If negative, prepend the negative sign to the normalized positive value if (value[0] === "-") { // Strip off the negative sign value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") + // Cannot have multiple negative signs (e.g. "--0x04") if (value[0] === "-") { - logger$p.throwArgumentError("invalid hex", "value", value); + logger$o.throwArgumentError("invalid hex", "value", value); } // Call toHex on the positive component - value = toHex$2$1(value); + value = toHex$1$2(value); // Do not allow "-0x00" if (value === "0x00") { return value; @@ -34077,38 +35085,38 @@ function toHex$2$1(value) { } return value; } -function toBigNumber$1$1(value) { - return BigNumber$1$1.from(toHex$2$1(value)); +function toBigNumber$2(value) { + return BigNumber$2.from(toHex$1$2(value)); } -function toBN$1$1(value) { - const hex = BigNumber$1$1.from(value).toHexString(); +function toBN$2(value) { + const hex = BigNumber$2.from(value).toHexString(); if (hex[0] === "-") { - return (new BN$1$1("-" + hex.substring(3), 16)); + return (new BN$2("-" + hex.substring(3), 16)); } - return new BN$1$1(hex.substring(2), 16); + return new BN$2(hex.substring(2), 16); } -function throwFault$2$1(fault, operation, value) { +function throwFault$1$1(fault, operation, value) { const params = { fault: fault, operation: operation }; if (value != null) { params.value = value; } - return logger$p.throwError(fault, Logger$2.errors.NUMERIC_FAULT, params); + return logger$o.throwError(fault, Logger$2.errors.NUMERIC_FAULT, params); } // value should have no prefix function _base36To16$2(value) { - return (new BN$1$1(value, 36)).toString(16); + return (new BN$2(value, 36)).toString(16); } -const logger$o = new Logger$2(version$h); -const _constructorGuard$3$1 = {}; -const Zero$2$1 = BigNumber$1$1.from(0); -const NegativeOne$2$1 = BigNumber$1$1.from(-1); -function throwFault$1$1(message, fault, operation, value) { +const logger$n = new Logger$2(version$g$1); +const _constructorGuard$2$1 = {}; +const Zero$2$1 = BigNumber$2.from(0); +const NegativeOne$2$1 = BigNumber$2.from(-1); +function throwFault$3(message, fault, operation, value) { const params = { fault: fault, operation: operation }; if (value !== undefined) { params.value = value; } - return logger$o.throwError(message, Logger$2.errors.NUMERIC_FAULT, params); + return logger$n.throwError(message, Logger$2.errors.NUMERIC_FAULT, params); } // Constant to pull zeros from for multipliers let zeros$1 = "0"; @@ -34119,14 +35127,14 @@ while (zeros$1.length < 256) { function getMultiplier$1(decimals) { if (typeof (decimals) !== "number") { try { - decimals = BigNumber$1$1.from(decimals).toNumber(); + decimals = BigNumber$2.from(decimals).toNumber(); } catch (e) { } } if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) { return ("1" + zeros$1.substring(0, decimals)); } - return logger$o.throwArgumentError("invalid decimal size", "decimals", decimals); + return logger$n.throwArgumentError("invalid decimal size", "decimals", decimals); } function formatFixed$1(value, decimals) { if (decimals == null) { @@ -34134,7 +35142,7 @@ function formatFixed$1(value, decimals) { } const multiplier = getMultiplier$1(decimals); // Make sure wei is a big number (convert as necessary) - value = BigNumber$1$1.from(value); + value = BigNumber$2.from(value); const negative = value.lt(Zero$2$1); if (negative) { value = value.mul(NegativeOne$2$1); @@ -34162,8 +35170,8 @@ function parseFixed$1(value, decimals) { decimals = 0; } const multiplier = getMultiplier$1(decimals); - if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) { - logger$o.throwArgumentError("invalid decimal value", "value", value); + if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) { + logger$n.throwArgumentError("invalid decimal value", "value", value); } // Is it negative? const negative = (value.substring(0, 1) === "-"); @@ -34171,12 +35179,12 @@ function parseFixed$1(value, decimals) { value = value.substring(1); } if (value === ".") { - logger$o.throwArgumentError("missing value", "value", value); + logger$n.throwArgumentError("missing value", "value", value); } // Split it into a whole and fractional part const comps = value.split("."); if (comps.length > 2) { - logger$o.throwArgumentError("too many decimal points", "value", value); + logger$n.throwArgumentError("too many decimal points", "value", value); } let whole = comps[0], fraction = comps[1]; if (!whole) { @@ -34185,19 +35193,24 @@ function parseFixed$1(value, decimals) { if (!fraction) { fraction = "0"; } - // Get significant digits to check truncation for underflow - { - const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig)); - if (sigFraction.length > multiplier.length - 1) { - throwFault$1$1("fractional component exceeds decimals", "underflow", "parseFixed"); - } + // Trim trailing zeros + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + // Check the fraction doesn't exceed our decimals size + if (fraction.length > multiplier.length - 1) { + throwFault$3("fractional component exceeds decimals", "underflow", "parseFixed"); + } + // If decimals is 0, we have an empty string for fraction + if (fraction === "") { + fraction = "0"; } // Fully pad the string with zeros to get to wei while (fraction.length < multiplier.length - 1) { fraction += "0"; } - const wholeValue = BigNumber$1$1.from(whole); - const fractionValue = BigNumber$1$1.from(fraction); + const wholeValue = BigNumber$2.from(whole); + const fractionValue = BigNumber$2.from(fraction); let wei = (wholeValue.mul(multiplier)).add(fractionValue); if (negative) { wei = wei.mul(NegativeOne$2$1); @@ -34206,8 +35219,8 @@ function parseFixed$1(value, decimals) { } class FixedFormat$1 { constructor(constructorGuard, signed, width, decimals) { - if (constructorGuard !== _constructorGuard$3$1) { - logger$o.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$2.errors.UNSUPPORTED_OPERATION, { + if (constructorGuard !== _constructorGuard$2$1) { + logger$n.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } @@ -34236,7 +35249,7 @@ class FixedFormat$1 { else { const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); if (!match) { - logger$o.throwArgumentError("invalid fixed format", "format", value); + logger$n.throwArgumentError("invalid fixed format", "format", value); } signed = (match[1] !== "u"); width = parseInt(match[2]); @@ -34249,7 +35262,7 @@ class FixedFormat$1 { return defaultValue; } if (typeof (value[key]) !== type) { - logger$o.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]); + logger$n.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]); } return value[key]; }; @@ -34258,19 +35271,19 @@ class FixedFormat$1 { decimals = check("decimals", "number", decimals); } if (width % 8) { - logger$o.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width); + logger$n.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width); } if (decimals > 80) { - logger$o.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); + logger$n.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); } - return new FixedFormat$1(_constructorGuard$3$1, signed, width, decimals); + return new FixedFormat$1(_constructorGuard$2$1, signed, width, decimals); } } class FixedNumber$1 { constructor(constructorGuard, hex, value, format) { - logger$o.checkNew(new.target, FixedNumber$1); - if (constructorGuard !== _constructorGuard$3$1) { - logger$o.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$n.checkNew(new.target, FixedNumber$1); + if (constructorGuard !== _constructorGuard$2$1) { + logger$n.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } @@ -34282,7 +35295,7 @@ class FixedNumber$1 { } _checkFormat(other) { if (this.format.name !== other.format.name) { - logger$o.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); + logger$n.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); } } addUnsafe(other) { @@ -34344,7 +35357,7 @@ class FixedNumber$1 { comps.push("0"); } if (decimals < 0 || decimals > 80 || (decimals % 1)) { - logger$o.throwArgumentError("invalid decimal count", "decimals", decimals); + logger$n.throwArgumentError("invalid decimal count", "decimals", decimals); } if (comps[1].length <= decimals) { return this; @@ -34365,9 +35378,9 @@ class FixedNumber$1 { return this._hex; } if (width % 8) { - logger$o.throwArgumentError("invalid byte width", "width", width); + logger$n.throwArgumentError("invalid byte width", "width", width); } - const hex = BigNumber$1$1.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + const hex = BigNumber$2.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); return hexZeroPad$2(hex, width / 8); } toUnsafeFloat() { return parseFloat(this.toString()); } @@ -34395,7 +35408,7 @@ class FixedNumber$1 { const fixedFormat = FixedFormat$1.from(format); const numeric = parseFixed$1(value, fixedFormat.decimals); if (!fixedFormat.signed && numeric.lt(Zero$2$1)) { - throwFault$1$1("unsigned value cannot be negative", "overflow", "value", value); + throwFault$3("unsigned value cannot be negative", "overflow", "value", value); } let hex = null; if (fixedFormat.signed) { @@ -34406,7 +35419,7 @@ class FixedNumber$1 { hex = hexZeroPad$2(hex, fixedFormat.width / 8); } const decimal = formatFixed$1(numeric, fixedFormat.decimals); - return new FixedNumber$1(_constructorGuard$3$1, hex, decimal, fixedFormat); + return new FixedNumber$1(_constructorGuard$2$1, hex, decimal, fixedFormat); } static fromBytes(value, format) { if (format == null) { @@ -34416,13 +35429,13 @@ class FixedNumber$1 { if (arrayify$2(value).length > fixedFormat.width / 8) { throw new Error("overflow"); } - let numeric = BigNumber$1$1.from(value); + let numeric = BigNumber$2.from(value); if (fixedFormat.signed) { numeric = numeric.fromTwos(fixedFormat.width); } const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); const decimal = formatFixed$1(numeric, fixedFormat.decimals); - return new FixedNumber$1(_constructorGuard$3$1, hex, decimal, fixedFormat); + return new FixedNumber$1(_constructorGuard$2$1, hex, decimal, fixedFormat); } static from(value, format) { if (typeof (value) === "string") { @@ -34440,7 +35453,7 @@ class FixedNumber$1 { throw error; } } - return logger$o.throwArgumentError("invalid FixedNumber value", "value", value); + return logger$n.throwArgumentError("invalid FixedNumber value", "value", value); } static isFixedNumber(value) { return !!(value && value._isFixedNumber); @@ -34449,7 +35462,7 @@ class FixedNumber$1 { const ONE$1 = FixedNumber$1.from(1); const BUMP$1 = FixedNumber$1.from("0.5"); -const version$g$1 = "properties/5.4.1"; +const version$f$1 = "properties/5.6.0"; var __awaiter$8$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -34460,7 +35473,7 @@ var __awaiter$8$1 = function (thisArg, _arguments, P, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$n = new Logger$2(version$g$1); +const logger$m = new Logger$2(version$f$1); function defineReadOnly$2(object, name, value) { Object.defineProperty(object, name, { enumerable: true, @@ -34496,11 +35509,11 @@ function resolveProperties$2(object) { } function checkProperties$1(object, properties) { if (!object || typeof (object) !== "object") { - logger$n.throwArgumentError("invalid object", "object", object); + logger$m.throwArgumentError("invalid object", "object", object); } Object.keys(object).forEach((key) => { if (!properties[key]) { - logger$n.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); + logger$m.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); } }); } @@ -34538,7 +35551,7 @@ function _isFrozen$2(object) { } return true; } - return logger$n.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); + return logger$m.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); } // Returns a new copy of object, such that no properties may be replaced. // New properties may be added only to objects. @@ -34561,7 +35574,7 @@ function _deepCopy$2(object) { } return result; } - return logger$n.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); + return logger$m.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); } function deepCopy$2(object) { return _deepCopy$2(object); @@ -34574,10 +35587,10 @@ class Description$2 { } } -const version$f$1 = "abi/5.4.1"; +const version$e$2 = "abi/5.6.1"; -const logger$m = new Logger$2(version$f$1); -const _constructorGuard$2$1 = {}; +const logger$l = new Logger$2(version$e$2); +const _constructorGuard$1$2 = {}; let ModifiersBytes$1 = { calldata: true, memory: true, storage: true }; let ModifiersNest$1 = { calldata: true, memory: true }; function checkModifier$1(type, name) { @@ -34597,7 +35610,7 @@ function checkModifier$1(type, name) { } } if (ModifiersBytes$1[name] || name === "payable") { - logger$m.throwArgumentError("invalid modifier", "name", name); + logger$l.throwArgumentError("invalid modifier", "name", name); } return false; } @@ -34605,7 +35618,7 @@ function checkModifier$1(type, name) { function parseParamType$1(param, allowIndexed) { let originalParam = param; function throwError(i) { - logger$m.throwArgumentError(`unexpected character at position ${i}`, "param", param); + logger$l.throwArgumentError(`unexpected character at position ${i}`, "param", param); } param = param.replace(/\s/g, " "); function newNode(parent) { @@ -34744,7 +35757,7 @@ function parseParamType$1(param, allowIndexed) { } } if (node.parent) { - logger$m.throwArgumentError("unexpected eof", "param", param); + logger$l.throwArgumentError("unexpected eof", "param", param); } delete parent.state; if (node.name === "indexed") { @@ -34773,7 +35786,7 @@ const FormatTypes$1 = Object.freeze({ sighash: "sighash", // Human-Readable with Minimal spacing and without names (compact human-readable) minimal: "minimal", - // Human-Readble with nice spacing, including all names + // Human-Readable with nice spacing, including all names full: "full", // JSON-format a la Solidity json: "json" @@ -34781,8 +35794,8 @@ const FormatTypes$1 = Object.freeze({ const paramTypeArray$1 = new RegExp(/^(.*)\[([0-9]*)\]$/); class ParamType$1 { constructor(constructorGuard, params) { - if (constructorGuard !== _constructorGuard$2$1) { - logger$m.throwError("use fromString", Logger$2.errors.UNSUPPORTED_OPERATION, { + if (constructorGuard !== _constructorGuard$1$2) { + logger$l.throwError("use fromString", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new ParamType()" }); } @@ -34811,13 +35824,13 @@ class ParamType$1 { // Format the parameter fragment // - sighash: "(uint256,address)" // - minimal: "tuple(uint256,address) indexed" - // - full: "tuple(uint256 foo, addres bar) indexed baz" + // - full: "tuple(uint256 foo, address bar) indexed baz" format(format) { if (!format) { format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { let result = { @@ -34869,7 +35882,7 @@ class ParamType$1 { if (ParamType$1.isParamType(value)) { return value; } - return new ParamType$1(_constructorGuard$2$1, { + return new ParamType$1(_constructorGuard$1$2, { name: (value.name || null), type: verifyType$1(value.type), indexed: ((value.indexed == null) ? null : !!value.indexed), @@ -34896,8 +35909,8 @@ function parseParams$1(value, allowIndex) { } class Fragment$1 { constructor(constructorGuard, params) { - if (constructorGuard !== _constructorGuard$2$1) { - logger$m.throwError("use a static from method", Logger$2.errors.UNSUPPORTED_OPERATION, { + if (constructorGuard !== _constructorGuard$1$2) { + logger$l.throwError("use a static from method", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new Fragment()" }); } @@ -34932,7 +35945,7 @@ class Fragment$1 { // @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment? return null; } - return logger$m.throwArgumentError("invalid fragment object", "value", value); + return logger$l.throwArgumentError("invalid fragment object", "value", value); } static fromString(value) { // Make sure the "returns" is surrounded by a space and all whitespace is exactly one space @@ -34951,7 +35964,7 @@ class Fragment$1 { else if (value.split(" ")[0] === "error") { return ErrorFragment$1.fromString(value.substring(5).trim()); } - return logger$m.throwArgumentError("unsupported fragment", "value", value); + return logger$l.throwArgumentError("unsupported fragment", "value", value); } static isFragment(value) { return !!(value && value._isFragment); @@ -34963,7 +35976,7 @@ class EventFragment$1 extends Fragment$1 { format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -34996,7 +36009,7 @@ class EventFragment$1 extends Fragment$1 { return value; } if (value.type !== "event") { - logger$m.throwArgumentError("invalid event object", "value", value); + logger$l.throwArgumentError("invalid event object", "value", value); } const params = { name: verifyIdentifier$1(value.name), @@ -35004,12 +36017,12 @@ class EventFragment$1 extends Fragment$1 { inputs: (value.inputs ? value.inputs.map(ParamType$1.fromObject) : []), type: "event" }; - return new EventFragment$1(_constructorGuard$2$1, params); + return new EventFragment$1(_constructorGuard$1$2, params); } static fromString(value) { let match = value.match(regexParen$1); if (!match) { - logger$m.throwArgumentError("invalid event string", "value", value); + logger$l.throwArgumentError("invalid event string", "value", value); } let anonymous = false; match[3].split(" ").forEach((modifier) => { @@ -35020,7 +36033,7 @@ class EventFragment$1 extends Fragment$1 { case "": break; default: - logger$m.warn("unknown modifier: " + modifier); + logger$l.warn("unknown modifier: " + modifier); } }); return EventFragment$1.fromObject({ @@ -35039,12 +36052,12 @@ function parseGas$1(value, params) { let comps = value.split("@"); if (comps.length !== 1) { if (comps.length > 2) { - logger$m.throwArgumentError("invalid human-readable ABI signature", "value", value); + logger$l.throwArgumentError("invalid human-readable ABI signature", "value", value); } if (!comps[1].match(/^[0-9]+$/)) { - logger$m.throwArgumentError("invalid human-readable ABI signature gas", "value", value); + logger$l.throwArgumentError("invalid human-readable ABI signature gas", "value", value); } - params.gas = BigNumber$1$1.from(comps[1]); + params.gas = BigNumber$2.from(comps[1]); return comps[0]; } return value; @@ -35095,14 +36108,14 @@ function verifyState$1(value) { result.constant = (result.stateMutability === "view" || result.stateMutability === "pure"); if (value.constant != null) { if ((!!value.constant) !== result.constant) { - logger$m.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); + logger$l.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); } } // Set (and check things are consistent) the payable property result.payable = (result.stateMutability === "payable"); if (value.payable != null) { if ((!!value.payable) !== result.payable) { - logger$m.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); + logger$l.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); } } } @@ -35110,7 +36123,7 @@ function verifyState$1(value) { result.payable = !!value.payable; // If payable we can assume non-constant; otherwise we can't assume if (value.constant == null && !result.payable && value.type !== "constructor") { - logger$m.throwArgumentError("unable to determine stateMutability", "value", value); + logger$l.throwArgumentError("unable to determine stateMutability", "value", value); } result.constant = !!value.constant; if (result.constant) { @@ -35120,7 +36133,7 @@ function verifyState$1(value) { result.stateMutability = (result.payable ? "payable" : "nonpayable"); } if (result.payable && result.constant) { - logger$m.throwArgumentError("cannot have constant payable function", "value", value); + logger$l.throwArgumentError("cannot have constant payable function", "value", value); } } else if (value.constant != null) { @@ -35129,7 +36142,7 @@ function verifyState$1(value) { result.stateMutability = (result.constant ? "view" : "payable"); } else if (value.type !== "constructor") { - logger$m.throwArgumentError("unable to determine stateMutability", "value", value); + logger$l.throwArgumentError("unable to determine stateMutability", "value", value); } return result; } @@ -35139,7 +36152,7 @@ class ConstructorFragment$1 extends Fragment$1 { format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -35151,7 +36164,7 @@ class ConstructorFragment$1 extends Fragment$1 { }); } if (format === FormatTypes$1.sighash) { - logger$m.throwError("cannot format a constructor for sighash", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$l.throwError("cannot format a constructor for sighash", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "format(sighash)" }); } @@ -35172,11 +36185,11 @@ class ConstructorFragment$1 extends Fragment$1 { return value; } if (value.type !== "constructor") { - logger$m.throwArgumentError("invalid constructor object", "value", value); + logger$l.throwArgumentError("invalid constructor object", "value", value); } let state = verifyState$1(value); if (state.constant) { - logger$m.throwArgumentError("constructor cannot be constant", "value", value); + logger$l.throwArgumentError("constructor cannot be constant", "value", value); } const params = { name: null, @@ -35184,16 +36197,16 @@ class ConstructorFragment$1 extends Fragment$1 { inputs: (value.inputs ? value.inputs.map(ParamType$1.fromObject) : []), payable: state.payable, stateMutability: state.stateMutability, - gas: (value.gas ? BigNumber$1$1.from(value.gas) : null) + gas: (value.gas ? BigNumber$2.from(value.gas) : null) }; - return new ConstructorFragment$1(_constructorGuard$2$1, params); + return new ConstructorFragment$1(_constructorGuard$1$2, params); } static fromString(value) { let params = { type: "constructor" }; value = parseGas$1(value, params); let parens = value.match(regexParen$1); if (!parens || parens[1].trim() !== "constructor") { - logger$m.throwArgumentError("invalid constructor string", "value", value); + logger$l.throwArgumentError("invalid constructor string", "value", value); } params.inputs = parseParams$1(parens[2].trim(), false); parseModifiers$1(parens[3].trim(), params); @@ -35209,7 +36222,7 @@ class FunctionFragment$1 extends ConstructorFragment$1 { format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -35257,7 +36270,7 @@ class FunctionFragment$1 extends ConstructorFragment$1 { return value; } if (value.type !== "function") { - logger$m.throwArgumentError("invalid function object", "value", value); + logger$l.throwArgumentError("invalid function object", "value", value); } let state = verifyState$1(value); const params = { @@ -35268,20 +36281,20 @@ class FunctionFragment$1 extends ConstructorFragment$1 { outputs: (value.outputs ? value.outputs.map(ParamType$1.fromObject) : []), payable: state.payable, stateMutability: state.stateMutability, - gas: (value.gas ? BigNumber$1$1.from(value.gas) : null) + gas: (value.gas ? BigNumber$2.from(value.gas) : null) }; - return new FunctionFragment$1(_constructorGuard$2$1, params); + return new FunctionFragment$1(_constructorGuard$1$2, params); } static fromString(value) { let params = { type: "function" }; value = parseGas$1(value, params); let comps = value.split(" returns "); if (comps.length > 2) { - logger$m.throwArgumentError("invalid function string", "value", value); + logger$l.throwArgumentError("invalid function string", "value", value); } let parens = comps[0].match(regexParen$1); if (!parens) { - logger$m.throwArgumentError("invalid function signature", "value", value); + logger$l.throwArgumentError("invalid function signature", "value", value); } params.name = parens[1].trim(); if (params.name) { @@ -35293,7 +36306,7 @@ class FunctionFragment$1 extends ConstructorFragment$1 { if (comps.length > 1) { let returns = comps[1].match(regexParen$1); if (returns[1].trim() != "" || returns[3].trim() != "") { - logger$m.throwArgumentError("unexpected tokens", "value", value); + logger$l.throwArgumentError("unexpected tokens", "value", value); } params.outputs = parseParams$1(returns[2], false); } @@ -35311,7 +36324,7 @@ class FunctionFragment$1 extends ConstructorFragment$1 { function checkForbidden$1(fragment) { const sig = fragment.format(); if (sig === "Error(string)" || sig === "Panic(uint256)") { - logger$m.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment); + logger$l.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment); } return fragment; } @@ -35321,7 +36334,7 @@ class ErrorFragment$1 extends Fragment$1 { format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -35348,20 +36361,20 @@ class ErrorFragment$1 extends Fragment$1 { return value; } if (value.type !== "error") { - logger$m.throwArgumentError("invalid error object", "value", value); + logger$l.throwArgumentError("invalid error object", "value", value); } const params = { type: value.type, name: verifyIdentifier$1(value.name), inputs: (value.inputs ? value.inputs.map(ParamType$1.fromObject) : []) }; - return checkForbidden$1(new ErrorFragment$1(_constructorGuard$2$1, params)); + return checkForbidden$1(new ErrorFragment$1(_constructorGuard$1$2, params)); } static fromString(value) { let params = { type: "error" }; let parens = value.match(regexParen$1); if (!parens) { - logger$m.throwArgumentError("invalid error signature", "value", value); + logger$l.throwArgumentError("invalid error signature", "value", value); } params.name = parens[1].trim(); if (params.name) { @@ -35389,7 +36402,7 @@ function verifyType$1(type) { const regexIdentifier$1 = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); function verifyIdentifier$1(value) { if (!value || !value.match(regexIdentifier$1)) { - logger$m.throwArgumentError(`invalid identifier "${value}"`, "value", value); + logger$l.throwArgumentError(`invalid identifier "${value}"`, "value", value); } return value; } @@ -35413,7 +36426,7 @@ function splitNesting$1(value) { else if (c === ")") { depth--; if (depth === -1) { - logger$m.throwArgumentError("unbalanced parenthesis", "value", value); + logger$l.throwArgumentError("unbalanced parenthesis", "value", value); } } } @@ -35424,7 +36437,7 @@ function splitNesting$1(value) { return result; } -const logger$l = new Logger$2(version$f$1); +const logger$k = new Logger$2(version$e$2); function checkResultErrors$1(result) { // Find the first error (if any) const errors = []; @@ -35455,7 +36468,7 @@ class Coder$1 { this.dynamic = dynamic; } _throwError(message, value) { - logger$l.throwArgumentError(message, this.localName, value); + logger$k.throwArgumentError(message, this.localName, value); } } class Writer$1 { @@ -35487,9 +36500,9 @@ class Writer$1 { return this._writeData(bytes); } _getValue(value) { - let bytes = arrayify$2(BigNumber$1$1.from(value)); + let bytes = arrayify$2(BigNumber$2.from(value)); if (bytes.length > this.wordSize) { - logger$l.throwError("value out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { + logger$k.throwError("value out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { length: this.wordSize, offset: bytes.length }); @@ -35511,535 +36524,710 @@ class Writer$1 { this._data[offset] = this._getValue(value); }; } -} -class Reader$1 { - constructor(data, wordSize, coerceFunc, allowLoose) { - defineReadOnly$2(this, "_data", arrayify$2(data)); - defineReadOnly$2(this, "wordSize", wordSize || 32); - defineReadOnly$2(this, "_coerceFunc", coerceFunc); - defineReadOnly$2(this, "allowLoose", allowLoose); - this._offset = 0; +} +class Reader$1 { + constructor(data, wordSize, coerceFunc, allowLoose) { + defineReadOnly$2(this, "_data", arrayify$2(data)); + defineReadOnly$2(this, "wordSize", wordSize || 32); + defineReadOnly$2(this, "_coerceFunc", coerceFunc); + defineReadOnly$2(this, "allowLoose", allowLoose); + this._offset = 0; + } + get data() { return hexlify$2(this._data); } + get consumed() { return this._offset; } + // The default Coerce function + static coerce(name, value) { + let match = name.match("^u?int([0-9]+)$"); + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + return value; + } + coerce(name, value) { + if (this._coerceFunc) { + return this._coerceFunc(name, value); + } + return Reader$1.coerce(name, value); + } + _peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; + if (this._offset + alignedLength > this._data.length) { + if (this.allowLoose && loose && this._offset + length <= this._data.length) { + alignedLength = length; + } + else { + logger$k.throwError("data out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + return this._data.slice(this._offset, this._offset + alignedLength); + } + subReader(offset) { + return new Reader$1(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + } + readBytes(length, loose) { + let bytes = this._peekBytes(0, length, !!loose); + this._offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + readValue() { + return BigNumber$2.from(this.readBytes(this.wordSize)); + } +} + +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ + +var sha3$2 = createCommonjsModule$1$1(function (module) { +/*jslint bitwise: true */ +(function () { + + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; + if (NODE_JS) { + root = commonjsGlobal$2; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; + + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } + + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } + + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; + + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); + } + return method; + }; + + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + + var methods = {}, methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } + + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); + } + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; } - get data() { return hexlify$2(this._data); } - get consumed() { return this._offset; } - // The default Coerce function - static coerce(name, value) { - let match = name.match("^u?int([0-9]+)$"); - if (match && parseInt(match[1]) <= 48) { - value = value.toNumber(); - } - return value; + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } } - coerce(name, value) { - if (this._coerceFunc) { - return this._coerceFunc(name, value); - } - return Reader$1.coerce(name, value); + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } } - _peekBytes(offset, length, loose) { - let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; - if (this._offset + alignedLength > this._data.length) { - if (this.allowLoose && loose && this._offset + length <= this._data.length) { - alignedLength = length; - } - else { - logger$l.throwError("data out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { - length: this._data.length, - offset: this._offset + alignedLength - }); - } - } - return this._data.slice(this._offset, this._offset + alignedLength); + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); } - subReader(offset) { - return new Reader$1(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } } - readBytes(length, loose) { - let bytes = this._peekBytes(0, length, !!loose); - this._offset += bytes.length; - // @TODO: Make sure the length..end bytes are all 0? - return bytes.slice(0, length); + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); } - readValue() { - return BigNumber$1$1.from(this.readBytes(this.wordSize)); + return buffer; + }; + + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } } -} + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.5.7 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2016 - * @license MIT - */ + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } -var sha3$2 = createCommonjsModule$1$1(function (module) { -/*jslint bitwise: true */ -(function () { - - var root = typeof window === 'object' ? window : {}; - var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; - if (NODE_JS) { - root = commonjsGlobal$2; - } - var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; - var HEX_CHARS = '0123456789abcdef'.split(''); - var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; - var KECCAK_PADDING = [1, 256, 65536, 16777216]; - var PADDING = [6, 1536, 393216, 100663296]; - var SHIFT = [0, 8, 16, 24]; - var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, - 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, - 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, - 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, - 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; - var BITS = [224, 256, 384, 512]; - var SHAKE_BITS = [128, 256]; - var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; - - var createOutputMethod = function (bits, padding, outputType) { - return function (message) { - return new Keccak(bits, padding, bits).update(message)[outputType](); - }; - }; - - var createShakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits) { - return new Keccak(bits, padding, outputBits).update(message)[outputType](); - }; - }; - - var createMethod = function (bits, padding) { - var method = createOutputMethod(bits, padding, 'hex'); - method.create = function () { - return new Keccak(bits, padding, bits); - }; - method.update = function (message) { - return method.create().update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createOutputMethod(bits, padding, type); - } - return method; - }; - - var createShakeMethod = function (bits, padding) { - var method = createShakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits) { - return new Keccak(bits, padding, outputBits); - }; - method.update = function (message, outputBits) { - return method.create(outputBits).update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createShakeOutputMethod(bits, padding, type); - } - return method; - }; - - var algorithms = [ - {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod}, - {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod}, - {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod} - ]; - - var methods = {}, methodNames = []; - - for (var i = 0; i < algorithms.length; ++i) { - var algorithm = algorithms[i]; - var bits = algorithm.bits; - for (var j = 0; j < bits.length; ++j) { - var methodName = algorithm.name +'_' + bits[j]; - methodNames.push(methodName); - methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); - } - } - - function Keccak(bits, padding, outputBits) { - this.blocks = []; - this.s = []; - this.padding = padding; - this.outputBits = outputBits; - this.reset = true; - this.block = 0; - this.start = 0; - this.blockCount = (1600 - (bits << 1)) >> 5; - this.byteCount = this.blockCount << 2; - this.outputBlocks = outputBits >> 5; - this.extraBytes = (outputBits & 31) >> 3; - - for (var i = 0; i < 50; ++i) { - this.s[i] = 0; - } - } - - Keccak.prototype.update = function (message) { - var notString = typeof message !== 'string'; - if (notString && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } - var length = message.length, blocks = this.blocks, byteCount = this.byteCount, - blockCount = this.blockCount, index = 0, s = this.s, i, code; - - while (index < length) { - if (this.reset) { - this.reset = false; - blocks[0] = this.block; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - if (notString) { - for (i = this.start; index < length && i < byteCount; ++index) { - blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index < length && i < byteCount; ++index) { - code = message.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - if (i >= byteCount) { - this.start = i - byteCount; - this.block = blocks[blockCount]; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - this.reset = true; - } else { - this.start = i; - } - } - return this; - }; - - Keccak.prototype.finalize = function () { - var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; - blocks[i >> 2] |= this.padding[i & 3]; - if (this.lastByteIndex === this.byteCount) { - blocks[0] = blocks[blockCount]; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - blocks[blockCount - 1] |= 0x80000000; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - }; - - Keccak.prototype.toString = Keccak.prototype.hex = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var hex = '', block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + - HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + - HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + - HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; - } - if (j % blockCount === 0) { - f(s); - i = 0; - } - } - if (extraBytes) { - block = s[i]; - if (extraBytes > 0) { - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; - } - if (extraBytes > 1) { - hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; - } - if (extraBytes > 2) { - hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; - } - } - return hex; - }; - - Keccak.prototype.arrayBuffer = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var bytes = this.outputBits >> 3; - var buffer; - if (extraBytes) { - buffer = new ArrayBuffer((outputBlocks + 1) << 2); - } else { - buffer = new ArrayBuffer(bytes); - } - var array = new Uint32Array(buffer); - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - array[j] = s[i]; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - array[i] = s[i]; - buffer = buffer.slice(0, bytes); - } - return buffer; - }; - - Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - - Keccak.prototype.digest = Keccak.prototype.array = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var array = [], offset, block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - array[offset + 1] = (block >> 8) & 0xFF; - array[offset + 2] = (block >> 16) & 0xFF; - array[offset + 3] = (block >> 24) & 0xFF; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - offset = j << 2; - block = s[i]; - if (extraBytes > 0) { - array[offset] = block & 0xFF; - } - if (extraBytes > 1) { - array[offset + 1] = (block >> 8) & 0xFF; - } - if (extraBytes > 2) { - array[offset + 2] = (block >> 16) & 0xFF; - } - } - return array; - }; - - var f = function (s) { - var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, - b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, - b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; - for (n = 0; n < 48; n += 2) { - c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; - c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; - c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; - c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; - c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; - c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; - c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; - c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; - c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; - c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; - - h = c8 ^ ((c2 << 1) | (c3 >>> 31)); - l = c9 ^ ((c3 << 1) | (c2 >>> 31)); - s[0] ^= h; - s[1] ^= l; - s[10] ^= h; - s[11] ^= l; - s[20] ^= h; - s[21] ^= l; - s[30] ^= h; - s[31] ^= l; - s[40] ^= h; - s[41] ^= l; - h = c0 ^ ((c4 << 1) | (c5 >>> 31)); - l = c1 ^ ((c5 << 1) | (c4 >>> 31)); - s[2] ^= h; - s[3] ^= l; - s[12] ^= h; - s[13] ^= l; - s[22] ^= h; - s[23] ^= l; - s[32] ^= h; - s[33] ^= l; - s[42] ^= h; - s[43] ^= l; - h = c2 ^ ((c6 << 1) | (c7 >>> 31)); - l = c3 ^ ((c7 << 1) | (c6 >>> 31)); - s[4] ^= h; - s[5] ^= l; - s[14] ^= h; - s[15] ^= l; - s[24] ^= h; - s[25] ^= l; - s[34] ^= h; - s[35] ^= l; - s[44] ^= h; - s[45] ^= l; - h = c4 ^ ((c8 << 1) | (c9 >>> 31)); - l = c5 ^ ((c9 << 1) | (c8 >>> 31)); - s[6] ^= h; - s[7] ^= l; - s[16] ^= h; - s[17] ^= l; - s[26] ^= h; - s[27] ^= l; - s[36] ^= h; - s[37] ^= l; - s[46] ^= h; - s[47] ^= l; - h = c6 ^ ((c0 << 1) | (c1 >>> 31)); - l = c7 ^ ((c1 << 1) | (c0 >>> 31)); - s[8] ^= h; - s[9] ^= l; - s[18] ^= h; - s[19] ^= l; - s[28] ^= h; - s[29] ^= l; - s[38] ^= h; - s[39] ^= l; - s[48] ^= h; - s[49] ^= l; - - b0 = s[0]; - b1 = s[1]; - b32 = (s[11] << 4) | (s[10] >>> 28); - b33 = (s[10] << 4) | (s[11] >>> 28); - b14 = (s[20] << 3) | (s[21] >>> 29); - b15 = (s[21] << 3) | (s[20] >>> 29); - b46 = (s[31] << 9) | (s[30] >>> 23); - b47 = (s[30] << 9) | (s[31] >>> 23); - b28 = (s[40] << 18) | (s[41] >>> 14); - b29 = (s[41] << 18) | (s[40] >>> 14); - b20 = (s[2] << 1) | (s[3] >>> 31); - b21 = (s[3] << 1) | (s[2] >>> 31); - b2 = (s[13] << 12) | (s[12] >>> 20); - b3 = (s[12] << 12) | (s[13] >>> 20); - b34 = (s[22] << 10) | (s[23] >>> 22); - b35 = (s[23] << 10) | (s[22] >>> 22); - b16 = (s[33] << 13) | (s[32] >>> 19); - b17 = (s[32] << 13) | (s[33] >>> 19); - b48 = (s[42] << 2) | (s[43] >>> 30); - b49 = (s[43] << 2) | (s[42] >>> 30); - b40 = (s[5] << 30) | (s[4] >>> 2); - b41 = (s[4] << 30) | (s[5] >>> 2); - b22 = (s[14] << 6) | (s[15] >>> 26); - b23 = (s[15] << 6) | (s[14] >>> 26); - b4 = (s[25] << 11) | (s[24] >>> 21); - b5 = (s[24] << 11) | (s[25] >>> 21); - b36 = (s[34] << 15) | (s[35] >>> 17); - b37 = (s[35] << 15) | (s[34] >>> 17); - b18 = (s[45] << 29) | (s[44] >>> 3); - b19 = (s[44] << 29) | (s[45] >>> 3); - b10 = (s[6] << 28) | (s[7] >>> 4); - b11 = (s[7] << 28) | (s[6] >>> 4); - b42 = (s[17] << 23) | (s[16] >>> 9); - b43 = (s[16] << 23) | (s[17] >>> 9); - b24 = (s[26] << 25) | (s[27] >>> 7); - b25 = (s[27] << 25) | (s[26] >>> 7); - b6 = (s[36] << 21) | (s[37] >>> 11); - b7 = (s[37] << 21) | (s[36] >>> 11); - b38 = (s[47] << 24) | (s[46] >>> 8); - b39 = (s[46] << 24) | (s[47] >>> 8); - b30 = (s[8] << 27) | (s[9] >>> 5); - b31 = (s[9] << 27) | (s[8] >>> 5); - b12 = (s[18] << 20) | (s[19] >>> 12); - b13 = (s[19] << 20) | (s[18] >>> 12); - b44 = (s[29] << 7) | (s[28] >>> 25); - b45 = (s[28] << 7) | (s[29] >>> 25); - b26 = (s[38] << 8) | (s[39] >>> 24); - b27 = (s[39] << 8) | (s[38] >>> 24); - b8 = (s[48] << 14) | (s[49] >>> 18); - b9 = (s[49] << 14) | (s[48] >>> 18); - - s[0] = b0 ^ (~b2 & b4); - s[1] = b1 ^ (~b3 & b5); - s[10] = b10 ^ (~b12 & b14); - s[11] = b11 ^ (~b13 & b15); - s[20] = b20 ^ (~b22 & b24); - s[21] = b21 ^ (~b23 & b25); - s[30] = b30 ^ (~b32 & b34); - s[31] = b31 ^ (~b33 & b35); - s[40] = b40 ^ (~b42 & b44); - s[41] = b41 ^ (~b43 & b45); - s[2] = b2 ^ (~b4 & b6); - s[3] = b3 ^ (~b5 & b7); - s[12] = b12 ^ (~b14 & b16); - s[13] = b13 ^ (~b15 & b17); - s[22] = b22 ^ (~b24 & b26); - s[23] = b23 ^ (~b25 & b27); - s[32] = b32 ^ (~b34 & b36); - s[33] = b33 ^ (~b35 & b37); - s[42] = b42 ^ (~b44 & b46); - s[43] = b43 ^ (~b45 & b47); - s[4] = b4 ^ (~b6 & b8); - s[5] = b5 ^ (~b7 & b9); - s[14] = b14 ^ (~b16 & b18); - s[15] = b15 ^ (~b17 & b19); - s[24] = b24 ^ (~b26 & b28); - s[25] = b25 ^ (~b27 & b29); - s[34] = b34 ^ (~b36 & b38); - s[35] = b35 ^ (~b37 & b39); - s[44] = b44 ^ (~b46 & b48); - s[45] = b45 ^ (~b47 & b49); - s[6] = b6 ^ (~b8 & b0); - s[7] = b7 ^ (~b9 & b1); - s[16] = b16 ^ (~b18 & b10); - s[17] = b17 ^ (~b19 & b11); - s[26] = b26 ^ (~b28 & b20); - s[27] = b27 ^ (~b29 & b21); - s[36] = b36 ^ (~b38 & b30); - s[37] = b37 ^ (~b39 & b31); - s[46] = b46 ^ (~b48 & b40); - s[47] = b47 ^ (~b49 & b41); - s[8] = b8 ^ (~b0 & b2); - s[9] = b9 ^ (~b1 & b3); - s[18] = b18 ^ (~b10 & b12); - s[19] = b19 ^ (~b11 & b13); - s[28] = b28 ^ (~b20 & b22); - s[29] = b29 ^ (~b21 & b23); - s[38] = b38 ^ (~b30 & b32); - s[39] = b39 ^ (~b31 & b33); - s[48] = b48 ^ (~b40 & b42); - s[49] = b49 ^ (~b41 & b43); - - s[0] ^= RC[n]; - s[1] ^= RC[n + 1]; - } - }; - - if (COMMON_JS) { - module.exports = methods; - } else { - for (var i = 0; i < methodNames.length; ++i) { - root[methodNames[i]] = methods[methodNames[i]]; - } - } + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } })(); }); @@ -36049,9 +37237,9 @@ function keccak256$2(data) { return '0x' + sha3$1$2.keccak_256(arrayify$2(data)); } -const version$e$2 = "rlp/5.4.0"; +const version$d$2 = "rlp/5.6.0"; -const logger$k = new Logger$2(version$e$2); +const logger$j = new Logger$2(version$d$2); function arrayifyInteger$2(value) { const result = []; while (value) { @@ -36082,7 +37270,7 @@ function _encode$2(object) { return length.concat(payload); } if (!isBytesLike$2(object)) { - logger$k.throwArgumentError("RLP object must be BytesLike", "object", object); + logger$j.throwArgumentError("RLP object must be BytesLike", "object", object); } const data = Array.prototype.slice.call(arrayify$2(object)); if (data.length === 1 && data[0] <= 0x7f) { @@ -36106,7 +37294,7 @@ function _decodeChildren$1(data, offset, childOffset, length) { result.push(decoded.result); childOffset += decoded.consumed; if (childOffset > offset + 1 + length) { - logger$k.throwError("child data too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("child data too short", Logger$2.errors.BUFFER_OVERRUN, {}); } } return { consumed: (1 + length), result: result }; @@ -36114,35 +37302,35 @@ function _decodeChildren$1(data, offset, childOffset, length) { // returns { consumed: number, result: Object } function _decode$1(data, offset) { if (data.length === 0) { - logger$k.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); } // Array with extra length prefix if (data[offset] >= 0xf8) { const lengthLength = data[offset] - 0xf7; if (offset + 1 + lengthLength > data.length) { - logger$k.throwError("data short segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data short segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger$1(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { - logger$k.throwError("data long segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data long segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); } return _decodeChildren$1(data, offset, offset + 1 + lengthLength, lengthLength + length); } else if (data[offset] >= 0xc0) { const length = data[offset] - 0xc0; if (offset + 1 + length > data.length) { - logger$k.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); } return _decodeChildren$1(data, offset, offset + 1, length); } else if (data[offset] >= 0xb8) { const lengthLength = data[offset] - 0xb7; if (offset + 1 + lengthLength > data.length) { - logger$k.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger$1(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { - logger$k.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const result = hexlify$2(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); return { consumed: (1 + lengthLength + length), result: result }; @@ -36150,28 +37338,28 @@ function _decode$1(data, offset) { else if (data[offset] >= 0x80) { const length = data[offset] - 0x80; if (offset + 1 + length > data.length) { - logger$k.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const result = hexlify$2(data.slice(offset + 1, offset + 1 + length)); return { consumed: (1 + length), result: result }; } return { consumed: 1, result: hexlify$2(data[offset]) }; } -function decode$1$1(data) { +function decode$2$1(data) { const bytes = arrayify$2(data); const decoded = _decode$1(bytes, 0); if (decoded.consumed !== bytes.length) { - logger$k.throwArgumentError("invalid rlp data", "data", data); + logger$j.throwArgumentError("invalid rlp data", "data", data); } return decoded.result; } -const version$d$2 = "address/5.4.0"; +const version$c$2 = "address/5.6.0"; -const logger$j = new Logger$2(version$d$2); +const logger$i = new Logger$2(version$c$2); function getChecksumAddress$2(address) { if (!isHexString$2(address, 20)) { - logger$j.throwArgumentError("invalid address", "address", address); + logger$i.throwArgumentError("invalid address", "address", address); } address = address.toLowerCase(); const chars = address.substring(2).split(""); @@ -36227,7 +37415,7 @@ function ibanChecksum$2(address) { function getAddress$2(address) { let result = null; if (typeof (address) !== "string") { - logger$j.throwArgumentError("invalid address", "address", address); + logger$i.throwArgumentError("invalid address", "address", address); } if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { // Missing the 0x prefix @@ -36237,14 +37425,14 @@ function getAddress$2(address) { result = getChecksumAddress$2(address); // It is a checksummed address with a bad checksum if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { - logger$j.throwArgumentError("bad address checksum", "address", address); + logger$i.throwArgumentError("bad address checksum", "address", address); } // Maybe ICAP? (we only support direct mode) } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { // It is an ICAP address with a bad checksum if (address.substring(2, 4) !== ibanChecksum$2(address)) { - logger$j.throwArgumentError("bad icap checksum", "address", address); + logger$i.throwArgumentError("bad icap checksum", "address", address); } result = _base36To16$2(address.substring(4)); while (result.length < 40) { @@ -36253,7 +37441,7 @@ function getAddress$2(address) { result = getChecksumAddress$2("0x" + result); } else { - logger$j.throwArgumentError("invalid address", "address", address); + logger$i.throwArgumentError("invalid address", "address", address); } return result; } @@ -36264,9 +37452,9 @@ function getContractAddress$2(transaction) { from = getAddress$2(transaction.from); } catch (error) { - logger$j.throwArgumentError("missing from address", "transaction", transaction); + logger$i.throwArgumentError("missing from address", "transaction", transaction); } - const nonce = stripZeros$2(arrayify$2(BigNumber$1$1.from(transaction.nonce).toHexString())); + const nonce = stripZeros$2(arrayify$2(BigNumber$2.from(transaction.nonce).toHexString())); return getAddress$2(hexDataSlice$2(keccak256$2(encode$2$1([from, nonce])), 12)); } @@ -36308,7 +37496,7 @@ class AnonymousCoder$1 extends Coder$1 { } } -const logger$i = new Logger$2(version$f$1); +const logger$h$1 = new Logger$2(version$e$2); function pack$1(writer, coders, values) { let arrayValues = null; if (Array.isArray(values)) { @@ -36319,14 +37507,14 @@ function pack$1(writer, coders, values) { arrayValues = coders.map((coder) => { const name = coder.localName; if (!name) { - logger$i.throwError("cannot encode object for signature with missing names", Logger$2.errors.INVALID_ARGUMENT, { + logger$h$1.throwError("cannot encode object for signature with missing names", Logger$2.errors.INVALID_ARGUMENT, { argument: "values", coder: coder, value: values }); } if (unique[name]) { - logger$i.throwError("cannot encode object for signature with duplicate names", Logger$2.errors.INVALID_ARGUMENT, { + logger$h$1.throwError("cannot encode object for signature with duplicate names", Logger$2.errors.INVALID_ARGUMENT, { argument: "values", coder: coder, value: values @@ -36337,10 +37525,10 @@ function pack$1(writer, coders, values) { }); } else { - logger$i.throwArgumentError("invalid tuple value", "tuple", values); + logger$h$1.throwArgumentError("invalid tuple value", "tuple", values); } if (coders.length !== arrayValues.length) { - logger$i.throwArgumentError("types/value length mismatch", "tuple", values); + logger$h$1.throwArgumentError("types/value length mismatch", "tuple", values); } let staticWriter = new Writer$1(writer.wordSize); let dynamicWriter = new Writer$1(writer.wordSize); @@ -36481,7 +37669,7 @@ class ArrayCoder$1 extends Coder$1 { count = value.length; writer.writeValue(value.length); } - logger$i.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + logger$h$1.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); let coders = []; for (let i = 0; i < value.length; i++) { coders.push(this.coder); @@ -36498,7 +37686,7 @@ class ArrayCoder$1 extends Coder$1 { // bytes as a link to the data). This could use a much // tighter bound, but we are erroring on the side of safety. if (count * 32 > reader._data.length) { - logger$i.throwError("insufficient data length", Logger$2.errors.BUFFER_OVERRUN, { + logger$h$1.throwError("insufficient data length", Logger$2.errors.BUFFER_OVERRUN, { length: reader._data.length, count: count }); @@ -36596,10 +37784,10 @@ class NullCoder$1 extends Coder$1 { const AddressZero$1 = "0x0000000000000000000000000000000000000000"; -const NegativeOne$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(-1)); -const Zero$1$2 = ( /*#__PURE__*/BigNumber$1$1.from(0)); -const One$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(1)); -const MaxUint256$1$1 = ( /*#__PURE__*/BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); +const NegativeOne$1$1 = ( /*#__PURE__*/BigNumber$2.from(-1)); +const Zero$1$2 = ( /*#__PURE__*/BigNumber$2.from(0)); +const One$1$1 = ( /*#__PURE__*/BigNumber$2.from(1)); +const MaxUint256$1$1 = ( /*#__PURE__*/BigNumber$2.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); const HashZero$1 = "0x0000000000000000000000000000000000000000000000000000000000000000"; @@ -36614,7 +37802,7 @@ class NumberCoder$1 extends Coder$1 { return 0; } encode(writer, value) { - let v = BigNumber$1$1.from(value); + let v = BigNumber$2.from(value); // Check bounds are safe for encoding let maxUintValue = MaxUint256$1$1.mask(writer.wordSize * 8); if (this.signed) { @@ -36641,9 +37829,9 @@ class NumberCoder$1 extends Coder$1 { } } -const version$c$2 = "strings/5.4.0"; +const version$b$2 = "strings/5.6.0"; -const logger$h$1 = new Logger$2(version$c$2); +const logger$g$2 = new Logger$2(version$b$2); /////////////////////////////// var UnicodeNormalizationForm$2; (function (UnicodeNormalizationForm) { @@ -36675,13 +37863,13 @@ var Utf8ErrorReason$2; // - offset = start of this codepoint // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate"; - // The string is an overlong reperesentation + // The string is an overlong representation // - offset = start of this codepoint // - badCodepoint = the computed codepoint; already bounds checked Utf8ErrorReason["OVERLONG"] = "overlong representation"; })(Utf8ErrorReason$2 || (Utf8ErrorReason$2 = {})); function errorFunc$2(reason, offset, bytes, output, badCodepoint) { - return logger$h$1.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); + return logger$g$2.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); } function ignoreFunc$2(reason, offset, bytes, output, badCodepoint) { // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes @@ -36781,7 +37969,7 @@ function getUtf8CodePoints$2(bytes, onError) { res = (res << 6) | (nextChar & 0x3f); i++; } - // See above loop for invalid contimuation byte + // See above loop for invalid continuation byte if (res === null) { continue; } @@ -36807,7 +37995,7 @@ function getUtf8CodePoints$2(bytes, onError) { // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array function toUtf8Bytes$2(str, form = UnicodeNormalizationForm$2.current) { if (form != UnicodeNormalizationForm$2.current) { - logger$h$1.checkNormalize(); + logger$g$2.checkNormalize(); str = str.normalize(form); } let result = []; @@ -37112,12 +38300,12 @@ class TupleCoder$1 extends Coder$1 { } } -const logger$g$2 = new Logger$2(version$f$1); +const logger$f$2 = new Logger$2(version$e$2); const paramTypeBytes$1 = new RegExp(/^bytes([0-9]*)$/); const paramTypeNumber$1 = new RegExp(/^(u?int)([0-9]*)$/); class AbiCoder$1 { constructor(coerceFunc) { - logger$g$2.checkNew(new.target, AbiCoder$1); + logger$f$2.checkNew(new.target, AbiCoder$1); defineReadOnly$2(this, "coerceFunc", coerceFunc || null); } _getCoder(param) { @@ -37144,7 +38332,7 @@ class AbiCoder$1 { if (match) { let size = parseInt(match[2] || "256"); if (size === 0 || size > 256 || (size % 8) !== 0) { - logger$g$2.throwArgumentError("invalid " + match[1] + " bit length", "param", param); + logger$f$2.throwArgumentError("invalid " + match[1] + " bit length", "param", param); } return new NumberCoder$1(size / 8, (match[1] === "int"), param.name); } @@ -37153,11 +38341,11 @@ class AbiCoder$1 { if (match) { let size = parseInt(match[1]); if (size === 0 || size > 32) { - logger$g$2.throwArgumentError("invalid bytes length", "param", param); + logger$f$2.throwArgumentError("invalid bytes length", "param", param); } return new FixedBytesCoder$1(size, param.name); } - return logger$g$2.throwArgumentError("invalid type", "type", param.type); + return logger$f$2.throwArgumentError("invalid type", "type", param.type); } _getWordSize() { return 32; } _getReader(data, allowLoose) { @@ -37173,7 +38361,7 @@ class AbiCoder$1 { } encode(types, values) { if (types.length !== values.length) { - logger$g$2.throwError("types/values length mismatch", Logger$2.errors.INVALID_ARGUMENT, { + logger$f$2.throwError("types/values length mismatch", Logger$2.errors.INVALID_ARGUMENT, { count: { types: types.length, values: values.length }, value: { types: types, values: values } }); @@ -37196,23 +38384,23 @@ function id$3(text) { return keccak256$2(toUtf8Bytes$2(text)); } -const version$b$2 = "hash/5.4.0"; +const version$a$2 = "hash/5.6.0"; -const logger$f$2 = new Logger$2(version$b$2); +const logger$e$2 = new Logger$2(version$a$2); const Zeros$1 = new Uint8Array(32); Zeros$1.fill(0); const Partition$1 = new RegExp("^((.*)\\.)?([^.]+)$"); function namehash$1(name) { /* istanbul ignore if */ if (typeof (name) !== "string") { - logger$f$2.throwArgumentError("invalid ENS name; not a string", "name", name); + logger$e$2.throwArgumentError("invalid ENS name; not a string", "name", name); } let current = name; let result = Zeros$1; while (current.length) { const partition = current.match(Partition$1); if (partition == null || partition[2] === "") { - logger$f$2.throwArgumentError("invalid ENS address; missing component", "name", name); + logger$e$2.throwArgumentError("invalid ENS address; missing component", "name", name); } const label = toUtf8Bytes$2(nameprep$1(partition[3])); result = keccak256$2(concat$2([result, keccak256$2(label)])); @@ -37220,6 +38408,15 @@ function namehash$1(name) { } return hexlify$2(result); } +function dnsEncode$1(name) { + return hexlify$2(concat$2(name.split(".").map((comp) => { + // We jam in an _ prefix to fill in with the length later + // Note: Nameprep throws if the component is over 63 bytes + const bytes = toUtf8Bytes$2("_" + nameprep$1(comp)); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} var __awaiter$7$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -37230,13 +38427,13 @@ var __awaiter$7$1 = function (thisArg, _arguments, P, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$e$2 = new Logger$2(version$b$2); +const logger$d$2 = new Logger$2(version$a$2); const padding$1 = new Uint8Array(32); padding$1.fill(0); -const NegativeOne$3 = BigNumber$1$1.from(-1); -const Zero$3 = BigNumber$1$1.from(0); -const One$2 = BigNumber$1$1.from(1); -const MaxUint256$2 = BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +const NegativeOne$3 = BigNumber$2.from(-1); +const Zero$3 = BigNumber$2.from(0); +const One$2 = BigNumber$2.from(1); +const MaxUint256$2 = BigNumber$2.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); function hexPadRight$1(value) { const bytes = arrayify$2(value); const padOffset = bytes.length % 32; @@ -37260,7 +38457,7 @@ const domainFieldNames$1 = [ function checkString$1(key) { return function (value) { if (typeof (value) !== "string") { - logger$e$2.throwArgumentError(`invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + logger$d$2.throwArgumentError(`invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); } return value; }; @@ -37270,17 +38467,17 @@ const domainChecks$1 = { version: checkString$1("version"), chainId: function (value) { try { - return BigNumber$1$1.from(value).toString(); + return BigNumber$2.from(value).toString(); } catch (error) { } - return logger$e$2.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value); + return logger$d$2.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value); }, verifyingContract: function (value) { try { return getAddress$2(value).toLowerCase(); } catch (error) { } - return logger$e$2.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + return logger$d$2.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value); }, salt: function (value) { try { @@ -37291,7 +38488,7 @@ const domainChecks$1 = { return hexlify$2(bytes); } catch (error) { } - return logger$e$2.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value); + return logger$d$2.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value); } }; function getBaseEncoder$1(type) { @@ -37302,14 +38499,14 @@ function getBaseEncoder$1(type) { const signed = (match[1] === ""); const width = parseInt(match[2] || "256"); if (width % 8 !== 0 || width > 256 || (match[2] && match[2] !== String(width))) { - logger$e$2.throwArgumentError("invalid numeric width", "type", type); + logger$d$2.throwArgumentError("invalid numeric width", "type", type); } const boundsUpper = MaxUint256$2.mask(signed ? (width - 1) : width); const boundsLower = signed ? boundsUpper.add(One$2).mul(NegativeOne$3) : Zero$3; return function (value) { - const v = BigNumber$1$1.from(value); + const v = BigNumber$2.from(value); if (v.lt(boundsLower) || v.gt(boundsUpper)) { - logger$e$2.throwArgumentError(`value out-of-bounds for ${type}`, "value", value); + logger$d$2.throwArgumentError(`value out-of-bounds for ${type}`, "value", value); } return hexZeroPad$2(v.toTwos(256).toHexString(), 32); }; @@ -37321,12 +38518,12 @@ function getBaseEncoder$1(type) { if (match) { const width = parseInt(match[1]); if (width === 0 || width > 32 || match[1] !== String(width)) { - logger$e$2.throwArgumentError("invalid bytes width", "type", type); + logger$d$2.throwArgumentError("invalid bytes width", "type", type); } return function (value) { const bytes = arrayify$2(value); if (bytes.length !== width) { - logger$e$2.throwArgumentError(`invalid length for ${type}`, "value", value); + logger$d$2.throwArgumentError(`invalid length for ${type}`, "value", value); } return hexPadRight$1(value); }; @@ -37372,13 +38569,13 @@ class TypedDataEncoder$1 { types[name].forEach((field) => { // Check each field has a unique name if (uniqueNames[field.name]) { - logger$e$2.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); + logger$d$2.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); } uniqueNames[field.name] = true; // Get the base type (drop any array specifiers) const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; if (baseType === name) { - logger$e$2.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types); + logger$d$2.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types); } // Is this a base encoding type? const encoder = getBaseEncoder$1(baseType); @@ -37386,7 +38583,7 @@ class TypedDataEncoder$1 { return; } if (!parents[baseType]) { - logger$e$2.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types); + logger$d$2.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types); } // Add linkage parents[baseType].push(name); @@ -37396,16 +38593,16 @@ class TypedDataEncoder$1 { // Deduce the primary type const primaryTypes = Object.keys(parents).filter((n) => (parents[n].length === 0)); if (primaryTypes.length === 0) { - logger$e$2.throwArgumentError("missing primary type", "types", types); + logger$d$2.throwArgumentError("missing primary type", "types", types); } else if (primaryTypes.length > 1) { - logger$e$2.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types); + logger$d$2.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types); } defineReadOnly$2(this, "primaryType", primaryTypes[0]); // Check for circular type references function checkCircular(type, found) { if (found[type]) { - logger$e$2.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types); + logger$d$2.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types); } found[type] = true; Object.keys(links[type]).forEach((child) => { @@ -37452,7 +38649,7 @@ class TypedDataEncoder$1 { const length = parseInt(match[3]); return (value) => { if (length >= 0 && value.length !== length) { - logger$e$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + logger$d$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); } let result = value.map(subEncoder); if (this._types[subtype]) { @@ -37477,12 +38674,12 @@ class TypedDataEncoder$1 { return hexConcat$2(values); }; } - return logger$e$2.throwArgumentError(`unknown type: ${type}`, "type", type); + return logger$d$2.throwArgumentError(`unknown type: ${type}`, "type", type); } encodeType(name) { const result = this._types[name]; if (!result) { - logger$e$2.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name); + logger$d$2.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name); } return result; } @@ -37512,7 +38709,7 @@ class TypedDataEncoder$1 { const subtype = match[1]; const length = parseInt(match[3]); if (length >= 0 && value.length !== length) { - logger$e$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + logger$d$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); } return value.map((v) => this._visit(subtype, v, callback)); } @@ -37524,7 +38721,7 @@ class TypedDataEncoder$1 { return accum; }, {}); } - return logger$e$2.throwArgumentError(`unknown type: ${type}`, "type", type); + return logger$d$2.throwArgumentError(`unknown type: ${type}`, "type", type); } visit(value, callback) { return this._visit(this.primaryType, value, callback); @@ -37543,7 +38740,7 @@ class TypedDataEncoder$1 { for (const name in domain) { const type = domainFieldTypes$1[name]; if (!type) { - logger$e$2.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + logger$d$2.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); } domainFields.push({ name, type }); } @@ -37617,7 +38814,7 @@ class TypedDataEncoder$1 { const encoder = TypedDataEncoder$1.from(types); const typesWithDomain = shallowCopy$2(types); if (typesWithDomain.EIP712Domain) { - logger$e$2.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + logger$d$2.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); } else { typesWithDomain.EIP712Domain = domainTypes; @@ -37635,7 +38832,7 @@ class TypedDataEncoder$1 { } // uint or int if (type.match(/^u?int/)) { - return BigNumber$1$1.from(value).toString(); + return BigNumber$2.from(value).toString(); } switch (type) { case "address": @@ -37644,17 +38841,17 @@ class TypedDataEncoder$1 { return !!value; case "string": if (typeof (value) !== "string") { - logger$e$2.throwArgumentError(`invalid string`, "value", value); + logger$d$2.throwArgumentError(`invalid string`, "value", value); } return value; } - return logger$e$2.throwArgumentError("unsupported type", "type", type); + return logger$d$2.throwArgumentError("unsupported type", "type", type); }) }; } } -const logger$d$2 = new Logger$2(version$f$1); +const logger$c$2 = new Logger$2(version$e$2); class LogDescription$1 extends Description$2 { } class TransactionDescription$1 extends Description$2 { @@ -37690,7 +38887,7 @@ function checkNames(fragment: Fragment, type: "input" | "output", params: Array< */ class Interface$1 { constructor(fragments) { - logger$d$2.checkNew(new.target, Interface$1); + logger$c$2.checkNew(new.target, Interface$1); let abi = []; if (typeof (fragments) === "string") { abi = JSON.parse(fragments); @@ -37701,7 +38898,7 @@ class Interface$1 { defineReadOnly$2(this, "fragments", abi.map((fragment) => { return Fragment$1.from(fragment); }).filter((fragment) => (fragment != null))); - defineReadOnly$2(this, "_abiCoder", getStatic$2((new.target), "getAbiCoder")()); + defineReadOnly$2(this, "_abiCoder", getStatic$2(new.target, "getAbiCoder")()); defineReadOnly$2(this, "functions", {}); defineReadOnly$2(this, "errors", {}); defineReadOnly$2(this, "events", {}); @@ -37712,7 +38909,7 @@ class Interface$1 { switch (fragment.type) { case "constructor": if (this.deploy) { - logger$d$2.warn("duplicate definition - constructor"); + logger$c$2.warn("duplicate definition - constructor"); return; } //checkNames(fragment, "input", fragment.inputs); @@ -37735,7 +38932,7 @@ class Interface$1 { } let signature = fragment.format(); if (bucket[signature]) { - logger$d$2.warn("duplicate definition - " + signature); + logger$c$2.warn("duplicate definition - " + signature); return; } bucket[signature] = fragment; @@ -37754,7 +38951,7 @@ class Interface$1 { format = FormatTypes$1.full; } if (format === FormatTypes$1.sighash) { - logger$d$2.throwArgumentError("interface does not support formatting sighash", "format", format); + logger$c$2.throwArgumentError("interface does not support formatting sighash", "format", format); } const abi = this.fragments.map((fragment) => fragment.format(format)); // We need to re-bundle the JSON fragments a bit @@ -37784,24 +38981,24 @@ class Interface$1 { return this.functions[name]; } } - logger$d$2.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrSighash.indexOf("(") === -1) { const name = nameOrSignatureOrSighash.trim(); const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { - logger$d$2.throwArgumentError("no matching function", "name", name); + logger$c$2.throwArgumentError("no matching function", "name", name); } else if (matching.length > 1) { - logger$d$2.throwArgumentError("multiple matching functions", "name", name); + logger$c$2.throwArgumentError("multiple matching functions", "name", name); } return this.functions[matching[0]]; } - // Normlize the signature and lookup the function + // Normalize the signature and lookup the function const result = this.functions[FunctionFragment$1.fromString(nameOrSignatureOrSighash).format()]; if (!result) { - logger$d$2.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); } return result; } @@ -37814,24 +39011,24 @@ class Interface$1 { return this.events[name]; } } - logger$d$2.throwArgumentError("no matching event", "topichash", topichash); + logger$c$2.throwArgumentError("no matching event", "topichash", topichash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrTopic.indexOf("(") === -1) { const name = nameOrSignatureOrTopic.trim(); const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { - logger$d$2.throwArgumentError("no matching event", "name", name); + logger$c$2.throwArgumentError("no matching event", "name", name); } else if (matching.length > 1) { - logger$d$2.throwArgumentError("multiple matching events", "name", name); + logger$c$2.throwArgumentError("multiple matching events", "name", name); } return this.events[matching[0]]; } - // Normlize the signature and lookup the function + // Normalize the signature and lookup the function const result = this.events[EventFragment$1.fromString(nameOrSignatureOrTopic).format()]; if (!result) { - logger$d$2.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + logger$c$2.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); } return result; } @@ -37845,24 +39042,24 @@ class Interface$1 { return this.errors[name]; } } - logger$d$2.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrSighash.indexOf("(") === -1) { const name = nameOrSignatureOrSighash.trim(); const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { - logger$d$2.throwArgumentError("no matching error", "name", name); + logger$c$2.throwArgumentError("no matching error", "name", name); } else if (matching.length > 1) { - logger$d$2.throwArgumentError("multiple matching errors", "name", name); + logger$c$2.throwArgumentError("multiple matching errors", "name", name); } return this.errors[matching[0]]; } - // Normlize the signature and lookup the function + // Normalize the signature and lookup the function const result = this.errors[FunctionFragment$1.fromString(nameOrSignatureOrSighash).format()]; if (!result) { - logger$d$2.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); } return result; } @@ -37905,7 +39102,7 @@ class Interface$1 { } const bytes = arrayify$2(data); if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(fragment)) { - logger$d$2.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$2(bytes)); + logger$c$2.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$2(bytes)); } return this._decodeParams(fragment.inputs, bytes.slice(4)); } @@ -37925,7 +39122,7 @@ class Interface$1 { } const bytes = arrayify$2(data); if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { - logger$d$2.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$2(bytes)); + logger$c$2.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$2(bytes)); } return this._decodeParams(functionFragment.inputs, bytes.slice(4)); } @@ -37946,6 +39143,7 @@ class Interface$1 { } let bytes = arrayify$2(data); let reason = null; + let message = ""; let errorArgs = null; let errorName = null; let errorSignature = null; @@ -37966,6 +39164,12 @@ class Interface$1 { if (builtin.reason) { reason = errorArgs[0]; } + if (errorName === "Error") { + message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`; + } + else if (errorName === "Panic") { + message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`; + } } else { try { @@ -37974,16 +39178,14 @@ class Interface$1 { errorName = error.name; errorSignature = error.format(); } - catch (error) { - console.log(error); - } + catch (error) { } } break; } } - return logger$d$2.throwError("call revert exception", Logger$2.errors.CALL_EXCEPTION, { + return logger$c$2.throwError("call revert exception" + message, Logger$2.errors.CALL_EXCEPTION, { method: functionFragment.format(), - errorArgs, errorName, errorSignature, reason + data: hexlify$2(data), errorArgs, errorName, errorSignature, reason }); } // Encode the result for a function call (e.g. for eth_call) @@ -37999,7 +39201,7 @@ class Interface$1 { eventFragment = this.getEvent(eventFragment); } if (values.length > eventFragment.inputs.length) { - logger$d$2.throwError("too many arguments for " + eventFragment.format(), Logger$2.errors.UNEXPECTED_ARGUMENT, { + logger$c$2.throwError("too many arguments for " + eventFragment.format(), Logger$2.errors.UNEXPECTED_ARGUMENT, { argument: "values", value: values }); @@ -38025,7 +39227,7 @@ class Interface$1 { let param = eventFragment.inputs[index]; if (!param.indexed) { if (value != null) { - logger$d$2.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + logger$c$2.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); } return; } @@ -38033,7 +39235,7 @@ class Interface$1 { topics.push(null); } else if (param.baseType === "array" || param.baseType === "tuple") { - logger$d$2.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + logger$c$2.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); } else if (Array.isArray(value)) { topics.push(value.map((value) => encodeTopic(param, value))); @@ -38059,7 +39261,7 @@ class Interface$1 { topics.push(this.getEventTopic(eventFragment)); } if (values.length !== eventFragment.inputs.length) { - logger$d$2.throwArgumentError("event arguments/values mismatch", "values", values); + logger$c$2.throwArgumentError("event arguments/values mismatch", "values", values); } eventFragment.inputs.forEach((param, index) => { const value = values[index]; @@ -38071,7 +39273,7 @@ class Interface$1 { topics.push(keccak256$2(value)); } else if (param.baseType === "tuple" || param.baseType === "array") { - // @TOOD + // @TODO throw new Error("not implemented"); } else { @@ -38096,7 +39298,7 @@ class Interface$1 { if (topics != null && !eventFragment.anonymous) { let topicHash = this.getEventTopic(eventFragment); if (!isHexString$2(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { - logger$d$2.throwError("fragment/topic mismatch", Logger$2.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); + logger$c$2.throwError("fragment/topic mismatch", Logger$2.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); } topics = topics.slice(1); } @@ -38188,7 +39390,7 @@ class Interface$1 { name: fragment.name, signature: fragment.format(), sighash: this.getSighash(fragment), - value: BigNumber$1$1.from(tx.value || "0"), + value: BigNumber$2.from(tx.value || "0"), }); } // @TODO @@ -38202,7 +39404,7 @@ class Interface$1 { } // @TODO: If anonymous, and the only method, and the input count matches, should we parse? // Probably not, because just because it is the only event in the ABI does - // not mean we have the full ABI; maybe jsut a fragment? + // not mean we have the full ABI; maybe just a fragment? return new LogDescription$1({ eventFragment: fragment, name: fragment.name, @@ -38241,7 +39443,7 @@ class Interface$1 { } } -const version$a$2 = "abstract-provider/5.4.1"; +const version$9$2 = "abstract-provider/5.6.0"; var __awaiter$6$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -38252,7 +39454,7 @@ var __awaiter$6$1 = function (thisArg, _arguments, P, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$c$2 = new Logger$2(version$a$2); +const logger$b$2 = new Logger$2(version$9$2); //export type CallTransactionable = { // call(transaction: TransactionRequest): Promise; //}; @@ -38265,7 +39467,7 @@ class ForkEvent$1 extends Description$2 { // Exported Abstracts class Provider$2 { constructor() { - logger$c$2.checkAbstract(new.target, Provider$2); + logger$b$2.checkAbstract(new.target, Provider$2); defineReadOnly$2(this, "_isProvider", true); } getFeeData() { @@ -38283,7 +39485,7 @@ class Provider$2 { // We may want to compute this more accurately in the future, // using the formula "check if the base fee is correct". // See: https://eips.ethereum.org/EIPS/eip-1559 - maxPriorityFeePerGas = BigNumber$1$1.from("2500000000"); + maxPriorityFeePerGas = BigNumber$2.from("1500000000"); maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); } return { maxFeePerGas, maxPriorityFeePerGas, gasPrice }; @@ -38302,7 +39504,7 @@ class Provider$2 { } } -const version$9$2 = "abstract-signer/5.4.1"; +const version$8$2 = "abstract-signer/5.6.0"; var __awaiter$5$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -38313,9 +39515,9 @@ var __awaiter$5$1 = function (thisArg, _arguments, P, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$b$2 = new Logger$2(version$9$2); +const logger$a$2 = new Logger$2(version$8$2); const allowedTransactionKeys$1$1 = [ - "accessList", "chainId", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" + "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors$2 = [ Logger$2.errors.INSUFFICIENT_FUNDS, @@ -38326,7 +39528,7 @@ class Signer$2 { /////////////////// // Sub-classes MUST call super constructor() { - logger$b$2.checkAbstract(new.target, Signer$2); + logger$a$2.checkAbstract(new.target, Signer$2); defineReadOnly$2(this, "_isSigner", true); } /////////////////// @@ -38343,7 +39545,7 @@ class Signer$2 { return yield this.provider.getTransactionCount(this.getAddress(), blockTag); }); } - // Populates "from" if unspecified, and estimates the gas for the transation + // Populates "from" if unspecified, and estimates the gas for the transaction estimateGas(transaction) { return __awaiter$5$1(this, void 0, void 0, function* () { this._checkProvider("estimateGas"); @@ -38351,7 +39553,7 @@ class Signer$2 { return yield this.provider.estimateGas(tx); }); } - // Populates "from" if unspecified, and calls with the transation + // Populates "from" if unspecified, and calls with the transaction call(transaction, blockTag) { return __awaiter$5$1(this, void 0, void 0, function* () { this._checkProvider("call"); @@ -38405,7 +39607,7 @@ class Signer$2 { checkTransaction(transaction) { for (const key in transaction) { if (allowedTransactionKeys$1$1.indexOf(key) === -1) { - logger$b$2.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); + logger$a$2.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); } } const tx = shallowCopy$2(transaction); @@ -38419,7 +39621,7 @@ class Signer$2 { this.getAddress() ]).then((result) => { if (result[0].toLowerCase() !== result[1].toLowerCase()) { - logger$b$2.throwArgumentError("from address mismatch", "transaction", transaction); + logger$a$2.throwArgumentError("from address mismatch", "transaction", transaction); } return result[0]; }); @@ -38443,20 +39645,20 @@ class Signer$2 { } const address = yield this.resolveName(to); if (address == null) { - logger$b$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + logger$a$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to); } return address; })); // Prevent this error from causing an UnhandledPromiseException tx.to.catch((error) => { }); } - // Do not allow mixing pre-eip-1559 and eip-1559 proerties + // Do not allow mixing pre-eip-1559 and eip-1559 properties const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null); if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { - logger$b$2.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); + logger$a$2.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); } else if ((tx.type === 0 || tx.type === 1) && hasEip1559) { - logger$b$2.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); + logger$a$2.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); } if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) { // Fully-formed EIP-1559 transaction (skip getFeeData) @@ -38500,7 +39702,7 @@ class Signer$2 { // Network doesn't support EIP-1559... // ...but they are trying to use EIP-1559 properties if (hasEip1559) { - logger$b$2.throwError("network does not support EIP-1559", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$a$2.throwError("network does not support EIP-1559", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "populateTransaction" }); } @@ -38513,7 +39715,7 @@ class Signer$2 { } else { // getFeeData has failed us. - logger$b$2.throwError("failed to get consistent fee data", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$a$2.throwError("failed to get consistent fee data", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "signer.getFeeData" }); } @@ -38537,7 +39739,7 @@ class Signer$2 { if (forwardErrors$2.indexOf(error.code) >= 0) { throw error; } - return logger$b$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$2.errors.UNPREDICTABLE_GAS_LIMIT, { + return logger$a$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$2.errors.UNPREDICTABLE_GAS_LIMIT, { error: error, tx: tx }); @@ -38552,7 +39754,7 @@ class Signer$2 { this.getChainId() ]).then((results) => { if (results[1] !== 0 && results[0] !== results[1]) { - logger$b$2.throwArgumentError("chainId address mismatch", "transaction", transaction); + logger$a$2.throwArgumentError("chainId address mismatch", "transaction", transaction); } return results[0]; }); @@ -38564,7 +39766,7 @@ class Signer$2 { // Sub-classes SHOULD leave these alone _checkProvider(operation) { if (!this.provider) { - logger$b$2.throwError("missing provider", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$a$2.throwError("missing provider", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: (operation || "_checkProvider") }); } @@ -38575,7 +39777,7 @@ class Signer$2 { } class VoidSigner$1 extends Signer$2 { constructor(address, provider) { - logger$b$2.checkNew(new.target, VoidSigner$1); + logger$a$2.checkNew(new.target, VoidSigner$1); super(); defineReadOnly$2(this, "address", address); defineReadOnly$2(this, "provider", provider || null); @@ -38585,7 +39787,7 @@ class VoidSigner$1 extends Signer$2 { } _fail(message, operation) { return Promise.resolve().then(() => { - logger$b$2.throwError(message, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: operation }); + logger$a$2.throwError(message, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: operation }); }); } signMessage(message) { @@ -38715,13 +39917,13 @@ function toArray$1(msg, enc) { } var toArray_1$1 = toArray$1; -function toHex$1$2(msg) { +function toHex$3(msg) { var res = ''; for (var i = 0; i < msg.length; i++) res += zero2$1(msg[i].toString(16)); return res; } -var toHex_1$1 = toHex$1$2; +var toHex_1$1 = toHex$3; function htonl$1(w) { var res = (w >>> 24) | @@ -42306,9 +43508,9 @@ elliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null); var EC$1$1 = elliptic_1$1.ec; -const version$8$2 = "signing-key/5.4.0"; +const version$7$2 = "signing-key/5.6.1"; -const logger$a$2 = new Logger$2(version$8$2); +const logger$9$2 = new Logger$2(version$7$2); let _curve$1 = null; function getCurve$1() { if (!_curve$1) { @@ -42320,6 +43522,9 @@ class SigningKey$1 { constructor(privateKey) { defineReadOnly$2(this, "curve", "secp256k1"); defineReadOnly$2(this, "privateKey", hexlify$2(privateKey)); + if (hexDataLength$2(this.privateKey) !== 32) { + logger$9$2.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + } const keyPair = getCurve$1().keyFromPrivate(arrayify$2(this.privateKey)); defineReadOnly$2(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); defineReadOnly$2(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); @@ -42334,7 +43539,7 @@ class SigningKey$1 { const keyPair = getCurve$1().keyFromPrivate(arrayify$2(this.privateKey)); const digestBytes = arrayify$2(digest); if (digestBytes.length !== 32) { - logger$a$2.throwArgumentError("bad digest length", "digest", digest); + logger$9$2.throwArgumentError("bad digest length", "digest", digest); } const signature = keyPair.sign(digestBytes, { canonical: true }); return splitSignature$1({ @@ -42378,12 +43583,12 @@ function computePublicKey$1(key, compressed) { } return "0x" + getCurve$1().keyFromPublic(bytes).getPublic(true, "hex"); } - return logger$a$2.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + return logger$9$2.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } -const version$7$2 = "transactions/5.4.0"; +const version$6$2 = "transactions/5.6.0"; -const logger$9$2 = new Logger$2(version$7$2); +const logger$8$2 = new Logger$2(version$6$2); var TransactionTypes$2; (function (TransactionTypes) { TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy"; @@ -42401,7 +43606,7 @@ function handleNumber$1(value) { if (value === "0x") { return Zero$1$2; } - return BigNumber$1$1.from(value); + return BigNumber$2.from(value); } function computeAddress$1(key) { const publicKey = computePublicKey$1(key); @@ -42411,9 +43616,9 @@ function recoverAddress$1(digest, signature) { return computeAddress$1(recoverPublicKey$1(arrayify$2(digest), signature)); } function formatNumber$1(value, name) { - const result = stripZeros$2(BigNumber$1$1.from(value).toHexString()); + const result = stripZeros$2(BigNumber$2.from(value).toHexString()); if (result.length > 32) { - logger$9$2.throwArgumentError("invalid length for " + name, ("transaction:" + name), value); + logger$8$2.throwArgumentError("invalid length for " + name, ("transaction:" + name), value); } return result; } @@ -42422,7 +43627,7 @@ function accessSetify$2(addr, storageKeys) { address: getAddress$2(addr), storageKeys: (storageKeys || []).map((storageKey, index) => { if (hexDataLength$2(storageKey) !== 32) { - logger$9$2.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey); + logger$8$2.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey); } return storageKey.toLowerCase(); }) @@ -42433,7 +43638,7 @@ function accessListify$2(value) { return value.map((set, index) => { if (Array.isArray(set)) { if (set.length > 2) { - logger$9$2.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set); + logger$8$2.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set); } return accessSetify$2(set[0], set[1]); } @@ -42458,10 +43663,10 @@ function _serializeEip1559$1(transaction, signature) { // EIP-1559 fees; otherwise they may not understand what they // think they are setting in terms of fee. if (transaction.gasPrice != null) { - const gasPrice = BigNumber$1$1.from(transaction.gasPrice); - const maxFeePerGas = BigNumber$1$1.from(transaction.maxFeePerGas || 0); + const gasPrice = BigNumber$2.from(transaction.gasPrice); + const maxFeePerGas = BigNumber$2.from(transaction.maxFeePerGas || 0); if (!gasPrice.eq(maxFeePerGas)) { - logger$9$2.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + logger$8$2.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { gasPrice, maxFeePerGas }); } @@ -42513,7 +43718,7 @@ function _parseEipSignature$1(tx, fields, serialize) { tx.v = recid; } catch (error) { - logger$9$2.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); + logger$8$2.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); } tx.r = hexZeroPad$2(fields[1], 32); tx.s = hexZeroPad$2(fields[2], 32); @@ -42526,9 +43731,9 @@ function _parseEipSignature$1(tx, fields, serialize) { } } function _parseEip1559$1(payload) { - const transaction = decode$1$1(payload.slice(1)); + const transaction = decode$2$1(payload.slice(1)); if (transaction.length !== 9 && transaction.length !== 12) { - logger$9$2.throwArgumentError("invalid component count for transaction type: 2", "payload", hexlify$2(payload)); + logger$8$2.throwArgumentError("invalid component count for transaction type: 2", "payload", hexlify$2(payload)); } const maxPriorityFeePerGas = handleNumber$1(transaction[2]); const maxFeePerGas = handleNumber$1(transaction[3]); @@ -42554,9 +43759,9 @@ function _parseEip1559$1(payload) { return tx; } function _parseEip2930$1(payload) { - const transaction = decode$1$1(payload.slice(1)); + const transaction = decode$2$1(payload.slice(1)); if (transaction.length !== 8 && transaction.length !== 11) { - logger$9$2.throwArgumentError("invalid component count for transaction type: 1", "payload", hexlify$2(payload)); + logger$8$2.throwArgumentError("invalid component count for transaction type: 1", "payload", hexlify$2(payload)); } const tx = { type: 1, @@ -42579,9 +43784,9 @@ function _parseEip2930$1(payload) { } // Legacy Transactions and EIP-155 function _parse$1(rawTransaction) { - const transaction = decode$1$1(rawTransaction); + const transaction = decode$2$1(rawTransaction); if (transaction.length !== 9 && transaction.length !== 6) { - logger$9$2.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); + logger$8$2.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); } const tx = { nonce: handleNumber$1(transaction[0]).toNumber(), @@ -42597,7 +43802,7 @@ function _parse$1(rawTransaction) { return tx; } try { - tx.v = BigNumber$1$1.from(transaction[6]).toNumber(); + tx.v = BigNumber$2.from(transaction[6]).toNumber(); } catch (error) { console.log(error); @@ -42605,13 +43810,13 @@ function _parse$1(rawTransaction) { } tx.r = hexZeroPad$2(transaction[7], 32); tx.s = hexZeroPad$2(transaction[8], 32); - if (BigNumber$1$1.from(tx.r).isZero() && BigNumber$1$1.from(tx.s).isZero()) { + if (BigNumber$2.from(tx.r).isZero() && BigNumber$2.from(tx.s).isZero()) { // EIP-155 unsigned transaction tx.chainId = tx.v; tx.v = 0; } else { - // Signed Tranasaction + // Signed Transaction tx.chainId = Math.floor((tx.v - 35) / 2); if (tx.chainId < 0) { tx.chainId = 0; @@ -42649,13 +43854,13 @@ function parse$1(rawTransaction) { case 2: return _parseEip1559$1(payload); } - return logger$9$2.throwError(`unsupported transaction type: ${payload[0]}`, Logger$2.errors.UNSUPPORTED_OPERATION, { + return logger$8$2.throwError(`unsupported transaction type: ${payload[0]}`, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "parseTransaction", transactionType: payload[0] }); } -const version$6$2 = "contracts/5.4.1"; +const version$5$2 = "contracts/5.6.0"; var __awaiter$4$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -42666,23 +43871,26 @@ var __awaiter$4$1 = function (thisArg, _arguments, P, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$8$2 = new Logger$2(version$6$2); +const logger$7$2 = new Logger$2(version$5$2); function resolveName$1(resolver, nameOrPromise) { return __awaiter$4$1(this, void 0, void 0, function* () { const name = yield nameOrPromise; + if (typeof (name) !== "string") { + logger$7$2.throwArgumentError("invalid address or ENS name", "name", name); + } // If it is already an address, just use it (after adding checksum) try { return getAddress$2(name); } catch (error) { } if (!resolver) { - logger$8$2.throwError("a provider or signer is needed to resolve ENS names", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("a provider or signer is needed to resolve ENS names", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "resolveName" }); } const address = yield resolver.resolveName(name); if (address == null) { - logger$8$2.throwArgumentError("resolver or addr is not configured for ENS name", "name", name); + logger$7$2.throwArgumentError("resolver or addr is not configured for ENS name", "name", name); } return address; }); @@ -42703,7 +43911,10 @@ function resolveAddresses$1(resolver, value, paramType) { } if (paramType.baseType === "array") { if (!Array.isArray(value)) { - return Promise.reject(new Error("invalid value for array")); + return Promise.reject(logger$7$2.makeError("invalid value for array", Logger$2.errors.INVALID_ARGUMENT, { + argument: "value", + value + })); } return yield Promise.all(value.map((v) => resolveAddresses$1(resolver, v, paramType.arrayChildren))); } @@ -42718,7 +43929,7 @@ function populateTransaction$1(contract, fragment, args) { overrides = shallowCopy$2(args.pop()); } // Make sure the parameter count matches - logger$8$2.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); + logger$7$2.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); // Populate "from" override (allow promises) if (contract.signer) { if (overrides.from) { @@ -42729,7 +43940,7 @@ function populateTransaction$1(contract, fragment, args) { signer: contract.signer.getAddress() }).then((check) => __awaiter$4$1(this, void 0, void 0, function* () { if (getAddress$2(check.signer) !== check.override) { - logger$8$2.throwError("Contract with a Signer cannot override from", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("Contract with a Signer cannot override from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "overrides.from" }); } @@ -42763,19 +43974,19 @@ function populateTransaction$1(contract, fragment, args) { const ro = resolved.overrides; // Populate simple overrides if (ro.nonce != null) { - tx.nonce = BigNumber$1$1.from(ro.nonce).toNumber(); + tx.nonce = BigNumber$2.from(ro.nonce).toNumber(); } if (ro.gasLimit != null) { - tx.gasLimit = BigNumber$1$1.from(ro.gasLimit); + tx.gasLimit = BigNumber$2.from(ro.gasLimit); } if (ro.gasPrice != null) { - tx.gasPrice = BigNumber$1$1.from(ro.gasPrice); + tx.gasPrice = BigNumber$2.from(ro.gasPrice); } if (ro.maxFeePerGas != null) { - tx.maxFeePerGas = BigNumber$1$1.from(ro.maxFeePerGas); + tx.maxFeePerGas = BigNumber$2.from(ro.maxFeePerGas); } if (ro.maxPriorityFeePerGas != null) { - tx.maxPriorityFeePerGas = BigNumber$1$1.from(ro.maxPriorityFeePerGas); + tx.maxPriorityFeePerGas = BigNumber$2.from(ro.maxPriorityFeePerGas); } if (ro.from != null) { tx.from = ro.from; @@ -42788,7 +43999,7 @@ function populateTransaction$1(contract, fragment, args) { } // If there was no "gasLimit" override, but the ABI specifies a default, use it if (tx.gasLimit == null && fragment.gas != null) { - // Conmpute the intrinisic gas cost for this transaction + // Compute the intrinsic gas cost for this transaction // @TODO: This is based on the yellow paper as of Petersburg; this is something // we may wish to parameterize in v6 as part of the Network object. Since this // is always a non-nil to address, we can ignore G_create, but may wish to add @@ -42801,20 +44012,26 @@ function populateTransaction$1(contract, fragment, args) { intrinsic += 64; } } - tx.gasLimit = BigNumber$1$1.from(fragment.gas).add(intrinsic); + tx.gasLimit = BigNumber$2.from(fragment.gas).add(intrinsic); } // Populate "value" override if (ro.value) { - const roValue = BigNumber$1$1.from(ro.value); + const roValue = BigNumber$2.from(ro.value); if (!roValue.isZero() && !fragment.payable) { - logger$8$2.throwError("non-payable method cannot override value", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("non-payable method cannot override value", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "overrides.value", value: overrides.value }); } tx.value = roValue; } - // Remvoe the overrides + if (ro.customData) { + tx.customData = shallowCopy$2(ro.customData); + } + if (ro.ccipReadEnabled) { + tx.ccipReadEnabled = !!ro.ccipReadEnabled; + } + // Remove the overrides delete overrides.nonce; delete overrides.gasLimit; delete overrides.gasPrice; @@ -42824,11 +44041,13 @@ function populateTransaction$1(contract, fragment, args) { delete overrides.accessList; delete overrides.maxFeePerGas; delete overrides.maxPriorityFeePerGas; + delete overrides.customData; + delete overrides.ccipReadEnabled; // Make sure there are no stray overrides, which may indicate a // typo or using an unsupported key. const leftovers = Object.keys(overrides).filter((key) => (overrides[key] != null)); if (leftovers.length) { - logger$8$2.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "overrides", overrides: leftovers }); @@ -42846,7 +44065,7 @@ function buildEstimate$1(contract, fragment) { return function (...args) { return __awaiter$4$1(this, void 0, void 0, function* () { if (!signerOrProvider) { - logger$8$2.throwError("estimate require a provider or signer", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("estimate require a provider or signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); } @@ -42855,6 +44074,43 @@ function buildEstimate$1(contract, fragment) { }); }; } +function addContractWait$1(contract, tx) { + const wait = tx.wait.bind(tx); + tx.wait = (confirmations) => { + return wait(confirmations).then((receipt) => { + receipt.events = receipt.logs.map((log) => { + let event = deepCopy$2(log); + let parsed = null; + try { + parsed = contract.interface.parseLog(log); + } + catch (e) { } + // Successfully parsed the event log; include it + if (parsed) { + event.args = parsed.args; + event.decode = (data, topics) => { + return contract.interface.decodeEventLog(parsed.eventFragment, data, topics); + }; + event.event = parsed.name; + event.eventSignature = parsed.signature; + } + // Useful operations + event.removeListener = () => { return contract.provider; }; + event.getBlock = () => { + return contract.provider.getBlock(receipt.blockHash); + }; + event.getTransaction = () => { + return contract.provider.getTransaction(receipt.transactionHash); + }; + event.getTransactionReceipt = () => { + return Promise.resolve(receipt); + }; + return event; + }); + return receipt; + }); + }; +} function buildCall$1(contract, fragment, collapseSimple) { const signerOrProvider = (contract.signer || contract.provider); return function (...args) { @@ -42898,52 +44154,18 @@ function buildSend$1(contract, fragment) { return function (...args) { return __awaiter$4$1(this, void 0, void 0, function* () { if (!contract.signer) { - logger$8$2.throwError("sending a transaction requires a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("sending a transaction requires a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); } - // If the contract was just deployed, wait until it is minded + // If the contract was just deployed, wait until it is mined if (contract.deployTransaction != null) { yield contract._deployed(); } const txRequest = yield populateTransaction$1(contract, fragment, args); const tx = yield contract.signer.sendTransaction(txRequest); - // Tweak the tw.wait so the receipt has extra properties - const wait = tx.wait.bind(tx); - tx.wait = (confirmations) => { - return wait(confirmations).then((receipt) => { - receipt.events = receipt.logs.map((log) => { - let event = deepCopy$2(log); - let parsed = null; - try { - parsed = contract.interface.parseLog(log); - } - catch (e) { } - // Successfully parsed the event log; include it - if (parsed) { - event.args = parsed.args; - event.decode = (data, topics) => { - return contract.interface.decodeEventLog(parsed.eventFragment, data, topics); - }; - event.event = parsed.name; - event.eventSignature = parsed.signature; - } - // Useful operations - event.removeListener = () => { return contract.provider; }; - event.getBlock = () => { - return contract.provider.getBlock(receipt.blockHash); - }; - event.getTransaction = () => { - return contract.provider.getTransaction(receipt.transactionHash); - }; - event.getTransactionReceipt = () => { - return Promise.resolve(receipt); - }; - return event; - }); - return receipt; - }); - }; + // Tweak the tx.wait so the receipt has extra properties + addContractWait$1(contract, tx); return tx; }); }; @@ -43022,7 +44244,7 @@ class ErrorRunningEvent$1 extends RunningEvent$1 { // or have a common abstract super class, with enough constructor // options to configure both. // A Fragment Event will populate all the properties that Wildcard -// will, and additioanlly dereference the arguments when emitting +// will, and additionally dereference the arguments when emitting class FragmentRunningEvent$1 extends RunningEvent$1 { constructor(address, contractInterface, fragment, topics) { const filter = { @@ -43031,7 +44253,7 @@ class FragmentRunningEvent$1 extends RunningEvent$1 { let topic = contractInterface.getEventTopic(fragment); if (topics) { if (topic !== topics[0]) { - logger$8$2.throwArgumentError("topic mismatch", "topics", topics); + logger$7$2.throwArgumentError("topic mismatch", "topics", topics); } filter.topics = topics.slice(); } @@ -43068,7 +44290,7 @@ class FragmentRunningEvent$1 extends RunningEvent$1 { return args; } } -// A Wildard Event will attempt to populate: +// A Wildcard Event will attempt to populate: // - event The name of the event name // - eventSignature The full signature of the event // - decode A function to decode data and topics @@ -43097,10 +44319,10 @@ class WildcardRunningEvent$1 extends RunningEvent$1 { } class BaseContract$1 { constructor(addressOrName, contractInterface, signerOrProvider) { - logger$8$2.checkNew(new.target, Contract$1); + logger$7$2.checkNew(new.target, Contract$1); // @TODO: Maybe still check the addressOrName looks like a valid address or name? //address = getAddress(address); - defineReadOnly$2(this, "interface", getStatic$2((new.target), "getInterface")(contractInterface)); + defineReadOnly$2(this, "interface", getStatic$2(new.target, "getInterface")(contractInterface)); if (signerOrProvider == null) { defineReadOnly$2(this, "provider", null); defineReadOnly$2(this, "signer", null); @@ -43114,7 +44336,7 @@ class BaseContract$1 { defineReadOnly$2(this, "signer", null); } else { - logger$8$2.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); + logger$7$2.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); } defineReadOnly$2(this, "callStatic", {}); defineReadOnly$2(this, "estimateGas", {}); @@ -43142,14 +44364,14 @@ class BaseContract$1 { defineReadOnly$2(this.filters, name, this.filters[filters[0]]); } else { - logger$8$2.warn(`Duplicate definition of ${name} (${filters.join(", ")})`); + logger$7$2.warn(`Duplicate definition of ${name} (${filters.join(", ")})`); } }); } defineReadOnly$2(this, "_runningEvents", {}); defineReadOnly$2(this, "_wrappedEmits", {}); if (addressOrName == null) { - logger$8$2.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); + logger$7$2.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); } defineReadOnly$2(this, "address", addressOrName); if (this.provider) { @@ -43161,11 +44383,13 @@ class BaseContract$1 { } catch (error) { // Without a provider, we cannot use ENS names - logger$8$2.throwError("provider is required to use ENS name as contract address", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("provider is required to use ENS name as contract address", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new Contract" }); } } + // Swallow bad ENS names to prevent Unhandled Exceptions + this.resolvedAddress.catch((e) => { }); const uniqueNames = {}; const uniqueSignatures = {}; Object.keys(this.interface.functions).forEach((signature) => { @@ -43173,7 +44397,7 @@ class BaseContract$1 { // Check that the signature is unique; if not the ABI generation has // not been cleaned or may be incorrectly generated if (uniqueSignatures[signature]) { - logger$8$2.warn(`Duplicate ABI entry for ${JSON.stringify(signature)}`); + logger$7$2.warn(`Duplicate ABI entry for ${JSON.stringify(signature)}`); return; } uniqueSignatures[signature] = true; @@ -43181,10 +44405,10 @@ class BaseContract$1 { // are ambiguous { const name = fragment.name; - if (!uniqueNames[name]) { - uniqueNames[name] = []; + if (!uniqueNames[`%${name}`]) { + uniqueNames[`%${name}`] = []; } - uniqueNames[name].push(signature); + uniqueNames[`%${name}`].push(signature); } if (this[signature] == null) { defineReadOnly$2(this, signature, buildDefault$1(this, fragment, true)); @@ -43211,6 +44435,8 @@ class BaseContract$1 { if (signatures.length > 1) { return; } + // Strip off the leading "%" used for prototype protection + name = name.substring(1); const signature = signatures[0]; // If overwriting a member property that is null, swallow the error try { @@ -43260,7 +44486,7 @@ class BaseContract$1 { // Otherwise, poll for our code to be deployed this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code) => { if (code === "0x") { - logger$8$2.throwError("contract not deployed", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("contract not deployed", Logger$2.errors.UNSUPPORTED_OPERATION, { contractAddress: this.address, operation: "getDeployed" }); @@ -43277,14 +44503,14 @@ class BaseContract$1 { // estimateDeploy(bytecode: string, ...args): Promise fallback(overrides) { if (!this.signer) { - logger$8$2.throwError("sending a transactions require a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); + logger$7$2.throwError("sending a transactions require a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); } const tx = shallowCopy$2(overrides || {}); ["from", "to"].forEach(function (key) { if (tx[key] == null) { return; } - logger$8$2.throwError("cannot override " + key, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: key }); + logger$7$2.throwError("cannot override " + key, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: key }); }); tx.to = this.resolvedAddress; return this.deployed().then(() => { @@ -43387,7 +44613,7 @@ class BaseContract$1 { } _addEventListener(runningEvent, listener, once) { if (!this.provider) { - logger$8$2.throwError("events require a provider or a signer with a provider", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "once" }); + logger$7$2.throwError("events require a provider or a signer with a provider", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "once" }); } runningEvent.addListener(listener, once); // Track this running event and its listeners (may already be there; but no hard in updating) @@ -43427,7 +44653,7 @@ class BaseContract$1 { const filter = shallowCopy$2(runningEvent.filter); if (typeof (fromBlockOrBlockhash) === "string" && isHexString$2(fromBlockOrBlockhash, 32)) { if (toBlock != null) { - logger$8$2.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock); + logger$7$2.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock); } filter.blockHash = fromBlockOrBlockhash; } @@ -43517,286 +44743,6 @@ class BaseContract$1 { class Contract$1 extends BaseContract$1 { } -const version$5$2 = "bignumber/5.4.2"; - -var BN$2 = bn$2.BN; -const logger$7$2 = new Logger$2(version$5$2); -const _constructorGuard$1$2 = {}; -const MAX_SAFE$2 = 0x1fffffffffffff; -// Only warn about passing 10 into radix once -let _warnedToStringRadix$2 = false; -class BigNumber$2 { - constructor(constructorGuard, hex) { - logger$7$2.checkNew(new.target, BigNumber$2); - if (constructorGuard !== _constructorGuard$1$2) { - logger$7$2.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { - operation: "new (BigNumber)" - }); - } - this._hex = hex; - this._isBigNumber = true; - Object.freeze(this); - } - fromTwos(value) { - return toBigNumber$2(toBN$2(this).fromTwos(value)); - } - toTwos(value) { - return toBigNumber$2(toBN$2(this).toTwos(value)); - } - abs() { - if (this._hex[0] === "-") { - return BigNumber$2.from(this._hex.substring(1)); - } - return this; - } - add(other) { - return toBigNumber$2(toBN$2(this).add(toBN$2(other))); - } - sub(other) { - return toBigNumber$2(toBN$2(this).sub(toBN$2(other))); - } - div(other) { - const o = BigNumber$2.from(other); - if (o.isZero()) { - throwFault$3("division by zero", "div"); - } - return toBigNumber$2(toBN$2(this).div(toBN$2(other))); - } - mul(other) { - return toBigNumber$2(toBN$2(this).mul(toBN$2(other))); - } - mod(other) { - const value = toBN$2(other); - if (value.isNeg()) { - throwFault$3("cannot modulo negative values", "mod"); - } - return toBigNumber$2(toBN$2(this).umod(value)); - } - pow(other) { - const value = toBN$2(other); - if (value.isNeg()) { - throwFault$3("cannot raise to negative values", "pow"); - } - return toBigNumber$2(toBN$2(this).pow(value)); - } - and(other) { - const value = toBN$2(other); - if (this.isNegative() || value.isNeg()) { - throwFault$3("cannot 'and' negative values", "and"); - } - return toBigNumber$2(toBN$2(this).and(value)); - } - or(other) { - const value = toBN$2(other); - if (this.isNegative() || value.isNeg()) { - throwFault$3("cannot 'or' negative values", "or"); - } - return toBigNumber$2(toBN$2(this).or(value)); - } - xor(other) { - const value = toBN$2(other); - if (this.isNegative() || value.isNeg()) { - throwFault$3("cannot 'xor' negative values", "xor"); - } - return toBigNumber$2(toBN$2(this).xor(value)); - } - mask(value) { - if (this.isNegative() || value < 0) { - throwFault$3("cannot mask negative values", "mask"); - } - return toBigNumber$2(toBN$2(this).maskn(value)); - } - shl(value) { - if (this.isNegative() || value < 0) { - throwFault$3("cannot shift negative values", "shl"); - } - return toBigNumber$2(toBN$2(this).shln(value)); - } - shr(value) { - if (this.isNegative() || value < 0) { - throwFault$3("cannot shift negative values", "shr"); - } - return toBigNumber$2(toBN$2(this).shrn(value)); - } - eq(other) { - return toBN$2(this).eq(toBN$2(other)); - } - lt(other) { - return toBN$2(this).lt(toBN$2(other)); - } - lte(other) { - return toBN$2(this).lte(toBN$2(other)); - } - gt(other) { - return toBN$2(this).gt(toBN$2(other)); - } - gte(other) { - return toBN$2(this).gte(toBN$2(other)); - } - isNegative() { - return (this._hex[0] === "-"); - } - isZero() { - return toBN$2(this).isZero(); - } - toNumber() { - try { - return toBN$2(this).toNumber(); - } - catch (error) { - throwFault$3("overflow", "toNumber", this.toString()); - } - return null; - } - toBigInt() { - try { - return BigInt(this.toString()); - } - catch (e) { } - return logger$7$2.throwError("this platform does not support BigInt", Logger$2.errors.UNSUPPORTED_OPERATION, { - value: this.toString() - }); - } - toString() { - // Lots of people expect this, which we do not support, so check (See: #889) - if (arguments.length > 0) { - if (arguments[0] === 10) { - if (!_warnedToStringRadix$2) { - _warnedToStringRadix$2 = true; - logger$7$2.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); - } - } - else if (arguments[0] === 16) { - logger$7$2.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); - } - else { - logger$7$2.throwError("BigNumber.toString does not accept parameters", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); - } - } - return toBN$2(this).toString(10); - } - toHexString() { - return this._hex; - } - toJSON(key) { - return { type: "BigNumber", hex: this.toHexString() }; - } - static from(value) { - if (value instanceof BigNumber$2) { - return value; - } - if (typeof (value) === "string") { - if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber$2(_constructorGuard$1$2, toHex$3(value)); - } - if (value.match(/^-?[0-9]+$/)) { - return new BigNumber$2(_constructorGuard$1$2, toHex$3(new BN$2(value))); - } - return logger$7$2.throwArgumentError("invalid BigNumber string", "value", value); - } - if (typeof (value) === "number") { - if (value % 1) { - throwFault$3("underflow", "BigNumber.from", value); - } - if (value >= MAX_SAFE$2 || value <= -MAX_SAFE$2) { - throwFault$3("overflow", "BigNumber.from", value); - } - return BigNumber$2.from(String(value)); - } - const anyValue = value; - if (typeof (anyValue) === "bigint") { - return BigNumber$2.from(anyValue.toString()); - } - if (isBytes$2(anyValue)) { - return BigNumber$2.from(hexlify$2(anyValue)); - } - if (anyValue) { - // Hexable interface (takes piority) - if (anyValue.toHexString) { - const hex = anyValue.toHexString(); - if (typeof (hex) === "string") { - return BigNumber$2.from(hex); - } - } - else { - // For now, handle legacy JSON-ified values (goes away in v6) - let hex = anyValue._hex; - // New-form JSON - if (hex == null && anyValue.type === "BigNumber") { - hex = anyValue.hex; - } - if (typeof (hex) === "string") { - if (isHexString$2(hex) || (hex[0] === "-" && isHexString$2(hex.substring(1)))) { - return BigNumber$2.from(hex); - } - } - } - } - return logger$7$2.throwArgumentError("invalid BigNumber value", "value", value); - } - static isBigNumber(value) { - return !!(value && value._isBigNumber); - } -} -// Normalize the hex string -function toHex$3(value) { - // For BN, call on the hex string - if (typeof (value) !== "string") { - return toHex$3(value.toString(16)); - } - // If negative, prepend the negative sign to the normalized positive value - if (value[0] === "-") { - // Strip off the negative sign - value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") - if (value[0] === "-") { - logger$7$2.throwArgumentError("invalid hex", "value", value); - } - // Call toHex on the positive component - value = toHex$3(value); - // Do not allow "-0x00" - if (value === "0x00") { - return value; - } - // Negate the value - return "-" + value; - } - // Add a "0x" prefix if missing - if (value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - // Normalize zero - if (value === "0x") { - return "0x00"; - } - // Make the string even length - if (value.length % 2) { - value = "0x0" + value.substring(2); - } - // Trim to smallest even-length string - while (value.length > 4 && value.substring(0, 4) === "0x00") { - value = "0x" + value.substring(4); - } - return value; -} -function toBigNumber$2(value) { - return BigNumber$2.from(toHex$3(value)); -} -function toBN$2(value) { - const hex = BigNumber$2.from(value).toHexString(); - if (hex[0] === "-") { - return (new BN$2("-" + hex.substring(3), 16)); - } - return new BN$2(hex.substring(2), 16); -} -function throwFault$3(fault, operation, value) { - const params = { fault: fault, operation: operation }; - if (value != null) { - params.value = value; - } - return logger$7$2.throwError(fault, Logger$2.errors.NUMERIC_FAULT, params); -} - /** * var basex = require("base-x"); * @@ -43913,14 +44859,14 @@ const Base58$1 = new BaseX$1("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqr //console.log(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj")) //console.log(Base58.encode(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj"))) -const version$4$2 = "sha2/5.4.0"; +const version$4$2 = "sha2/5.6.0"; new Logger$2(version$4$2); function sha256$2(data) { return "0x" + (hash$1.sha256().update(arrayify$2(data)).digest("hex")); } -const version$3$2 = "networks/5.4.2"; +const version$3$2 = "networks/5.6.2"; const logger$6$2 = new Logger$2(version$3$2); function isRenetworkable$1(value) { @@ -43932,44 +44878,50 @@ function ethDefaultProvider$1(network) { options = {}; } const providerList = []; - if (providers.InfuraProvider) { + if (providers.InfuraProvider && options.infura !== "-") { try { providerList.push(new providers.InfuraProvider(network, options.infura)); } catch (error) { } } - if (providers.EtherscanProvider) { + if (providers.EtherscanProvider && options.etherscan !== "-") { try { providerList.push(new providers.EtherscanProvider(network, options.etherscan)); } catch (error) { } } - if (providers.AlchemyProvider) { + if (providers.AlchemyProvider && options.alchemy !== "-") { try { providerList.push(new providers.AlchemyProvider(network, options.alchemy)); } catch (error) { } } - if (providers.PocketProvider) { + if (providers.PocketProvider && options.pocket !== "-") { // These networks are currently faulty on Pocket as their // network does not handle the Berlin hardfork, which is // live on these ones. // @TODO: This goes away once Pocket has upgraded their nodes const skip = ["goerli", "ropsten", "rinkeby"]; try { - const provider = new providers.PocketProvider(network); + const provider = new providers.PocketProvider(network, options.pocket); if (provider.network && skip.indexOf(provider.network.name) === -1) { providerList.push(provider); } } catch (error) { } } - if (providers.CloudflareProvider) { + if (providers.CloudflareProvider && options.cloudflare !== "-") { try { providerList.push(new providers.CloudflareProvider(network)); } catch (error) { } } + if (providers.AnkrProvider && options.ankr !== "-") { + try { + providerList.push(new providers.AnkrProvider(network, options.ankr)); + } + catch (error) { } + } if (providerList.length === 0) { return null; } @@ -44019,6 +44971,7 @@ const classicMordor$1 = { name: "classicMordor", _defaultProvider: etcDefaultProvider$1("https://www.ethercluster.com/mordor", "classicMordor") }; +// See: https://chainlist.org const networks$1 = { unspecified: { chainId: 0, name: "unspecified" }, homestead: homestead$1, @@ -44043,6 +44996,7 @@ const networks$1 = { name: "goerli", _defaultProvider: ethDefaultProvider$1("goerli") }, + kintsugi: { chainId: 1337702, name: "kintsugi" }, // ETC (See: #351) classic: { chainId: 61, @@ -44060,6 +45014,11 @@ const networks$1 = { xdai: { chainId: 100, name: "xdai" }, matic: { chainId: 137, name: "matic" }, maticmum: { chainId: 80001, name: "maticmum" }, + optimism: { chainId: 10, name: "optimism" }, + "optimism-kovan": { chainId: 69, name: "optimism-kovan" }, + "optimism-goerli": { chainId: 420, name: "optimism-goerli" }, + arbitrum: { chainId: 42161, name: "arbitrum" }, + "arbitrum-rinkeby": { chainId: 421611, name: "arbitrum-rinkeby" }, bnb: { chainId: 56, name: "bnb" }, bnbt: { chainId: 97, name: "bnbt" }, }; @@ -44135,6 +45094,14 @@ function getNetwork$1(network) { }; } +function decode$1$1(textData) { + textData = atob(textData); + const data = []; + for (let i = 0; i < textData.length; i++) { + data.push(textData.charCodeAt(i)); + } + return arrayify$2(data); +} function encode$1$1(data) { data = arrayify$2(data); let textData = ""; @@ -44144,7 +45111,7 @@ function encode$1$1(data) { return btoa(textData); } -const version$2$2 = "web/5.4.0"; +const version$2$2 = "web/5.6.0"; var __awaiter$3$2 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -44164,12 +45131,14 @@ function getUrl$1(href, options) { method: (options.method || "GET"), headers: (options.headers || {}), body: (options.body || undefined), - mode: "cors", - cache: "no-cache", - credentials: "same-origin", - redirect: "follow", - referrer: "client", // no-referrer, *client }; + if (options.skipFetchSetup !== true) { + request.mode = "cors"; // no-cors, cors, *same-origin + request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached + request.credentials = "same-origin"; // include, *same-origin, omit + request.redirect = "follow"; // manual, *follow, error + request.referrer = "client"; // no-referrer, *client + } const response = yield fetch(href, request); const body = yield response.arrayBuffer(); const headers = {}; @@ -44238,6 +45207,7 @@ function _fetchData$1(connection, body, processFunc) { const throttleCallback = ((typeof (connection) === "object") ? connection.throttleCallback : null); const throttleSlotInterval = ((typeof (connection) === "object" && typeof (connection.throttleSlotInterval) === "number") ? connection.throttleSlotInterval : 100); logger$5$2.assertArgument((throttleSlotInterval > 0 && (throttleSlotInterval % 1) === 0), "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval); + const errorPassThrough = ((typeof (connection) === "object") ? !!(connection.errorPassThrough) : false); const headers = {}; let url = null; // @TODO: Allow ConnectionInfo to override some of these values @@ -44276,6 +45246,35 @@ function _fetchData$1(connection, body, processFunc) { value: "Basic " + encode$1$1(toUtf8Bytes$2(authorization)) }; } + if (connection.skipFetchSetup != null) { + options.skipFetchSetup = !!connection.skipFetchSetup; + } + } + const reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i"); + const dataMatch = ((url) ? url.match(reData) : null); + if (dataMatch) { + try { + const response = { + statusCode: 200, + statusMessage: "OK", + headers: { "content-type": dataMatch[1] }, + body: decode$1$1(dataMatch[2]) + }; + let result = response.body; + if (processFunc) { + result = processFunc(response.body, response); + } + return Promise.resolve(result); + } + catch (error) { + logger$5$2.throwError("processing response error", Logger$2.errors.SERVER_ERROR, { + body: bodyify$1(dataMatch[1], dataMatch[2]), + error: error, + requestBody: null, + requestMethod: "GET", + url: url + }); + } } if (body) { options.method = "POST"; @@ -44326,24 +45325,34 @@ function _fetchData$1(connection, body, processFunc) { let response = null; try { response = yield getUrl$1(url, options); - // Exponential back-off throttling - if (response.statusCode === 429 && attempt < attemptLimit) { - let tryAgain = true; - if (throttleCallback) { - tryAgain = yield throttleCallback(attempt, url); + if (attempt < attemptLimit) { + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirection; for now we only support absolute locataions + const location = response.headers.location || ""; + if (options.method === "GET" && location.match(/^https:/)) { + url = response.headers.location; + continue; + } } - if (tryAgain) { - let stall = 0; - const retryAfter = response.headers["retry-after"]; - if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { - stall = parseInt(retryAfter) * 1000; + else if (response.statusCode === 429) { + // Exponential back-off throttling + let tryAgain = true; + if (throttleCallback) { + tryAgain = yield throttleCallback(attempt, url); } - else { - stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + if (tryAgain) { + let stall = 0; + const retryAfter = response.headers["retry-after"]; + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1000; + } + else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + //console.log("Stalling 429"); + yield staller$1(stall); + continue; } - //console.log("Stalling 429"); - yield staller$1(stall); - continue; } } } @@ -44363,7 +45372,7 @@ function _fetchData$1(connection, body, processFunc) { if (allow304 && response.statusCode === 304) { body = null; } - else if (response.statusCode < 200 || response.statusCode >= 300) { + else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) { runningTimeout.cancel(); logger$5$2.throwError("bad response", Logger$2.errors.SERVER_ERROR, { status: response.statusCode, @@ -44405,7 +45414,7 @@ function _fetchData$1(connection, body, processFunc) { } } runningTimeout.cancel(); - // If we had a processFunc, it eitehr returned a T or threw above. + // If we had a processFunc, it either returned a T or threw above. // The "body" is now a Uint8Array. return body; } @@ -44652,7 +45661,7 @@ function decodeUnsafe$1 () { if (typeof res === 'object') return res } -function decode$2 (str) { +function decode$3 (str) { var res = __decode$1.apply(null, arguments); if (typeof res === 'object') return res @@ -44713,7 +45722,7 @@ function fromWords$1 (words) { var bech32$1 = { decodeUnsafe: decodeUnsafe$1, - decode: decode$2, + decode: decode$3, encode: encode$4, toWordsUnsafe: toWordsUnsafe$1, toWords: toWords$1, @@ -44721,7 +45730,7 @@ var bech32$1 = { fromWords: fromWords$1 }; -const version$1$2 = "providers/5.4.5"; +const version$1$2 = "providers/5.6.5"; const logger$4$2 = new Logger$2(version$1$2); class Formatter$1 { @@ -44808,7 +45817,7 @@ class Formatter$1 { type: type }; formats.block = { - hash: hash, + hash: Formatter$1.allowNull(hash), parentHash: hash, number: number, timestamp: number, @@ -44816,7 +45825,7 @@ class Formatter$1 { difficulty: this.difficulty.bind(this), gasLimit: bigNumber, gasUsed: bigNumber, - miner: address, + miner: Formatter$1.allowNull(address), extraData: data, transactions: Formatter$1.allowNull(Formatter$1.arrayOf(hash)), baseFeePerGas: Formatter$1.allowNull(bigNumber) @@ -44852,17 +45861,17 @@ class Formatter$1 { if (number === "0x") { return 0; } - return BigNumber$1$1.from(number).toNumber(); + return BigNumber$2.from(number).toNumber(); } type(number) { if (number === "0x" || number == null) { return 0; } - return BigNumber$1$1.from(number).toNumber(); + return BigNumber$2.from(number).toNumber(); } // Strict! Used on input. bigNumber(value) { - return BigNumber$1$1.from(value); + return BigNumber$2.from(value); } // Requires a boolean, "true" or "false"; returns a boolean boolean(value) { @@ -44942,7 +45951,7 @@ class Formatter$1 { if (value == null) { return null; } - const v = BigNumber$1$1.from(value); + const v = BigNumber$2.from(value); try { return v.toNumber(); } @@ -44959,7 +45968,11 @@ class Formatter$1 { if (value.author != null && value.miner == null) { value.miner = value.author; } - return Formatter$1.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$1.check(format, value); + result._difficulty = ((difficulty == null) ? null : BigNumber$2.from(difficulty)); + return result; } block(value) { return this._block(value, this.formats.block); @@ -44978,7 +45991,7 @@ class Formatter$1 { } // Some clients (TestRPC) do strange things like return 0x0 for the // 0 address; correct this to be a real address - if (transaction.to && BigNumber$1$1.from(transaction.to).isZero()) { + if (transaction.to && BigNumber$2.from(transaction.to).isZero()) { transaction.to = "0x0000000000000000000000000000000000000000"; } // Rename input to data @@ -44996,7 +46009,7 @@ class Formatter$1 { if (transaction.chainId != null) { let chainId = transaction.chainId; if (isHexString$2(chainId)) { - chainId = BigNumber$1$1.from(chainId).toNumber(); + chainId = BigNumber$2.from(chainId).toNumber(); } result.chainId = chainId; } @@ -45007,7 +46020,7 @@ class Formatter$1 { chainId = transaction.chainId; } if (isHexString$2(chainId)) { - chainId = BigNumber$1$1.from(chainId).toNumber(); + chainId = BigNumber$2.from(chainId).toNumber(); } if (typeof (chainId) !== "number" && result.v != null) { chainId = (result.v - 35) / 2; @@ -45039,7 +46052,7 @@ class Formatter$1 { if (result.root != null) { if (result.root.length <= 4) { // Could be 0x00, 0x0, 0x01 or 0x1 - const value = BigNumber$1$1.from(result.root).toNumber(); + const value = BigNumber$2.from(result.root).toNumber(); if (value === 0 || value === 1) { // Make sure if both are specified, they match if (result.status != null && (result.status !== value)) { @@ -45137,6 +46150,7 @@ var __awaiter$1$2 = function (thisArg, _arguments, P, generator) { }); }; const logger$3$2 = new Logger$2(version$1$2); +const MAX_CCIP_REDIRECTS$1 = 10; ////////////////////////////// // Event Serializeing function checkTopic$1(topic) { @@ -45237,6 +46251,8 @@ class Event$1 { defineReadOnly$2(this, "tag", tag); defineReadOnly$2(this, "listener", listener); defineReadOnly$2(this, "once", once); + this._lastBlockNumber = -2; + this._inflight = false; } get event() { switch (this.type) { @@ -45287,42 +46303,155 @@ const coinInfos$1 = { "700": { symbol: "xdai", ilk: "eth" }, }; function bytes32ify$1(value) { - return hexZeroPad$2(BigNumber$1$1.from(value).toHexString(), 32); + return hexZeroPad$2(BigNumber$2.from(value).toHexString(), 32); } // Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d) function base58Encode$1(data) { return Base58$1.encode(concat$2([data, hexDataSlice$2(sha256$2(sha256$2(data)), 0, 4)])); } +const matcherIpfs$1 = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers$1 = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs$1, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; +function _parseString$1(result, start) { + try { + return toUtf8String$2(_parseBytes$1(result, start)); + } + catch (error) { } + return null; +} +function _parseBytes$1(result, start) { + if (result === "0x") { + return null; + } + const offset = BigNumber$2.from(hexDataSlice$2(result, start, start + 32)).toNumber(); + const length = BigNumber$2.from(hexDataSlice$2(result, offset, offset + 32)).toNumber(); + return hexDataSlice$2(result, offset + 32, offset + 32 + length); +} +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink$1(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + logger$3$2.throwArgumentError("unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; +} +function numPad$1(value) { + const result = arrayify$2(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} +function bytesPad$1(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} +// ABI Encodes a series of (bytes, bytes, ...) +function encodeBytes$1(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(null); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = arrayify$2(datas[i]); + // Update the bytes offset + result[i] = numPad$1(byteCount); + // The length and padded value of data + result.push(numPad$1(data.length)); + result.push(bytesPad$1(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return hexConcat$2(result); +} class Resolver$1 { - constructor(provider, address, name) { + // The resolvedAddress is only for creating a ReverseLookup resolver + constructor(provider, address, name, resolvedAddress) { defineReadOnly$2(this, "provider", provider); defineReadOnly$2(this, "name", name); defineReadOnly$2(this, "address", provider.formatter.address(address)); + defineReadOnly$2(this, "_resolvedAddress", resolvedAddress); } - _fetchBytes(selector, parameters) { + supportsWildcard() { + if (!this._supportsEip2544) { + // supportsInterface(bytes4 = selector("resolve(bytes,bytes)")) + this._supportsEip2544 = this.provider.call({ + to: this.address, + data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000" + }).then((result) => { + return BigNumber$2.from(result).eq(1); + }).catch((error) => { + if (error.code === Logger$2.errors.CALL_EXCEPTION) { + return false; + } + // Rethrow the error: link is down, etc. Let future attempts retry. + this._supportsEip2544 = null; + throw error; + }); + } + return this._supportsEip2544; + } + _fetch(selector, parameters) { return __awaiter$1$2(this, void 0, void 0, function* () { - // keccak256("addr(bytes32,uint256)") - const transaction = { + // e.g. keccak256("addr(bytes32,uint256)") + const tx = { to: this.address, + ccipReadEnabled: true, data: hexConcat$2([selector, namehash$1(this.name), (parameters || "0x")]) }; + // Wildcard support; use EIP-2544 to resolve the request + let parseBytes = false; + if (yield this.supportsWildcard()) { + parseBytes = true; + // selector("resolve(bytes,bytes)") + tx.data = hexConcat$2(["0x9061b923", encodeBytes$1([dnsEncode$1(this.name), tx.data])]); + } try { - const result = yield this.provider.call(transaction); - if (result === "0x") { - return null; + let result = yield this.provider.call(tx); + if ((arrayify$2(result).length % 32) === 4) { + logger$3$2.throwError("resolver threw error", Logger$2.errors.CALL_EXCEPTION, { + transaction: tx, data: result + }); } - const offset = BigNumber$1$1.from(hexDataSlice$2(result, 0, 32)).toNumber(); - const length = BigNumber$1$1.from(hexDataSlice$2(result, offset, offset + 32)).toNumber(); - return hexDataSlice$2(result, offset + 32, offset + 32 + length); + if (parseBytes) { + result = _parseBytes$1(result, 0); + } + return result; } catch (error) { if (error.code === Logger$2.errors.CALL_EXCEPTION) { return null; } - return null; + throw error; } }); } + _fetchBytes(selector, parameters) { + return __awaiter$1$2(this, void 0, void 0, function* () { + const result = yield this._fetch(selector, parameters); + if (result != null) { + return _parseBytes$1(result, 0); + } + return null; + }); + } _getAddress(coinType, hexBytes) { const coinInfo = coinInfos$1[String(coinType)]; if (coinInfo == null) { @@ -45384,16 +46513,12 @@ class Resolver$1 { if (coinType === 60) { try { // keccak256("addr(bytes32)") - const transaction = { - to: this.address, - data: ("0x3b3b57de" + namehash$1(this.name).substring(2)) - }; - const hexBytes = yield this.provider.call(transaction); + const result = yield this._fetch("0x3b3b57de"); // No address - if (hexBytes === "0x" || hexBytes === HashZero$1) { + if (result === "0x" || result === HashZero$1) { return null; } - return this.provider.formatter.callAddress(hexBytes); + return this.provider.formatter.callAddress(result); } catch (error) { if (error.code === Logger$2.errors.CALL_EXCEPTION) { @@ -45420,6 +46545,119 @@ class Resolver$1 { return address; }); } + getAvatar() { + return __awaiter$1$2(this, void 0, void 0, function* () { + const linkage = [{ type: "name", content: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = yield this.getText("avatar"); + if (avatar == null) { + return null; + } + for (let i = 0; i < matchers$1.length; i++) { + const match = avatar.match(matchers$1[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + linkage.push({ type: "url", content: avatar }); + return { linkage, url: avatar }; + case "data": + linkage.push({ type: "data", content: avatar }); + return { linkage, url: avatar }; + case "ipfs": + linkage.push({ type: "ipfs", content: avatar }); + return { linkage, url: getIpfsLink$1(avatar) }; + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: scheme, content: avatar }); + // The owner of this name + const owner = (this._resolvedAddress || (yield this.getAddress())); + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return null; + } + const addr = yield this.provider.formatter.address(comps[0]); + const tokenId = hexZeroPad$2(BigNumber$2.from(comps[1]).toHexString(), 32); + // Check that this account owns the token + if (scheme === "erc721") { + // ownerOf(uint256 tokenId) + const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({ + to: addr, data: hexConcat$2(["0x6352211e", tokenId]) + })); + if (owner !== tokenOwner) { + return null; + } + linkage.push({ type: "owner", content: tokenOwner }); + } + else if (scheme === "erc1155") { + // balanceOf(address owner, uint256 tokenId) + const balance = BigNumber$2.from(yield this.provider.call({ + to: addr, data: hexConcat$2(["0x00fdd58e", hexZeroPad$2(owner, 32), tokenId]) + })); + if (balance.isZero()) { + return null; + } + linkage.push({ type: "balance", content: balance.toString() }); + } + // Call the token contract for the metadata URL + const tx = { + to: this.provider.formatter.address(comps[0]), + data: hexConcat$2([selector, tokenId]) + }; + let metadataUrl = _parseString$1(yield this.provider.call(tx), 0); + if (metadataUrl == null) { + return null; + } + linkage.push({ type: "metadata-url-base", content: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + linkage.push({ type: "metadata-url-expanded", content: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink$1(metadataUrl); + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + // Get the token metadata + const metadata = yield fetchJson$1(metadataUrl); + if (!metadata) { + return null; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + return null; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs$1); + if (ipfs == null) { + return null; + } + linkage.push({ type: "url-ipfs", content: imageUrl }); + imageUrl = getIpfsLink$1(imageUrl); + } + linkage.push({ type: "url", content: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return null; + }); + } getContentHash() { return __awaiter$1$2(this, void 0, void 0, function* () { // keccak256("contenthash()") @@ -45436,6 +46674,14 @@ class Resolver$1 { return "ipfs:/\/" + Base58$1.encode("0x" + ipfs[1]); } } + // IPNS (CID: 1, Type: libp2p-key) + const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipns) { + const length = parseInt(ipns[3], 16); + if (ipns[4].length === length * 2) { + return "ipns:/\/" + Base58$1.encode("0x" + ipns[1]); + } + } // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); if (swarm) { @@ -45486,6 +46732,7 @@ class BaseProvider$1 extends Provider$2 { // Events being listened to this._events = []; this._emitted = { block: -2 }; + this.disableCcipRead = false; this.formatter = new.target.getFormatter(); // If network is any, this Provider allows the underlying // network to change dynamically, and we auto-detect the @@ -45502,7 +46749,7 @@ class BaseProvider$1 extends Provider$2 { this._ready().catch((error) => { }); } else { - const knownNetwork = getStatic$2((new.target), "getNetwork")(network); + const knownNetwork = getStatic$2(new.target, "getNetwork")(network); if (knownNetwork) { defineReadOnly$2(this, "_network", knownNetwork); this.emit("network", knownNetwork, null); @@ -45513,6 +46760,7 @@ class BaseProvider$1 extends Provider$2 { } this._maxInternalBlockNumber = -1024; this._lastBlockNumber = -2; + this._maxFilterBlockRange = 10; this._pollingInterval = 4000; this._fastQueryDate = 0; } @@ -45551,7 +46799,7 @@ class BaseProvider$1 extends Provider$2 { } // This will always return the most recently established network. // For "any", this can change (a "network" event is emitted before - // any change is refelcted); otherwise this cannot change + // any change is reflected); otherwise this cannot change get ready() { return poll$1(() => { return this._ready().then((network) => { @@ -45576,6 +46824,40 @@ class BaseProvider$1 extends Provider$2 { static getNetwork(network) { return getNetwork$1((network == null) ? "homestead" : network); } + ccipReadFetch(tx, calldata, urls) { + return __awaiter$1$2(this, void 0, void 0, function* () { + if (this.disableCcipRead || urls.length === 0) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + const json = (url.indexOf("{data}") >= 0) ? null : JSON.stringify({ data, sender }); + const result = yield fetchJson$1({ url: href, errorPassThrough: true }, json, (value, response) => { + value.status = response.statusCode; + return value; + }); + if (result.data) { + return result.data; + } + const errorMessage = (result.message || "unknown error"); + // 4xx indicates the result is not present; stop + if (result.status >= 400 && result.status < 500) { + return logger$3$2.throwError(`response not found during CCIP fetch: ${errorMessage}`, Logger$2.errors.SERVER_ERROR, { url, errorMessage }); + } + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + return logger$3$2.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, Logger$2.errors.SERVER_ERROR, { + urls, errorMessages + }); + }); + } // Fetches the blockNumber, but will reuse any result that is less // than maxAge old or has been requested since the last request _getInternalBlockNumber(maxAge) { @@ -45620,7 +46902,7 @@ class BaseProvider$1 extends Provider$2 { throw networkError; } const respTime = getTime$1(); - blockNumber = BigNumber$1$1.from(blockNumber).toNumber(); + blockNumber = BigNumber$2.from(blockNumber).toNumber(); if (blockNumber < this._maxInternalBlockNumber) { blockNumber = this._maxInternalBlockNumber; } @@ -45723,20 +47005,44 @@ class BaseProvider$1 extends Provider$2 { break; } case "filter": { - const filter = event.filter; - filter.fromBlock = this._lastBlockNumber + 1; - filter.toBlock = blockNumber; - const runner = this.getLogs(filter).then((logs) => { - if (logs.length === 0) { - return; + // We only allow a single getLogs to be in-flight at a time + if (!event._inflight) { + event._inflight = true; + // Filter from the last known event; due to load-balancing + // and some nodes returning updated block numbers before + // indexing events, a logs result with 0 entries cannot be + // trusted and we must retry a range which includes it again + const filter = event.filter; + filter.fromBlock = event._lastBlockNumber + 1; + filter.toBlock = blockNumber; + // Prevent fitler ranges from growing too wild + if (filter.toBlock - this._maxFilterBlockRange > filter.fromBlock) { + filter.fromBlock = filter.toBlock - this._maxFilterBlockRange; } - logs.forEach((log) => { - this._emitted["b:" + log.blockHash] = log.blockNumber; - this._emitted["t:" + log.transactionHash] = log.blockNumber; - this.emit(filter, log); + const runner = this.getLogs(filter).then((logs) => { + // Allow the next getLogs + event._inflight = false; + if (logs.length === 0) { + return; + } + logs.forEach((log) => { + // Only when we get an event for a given block number + // can we trust the events are indexed + if (log.blockNumber > event._lastBlockNumber) { + event._lastBlockNumber = log.blockNumber; + } + // Make sure we stall requests to fetch blocks and txs + this._emitted["b:" + log.blockHash] = log.blockNumber; + this._emitted["t:" + log.transactionHash] = log.blockNumber; + this.emit(filter, log); + }); + }).catch((error) => { + this.emit("error", error); + // Allow another getLogs (the range was not updated) + event._inflight = false; }); - }).catch((error) => { this.emit("error", error); }); - runners.push(runner); + runners.push(runner); + } break; } } @@ -46039,7 +47345,7 @@ class BaseProvider$1 extends Provider$2 { yield this.getNetwork(); const result = yield this.perform("getGasPrice", {}); try { - return BigNumber$1$1.from(result); + return BigNumber$2.from(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46058,7 +47364,7 @@ class BaseProvider$1 extends Provider$2 { }); const result = yield this.perform("getBalance", params); try { - return BigNumber$1$1.from(result); + return BigNumber$2.from(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46077,7 +47383,7 @@ class BaseProvider$1 extends Provider$2 { }); const result = yield this.perform("getTransactionCount", params); try { - return BigNumber$1$1.from(result).toNumber(); + return BigNumber$2.from(result).toNumber(); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46206,7 +47512,7 @@ class BaseProvider$1 extends Provider$2 { if (values[key] == null) { return; } - tx[key] = Promise.resolve(values[key]).then((v) => (v ? BigNumber$1$1.from(v) : null)); + tx[key] = Promise.resolve(values[key]).then((v) => (v ? BigNumber$2.from(v) : null)); }); ["type"].forEach((key) => { if (values[key] == null) { @@ -46248,25 +47554,99 @@ class BaseProvider$1 extends Provider$2 { return this.formatter.filter(yield resolveProperties$2(result)); }); } - call(transaction, blockTag) { + _call(transaction, blockTag, attempt) { return __awaiter$1$2(this, void 0, void 0, function* () { - yield this.getNetwork(); - const params = yield resolveProperties$2({ - transaction: this._getTransactionRequest(transaction), - blockTag: this._getBlockTag(blockTag) - }); - const result = yield this.perform("call", params); + if (attempt >= MAX_CCIP_REDIRECTS$1) { + logger$3$2.throwError("CCIP read exceeded maximum redirections", Logger$2.errors.SERVER_ERROR, { + redirects: attempt, transaction + }); + } + const txSender = transaction.to; + const result = yield this.perform("call", { transaction, blockTag }); + // CCIP Read request via OffchainLookup(address,string[],bytes,bytes4,bytes) + if (attempt >= 0 && blockTag === "latest" && txSender != null && result.substring(0, 10) === "0x556f1830" && (hexDataLength$2(result) % 32 === 4)) { + try { + const data = hexDataSlice$2(result, 4); + // Check the sender of the OffchainLookup matches the transaction + const sender = hexDataSlice$2(data, 0, 32); + if (!BigNumber$2.from(sender).eq(txSender)) { + logger$3$2.throwError("CCIP Read sender did not match", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + // Read the URLs from the response + const urls = []; + const urlsOffset = BigNumber$2.from(hexDataSlice$2(data, 32, 64)).toNumber(); + const urlsLength = BigNumber$2.from(hexDataSlice$2(data, urlsOffset, urlsOffset + 32)).toNumber(); + const urlsData = hexDataSlice$2(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString$1(urlsData, u * 32); + if (url == null) { + logger$3$2.throwError("CCIP Read contained corrupt URL string", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + urls.push(url); + } + // Get the CCIP calldata to forward + const calldata = _parseBytes$1(data, 64); + // Get the callbackSelector (bytes4) + if (!BigNumber$2.from(hexDataSlice$2(data, 100, 128)).isZero()) { + logger$3$2.throwError("CCIP Read callback selector included junk", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const callbackSelector = hexDataSlice$2(data, 96, 100); + // Get the extra data to send back to the contract as context + const extraData = _parseBytes$1(data, 128); + const ccipResult = yield this.ccipReadFetch(transaction, calldata, urls); + if (ccipResult == null) { + logger$3$2.throwError("CCIP Read disabled or provided no URLs", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const tx = { + to: txSender, + data: hexConcat$2([callbackSelector, encodeBytes$1([ccipResult, extraData])]) + }; + return this._call(tx, blockTag, attempt + 1); + } + catch (error) { + if (error.code === Logger$2.errors.SERVER_ERROR) { + throw error; + } + } + } try { return hexlify$2(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { method: "call", - params, result, error + params: { transaction, blockTag }, result, error }); } }); } + call(transaction, blockTag) { + return __awaiter$1$2(this, void 0, void 0, function* () { + yield this.getNetwork(); + const resolved = yield resolveProperties$2({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag), + ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled) + }); + return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0 : -1); + }); + } estimateGas(transaction) { return __awaiter$1$2(this, void 0, void 0, function* () { yield this.getNetwork(); @@ -46275,7 +47655,7 @@ class BaseProvider$1 extends Provider$2 { }); const result = yield this.perform("estimateGas", params); try { - return BigNumber$1$1.from(result); + return BigNumber$2.from(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46287,6 +47667,10 @@ class BaseProvider$1 extends Provider$2 { } _getAddress(addressOrName) { return __awaiter$1$2(this, void 0, void 0, function* () { + addressOrName = yield addressOrName; + if (typeof (addressOrName) !== "string") { + logger$3$2.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } const address = yield this.resolveName(addressOrName); if (address == null) { logger$3$2.throwError("ENS name not configured", Logger$2.errors.UNSUPPORTED_OPERATION, { @@ -46310,7 +47694,7 @@ class BaseProvider$1 extends Provider$2 { } else { try { - params.blockTag = this.formatter.blockTag(yield this._getBlockTag(blockHashOrBlockTag)); + params.blockTag = yield this._getBlockTag(blockHashOrBlockTag); if (isHexString$2(params.blockTag)) { blockNumber = parseInt(params.blockTag.substring(2), 16); } @@ -46476,43 +47860,54 @@ class BaseProvider$1 extends Provider$2 { } getResolver(name) { return __awaiter$1$2(this, void 0, void 0, function* () { - try { - const address = yield this._getResolver(name); - if (address == null) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { return null; } - return new Resolver$1(this, address, name); - } - catch (error) { - if (error.code === Logger$2.errors.CALL_EXCEPTION) { + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { return null; } - return null; + // Check the current node for a resolver + const addr = yield this._getResolver(currentName, "getResolver"); + // Found a resolver! + if (addr != null) { + const resolver = new Resolver$1(this, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(yield resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); } }); } - _getResolver(name) { + _getResolver(name, operation) { return __awaiter$1$2(this, void 0, void 0, function* () { - // Get the resolver from the blockchain + if (operation == null) { + operation = "ENS"; + } const network = yield this.getNetwork(); // No ENS... if (!network.ensAddress) { - logger$3$2.throwError("network does not support ENS", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name }); + logger$3$2.throwError("network does not support ENS", Logger$2.errors.UNSUPPORTED_OPERATION, { operation, network: network.name }); } - // keccak256("resolver(bytes32)") - const transaction = { - to: network.ensAddress, - data: ("0x0178b8bf" + namehash$1(name).substring(2)) - }; try { - return this.formatter.callAddress(yield this.call(transaction)); + // keccak256("resolver(bytes32)") + const addrData = yield this.call({ + to: network.ensAddress, + data: ("0x0178b8bf" + namehash$1(name).substring(2)) + }); + return this.formatter.callAddress(addrData); } catch (error) { - if (error.code === Logger$2.errors.CALL_EXCEPTION) { - return null; - } - throw error; + // ENS registry cannot throw errors on resolver(bytes32) } + return null; }); } resolveName(name) { @@ -46531,7 +47926,7 @@ class BaseProvider$1 extends Provider$2 { if (typeof (name) !== "string") { logger$3$2.throwArgumentError("invalid ENS name", "name", name); } - // Get the addr from the resovler + // Get the addr from the resolver const resolver = yield this.getResolver(name); if (!resolver) { return null; @@ -46543,39 +47938,75 @@ class BaseProvider$1 extends Provider$2 { return __awaiter$1$2(this, void 0, void 0, function* () { address = yield address; address = this.formatter.address(address); - const reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; - const resolverAddress = yield this._getResolver(reverseName); - if (!resolverAddress) { + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddr = yield this._getResolver(node, "lookupAddress"); + if (resolverAddr == null) { return null; } // keccak("name(bytes32)") - let bytes = arrayify$2(yield this.call({ - to: resolverAddress, - data: ("0x691f3431" + namehash$1(reverseName).substring(2)) - })); - // Strip off the dynamic string pointer (0x20) - if (bytes.length < 32 || !BigNumber$1$1.from(bytes.slice(0, 32)).eq(32)) { + const name = _parseString$1(yield this.call({ + to: resolverAddr, + data: ("0x691f3431" + namehash$1(node).substring(2)) + }), 0); + const addr = yield this.resolveName(name); + if (addr != address) { return null; } - bytes = bytes.slice(32); - // Not a length-prefixed string - if (bytes.length < 32) { - return null; + return name; + }); + } + getAvatar(nameOrAddress) { + return __awaiter$1$2(this, void 0, void 0, function* () { + let resolver = null; + if (isHexString$2(nameOrAddress)) { + // Address; reverse lookup + const address = this.formatter.address(nameOrAddress); + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddress = yield this._getResolver(node, "getAvatar"); + if (!resolverAddress) { + return null; + } + // Try resolving the avatar against the addr.reverse resolver + resolver = new Resolver$1(this, resolverAddress, node); + try { + const avatar = yield resolver.getAvatar(); + if (avatar) { + return avatar.url; + } + } + catch (error) { + if (error.code !== Logger$2.errors.CALL_EXCEPTION) { + throw error; + } + } + // Try getting the name and performing forward lookup; allowing wildcards + try { + // keccak("name(bytes32)") + const name = _parseString$1(yield this.call({ + to: resolverAddress, + data: ("0x691f3431" + namehash$1(node).substring(2)) + }), 0); + resolver = yield this.getResolver(name); + } + catch (error) { + if (error.code !== Logger$2.errors.CALL_EXCEPTION) { + throw error; + } + return null; + } } - // Get the length of the string (from the length-prefix) - const length = BigNumber$1$1.from(bytes.slice(0, 32)).toNumber(); - bytes = bytes.slice(32); - // Length longer than available data - if (length > bytes.length) { - return null; + else { + // ENS name; forward lookup with wildcard + resolver = yield this.getResolver(nameOrAddress); + if (!resolver) { + return null; + } } - const name = toUtf8String$2(bytes.slice(0, length)); - // Make sure the reverse record matches the foward record - const addr = yield this.resolveName(name); - if (addr != address) { + const avatar = yield resolver.getAvatar(); + if (avatar == null) { return null; } - return name; + return avatar.url; }); } perform(method, params) { @@ -46691,18 +48122,46 @@ var __awaiter$9 = function (thisArg, _arguments, P, generator) { }; const logger$2$2 = new Logger$2(version$1$2); const errorGas$1 = ["call", "estimateGas"]; +function spelunk$1(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match("reverted") && isHexString$2(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunk$1(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunk$1(JSON.parse(value)); + } + catch (error) { } + } + return null; +} function checkError$1(method, error, params) { // Undo the "convenience" some nodes are attempting to prevent backwards // incompatibility; maybe for v6 consider forwarding reverts as errors - if (method === "call" && error.code === Logger$2.errors.SERVER_ERROR) { - const e = error.error; - if (e && e.message.match("reverted") && isHexString$2(e.data)) { - return e.data; + if (method === "call") { + const result = spelunk$1(error); + if (result) { + return result.data; } - logger$2$2.throwError("missing revert data in call exception", Logger$2.errors.CALL_EXCEPTION, { + logger$2$2.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger$2.errors.CALL_EXCEPTION, { error, data: "0x" }); } + // @TODO: Should we spelunk for message too? let message = error.message; if (error.code === Logger$2.errors.SERVER_ERROR && error.error && typeof (error.error.message) === "string") { message = error.error.message; @@ -46716,25 +48175,25 @@ function checkError$1(method, error, params) { message = (message || "").toLowerCase(); const transaction = params.transaction || params.signedTransaction; // "insufficient funds for gas * price + value + cost(data)" - if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { logger$2$2.throwError("insufficient funds for intrinsic transaction cost", Logger$2.errors.INSUFFICIENT_FUNDS, { error, method, transaction }); } // "nonce too low" - if (message.match(/nonce too low/)) { + if (message.match(/nonce (is )?too low/i)) { logger$2$2.throwError("nonce has already been used", Logger$2.errors.NONCE_EXPIRED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/replacement transaction underpriced/)) { + if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) { logger$2$2.throwError("replacement fee too low", Logger$2.errors.REPLACEMENT_UNDERPRICED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/only replay-protected/)) { + if (message.match(/only replay-protected/i)) { logger$2$2.throwError("legacy pre-eip-155 transactions not supported", Logger$2.errors.UNSUPPORTED_OPERATION, { error, method, transaction }); @@ -46767,12 +48226,12 @@ function getLowerCase$1(value) { } return value; } -const _constructorGuard$5 = {}; +const _constructorGuard$4 = {}; class JsonRpcSigner$1 extends Signer$2 { constructor(constructorGuard, provider, addressOrIndex) { logger$2$2.checkNew(new.target, JsonRpcSigner$1); super(); - if (constructorGuard !== _constructorGuard$5) { + if (constructorGuard !== _constructorGuard$4) { throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); } defineReadOnly$2(this, "provider", provider); @@ -46797,7 +48256,7 @@ class JsonRpcSigner$1 extends Signer$2 { }); } connectUnchecked() { - return new UncheckedJsonRpcSigner$1(_constructorGuard$5, this.provider, this._address || this._index); + return new UncheckedJsonRpcSigner$1(_constructorGuard$4, this.provider, this._address || this._index); } getAddress() { if (this._address) { @@ -46890,6 +48349,13 @@ class JsonRpcSigner$1 extends Signer$2 { }); } signMessage(message) { + return __awaiter$9(this, void 0, void 0, function* () { + const data = ((typeof (message) === "string") ? toUtf8Bytes$2(message) : message); + const address = yield this.getAddress(); + return yield this.provider.send("personal_sign", [hexlify$2(data), address.toLowerCase()]); + }); + } + _legacySignMessage(message) { return __awaiter$9(this, void 0, void 0, function* () { const data = ((typeof (message) === "string") ? toUtf8Bytes$2(message) : message); const address = yield this.getAddress(); @@ -47007,7 +48473,7 @@ class JsonRpcProvider$1 extends BaseProvider$1 { if (chainId != null) { const getNetwork = getStatic$2(this.constructor, "getNetwork"); try { - return getNetwork(BigNumber$1$1.from(chainId).toNumber()); + return getNetwork(BigNumber$2.from(chainId).toNumber()); } catch (error) { return logger$2$2.throwError("could not detect network", Logger$2.errors.NETWORK_ERROR, { @@ -47023,7 +48489,7 @@ class JsonRpcProvider$1 extends BaseProvider$1 { }); } getSigner(addressOrIndex) { - return new JsonRpcSigner$1(_constructorGuard$5, this, addressOrIndex); + return new JsonRpcSigner$1(_constructorGuard$4, this, addressOrIndex); } getUncheckedSigner(addressOrIndex) { return this.getSigner(addressOrIndex).connectUnchecked(); @@ -47127,8 +48593,8 @@ class JsonRpcProvider$1 extends BaseProvider$1 { // is fair), so we delete type if it is 0 and a non-EIP-1559 network if (method === "call" || method === "estimateGas") { const tx = params.transaction; - if (tx && tx.type != null && BigNumber$1$1.from(tx.type).isZero()) { - // If there are no EIP-1559 properties, it might be non-EIP-a559 + if (tx && tx.type != null && BigNumber$2.from(tx.type).isZero()) { + // If there are no EIP-1559 properties, it might be non-EIP-1559 if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { const feeData = yield this.getFeeData(); if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { @@ -47225,12 +48691,12 @@ class JsonRpcProvider$1 extends BaseProvider$1 { } checkProperties$1(transaction, allowed); const result = {}; - // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. - ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { if (transaction[key] == null) { return; } - const value = hexValue$1(transaction[key]); + const value = hexValue$1(BigNumber$2.from(transaction[key])); if (key === "gasLimit") { key = "gas"; } @@ -47254,12 +48720,6 @@ let _nextId = 1; function buildWeb3LegacyFetcher(provider, sendFunc) { const fetcher = "Web3LegacyFetcher"; 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 = { method: method, params: params, @@ -47307,12 +48767,6 @@ function buildEip1193Fetcher(provider) { if (params == null) { 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 = { method, params }; this.emit("debug", { action: "request", @@ -47388,9 +48842,9 @@ class Web3Provider extends JsonRpcProvider$1 { } } -const version$k = "units/5.4.0"; +const version$j = "units/5.6.0"; -const logger$r = new Logger$2(version$k); +const logger$q = new Logger$2(version$j); const names$1 = [ "wei", "kwei", @@ -47402,7 +48856,7 @@ const names$1 = [ ]; function parseUnits$1(value, unitName) { if (typeof (value) !== "string") { - logger$r.throwArgumentError("value must be a string", "value", value); + logger$q.throwArgumentError("value must be a string", "value", value); } if (typeof (unitName) === "string") { const index = names$1.indexOf(unitName); @@ -47413,22 +48867,26 @@ function parseUnits$1(value, unitName) { return parseFixed$1(value, (unitName != null) ? unitName : 18); } -function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } +function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } class Transaction { - constructor({ blockchain, from, nonce, to, api, method, params, value, sent, confirmed, failed }) { + constructor({ blockchain, from, to, value, api, method, params, sent, confirmed, failed }) { + // required this.blockchain = blockchain; this.from = from; - this.nonce = nonce; this.to = to; + this.value = _optionalChain$3([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); + + // optional this.api = api; this.method = method; this.params = params; - this.value = _optionalChain$6([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); this.sent = sent; this.confirmed = confirmed; this.failed = failed; + + // internal this._confirmed = false; this._failed = false; } @@ -47439,7 +48897,7 @@ class Transaction { static bigNumberify(value, blockchain) { if (typeof value === 'number') { - return parseUnits$1(value.toString(), CONSTANTS$2[blockchain].DECIMALS) + return parseUnits$1(value.toString(), CONSTANTS$3[blockchain].DECIMALS) } else if (value && value.toString) { return BigNumber$2.from(value.toString()) } else { @@ -47447,8 +48905,8 @@ class Transaction { } } - getContractArguments ({ contract }) { - let fragment = contract.interface.fragments.find((fragment) => { + getContractArguments() { + let fragment = this.getContract().interface.fragments.find((fragment) => { return fragment.name == this.method }); @@ -47463,6 +48921,17 @@ class Transaction { } } + getContract() { + return new Contract$1(this.to, this.api) + } + + async getData() { + let populatedTransaction = await this.getContract().populateTransaction[this.method].apply( + null, this.getContractArguments() + ); + return populatedTransaction.data + } + confirmation() { if (this._confirmed) { return Promise.resolve(this) @@ -47490,18 +48959,6 @@ class Transaction { } } -function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } -const estimate$2 = async ({ transaction, wallet })=> { - transaction = new Transaction(transaction); - if((await wallet.connectedTo(transaction.blockchain)) == false) { - await wallet.switchTo(transaction.blockchain); - } - let provider = new Web3Provider(window.ethereum, 'any'); - let signer = provider.getSigner(0); - let contract = new Contract$1(transaction.to, _optionalChain$5([transaction, 'optionalAccess', _ => _.api]), provider); - return contract.connect(signer).estimateGas[transaction.method](...transaction.getContractArguments({ contract }), { value: transaction.value }) -}; - const sendTransaction$2 = async ({ transaction, wallet })=> { transaction = new Transaction(transaction); if((await wallet.connectedTo(transaction.blockchain)) == false) { @@ -47568,13 +49025,13 @@ const submitSimpleTransfer$2 = ({ transaction, signer })=>{ }) }; -function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } +function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } class Web3Wallet { static __initStatic() {this.info = { name: 'Web3 Wallet', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 446.42 376.77'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23828487;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M408.69,171.4H473.4V107.77a46.55,46.55,0,0,0-46.55-46.55H73.53A46.55,46.55,0,0,0,27,107.77v65.09H62.7L89.56,146a9.46,9.46,0,0,1,5.73-2.73h0l.41,0h78.59a47.2,47.2,0,1,1,82.63,39.56q-1.41,1.71-3,3.31t-3.31,3a47.21,47.21,0,0,1-76.31-26.9H100.21L73.34,189.07a9.43,9.43,0,0,1-5.73,2.73h0l-.41,0h-.07l-.48,0H27v74H55.83l18.25-18.24a9.39,9.39,0,0,1,5.73-2.74h0l.41,0h29.9a47.16,47.16,0,1,1,0,19H84.72L66.48,282.11a9.42,9.42,0,0,1-5.72,2.74h0l-.39,0H27V319H83.29a4,4,0,0,1,.49,0h.06l.41,0h0A9.41,9.41,0,0,1,90,321.78l28,28h57.66a47.2,47.2,0,1,1,81.48,40.9c-.6.67-1.22,1.32-1.86,2s-1.3,1.26-2,1.86a47.22,47.22,0,0,1-77.65-25.73H114.09a9.5,9.5,0,0,1-3.09-.52l-.08,0-.29-.11-.17-.07-.19-.08-.27-.12-.08,0a9.38,9.38,0,0,1-2.55-1.81l-28-28H27v53.46A46.55,46.55,0,0,0,73.53,438H426.86a46.55,46.55,0,0,0,46.54-46.55V327.82H408.69a78.22,78.22,0,0,1-78.21-78.21h0A78.22,78.22,0,0,1,408.69,171.4Z' transform='translate(-26.98 -61.22)'/%3E%3Cpath class='cls-1' d='M247.91,359.29a26,26,0,1,0-26,26A26,26,0,0,0,247.91,359.29Z' transform='translate(-26.98 -61.22)'/%3E%3Cpath class='cls-1' d='M246.55,152.71a26,26,0,1,0-26,26A26,26,0,0,0,246.55,152.71Z' transform='translate(-26.98 -61.22)'/%3E%3Ccircle class='cls-1' cx='129.39' cy='193.15' r='25.99'/%3E%3Cpath class='cls-1' d='M409.17,190h-.48a59.57,59.57,0,0,0-59.57,59.57h0a59.57,59.57,0,0,0,59.57,59.57h.48a59.58,59.58,0,0,0,59.58-59.57h0A59.58,59.58,0,0,0,409.17,190Zm14.45,90.61h-31l8.88-32.53a15.5,15.5,0,1,1,13.29,0Z' transform='translate(-26.98 -61.22)'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'] + blockchains: ['ethereum', 'bsc', 'polygon'] };} constructor () { @@ -47588,12 +49045,6 @@ class Web3Wallet { transaction }) }; - this.estimate = (transaction)=> { - return estimate$2({ - wallet: this, - transaction - }) - }; } async account() { @@ -47601,13 +49052,13 @@ class Web3Wallet { } async accounts() { - if(!_optionalChain$4([window, 'optionalAccess', _ => _.ethereum])) { return [] } + if(!_optionalChain$2([window, 'optionalAccess', _ => _.ethereum])) { return [] } const accounts = await window.ethereum.request({ method: 'eth_accounts' }); return accounts } async connect() { - if(!_optionalChain$4([window, 'optionalAccess', _2 => _2.ethereum])) { return [] } + if(!_optionalChain$2([window, 'optionalAccess', _2 => _2.ethereum])) { return [] } const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); return accounts } @@ -47715,7 +49166,7 @@ class Coinbase extends Web3Wallet { static __initStatic() {this.info = { name: 'Coinbase', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 488.96 488.96'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:url(%23linear-gradient);%7D.cls-2%7Bfill:%234361ad;%7D%3C/style%3E%3ClinearGradient id='linear-gradient' x1='250' y1='7.35' x2='250' y2='496.32' gradientTransform='matrix(1, 0, 0, -1, 0, 502)' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%233d5ba9'/%3E%3Cstop offset='1' stop-color='%234868b1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath class='cls-1' d='M250,5.68C114.87,5.68,5.52,115,5.52,250.17S114.87,494.65,250,494.65,494.48,385.29,494.48,250.17,385.13,5.68,250,5.68Zm0,387.54A143.06,143.06,0,1,1,393.05,250.17,143.11,143.11,0,0,1,250,393.22Z' transform='translate(-5.52 -5.68)'/%3E%3Cpath class='cls-2' d='M284.69,296.09H215.31a11,11,0,0,1-10.9-10.9V215.48a11,11,0,0,1,10.9-10.91H285a11,11,0,0,1,10.9,10.91v69.71A11.07,11.07,0,0,1,284.69,296.09Z' transform='translate(-5.52 -5.68)'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'], + blockchains: ['ethereum', 'bsc', 'polygon'], install: 'https://wallet.coinbase.com' };} } Coinbase.__initStatic(); @@ -47725,34 +49176,12 @@ class MetaMask extends Web3Wallet { static __initStatic() {this.info = { name: 'MetaMask', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 485.93 450.56'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23828487;%7D.cls-2%7Bfill:%23e27726;stroke:%23e27726;%7D.cls-10,.cls-11,.cls-2,.cls-3,.cls-4,.cls-5,.cls-6,.cls-7,.cls-8,.cls-9%7Bstroke-linecap:round;stroke-linejoin:round;%7D.cls-3%7Bfill:%23e37725;stroke:%23e37725;%7D.cls-4%7Bfill:%23d6c0b3;stroke:%23d6c0b3;%7D.cls-5%7Bfill:%23243447;stroke:%23243447;%7D.cls-6%7Bfill:%23cd6328;stroke:%23cd6328;%7D.cls-7%7Bfill:%23e37525;stroke:%23e37525;%7D.cls-8%7Bfill:%23f6851f;stroke:%23f6851f;%7D.cls-9%7Bfill:%23c1ae9e;stroke:%23c1ae9e;%7D.cls-10%7Bfill:%23171717;stroke:%23171717;%7D.cls-11%7Bfill:%23763e1a;stroke:%23763e1a;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M247.91,356.29a26,26,0,1,0-26,26A26,26,0,0,0,247.91,356.29Z' transform='translate(-7.97 -21.33)'/%3E%3Cpath class='cls-1' d='M246.55,149.71a26,26,0,1,0-26,26A26,26,0,0,0,246.55,149.71Z' transform='translate(-7.97 -21.33)'/%3E%3Ccircle class='cls-1' cx='148.4' cy='230.05' r='25.99'/%3E%3Cpolygon class='cls-2' points='461.28 0.5 272.06 141.03 307.05 58.12 461.28 0.5'/%3E%3Cpolygon class='cls-3' points='24.46 0.5 212.16 142.37 178.88 58.12 24.46 0.5'/%3E%3Cpolygon class='cls-3' points='393.2 326.26 342.81 403.47 450.63 433.14 481.63 327.97 393.2 326.26'/%3E%3Cpolygon class='cls-3' points='4.49 327.97 35.3 433.14 143.13 403.47 92.73 326.26 4.49 327.97'/%3E%3Cpolygon class='cls-3' points='137.04 195.8 107 241.25 214.06 246.01 210.26 130.96 137.04 195.8'/%3E%3Cpolygon class='cls-3' points='348.7 195.8 274.53 129.63 272.06 246.01 378.94 241.25 348.7 195.8'/%3E%3Cpolygon class='cls-3' points='143.13 403.47 207.41 372.09 151.88 328.73 143.13 403.47'/%3E%3Cpolygon class='cls-3' points='278.34 372.09 342.81 403.47 333.87 328.73 278.34 372.09'/%3E%3Cpolygon class='cls-4' points='342.81 403.47 278.34 372.09 283.47 414.12 282.9 431.81 342.81 403.47'/%3E%3Cpolygon class='cls-4' points='143.13 403.47 203.03 431.81 202.65 414.12 207.41 372.09 143.13 403.47'/%3E%3Cpolygon class='cls-5' points='203.98 300.97 150.35 285.18 188.2 267.88 203.98 300.97'/%3E%3Cpolygon class='cls-5' points='281.76 300.97 297.55 267.88 335.58 285.18 281.76 300.97'/%3E%3Cpolygon class='cls-6' points='143.13 403.47 152.25 326.26 92.73 327.97 143.13 403.47'/%3E%3Cpolygon class='cls-6' points='333.68 326.26 342.81 403.47 393.2 327.97 333.68 326.26'/%3E%3Cpolygon class='cls-6' points='378.94 241.25 272.06 246.01 281.95 300.97 297.74 267.88 335.77 285.18 378.94 241.25'/%3E%3Cpolygon class='cls-6' points='150.35 285.18 188.39 267.88 203.98 300.97 214.06 246.01 107 241.25 150.35 285.18'/%3E%3Cpolygon class='cls-7' points='107 241.25 151.88 328.73 150.35 285.18 107 241.25'/%3E%3Cpolygon class='cls-7' points='335.77 285.18 333.87 328.73 378.94 241.25 335.77 285.18'/%3E%3Cpolygon class='cls-7' points='214.06 246.01 203.98 300.97 216.53 365.82 219.38 280.43 214.06 246.01'/%3E%3Cpolygon class='cls-7' points='272.06 246.01 266.93 280.24 269.21 365.82 281.95 300.97 272.06 246.01'/%3E%3Cpolygon class='cls-8' points='281.95 300.97 269.21 365.82 278.34 372.09 333.87 328.73 335.77 285.18 281.95 300.97'/%3E%3Cpolygon class='cls-8' points='150.35 285.18 151.88 328.73 207.41 372.09 216.53 365.82 203.98 300.97 150.35 285.18'/%3E%3Cpolygon class='cls-9' points='282.9 431.81 283.47 414.12 278.72 409.94 207.02 409.94 202.65 414.12 203.03 431.81 143.13 403.47 164.05 420.58 206.45 450.06 279.29 450.06 321.89 420.58 342.81 403.47 282.9 431.81'/%3E%3Cpolygon class='cls-10' points='278.34 372.09 269.21 365.82 216.53 365.82 207.41 372.09 202.65 414.12 207.02 409.94 278.72 409.94 283.47 414.12 278.34 372.09'/%3E%3Cpolygon class='cls-11' points='469.27 150.16 485.43 72.57 461.28 0.5 278.34 136.28 348.7 195.8 448.16 224.9 470.22 199.23 460.71 192.38 475.92 178.5 464.13 169.37 479.35 157.77 469.27 150.16'/%3E%3Cpolygon class='cls-11' points='0.5 72.57 16.66 150.16 6.39 157.77 21.61 169.37 10.01 178.5 25.22 192.38 15.71 199.23 37.58 224.9 137.04 195.8 207.41 136.28 24.46 0.5 0.5 72.57'/%3E%3Cpolygon class='cls-8' points='448.16 224.9 348.7 195.8 378.94 241.25 333.87 328.73 393.2 327.97 481.63 327.97 448.16 224.9'/%3E%3Cpolygon class='cls-8' points='137.04 195.8 37.58 224.9 4.49 327.97 92.73 327.97 151.88 328.73 107 241.25 137.04 195.8'/%3E%3Cpolygon class='cls-8' points='272.06 246.01 278.34 136.28 307.24 58.12 178.88 58.12 207.41 136.28 214.06 246.01 216.34 280.62 216.53 365.82 269.21 365.82 269.59 280.62 272.06 246.01'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'], + blockchains: ['ethereum', 'bsc', 'polygon'], install: 'https://metamask.io/download.html' };} } MetaMask.__initStatic(); -function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } -const estimate$1 = async ({ transaction, wallet })=> { - transaction = new Transaction(transaction); - if((await wallet.connectedTo(transaction.blockchain)) == false) { - throw({ code: 'WRONG_NETWORK' }) - } - let from = await wallet.account(); - let contract = new Contract$1(transaction.to, transaction.api); - let populatedTransaction = await contract.populateTransaction[transaction.method].apply( - null, transaction.getContractArguments({ contract }) - ); - return wallet.connector.sendCustomRequest({ - method: 'eth_estimateGas', - params: [{ - from, - to: transaction.to, - value: _optionalChain$3([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]), - data: populatedTransaction.data - }] - }) -}; - -function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } +function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } const sendTransaction$1 = async ({ transaction, wallet })=> { transaction = new Transaction(transaction); await transaction.prepare({ wallet }); @@ -47821,17 +49250,12 @@ const executeSubmit$1 = ({ transaction, wallet }) => { }; const submitContractInteraction$1 = async ({ transaction, wallet })=>{ - let contract = new Contract$1(transaction.to, transaction.api); - - let populatedTransaction = await contract.populateTransaction[transaction.method].apply( - null, transaction.getContractArguments({ contract }) - ); - return wallet.connector.sendTransaction({ from: transaction.from, to: transaction.to, - value: _optionalChain$2([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]), - data: populatedTransaction.data + value: _optionalChain$1([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]), + data: await transaction.getData(), + gas: (await estimate(transaction)).toString() }) }; @@ -47839,11 +49263,12 @@ const submitSimpleTransfer$1 = ({ transaction, wallet })=>{ return wallet.connector.sendTransaction({ from: transaction.from, to: transaction.to, - value: _optionalChain$2([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]) + value: _optionalChain$1([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]), + gas: CONSTANTS$3[transaction.blockchain].TRANSFER_GAS }) }; -function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } +function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } const setConnectedInstance$1 = (value)=>{ window._connectedWalletConnectInstance = value; }; @@ -47857,7 +49282,7 @@ class WalletConnect$1 { static __initStatic() {this.info = { name: 'WalletConnect', logo: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 25.4.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 500 500' style='enable-background:new 0 0 500 500;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%235991CD;%7D%0A%3C/style%3E%3Cg id='Page-1'%3E%3Cg id='walletconnect-logo-alt'%3E%3Cpath id='WalletConnect' class='st0' d='M102.7,162c81.5-79.8,213.6-79.8,295.1,0l9.8,9.6c4.1,4,4.1,10.5,0,14.4L374,218.9 c-2,2-5.3,2-7.4,0l-13.5-13.2c-56.8-55.7-149-55.7-205.8,0l-14.5,14.1c-2,2-5.3,2-7.4,0L91.9,187c-4.1-4-4.1-10.5,0-14.4 L102.7,162z M467.1,229.9l29.9,29.2c4.1,4,4.1,10.5,0,14.4L362.3,405.4c-4.1,4-10.7,4-14.8,0c0,0,0,0,0,0L252,311.9 c-1-1-2.7-1-3.7,0h0l-95.5,93.5c-4.1,4-10.7,4-14.8,0c0,0,0,0,0,0L3.4,273.6c-4.1-4-4.1-10.5,0-14.4l29.9-29.2 c4.1-4,10.7-4,14.8,0l95.5,93.5c1,1,2.7,1,3.7,0c0,0,0,0,0,0l95.5-93.5c4.1-4,10.7-4,14.8,0c0,0,0,0,0,0l95.5,93.5 c1,1,2.7,1,3.7,0l95.5-93.5C456.4,225.9,463,225.9,467.1,229.9z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A", - blockchains: ['ethereum', 'bsc'] + blockchains: ['ethereum', 'bsc', 'polygon'] };} constructor() { @@ -47871,12 +49296,6 @@ class WalletConnect$1 { transaction }) }; - this.estimate = (transaction)=> { - return estimate$1({ - wallet: this, - transaction - }) - }; } newWalletConnectInstance() { @@ -47934,7 +49353,7 @@ class WalletConnect$1 { this.connector = this.newWalletConnectInstance(); } - const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$1([options, 'optionalAccess', _ => _.chainId]) }); + const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$4([options, 'optionalAccess', _ => _.chainId]) }); if(accounts instanceof Array && accounts.length) { setConnectedInstance$1(this); @@ -48029,18 +49448,6 @@ class WalletConnect$1 { } } WalletConnect$1.__initStatic(); -function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } -const estimate = async ({ transaction, wallet })=> { - transaction = new Transaction(transaction); - if((await wallet.connectedTo(transaction.blockchain)) == false) { - await wallet.switchTo(transaction.blockchain); - } - let provider = new Web3Provider(wallet.connector, 'any'); - let signer = provider.getSigner(0); - let contract = new Contract$1(transaction.to, _optionalChain$7([transaction, 'optionalAccess', _ => _.api]), provider); - return contract.connect(signer).estimateGas[transaction.method](...transaction.getContractArguments({ contract }), { value: transaction.value }) -}; - const sendTransaction = async ({ transaction, wallet })=> { transaction = new Transaction(transaction); if((await wallet.connectedTo(transaction.blockchain)) == false) { @@ -48120,7 +49527,7 @@ class WalletLink { static __initStatic() {this.info = { name: 'Coinbase', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 488.96 488.96'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:url(%23linear-gradient);%7D.cls-2%7Bfill:%234361ad;%7D%3C/style%3E%3ClinearGradient id='linear-gradient' x1='250' y1='7.35' x2='250' y2='496.32' gradientTransform='matrix(1, 0, 0, -1, 0, 502)' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%233d5ba9'/%3E%3Cstop offset='1' stop-color='%234868b1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath class='cls-1' d='M250,5.68C114.87,5.68,5.52,115,5.52,250.17S114.87,494.65,250,494.65,494.48,385.29,494.48,250.17,385.13,5.68,250,5.68Zm0,387.54A143.06,143.06,0,1,1,393.05,250.17,143.11,143.11,0,0,1,250,393.22Z' transform='translate(-5.52 -5.68)'/%3E%3Cpath class='cls-2' d='M284.69,296.09H215.31a11,11,0,0,1-10.9-10.9V215.48a11,11,0,0,1,10.9-10.91H285a11,11,0,0,1,10.9,10.91v69.71A11.07,11.07,0,0,1,284.69,296.09Z' transform='translate(-5.52 -5.68)'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'], + blockchains: ['ethereum', 'bsc', 'polygon'], install: 'https://www.coinbase.com/wallet' };} @@ -48135,12 +49542,6 @@ class WalletLink { transaction }) }; - this.estimate = (transaction)=> { - return estimate({ - wallet: this, - transaction - }) - }; } newWalletLinkInstance() { @@ -53807,6 +55208,124 @@ var ERC20 = [ }, ]; +var ERC20onPolygon = [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'approve', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_from', type: 'address' }, + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [{ name: '', type: 'uint8' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_owner', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: 'balance', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transfer', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { name: '_owner', type: 'address' }, + { name: '_spender', type: 'address' }, + ], + name: 'allowance', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { payable: true, stateMutability: 'payable', type: 'fallback' }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'owner', type: 'address' }, + { indexed: true, name: 'spender', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'from', type: 'address' }, + { indexed: true, name: 'to', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Transfer', + type: 'event' + }, +]; + class Token { constructor({ blockchain, address }) { @@ -53815,8 +55334,8 @@ class Token { } async decimals() { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return CONSTANTS$2[this.blockchain].DECIMALS + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return CONSTANTS$3[this.blockchain].DECIMALS } let decimals = 0; try { @@ -53836,8 +55355,8 @@ class Token { } async symbol() { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return CONSTANTS$2[this.blockchain].SYMBOL + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return CONSTANTS$3[this.blockchain].SYMBOL } return await request( { @@ -53853,8 +55372,8 @@ class Token { } async name() { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return CONSTANTS$2[this.blockchain].CURRENCY + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return CONSTANTS$3[this.blockchain].CURRENCY } return await request( { @@ -53870,7 +55389,7 @@ class Token { } async balance(account) { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { return await request( { blockchain: this.blockchain, @@ -53898,8 +55417,8 @@ class Token { } async allowance(owner, spender) { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return BigNumber.from(CONSTANTS$2[this.blockchain].MAXINT) + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return BigNumber.from(CONSTANTS$3[this.blockchain].MAXINT) } else { return await request( { @@ -53957,6 +55476,11 @@ Token.bsc = { BEP20 }; +Token.polygon = { + DEFAULT: ERC20onPolygon, + ERC20: ERC20onPolygon +}; + var route$7 = () => {}; let getAmount = async ({ amount, blockchain, address }) => { @@ -57613,7 +59137,7 @@ var bn$3 = createCommonjsModule$4(function (module) { })(module, commonjsGlobal$3); }); -const version$4$3 = "logger/5.4.1"; +const version$4$3 = "logger/5.6.0"; let _permanentCensorErrors$3 = false; let _censorErrors$3 = false; @@ -57710,7 +59234,7 @@ var ErrorCode$3; // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficien funds (< value + gasLimit * gasPrice) + // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used @@ -57792,6 +59316,40 @@ class Logger$3 { messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$3.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$3.CALL_EXCEPTION: + case ErrorCode$3.INSUFFICIENT_FUNDS: + case ErrorCode$3.MISSING_NEW: + case ErrorCode$3.NONCE_EXPIRED: + case ErrorCode$3.REPLACEMENT_UNDERPRICED: + case ErrorCode$3.TRANSACTION_REPLACED: + case ErrorCode$3.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -57925,7 +59483,7 @@ class Logger$3 { Logger$3.errors = ErrorCode$3; Logger$3.levels = LogLevel$3; -const version$3$3 = "bytes/5.4.0"; +const version$3$3 = "bytes/5.6.1"; const logger$4$3 = new Logger$3(version$3$3); /////////////////////////////// @@ -57942,6 +59500,9 @@ function addSlice$3(array) { }; return array; } +function isInteger$3(value) { + return (typeof (value) === "number" && value == value && (value % 1) === 0); +} function isBytes$3(value) { if (value == null) { return false; @@ -57952,12 +59513,12 @@ function isBytes$3(value) { if (typeof (value) === "string") { return false; } - if (value.length == null) { + if (!isInteger$3(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (typeof (v) !== "number" || v < 0 || v >= 256 || (v % 1)) { + if (!isInteger$3(v) || v < 0 || v >= 256) { return false; } } @@ -57989,7 +59550,7 @@ function arrayify$3(value, options) { let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -58091,7 +59652,7 @@ function hexZeroPad$3(value, length) { return value; } -const version$2$3 = "bignumber/5.4.1"; +const version$2$3 = "bignumber/5.6.0"; var BN$3 = bn$3.BN; const logger$3$3 = new Logger$3(version$2$3); @@ -58140,7 +59701,7 @@ class BigNumber$3 { div(other) { const o = BigNumber$3.from(other); if (o.isZero()) { - throwFault$1$2("division by zero", "div"); + throwFault$1$2("division-by-zero", "div"); } return toBigNumber$3(toBN$3(this).div(toBN$3(other))); } @@ -58150,53 +59711,53 @@ class BigNumber$3 { mod(other) { const value = toBN$3(other); if (value.isNeg()) { - throwFault$1$2("cannot modulo negative values", "mod"); + throwFault$1$2("division-by-zero", "mod"); } return toBigNumber$3(toBN$3(this).umod(value)); } pow(other) { const value = toBN$3(other); if (value.isNeg()) { - throwFault$1$2("cannot raise to negative values", "pow"); + throwFault$1$2("negative-power", "pow"); } return toBigNumber$3(toBN$3(this).pow(value)); } and(other) { const value = toBN$3(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$2("cannot 'and' negative values", "and"); + throwFault$1$2("unbound-bitwise-result", "and"); } return toBigNumber$3(toBN$3(this).and(value)); } or(other) { const value = toBN$3(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$2("cannot 'or' negative values", "or"); + throwFault$1$2("unbound-bitwise-result", "or"); } return toBigNumber$3(toBN$3(this).or(value)); } xor(other) { const value = toBN$3(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$2("cannot 'xor' negative values", "xor"); + throwFault$1$2("unbound-bitwise-result", "xor"); } return toBigNumber$3(toBN$3(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$1$2("cannot mask negative values", "mask"); + throwFault$1$2("negative-width", "mask"); } return toBigNumber$3(toBN$3(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$1$2("cannot shift negative values", "shl"); + throwFault$1$2("negative-width", "shl"); } return toBigNumber$3(toBN$3(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$1$2("cannot shift negative values", "shr"); + throwFault$1$2("negative-width", "shr"); } return toBigNumber$3(toBN$3(this).shrn(value)); } @@ -58293,7 +59854,7 @@ class BigNumber$3 { return BigNumber$3.from(hexlify$3(anyValue)); } if (anyValue) { - // Hexable interface (takes piority) + // Hexable interface (takes priority) if (anyValue.toHexString) { const hex = anyValue.toHexString(); if (typeof (hex) === "string") { @@ -58330,7 +59891,7 @@ function toHex$4(value) { if (value[0] === "-") { // Strip off the negative sign value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") + // Cannot have multiple negative signs (e.g. "--0x04") if (value[0] === "-") { logger$3$3.throwArgumentError("invalid hex", "value", value); } @@ -58384,7 +59945,7 @@ function _base36To16$3(value) { } const logger$2$3 = new Logger$3(version$2$3); -const _constructorGuard$6 = {}; +const _constructorGuard$5 = {}; const Zero$4 = BigNumber$3.from(0); const NegativeOne$4 = BigNumber$3.from(-1); function throwFault$4(message, fault, operation, value) { @@ -58446,7 +60007,7 @@ function parseFixed$2(value, decimals) { decimals = 0; } const multiplier = getMultiplier$2(decimals); - if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) { + if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) { logger$2$3.throwArgumentError("invalid decimal value", "value", value); } // Is it negative? @@ -58469,12 +60030,17 @@ function parseFixed$2(value, decimals) { if (!fraction) { fraction = "0"; } - // Get significant digits to check truncation for underflow - { - const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig)); - if (sigFraction.length > multiplier.length - 1) { - throwFault$4("fractional component exceeds decimals", "underflow", "parseFixed"); - } + // Trim trailing zeros + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + // Check the fraction doesn't exceed our decimals size + if (fraction.length > multiplier.length - 1) { + throwFault$4("fractional component exceeds decimals", "underflow", "parseFixed"); + } + // If decimals is 0, we have an empty string for fraction + if (fraction === "") { + fraction = "0"; } // Fully pad the string with zeros to get to wei while (fraction.length < multiplier.length - 1) { @@ -58490,7 +60056,7 @@ function parseFixed$2(value, decimals) { } class FixedFormat$2 { constructor(constructorGuard, signed, width, decimals) { - if (constructorGuard !== _constructorGuard$6) { + if (constructorGuard !== _constructorGuard$5) { logger$2$3.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -58547,13 +60113,13 @@ class FixedFormat$2 { if (decimals > 80) { logger$2$3.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); } - return new FixedFormat$2(_constructorGuard$6, signed, width, decimals); + return new FixedFormat$2(_constructorGuard$5, signed, width, decimals); } } class FixedNumber$2 { constructor(constructorGuard, hex, value, format) { logger$2$3.checkNew(new.target, FixedNumber$2); - if (constructorGuard !== _constructorGuard$6) { + if (constructorGuard !== _constructorGuard$5) { logger$2$3.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -58637,577 +60203,752 @@ class FixedNumber$2 { const bump = BUMP$2.toFormat(this.format); return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); } - isZero() { - return (this._value === "0.0" || this._value === "0"); + isZero() { + return (this._value === "0.0" || this._value === "0"); + } + isNegative() { + return (this._value[0] === "-"); + } + toString() { return this._value; } + toHexString(width) { + if (width == null) { + return this._hex; + } + if (width % 8) { + logger$2$3.throwArgumentError("invalid byte width", "width", width); + } + const hex = BigNumber$3.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + return hexZeroPad$3(hex, width / 8); + } + toUnsafeFloat() { return parseFloat(this.toString()); } + toFormat(format) { + return FixedNumber$2.fromString(this._value, format); + } + static fromValue(value, decimals, format) { + // If decimals looks more like a format, and there is no format, shift the parameters + if (format == null && decimals != null && !isBigNumberish$2(decimals)) { + format = decimals; + decimals = null; + } + if (decimals == null) { + decimals = 0; + } + if (format == null) { + format = "fixed"; + } + return FixedNumber$2.fromString(formatFixed$2(value, decimals), FixedFormat$2.from(format)); + } + static fromString(value, format) { + if (format == null) { + format = "fixed"; + } + const fixedFormat = FixedFormat$2.from(format); + const numeric = parseFixed$2(value, fixedFormat.decimals); + if (!fixedFormat.signed && numeric.lt(Zero$4)) { + throwFault$4("unsigned value cannot be negative", "overflow", "value", value); + } + let hex = null; + if (fixedFormat.signed) { + hex = numeric.toTwos(fixedFormat.width).toHexString(); + } + else { + hex = numeric.toHexString(); + hex = hexZeroPad$3(hex, fixedFormat.width / 8); + } + const decimal = formatFixed$2(numeric, fixedFormat.decimals); + return new FixedNumber$2(_constructorGuard$5, hex, decimal, fixedFormat); + } + static fromBytes(value, format) { + if (format == null) { + format = "fixed"; + } + const fixedFormat = FixedFormat$2.from(format); + if (arrayify$3(value).length > fixedFormat.width / 8) { + throw new Error("overflow"); + } + let numeric = BigNumber$3.from(value); + if (fixedFormat.signed) { + numeric = numeric.fromTwos(fixedFormat.width); + } + const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); + const decimal = formatFixed$2(numeric, fixedFormat.decimals); + return new FixedNumber$2(_constructorGuard$5, hex, decimal, fixedFormat); + } + static from(value, format) { + if (typeof (value) === "string") { + return FixedNumber$2.fromString(value, format); + } + if (isBytes$3(value)) { + return FixedNumber$2.fromBytes(value, format); + } + try { + return FixedNumber$2.fromValue(value, 0, format); + } + catch (error) { + // Allow NUMERIC_FAULT to bubble up + if (error.code !== Logger$3.errors.INVALID_ARGUMENT) { + throw error; + } + } + return logger$2$3.throwArgumentError("invalid FixedNumber value", "value", value); + } + static isFixedNumber(value) { + return !!(value && value._isFixedNumber); + } +} +const ONE$2 = FixedNumber$2.from(1); +const BUMP$2 = FixedNumber$2.from("0.5"); + +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ + +var sha3$3 = createCommonjsModule$4(function (module) { +/*jslint bitwise: true */ +(function () { + + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; + if (NODE_JS) { + root = commonjsGlobal$3; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; + + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } + + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } + + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; + + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); + } + return method; + }; + + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + + var methods = {}, methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } + + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); } - isNegative() { - return (this._value[0] === "-"); + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; } - toString() { return this._value; } - toHexString(width) { - if (width == null) { - return this._hex; - } - if (width % 8) { - logger$2$3.throwArgumentError("invalid byte width", "width", width); - } - const hex = BigNumber$3.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); - return hexZeroPad$3(hex, width / 8); + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } } - toUnsafeFloat() { return parseFloat(this.toString()); } - toFormat(format) { - return FixedNumber$2.fromString(this._value, format); + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; } - static fromValue(value, decimals, format) { - // If decimals looks more like a format, and there is no format, shift the parameters - if (format == null && decimals != null && !isBigNumberish$2(decimals)) { - format = decimals; - decimals = null; - } - if (decimals == null) { - decimals = 0; - } - if (format == null) { - format = "fixed"; - } - return FixedNumber$2.fromString(formatFixed$2(value, decimals), FixedFormat$2.from(format)); + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } } - static fromString(value, format) { - if (format == null) { - format = "fixed"; - } - const fixedFormat = FixedFormat$2.from(format); - const numeric = parseFixed$2(value, fixedFormat.decimals); - if (!fixedFormat.signed && numeric.lt(Zero$4)) { - throwFault$4("unsigned value cannot be negative", "overflow", "value", value); - } - let hex = null; - if (fixedFormat.signed) { - hex = numeric.toTwos(fixedFormat.width).toHexString(); - } - else { - hex = numeric.toHexString(); - hex = hexZeroPad$3(hex, fixedFormat.width / 8); - } - const decimal = formatFixed$2(numeric, fixedFormat.decimals); - return new FixedNumber$2(_constructorGuard$6, hex, decimal, fixedFormat); + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } } - static fromBytes(value, format) { - if (format == null) { - format = "fixed"; - } - const fixedFormat = FixedFormat$2.from(format); - if (arrayify$3(value).length > fixedFormat.width / 8) { - throw new Error("overflow"); - } - let numeric = BigNumber$3.from(value); - if (fixedFormat.signed) { - numeric = numeric.fromTwos(fixedFormat.width); - } - const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); - const decimal = formatFixed$2(numeric, fixedFormat.decimals); - return new FixedNumber$2(_constructorGuard$6, hex, decimal, fixedFormat); + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); } - static from(value, format) { - if (typeof (value) === "string") { - return FixedNumber$2.fromString(value, format); - } - if (isBytes$3(value)) { - return FixedNumber$2.fromBytes(value, format); - } - try { - return FixedNumber$2.fromValue(value, 0, format); - } - catch (error) { - // Allow NUMERIC_FAULT to bubble up - if (error.code !== Logger$3.errors.INVALID_ARGUMENT) { - throw error; - } - } - return logger$2$3.throwArgumentError("invalid FixedNumber value", "value", value); + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } } - static isFixedNumber(value) { - return !!(value && value._isFixedNumber); + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); } -} -const ONE$2 = FixedNumber$2.from(1); -const BUMP$2 = FixedNumber$2.from("0.5"); + return buffer; + }; -/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.5.7 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2016 - * @license MIT - */ + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; -var sha3$3 = createCommonjsModule$4(function (module) { -/*jslint bitwise: true */ -(function () { - - var root = typeof window === 'object' ? window : {}; - var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; - if (NODE_JS) { - root = commonjsGlobal$3; - } - var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; - var HEX_CHARS = '0123456789abcdef'.split(''); - var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; - var KECCAK_PADDING = [1, 256, 65536, 16777216]; - var PADDING = [6, 1536, 393216, 100663296]; - var SHIFT = [0, 8, 16, 24]; - var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, - 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, - 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, - 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, - 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; - var BITS = [224, 256, 384, 512]; - var SHAKE_BITS = [128, 256]; - var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; - - var createOutputMethod = function (bits, padding, outputType) { - return function (message) { - return new Keccak(bits, padding, bits).update(message)[outputType](); - }; - }; - - var createShakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits) { - return new Keccak(bits, padding, outputBits).update(message)[outputType](); - }; - }; - - var createMethod = function (bits, padding) { - var method = createOutputMethod(bits, padding, 'hex'); - method.create = function () { - return new Keccak(bits, padding, bits); - }; - method.update = function (message) { - return method.create().update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createOutputMethod(bits, padding, type); - } - return method; - }; - - var createShakeMethod = function (bits, padding) { - var method = createShakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits) { - return new Keccak(bits, padding, outputBits); - }; - method.update = function (message, outputBits) { - return method.create(outputBits).update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createShakeOutputMethod(bits, padding, type); - } - return method; - }; - - var algorithms = [ - {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod}, - {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod}, - {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod} - ]; - - var methods = {}, methodNames = []; - - for (var i = 0; i < algorithms.length; ++i) { - var algorithm = algorithms[i]; - var bits = algorithm.bits; - for (var j = 0; j < bits.length; ++j) { - var methodName = algorithm.name +'_' + bits[j]; - methodNames.push(methodName); - methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); - } - } - - function Keccak(bits, padding, outputBits) { - this.blocks = []; - this.s = []; - this.padding = padding; - this.outputBits = outputBits; - this.reset = true; - this.block = 0; - this.start = 0; - this.blockCount = (1600 - (bits << 1)) >> 5; - this.byteCount = this.blockCount << 2; - this.outputBlocks = outputBits >> 5; - this.extraBytes = (outputBits & 31) >> 3; - - for (var i = 0; i < 50; ++i) { - this.s[i] = 0; - } - } - - Keccak.prototype.update = function (message) { - var notString = typeof message !== 'string'; - if (notString && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } - var length = message.length, blocks = this.blocks, byteCount = this.byteCount, - blockCount = this.blockCount, index = 0, s = this.s, i, code; - - while (index < length) { - if (this.reset) { - this.reset = false; - blocks[0] = this.block; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - if (notString) { - for (i = this.start; index < length && i < byteCount; ++index) { - blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index < length && i < byteCount; ++index) { - code = message.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - if (i >= byteCount) { - this.start = i - byteCount; - this.block = blocks[blockCount]; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - this.reset = true; - } else { - this.start = i; - } - } - return this; - }; - - Keccak.prototype.finalize = function () { - var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; - blocks[i >> 2] |= this.padding[i & 3]; - if (this.lastByteIndex === this.byteCount) { - blocks[0] = blocks[blockCount]; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - blocks[blockCount - 1] |= 0x80000000; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - }; - - Keccak.prototype.toString = Keccak.prototype.hex = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var hex = '', block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + - HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + - HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + - HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; - } - if (j % blockCount === 0) { - f(s); - i = 0; - } - } - if (extraBytes) { - block = s[i]; - if (extraBytes > 0) { - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; - } - if (extraBytes > 1) { - hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; - } - if (extraBytes > 2) { - hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; - } - } - return hex; - }; - - Keccak.prototype.arrayBuffer = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var bytes = this.outputBits >> 3; - var buffer; - if (extraBytes) { - buffer = new ArrayBuffer((outputBlocks + 1) << 2); - } else { - buffer = new ArrayBuffer(bytes); - } - var array = new Uint32Array(buffer); - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - array[j] = s[i]; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - array[i] = s[i]; - buffer = buffer.slice(0, bytes); - } - return buffer; - }; - - Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - - Keccak.prototype.digest = Keccak.prototype.array = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var array = [], offset, block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - array[offset + 1] = (block >> 8) & 0xFF; - array[offset + 2] = (block >> 16) & 0xFF; - array[offset + 3] = (block >> 24) & 0xFF; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - offset = j << 2; - block = s[i]; - if (extraBytes > 0) { - array[offset] = block & 0xFF; - } - if (extraBytes > 1) { - array[offset + 1] = (block >> 8) & 0xFF; - } - if (extraBytes > 2) { - array[offset + 2] = (block >> 16) & 0xFF; - } - } - return array; - }; - - var f = function (s) { - var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, - b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, - b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; - for (n = 0; n < 48; n += 2) { - c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; - c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; - c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; - c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; - c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; - c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; - c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; - c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; - c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; - c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; - - h = c8 ^ ((c2 << 1) | (c3 >>> 31)); - l = c9 ^ ((c3 << 1) | (c2 >>> 31)); - s[0] ^= h; - s[1] ^= l; - s[10] ^= h; - s[11] ^= l; - s[20] ^= h; - s[21] ^= l; - s[30] ^= h; - s[31] ^= l; - s[40] ^= h; - s[41] ^= l; - h = c0 ^ ((c4 << 1) | (c5 >>> 31)); - l = c1 ^ ((c5 << 1) | (c4 >>> 31)); - s[2] ^= h; - s[3] ^= l; - s[12] ^= h; - s[13] ^= l; - s[22] ^= h; - s[23] ^= l; - s[32] ^= h; - s[33] ^= l; - s[42] ^= h; - s[43] ^= l; - h = c2 ^ ((c6 << 1) | (c7 >>> 31)); - l = c3 ^ ((c7 << 1) | (c6 >>> 31)); - s[4] ^= h; - s[5] ^= l; - s[14] ^= h; - s[15] ^= l; - s[24] ^= h; - s[25] ^= l; - s[34] ^= h; - s[35] ^= l; - s[44] ^= h; - s[45] ^= l; - h = c4 ^ ((c8 << 1) | (c9 >>> 31)); - l = c5 ^ ((c9 << 1) | (c8 >>> 31)); - s[6] ^= h; - s[7] ^= l; - s[16] ^= h; - s[17] ^= l; - s[26] ^= h; - s[27] ^= l; - s[36] ^= h; - s[37] ^= l; - s[46] ^= h; - s[47] ^= l; - h = c6 ^ ((c0 << 1) | (c1 >>> 31)); - l = c7 ^ ((c1 << 1) | (c0 >>> 31)); - s[8] ^= h; - s[9] ^= l; - s[18] ^= h; - s[19] ^= l; - s[28] ^= h; - s[29] ^= l; - s[38] ^= h; - s[39] ^= l; - s[48] ^= h; - s[49] ^= l; - - b0 = s[0]; - b1 = s[1]; - b32 = (s[11] << 4) | (s[10] >>> 28); - b33 = (s[10] << 4) | (s[11] >>> 28); - b14 = (s[20] << 3) | (s[21] >>> 29); - b15 = (s[21] << 3) | (s[20] >>> 29); - b46 = (s[31] << 9) | (s[30] >>> 23); - b47 = (s[30] << 9) | (s[31] >>> 23); - b28 = (s[40] << 18) | (s[41] >>> 14); - b29 = (s[41] << 18) | (s[40] >>> 14); - b20 = (s[2] << 1) | (s[3] >>> 31); - b21 = (s[3] << 1) | (s[2] >>> 31); - b2 = (s[13] << 12) | (s[12] >>> 20); - b3 = (s[12] << 12) | (s[13] >>> 20); - b34 = (s[22] << 10) | (s[23] >>> 22); - b35 = (s[23] << 10) | (s[22] >>> 22); - b16 = (s[33] << 13) | (s[32] >>> 19); - b17 = (s[32] << 13) | (s[33] >>> 19); - b48 = (s[42] << 2) | (s[43] >>> 30); - b49 = (s[43] << 2) | (s[42] >>> 30); - b40 = (s[5] << 30) | (s[4] >>> 2); - b41 = (s[4] << 30) | (s[5] >>> 2); - b22 = (s[14] << 6) | (s[15] >>> 26); - b23 = (s[15] << 6) | (s[14] >>> 26); - b4 = (s[25] << 11) | (s[24] >>> 21); - b5 = (s[24] << 11) | (s[25] >>> 21); - b36 = (s[34] << 15) | (s[35] >>> 17); - b37 = (s[35] << 15) | (s[34] >>> 17); - b18 = (s[45] << 29) | (s[44] >>> 3); - b19 = (s[44] << 29) | (s[45] >>> 3); - b10 = (s[6] << 28) | (s[7] >>> 4); - b11 = (s[7] << 28) | (s[6] >>> 4); - b42 = (s[17] << 23) | (s[16] >>> 9); - b43 = (s[16] << 23) | (s[17] >>> 9); - b24 = (s[26] << 25) | (s[27] >>> 7); - b25 = (s[27] << 25) | (s[26] >>> 7); - b6 = (s[36] << 21) | (s[37] >>> 11); - b7 = (s[37] << 21) | (s[36] >>> 11); - b38 = (s[47] << 24) | (s[46] >>> 8); - b39 = (s[46] << 24) | (s[47] >>> 8); - b30 = (s[8] << 27) | (s[9] >>> 5); - b31 = (s[9] << 27) | (s[8] >>> 5); - b12 = (s[18] << 20) | (s[19] >>> 12); - b13 = (s[19] << 20) | (s[18] >>> 12); - b44 = (s[29] << 7) | (s[28] >>> 25); - b45 = (s[28] << 7) | (s[29] >>> 25); - b26 = (s[38] << 8) | (s[39] >>> 24); - b27 = (s[39] << 8) | (s[38] >>> 24); - b8 = (s[48] << 14) | (s[49] >>> 18); - b9 = (s[49] << 14) | (s[48] >>> 18); - - s[0] = b0 ^ (~b2 & b4); - s[1] = b1 ^ (~b3 & b5); - s[10] = b10 ^ (~b12 & b14); - s[11] = b11 ^ (~b13 & b15); - s[20] = b20 ^ (~b22 & b24); - s[21] = b21 ^ (~b23 & b25); - s[30] = b30 ^ (~b32 & b34); - s[31] = b31 ^ (~b33 & b35); - s[40] = b40 ^ (~b42 & b44); - s[41] = b41 ^ (~b43 & b45); - s[2] = b2 ^ (~b4 & b6); - s[3] = b3 ^ (~b5 & b7); - s[12] = b12 ^ (~b14 & b16); - s[13] = b13 ^ (~b15 & b17); - s[22] = b22 ^ (~b24 & b26); - s[23] = b23 ^ (~b25 & b27); - s[32] = b32 ^ (~b34 & b36); - s[33] = b33 ^ (~b35 & b37); - s[42] = b42 ^ (~b44 & b46); - s[43] = b43 ^ (~b45 & b47); - s[4] = b4 ^ (~b6 & b8); - s[5] = b5 ^ (~b7 & b9); - s[14] = b14 ^ (~b16 & b18); - s[15] = b15 ^ (~b17 & b19); - s[24] = b24 ^ (~b26 & b28); - s[25] = b25 ^ (~b27 & b29); - s[34] = b34 ^ (~b36 & b38); - s[35] = b35 ^ (~b37 & b39); - s[44] = b44 ^ (~b46 & b48); - s[45] = b45 ^ (~b47 & b49); - s[6] = b6 ^ (~b8 & b0); - s[7] = b7 ^ (~b9 & b1); - s[16] = b16 ^ (~b18 & b10); - s[17] = b17 ^ (~b19 & b11); - s[26] = b26 ^ (~b28 & b20); - s[27] = b27 ^ (~b29 & b21); - s[36] = b36 ^ (~b38 & b30); - s[37] = b37 ^ (~b39 & b31); - s[46] = b46 ^ (~b48 & b40); - s[47] = b47 ^ (~b49 & b41); - s[8] = b8 ^ (~b0 & b2); - s[9] = b9 ^ (~b1 & b3); - s[18] = b18 ^ (~b10 & b12); - s[19] = b19 ^ (~b11 & b13); - s[28] = b28 ^ (~b20 & b22); - s[29] = b29 ^ (~b21 & b23); - s[38] = b38 ^ (~b30 & b32); - s[39] = b39 ^ (~b31 & b33); - s[48] = b48 ^ (~b40 & b42); - s[49] = b49 ^ (~b41 & b43); - - s[0] ^= RC[n]; - s[1] ^= RC[n + 1]; - } - }; - - if (COMMON_JS) { - module.exports = methods; - } else { - for (var i = 0; i < methodNames.length; ++i) { - root[methodNames[i]] = methods[methodNames[i]]; - } - } + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; + + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } + + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } })(); }); @@ -59217,7 +60958,7 @@ function keccak256$3(data) { return '0x' + sha3$1$3.keccak_256(arrayify$3(data)); } -const version$1$3 = "address/5.4.0"; +const version$1$3 = "address/5.6.0"; const logger$1$3 = new Logger$3(version$1$3); function getChecksumAddress$3(address) { @@ -59309,9 +61050,9 @@ function getAddress$3(address) { return result; } -const version$l = "units/5.4.0"; +const version$k = "units/5.6.0"; -const logger$s = new Logger$3(version$l); +const logger$r = new Logger$3(version$k); const names$2 = [ "wei", "kwei", @@ -59323,7 +61064,7 @@ const names$2 = [ ]; function parseUnits$2(value, unitName) { if (typeof (value) !== "string") { - logger$s.throwArgumentError("value must be a string", "value", value); + logger$r.throwArgumentError("value must be a string", "value", value); } if (typeof (unitName) === "string") { const index = names$2.indexOf(unitName); @@ -59345,18 +61086,18 @@ function _optionalChain$1$1(ops) { let lastAccessLHS = undefined; let value = op let fixUniswapPath$1 = (path) => { let fixedPath = path.map((token, index) => { if ( - token === CONSTANTS$2.bsc.NATIVE && path[index+1] != CONSTANTS$2.bsc.WRAPPED && - path[index-1] != CONSTANTS$2.bsc.WRAPPED + token === CONSTANTS$3.bsc.NATIVE && path[index+1] != CONSTANTS$3.bsc.WRAPPED && + path[index-1] != CONSTANTS$3.bsc.WRAPPED ) { - return CONSTANTS$2.bsc.WRAPPED + return CONSTANTS$3.bsc.WRAPPED } else { return token } }); - if(fixedPath[0] == CONSTANTS$2.bsc.NATIVE && fixedPath[1] == CONSTANTS$2.bsc.WRAPPED) { + if(fixedPath[0] == CONSTANTS$3.bsc.NATIVE && fixedPath[1] == CONSTANTS$3.bsc.WRAPPED) { fixedPath.splice(0, 1); - } else if(fixedPath[fixedPath.length-1] == CONSTANTS$2.bsc.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$2.bsc.WRAPPED) { + } else if(fixedPath[fixedPath.length-1] == CONSTANTS$3.bsc.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$3.bsc.WRAPPED) { fixedPath.splice(fixedPath.length-1, 1); } @@ -59384,18 +61125,18 @@ let pathExists$1 = async (path) => { cache: 3600000, params: fixUniswapPath$1(path), }); - if(pair == CONSTANTS$2.bsc.ZERO) { return false } + if(pair == CONSTANTS$3.bsc.ZERO) { return false } let [reserves, token0, token1] = await Promise.all([ request({ blockchain: 'bsc', address: pair, method: 'getReserves' }, { api: basics$3.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'bsc', address: pair, method: 'token0' }, { api: basics$3.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'bsc', address: pair, method: 'token1' }, { api: basics$3.contracts.pair.api, cache: 3600000 }) ]); - if(path.includes(CONSTANTS$2.bsc.WRAPPED)) { - return minReserveRequirements$1({ min: 1, token: CONSTANTS$2.bsc.WRAPPED, decimals: CONSTANTS$2.bsc.DECIMALS, reserves, token0, token1 }) - } else if (path.includes(CONSTANTS$2.bsc.USD)) { - let token = new Token({ blockchain: 'bsc', address: CONSTANTS$2.bsc.USD }); + if(path.includes(CONSTANTS$3.bsc.WRAPPED)) { + return minReserveRequirements$1({ min: 1, token: CONSTANTS$3.bsc.WRAPPED, decimals: CONSTANTS$3.bsc.DECIMALS, reserves, token0, token1 }) + } else if (path.includes(CONSTANTS$3.bsc.USD)) { + let token = new Token({ blockchain: 'bsc', address: CONSTANTS$3.bsc.USD }); let decimals = await token.decimals(); - return minReserveRequirements$1({ min: 1000, token: CONSTANTS$2.bsc.USD, decimals, reserves, token0, token1 }) + return minReserveRequirements$1({ min: 1000, token: CONSTANTS$3.bsc.USD, decimals, reserves, token0, token1 }) } else { return true } @@ -59403,8 +61144,8 @@ let pathExists$1 = async (path) => { let findPath$1 = async ({ tokenIn, tokenOut }) => { if( - [tokenIn, tokenOut].includes(CONSTANTS$2.bsc.NATIVE) && - [tokenIn, tokenOut].includes(CONSTANTS$2.bsc.WRAPPED) + [tokenIn, tokenOut].includes(CONSTANTS$3.bsc.NATIVE) && + [tokenIn, tokenOut].includes(CONSTANTS$3.bsc.WRAPPED) ) { return } let path; @@ -59412,37 +61153,37 @@ let findPath$1 = async ({ tokenIn, tokenOut }) => { // direct path path = [tokenIn, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([tokenIn, CONSTANTS$2.bsc.WRAPPED]) && - tokenOut != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([tokenOut, CONSTANTS$2.bsc.WRAPPED]) + tokenIn != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([tokenIn, CONSTANTS$3.bsc.WRAPPED]) && + tokenOut != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([tokenOut, CONSTANTS$3.bsc.WRAPPED]) ) { // path via WRAPPED - path = [tokenIn, CONSTANTS$2.bsc.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.bsc.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.bsc.USD && - await pathExists$1([tokenIn, CONSTANTS$2.bsc.USD]) && - tokenOut != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([CONSTANTS$2.bsc.WRAPPED, tokenOut]) + tokenIn != CONSTANTS$3.bsc.USD && + await pathExists$1([tokenIn, CONSTANTS$3.bsc.USD]) && + tokenOut != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([CONSTANTS$3.bsc.WRAPPED, tokenOut]) ) { // path via tokenIn -> USD -> WRAPPED -> tokenOut - path = [tokenIn, CONSTANTS$2.bsc.USD, CONSTANTS$2.bsc.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.bsc.USD, CONSTANTS$3.bsc.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([tokenIn, CONSTANTS$2.bsc.WRAPPED]) && - tokenOut != CONSTANTS$2.bsc.USD && - await pathExists$1([CONSTANTS$2.bsc.USD, tokenOut]) + tokenIn != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([tokenIn, CONSTANTS$3.bsc.WRAPPED]) && + tokenOut != CONSTANTS$3.bsc.USD && + await pathExists$1([CONSTANTS$3.bsc.USD, tokenOut]) ) { // path via tokenIn -> WRAPPED -> USD -> tokenOut - path = [tokenIn, CONSTANTS$2.bsc.WRAPPED, CONSTANTS$2.bsc.USD, tokenOut]; + path = [tokenIn, CONSTANTS$3.bsc.WRAPPED, CONSTANTS$3.bsc.USD, tokenOut]; } // Add WRAPPED to route path if things start or end with NATIVE // because that actually reflects how things are routed in reality: - if(_optionalChain$1$1([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$2.bsc.NATIVE) { - path.splice(1, 0, CONSTANTS$2.bsc.WRAPPED); - } else if(_optionalChain$1$1([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$2.bsc.NATIVE) { - path.splice(path.length-1, 0, CONSTANTS$2.bsc.WRAPPED); + if(_optionalChain$1$1([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$3.bsc.NATIVE) { + path.splice(1, 0, CONSTANTS$3.bsc.WRAPPED); + } else if(_optionalChain$1$1([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$3.bsc.NATIVE) { + path.splice(path.length-1, 0, CONSTANTS$3.bsc.WRAPPED); } return path @@ -59550,7 +61291,7 @@ let getTransaction$1 = ({ api: basics$3.contracts.router.api, }; - if (path[0] === CONSTANTS$2[blockchain].NATIVE) { + if (path[0] === CONSTANTS$3[blockchain].NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactETHForTokens'; transaction.value = amountIn.toString(); @@ -59560,7 +61301,7 @@ let getTransaction$1 = ({ transaction.value = amountInMax.toString(); transaction.params = { amountOut: amountOut.toString() }; } - } else if (path[path.length - 1] === CONSTANTS$2[blockchain].NATIVE) { + } else if (path[path.length - 1] === CONSTANTS$3[blockchain].NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactTokensForETH'; transaction.params = { amountIn: amountIn.toString(), amountOutMin: amountOutMin.toString() }; @@ -59684,7 +61425,7 @@ var basics$2 = { } }; -function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } +function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } // Uniswap replaces 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with // the wrapped token 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 and implies wrapping. // @@ -59695,18 +61436,18 @@ function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[ let fixUniswapPath = (path) => { let fixedPath = path.map((token, index) => { if ( - token === CONSTANTS$2.ethereum.NATIVE && path[index+1] != CONSTANTS$2.ethereum.WRAPPED && - path[index-1] != CONSTANTS$2.ethereum.WRAPPED + token === CONSTANTS$3.ethereum.NATIVE && path[index+1] != CONSTANTS$3.ethereum.WRAPPED && + path[index-1] != CONSTANTS$3.ethereum.WRAPPED ) { - return CONSTANTS$2.ethereum.WRAPPED + return CONSTANTS$3.ethereum.WRAPPED } else { return token } }); - if(fixedPath[0] == CONSTANTS$2.ethereum.NATIVE && fixedPath[1] == CONSTANTS$2.ethereum.WRAPPED) { + if(fixedPath[0] == CONSTANTS$3.ethereum.NATIVE && fixedPath[1] == CONSTANTS$3.ethereum.WRAPPED) { fixedPath.splice(0, 1); - } else if(fixedPath[fixedPath.length-1] == CONSTANTS$2.ethereum.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$2.ethereum.WRAPPED) { + } else if(fixedPath[fixedPath.length-1] == CONSTANTS$3.ethereum.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$3.ethereum.WRAPPED) { fixedPath.splice(fixedPath.length-1, 1); } @@ -59730,18 +61471,18 @@ let pathExists = async (path) => { address: basics$2.contracts.factory.address, method: 'getPair' }, { api: basics$2.contracts.factory.api, cache: 3600000, params: fixUniswapPath(path) }); - if(pair == CONSTANTS$2.ethereum.ZERO) { return false } + if(pair == CONSTANTS$3.ethereum.ZERO) { return false } let [reserves, token0, token1] = await Promise.all([ request({ blockchain: 'ethereum', address: pair, method: 'getReserves' }, { api: basics$2.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'ethereum', address: pair, method: 'token0' }, { api: basics$2.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'ethereum', address: pair, method: 'token1' }, { api: basics$2.contracts.pair.api, cache: 3600000 }) ]); - if(path.includes(CONSTANTS$2.ethereum.WRAPPED)) { - return minReserveRequirements({ min: 1, token: CONSTANTS$2.ethereum.WRAPPED, decimals: CONSTANTS$2.ethereum.DECIMALS, reserves, token0, token1 }) - } else if (path.includes(CONSTANTS$2.ethereum.USD)) { - let token = new Token({ blockchain: 'ethereum', address: CONSTANTS$2.ethereum.USD }); + if(path.includes(CONSTANTS$3.ethereum.WRAPPED)) { + return minReserveRequirements({ min: 1, token: CONSTANTS$3.ethereum.WRAPPED, decimals: CONSTANTS$3.ethereum.DECIMALS, reserves, token0, token1 }) + } else if (path.includes(CONSTANTS$3.ethereum.USD)) { + let token = new Token({ blockchain: 'ethereum', address: CONSTANTS$3.ethereum.USD }); let decimals = await token.decimals(); - return minReserveRequirements({ min: 1000, token: CONSTANTS$2.ethereum.USD, decimals, reserves, token0, token1 }) + return minReserveRequirements({ min: 1000, token: CONSTANTS$3.ethereum.USD, decimals, reserves, token0, token1 }) } else { return true } @@ -59749,8 +61490,8 @@ let pathExists = async (path) => { let findPath = async ({ tokenIn, tokenOut }) => { if( - [tokenIn, tokenOut].includes(CONSTANTS$2.ethereum.NATIVE) && - [tokenIn, tokenOut].includes(CONSTANTS$2.ethereum.WRAPPED) + [tokenIn, tokenOut].includes(CONSTANTS$3.ethereum.NATIVE) && + [tokenIn, tokenOut].includes(CONSTANTS$3.ethereum.WRAPPED) ) { return } let path; @@ -59758,37 +61499,37 @@ let findPath = async ({ tokenIn, tokenOut }) => { // direct path path = [tokenIn, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([tokenIn, CONSTANTS$2.ethereum.WRAPPED]) && - tokenOut != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([tokenOut, CONSTANTS$2.ethereum.WRAPPED]) + tokenIn != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([tokenIn, CONSTANTS$3.ethereum.WRAPPED]) && + tokenOut != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([tokenOut, CONSTANTS$3.ethereum.WRAPPED]) ) { // path via WRAPPED - path = [tokenIn, CONSTANTS$2.ethereum.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.ethereum.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.ethereum.USD && - await pathExists([tokenIn, CONSTANTS$2.ethereum.USD]) && - tokenOut != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([CONSTANTS$2.ethereum.WRAPPED, tokenOut]) + tokenIn != CONSTANTS$3.ethereum.USD && + await pathExists([tokenIn, CONSTANTS$3.ethereum.USD]) && + tokenOut != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([CONSTANTS$3.ethereum.WRAPPED, tokenOut]) ) { // path via tokenIn -> USD -> WRAPPED -> tokenOut - path = [tokenIn, CONSTANTS$2.ethereum.USD, CONSTANTS$2.ethereum.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.ethereum.USD, CONSTANTS$3.ethereum.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([tokenIn, CONSTANTS$2.ethereum.WRAPPED]) && - tokenOut != CONSTANTS$2.ethereum.USD && - await pathExists([CONSTANTS$2.ethereum.USD, tokenOut]) + tokenIn != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([tokenIn, CONSTANTS$3.ethereum.WRAPPED]) && + tokenOut != CONSTANTS$3.ethereum.USD && + await pathExists([CONSTANTS$3.ethereum.USD, tokenOut]) ) { // path via tokenIn -> WRAPPED -> USD -> tokenOut - path = [tokenIn, CONSTANTS$2.ethereum.WRAPPED, CONSTANTS$2.ethereum.USD, tokenOut]; + path = [tokenIn, CONSTANTS$3.ethereum.WRAPPED, CONSTANTS$3.ethereum.USD, tokenOut]; } // Add WRAPPED to route path if things start or end with NATIVE // because that actually reflects how things are routed in reality: - if(_optionalChain$8([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$2.ethereum.NATIVE) { - path.splice(1, 0, CONSTANTS$2.ethereum.WRAPPED); - } else if(_optionalChain$8([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$2.ethereum.NATIVE) { - path.splice(path.length-1, 0, CONSTANTS$2.ethereum.WRAPPED); + if(_optionalChain$5([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$3.ethereum.NATIVE) { + path.splice(1, 0, CONSTANTS$3.ethereum.WRAPPED); + } else if(_optionalChain$5([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$3.ethereum.NATIVE) { + path.splice(path.length-1, 0, CONSTANTS$3.ethereum.WRAPPED); } return path @@ -59894,7 +61635,7 @@ let getTransaction = ({ api: basics$2.contracts.router.api, }; - if (path[0] === CONSTANTS$2.ethereum.NATIVE) { + if (path[0] === CONSTANTS$3.ethereum.NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactETHForTokens'; transaction.value = amountIn.toString(); @@ -59904,7 +61645,7 @@ let getTransaction = ({ transaction.value = amountInMax.toString(); transaction.params = { amountOut: amountOut.toString() }; } - } else if (path[path.length - 1] === CONSTANTS$2.ethereum.NATIVE) { + } else if (path[path.length - 1] === CONSTANTS$3.ethereum.NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactTokensForETH'; transaction.params = { amountIn: amountIn.toString(), amountOutMin: amountOutMin.toString() }; @@ -60009,7 +61750,7 @@ var basics$1 = { logo: 'data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EoDKPYmzTtElqEvv+jeoPddKwocs4SMn//kCHXijqG0L+8hMz77NvmWiJKKbXWOeWRlwjRP+6WU5hbW5a1922/4hPecRz3tA9b6r2vwzK0dAaOyfv9F01TlKG+VV7FaUo3TQEAAAAAAAAAAAAAAAAAAPgjD3Wdsa++sjjFAAAAAElFTkSuQmCC', contracts: { wrapper: { - address: CONSTANTS$2.ethereum.WRAPPED, + address: CONSTANTS$3.ethereum.WRAPPED, api: WETH }, } @@ -60029,19 +61770,19 @@ let route$2 = ({ return new Promise(async (resolve)=> { if( - ![CONSTANTS$2.ethereum.NATIVE, CONSTANTS$2.ethereum.WRAPPED].includes(tokenIn) && - ![CONSTANTS$2.ethereum.NATIVE, CONSTANTS$2.ethereum.WRAPPED].includes(tokenOut) + ![CONSTANTS$3.ethereum.NATIVE, CONSTANTS$3.ethereum.WRAPPED].includes(tokenIn) && + ![CONSTANTS$3.ethereum.NATIVE, CONSTANTS$3.ethereum.WRAPPED].includes(tokenOut) ) { return resolve() } amountIn = amountInMax = amountOut = amountOutMin = [amountIn, amountInMax, amountOut, amountOutMin].filter(Boolean)[0]; let route; - if(tokenIn === CONSTANTS$2.ethereum.NATIVE && tokenOut === CONSTANTS$2.ethereum.WRAPPED) { + if(tokenIn === CONSTANTS$3.ethereum.NATIVE && tokenOut === CONSTANTS$3.ethereum.WRAPPED) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.ethereum.NATIVE, CONSTANTS$2.ethereum.WRAPPED], + path: [CONSTANTS$3.ethereum.NATIVE, CONSTANTS$3.ethereum.WRAPPED], amountIn, amountInMax, amountOut, @@ -60052,17 +61793,17 @@ let route$2 = ({ transaction: { blockchain: 'ethereum', from: fromAddress, - to: CONSTANTS$2.ethereum.WRAPPED, + to: CONSTANTS$3.ethereum.WRAPPED, api: WETH, method: 'deposit', value: amountOut.toString() } }); - } else if(tokenIn === CONSTANTS$2.ethereum.WRAPPED && tokenOut === CONSTANTS$2.ethereum.NATIVE) { + } else if(tokenIn === CONSTANTS$3.ethereum.WRAPPED && tokenOut === CONSTANTS$3.ethereum.NATIVE) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.ethereum.WRAPPED, CONSTANTS$2.ethereum.NATIVE], + path: [CONSTANTS$3.ethereum.WRAPPED, CONSTANTS$3.ethereum.NATIVE], amountIn, amountInMax, amountOut, @@ -60073,7 +61814,7 @@ let route$2 = ({ transaction: { blockchain: 'ethereum', from: fromAddress, - to: CONSTANTS$2.ethereum.WRAPPED, + to: CONSTANTS$3.ethereum.WRAPPED, api: WETH, method: 'withdraw', params: [amountOut] @@ -60099,7 +61840,7 @@ var basics = { logo: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAMFBMVEVHcEz65KT545343IT21Gf0zErzwy7xvRnwtgLwuQv0yD31z1f6453767n+9+L///9r8v7xAAAACHRSTlMAIEx2m8Df+6FztuQAABgGSURBVHja7Z1LcxvJkceroX3E3vCQ7wBI6iw+Hb5ZJEGNb2uSIKU9TYgkIN42wsJLug6J6jlthEdEFX3eGMv2fWLs0X6AkXf8Abg7+gA7M/oCFrXRoEhRALqemdXVROfJ4RhJqH//KrM6KzObkMwyyyyzzDLLLLPMMssss8wyywzdgmJ1ZnG9Vt9pNHp8aING46C+vb64UK3kb/ji84VCoVhdXFqv1RvNTudSgE6n3ahvr68tVCuFQuEGr79QXVyq16NnHy2/0+HvLfrfnUbEQb2+vlgt3EQOguGjr9WbPXphjIf8yhhj7OL/HrQP1hcXbiAHxZlo1zebPT5c/EQLKaV8MERhfaFyk8gvFGeWas3hMw65xIb/1aCxvbZQuSlbIagu7TQanR4Ppat/T0LII5dQX7sJQSEoVGdqO12VZ3/dIgz6BzfBIRZnd5qdDtda/XsOeKfTPlirpBv+maWdyO1zI6OUnh6sLaR4I5RqzcvDjqkNOu2tlCoQVBeHnt9q/VFMaG8vVvOpfPyHIQcxdrKdOgWix9+wffxXriBsbKctJBZrhxTo+V/shJO1NEFQX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r9Uazc3lIGkTLr2+vrw0ffeEmr/8iKFRnFtdrEQeXAkTPfnt9caFayZPMMssss8wyyyyzzDLLLLPMMssM3f4fl5DWWgmVTDoAAAAASUVORK5CYII=', contracts: { wrapper: { - address: CONSTANTS$2.bsc.WRAPPED, + address: CONSTANTS$3.bsc.WRAPPED, api: WBNB }, } @@ -60119,19 +61860,19 @@ let route$1 = ({ return new Promise(async (resolve)=> { if( - ![CONSTANTS$2.bsc.NATIVE, CONSTANTS$2.bsc.WRAPPED].includes(tokenIn) && - ![CONSTANTS$2.bsc.NATIVE, CONSTANTS$2.bsc.WRAPPED].includes(tokenOut) + ![CONSTANTS$3.bsc.NATIVE, CONSTANTS$3.bsc.WRAPPED].includes(tokenIn) && + ![CONSTANTS$3.bsc.NATIVE, CONSTANTS$3.bsc.WRAPPED].includes(tokenOut) ) { return resolve() } amountIn = amountInMax = amountOut = amountOutMin = [amountIn, amountInMax, amountOut, amountOutMin].filter(Boolean)[0]; let route; - if(tokenIn === CONSTANTS$2.bsc.NATIVE && tokenOut === CONSTANTS$2.bsc.WRAPPED) { + if(tokenIn === CONSTANTS$3.bsc.NATIVE && tokenOut === CONSTANTS$3.bsc.WRAPPED) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.bsc.NATIVE, CONSTANTS$2.bsc.WRAPPED], + path: [CONSTANTS$3.bsc.NATIVE, CONSTANTS$3.bsc.WRAPPED], amountIn, amountInMax, amountOut, @@ -60142,17 +61883,17 @@ let route$1 = ({ transaction: { blockchain: 'bsc', from: fromAddress, - to: CONSTANTS$2.bsc.WRAPPED, + to: CONSTANTS$3.bsc.WRAPPED, api: WBNB, method: 'deposit', value: amountOut.toString() } }); - } else if(tokenIn === CONSTANTS$2.bsc.WRAPPED && tokenOut === CONSTANTS$2.bsc.NATIVE) { + } else if(tokenIn === CONSTANTS$3.bsc.WRAPPED && tokenOut === CONSTANTS$3.bsc.NATIVE) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.bsc.WRAPPED, CONSTANTS$2.bsc.NATIVE], + path: [CONSTANTS$3.bsc.WRAPPED, CONSTANTS$3.bsc.NATIVE], amountIn, amountInMax, amountOut, @@ -60163,7 +61904,7 @@ let route$1 = ({ transaction: { blockchain: 'bsc', from: fromAddress, - to: CONSTANTS$2.bsc.WRAPPED, + to: CONSTANTS$3.bsc.WRAPPED, api: WBNB, method: 'withdraw', params: [amountOut] @@ -60686,10 +62427,10 @@ class Currency { } const ensureNativeTokenAsset = async ({ address, options, assets, blockchain }) => { - if(options.only && options.only[blockchain] && !options.only[blockchain].find((only)=>(only.toLowerCase() == CONSTANTS$2[blockchain].NATIVE.toLowerCase()))){ return assets } - if(options.exclude && options.exclude[blockchain] && !!options.exclude[blockchain].find((exclude)=>(exclude.toLowerCase() == CONSTANTS$2[blockchain].NATIVE.toLowerCase()))){ return assets } + if(options.only && options.only[blockchain] && !options.only[blockchain].find((only)=>(only.toLowerCase() == CONSTANTS$3[blockchain].NATIVE.toLowerCase()))){ return assets } + if(options.exclude && options.exclude[blockchain] && !!options.exclude[blockchain].find((exclude)=>(exclude.toLowerCase() == CONSTANTS$3[blockchain].NATIVE.toLowerCase()))){ return assets } - const nativeTokenMissing = !assets.find((asset)=>(asset.address.toLowerCase() == CONSTANTS$2[blockchain].NATIVE.toLowerCase())); + const nativeTokenMissing = !assets.find((asset)=>(asset.address.toLowerCase() == CONSTANTS$3[blockchain].NATIVE.toLowerCase())); if(nativeTokenMissing) { let balance = await request( { @@ -60700,9 +62441,9 @@ const ensureNativeTokenAsset = async ({ address, options, assets, blockchain }) { cache: 30000 } ); assets = [{ - name: CONSTANTS$2[blockchain].CURRENCY, - symbol: CONSTANTS$2[blockchain].SYMBOL, - address: CONSTANTS$2[blockchain].NATIVE, + name: CONSTANTS$3[blockchain].CURRENCY, + symbol: CONSTANTS$3[blockchain].SYMBOL, + address: CONSTANTS$3[blockchain].NATIVE, type: 'NATIVE', blockchain, balance: balance.toString() @@ -60880,14 +62621,14 @@ const prepareUniswapTransaction = (transaction)=>{ transaction.params.path = transaction.params.path.filter((token, index, path)=>{ if( index == 1 && - token == CONSTANTS$2[transaction.blockchain].WRAPPED && - path[0] == CONSTANTS$2[transaction.blockchain].NATIVE + token == CONSTANTS$3[transaction.blockchain].WRAPPED && + path[0] == CONSTANTS$3[transaction.blockchain].NATIVE ) { return false } else if ( index == path.length-2 && - token == CONSTANTS$2[transaction.blockchain].WRAPPED && - path[path.length-1] == CONSTANTS$2[transaction.blockchain].NATIVE + token == CONSTANTS$3[transaction.blockchain].WRAPPED && + path[path.length-1] == CONSTANTS$3[transaction.blockchain].NATIVE ) { return false } else { @@ -64441,7 +66182,7 @@ var bn$4 = createCommonjsModule$5(function (module) { })(module, commonjsGlobal$4); }); -const version$3$4 = "logger/5.5.0"; +const version$3$4 = "logger/5.6.0"; let _permanentCensorErrors$4 = false; let _censorErrors$4 = false; @@ -64620,6 +66361,40 @@ class Logger$4 { messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$4.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$4.CALL_EXCEPTION: + case ErrorCode$4.INSUFFICIENT_FUNDS: + case ErrorCode$4.MISSING_NEW: + case ErrorCode$4.NONCE_EXPIRED: + case ErrorCode$4.REPLACEMENT_UNDERPRICED: + case ErrorCode$4.TRANSACTION_REPLACED: + case ErrorCode$4.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -64753,7 +66528,7 @@ class Logger$4 { Logger$4.errors = ErrorCode$4; Logger$4.levels = LogLevel$4; -const version$2$4 = "bytes/5.5.0"; +const version$2$4 = "bytes/5.6.1"; const logger$3$4 = new Logger$4(version$2$4); /////////////////////////////// @@ -64770,7 +66545,7 @@ function addSlice$4(array) { }; return array; } -function isInteger$1(value) { +function isInteger$4(value) { return (typeof (value) === "number" && value == value && (value % 1) === 0); } function isBytes$4(value) { @@ -64783,12 +66558,12 @@ function isBytes$4(value) { if (typeof (value) === "string") { return false; } - if (!isInteger$1(value.length) || value.length < 0) { + if (!isInteger$4(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (!isInteger$1(v) || v < 0 || v >= 256) { + if (!isInteger$4(v) || v < 0 || v >= 256) { return false; } } @@ -64820,7 +66595,7 @@ function arrayify$4(value, options) { let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -64922,7 +66697,7 @@ function hexZeroPad$4(value, length) { return value; } -const version$1$4 = "bignumber/5.5.0"; +const version$1$4 = "bignumber/5.6.0"; var BN$4 = bn$4.BN; const logger$2$4 = new Logger$4(version$1$4); @@ -64971,7 +66746,7 @@ class BigNumber$4 { div(other) { const o = BigNumber$4.from(other); if (o.isZero()) { - throwFault$1$3("division by zero", "div"); + throwFault$1$3("division-by-zero", "div"); } return toBigNumber$4(toBN$4(this).div(toBN$4(other))); } @@ -64981,53 +66756,53 @@ class BigNumber$4 { mod(other) { const value = toBN$4(other); if (value.isNeg()) { - throwFault$1$3("cannot modulo negative values", "mod"); + throwFault$1$3("division-by-zero", "mod"); } return toBigNumber$4(toBN$4(this).umod(value)); } pow(other) { const value = toBN$4(other); if (value.isNeg()) { - throwFault$1$3("cannot raise to negative values", "pow"); + throwFault$1$3("negative-power", "pow"); } return toBigNumber$4(toBN$4(this).pow(value)); } and(other) { const value = toBN$4(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$3("cannot 'and' negative values", "and"); + throwFault$1$3("unbound-bitwise-result", "and"); } return toBigNumber$4(toBN$4(this).and(value)); } or(other) { const value = toBN$4(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$3("cannot 'or' negative values", "or"); + throwFault$1$3("unbound-bitwise-result", "or"); } return toBigNumber$4(toBN$4(this).or(value)); } xor(other) { const value = toBN$4(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$3("cannot 'xor' negative values", "xor"); + throwFault$1$3("unbound-bitwise-result", "xor"); } return toBigNumber$4(toBN$4(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$1$3("cannot mask negative values", "mask"); + throwFault$1$3("negative-width", "mask"); } return toBigNumber$4(toBN$4(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$1$3("cannot shift negative values", "shl"); + throwFault$1$3("negative-width", "shl"); } return toBigNumber$4(toBN$4(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$1$3("cannot shift negative values", "shr"); + throwFault$1$3("negative-width", "shr"); } return toBigNumber$4(toBN$4(this).shrn(value)); } @@ -65211,7 +66986,7 @@ function throwFault$1$3(fault, operation, value) { } const logger$1$4 = new Logger$4(version$1$4); -const _constructorGuard$7 = {}; +const _constructorGuard$6 = {}; const Zero$5 = BigNumber$4.from(0); const NegativeOne$5 = BigNumber$4.from(-1); function throwFault$5(message, fault, operation, value) { @@ -65322,7 +67097,7 @@ function parseFixed$3(value, decimals) { } class FixedFormat$3 { constructor(constructorGuard, signed, width, decimals) { - if (constructorGuard !== _constructorGuard$7) { + if (constructorGuard !== _constructorGuard$6) { logger$1$4.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$4.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -65379,13 +67154,13 @@ class FixedFormat$3 { if (decimals > 80) { logger$1$4.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); } - return new FixedFormat$3(_constructorGuard$7, signed, width, decimals); + return new FixedFormat$3(_constructorGuard$6, signed, width, decimals); } } class FixedNumber$3 { constructor(constructorGuard, hex, value, format) { logger$1$4.checkNew(new.target, FixedNumber$3); - if (constructorGuard !== _constructorGuard$7) { + if (constructorGuard !== _constructorGuard$6) { logger$1$4.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$4.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -65522,7 +67297,7 @@ class FixedNumber$3 { hex = hexZeroPad$4(hex, fixedFormat.width / 8); } const decimal = formatFixed$3(numeric, fixedFormat.decimals); - return new FixedNumber$3(_constructorGuard$7, hex, decimal, fixedFormat); + return new FixedNumber$3(_constructorGuard$6, hex, decimal, fixedFormat); } static fromBytes(value, format) { if (format == null) { @@ -65538,7 +67313,7 @@ class FixedNumber$3 { } const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); const decimal = formatFixed$3(numeric, fixedFormat.decimals); - return new FixedNumber$3(_constructorGuard$7, hex, decimal, fixedFormat); + return new FixedNumber$3(_constructorGuard$6, hex, decimal, fixedFormat); } static from(value, format) { if (typeof (value) === "string") { @@ -65565,9 +67340,9 @@ class FixedNumber$3 { const ONE$3 = FixedNumber$3.from(1); const BUMP$3 = FixedNumber$3.from("0.5"); -const version$m = "units/5.5.0"; +const version$l = "units/5.6.0"; -const logger$t = new Logger$4(version$m); +const logger$s = new Logger$4(version$l); const names$3 = [ "wei", "kwei", @@ -65579,7 +67354,7 @@ const names$3 = [ ]; function parseUnits$3(value, unitName) { if (typeof (value) !== "string") { - logger$t.throwArgumentError("value must be a string", "value", value); + logger$s.throwArgumentError("value must be a string", "value", value); } if (typeof (unitName) === "string") { const index = names$3.indexOf(unitName); @@ -65618,7 +67393,7 @@ let getTransaction$2 = ({ paymentRoute, event, fee })=> { let transactionAddress = ({ paymentRoute, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return paymentRoute.toAddress } else { return paymentRoute.toToken.address @@ -65630,7 +67405,7 @@ let transactionAddress = ({ paymentRoute, fee })=> { let transactionApi = ({ paymentRoute, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return undefined } else { return Token[paymentRoute.blockchain].DEFAULT @@ -65642,7 +67417,7 @@ let transactionApi = ({ paymentRoute, fee })=> { let transactionMethod = ({ paymentRoute, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return undefined } else { return 'transfer' @@ -65654,7 +67429,7 @@ let transactionMethod = ({ paymentRoute, fee })=> { let transactionParams = ({ paymentRoute, exchangeRoute, event, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return undefined } else { return [paymentRoute.toAddress, paymentRoute.toAmount] @@ -65766,7 +67541,7 @@ let transactionPlugins = ({ paymentRoute, exchangeRoute, event, fee })=> { }; let transactionValue = ({ paymentRoute, exchangeRoute })=> { - if(paymentRoute.fromToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.fromToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { if(exchangeRoute) { return exchangeRoute.amountIn.toString() } else { // direct payment @@ -82976,17 +84751,17 @@ var lodash = createCommonjsModule$5(function (module, exports) { }.call(commonjsGlobal$4)); }); -function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } +function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } class PaymentRoute { constructor({ blockchain, fromAddress, fromToken, fromDecimals, fromAmount, fromBalance, toToken, toDecimals, toAmount, toAddress, toContract }) { this.blockchain = blockchain; this.fromAddress = fromAddress; this.fromToken = fromToken; - this.fromAmount = _optionalChain$9([fromAmount, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]); + this.fromAmount = _optionalChain$6([fromAmount, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]); this.fromDecimals = fromDecimals; this.fromBalance = fromBalance; this.toToken = toToken; - this.toAmount = _optionalChain$9([toAmount, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); + this.toAmount = _optionalChain$6([toAmount, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); this.toDecimals = toDecimals; this.toAddress = toAddress; this.toContract = toContract; @@ -83193,7 +84968,7 @@ let addApproval = (routes) => { if( ( route.directTransfer || - route.fromToken.address.toLowerCase() == CONSTANTS$2[route.blockchain].NATIVE.toLowerCase() + route.fromToken.address.toLowerCase() == CONSTANTS$3[route.blockchain].NATIVE.toLowerCase() ) && route.toContract == undefined ) { routes[index].approvalRequired = false; @@ -83205,7 +84980,7 @@ let addApproval = (routes) => { to: route.fromToken.address, api: Token[route.blockchain].DEFAULT, method: 'approve', - params: [routers[route.blockchain].address, CONSTANTS$2[route.blockchain].MAXINT] + params: [routers[route.blockchain].address, CONSTANTS$3[route.blockchain].MAXINT] }; } } @@ -83225,7 +85000,7 @@ let addDirectTransferStatus = ({ routes, fee }) => { let addRouteAmounts = (routes)=> { return routes.map((route)=>{ if(route.directTransfer && !route.fee) { - if(route.fromToken.address.toLowerCase() == CONSTANTS$2[route.blockchain].NATIVE.toLowerCase()) { + if(route.fromToken.address.toLowerCase() == CONSTANTS$3[route.blockchain].NATIVE.toLowerCase()) { route.fromAmount = route.transaction.value; route.toAmount = route.transaction.value; } else { @@ -83290,10 +85065,10 @@ let sortPaymentRoutes = (routes) => { return aWins } - if (a.fromToken.address.toLowerCase() == CONSTANTS$2[a.blockchain].NATIVE.toLowerCase()) { + if (a.fromToken.address.toLowerCase() == CONSTANTS$3[a.blockchain].NATIVE.toLowerCase()) { return aWins } - if (b.fromToken.address.toLowerCase() == CONSTANTS$2[b.blockchain].NATIVE.toLowerCase()) { + if (b.fromToken.address.toLowerCase() == CONSTANTS$3[b.blockchain].NATIVE.toLowerCase()) { return bWins } @@ -84984,7 +86759,7 @@ let TokenImage = function(props){ const address = props.address; react.useEffect(()=>{ - if(CONSTANTS$2[blockchain].NATIVE.toLowerCase() == address.toLowerCase()) { + if(CONSTANTS$3[blockchain].NATIVE.toLowerCase() == address.toLowerCase()) { setSrc(Blockchain.findByName(blockchain).logo); } else { setSrc(trustWalletAddress({ blockchain, address })); @@ -87115,13 +88890,13 @@ var ChangableAmountProvider = (function (props) { })); } else { Promise.all(props.accept.map(function (configuration) { - if (CONSTANTS$2[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) { + if (CONSTANTS$3[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) { return 1.00 / conversionRate; } return route({ blockchain: configuration.blockchain, - tokenIn: CONSTANTS$2[configuration.blockchain].USD, + tokenIn: CONSTANTS$3[configuration.blockchain].USD, amountIn: 1.00 / conversionRate * amount, tokenOut: configuration.token, fromAddress: account, @@ -87196,7 +88971,7 @@ var ChangableAmountProvider = (function (props) { setMaxAmount(maxAmount > 10 ? Math.round(maxAmount) : round$1(maxAmount)); })["catch"](setError); })["catch"](setError); - } else if (maxRoute.fromToken.address == CONSTANTS$2[maxRoute.blockchain].USD) { + } else if (maxRoute.fromToken.address == CONSTANTS$3[maxRoute.blockchain].USD) { var _maxAmount = parseFloat(new Decimal(readableMaxAmount).mul(conversionRate).toString()); setMaxAmount(_maxAmount > 10 ? Math.round(_maxAmount) : _maxAmount); @@ -87204,7 +88979,7 @@ var ChangableAmountProvider = (function (props) { route({ blockchain: maxRoute.blockchain, tokenIn: maxRoute.fromToken.address, - tokenOut: CONSTANTS$2[maxRoute.blockchain].USD, + tokenOut: CONSTANTS$3[maxRoute.blockchain].USD, amountIn: parseFloat(readableMaxAmount), fromAddress: account, toAddress: account @@ -87216,7 +88991,7 @@ var ChangableAmountProvider = (function (props) { Token.readable({ amount: routes[0].amountOut, blockchain: maxRoute.blockchain, - address: CONSTANTS$2[maxRoute.blockchain].USD + address: CONSTANTS$3[maxRoute.blockchain].USD }).then(function (readableMaxAmount) { var slippage = 1.01; var maxAmount = parseFloat(new Decimal(readableMaxAmount).div(slippage).mul(conversionRate).toString()); @@ -87883,7 +89658,7 @@ var PaymentValueProvider = (function (props) { Promise.all([route({ blockchain: payment.route.blockchain, tokenIn: payment.route.toToken.address, - tokenOut: CONSTANTS$2[payment.route.blockchain].USD, + tokenOut: CONSTANTS$3[payment.route.blockchain].USD, amountIn: payment.route.toAmount, fromAddress: account, toAddress: account @@ -87896,7 +89671,7 @@ var PaymentValueProvider = (function (props) { toAddress: account }) : Promise.resolve([]), new Token({ blockchain: payment.route.blockchain, - address: CONSTANTS$2[payment.route.blockchain].USD + address: CONSTANTS$3[payment.route.blockchain].USD }).decimals()]).then(function (_ref2) { var _ref3 = _slicedToArray(_ref2, 3), toTokenUSDExchangeRoutes = _ref3[0], @@ -87920,7 +89695,7 @@ var PaymentValueProvider = (function (props) { var toTokenUSDAmount; - if (payment.route.toToken.address.toLowerCase() == CONSTANTS$2[payment.route.blockchain].USD.toLowerCase()) { + if (payment.route.toToken.address.toLowerCase() == CONSTANTS$3[payment.route.blockchain].USD.toLowerCase()) { toTokenUSDAmount = payment.route.toAmount.toString(); } else if (toTokenUSDRoute == undefined) { setPaymentValue(''); diff --git a/dist/umd/index.bundle.js b/dist/umd/index.bundle.js index 5fac211..b29850c 100644 --- a/dist/umd/index.bundle.js +++ b/dist/umd/index.bundle.js @@ -1309,12 +1309,12 @@ name: 'bsc', id: '0x38', networkId: '56', - label: 'Binance Smart Chain', - fullName: 'Binance Smart Chain Mainnet', + label: 'BNB Smart Chain', + fullName: 'BNB Smart Chain Mainnet', logo: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAElBMVEVHcEz+8MH+5Zr8z0L7xin6uAAnV2YyAAAABXRSTlMAKUuw0AGI+EgAAAjjSURBVHja7d2NbeQ4DAVg5yo4nKeAwZUQYAs4A6lgM/23ssgFQf5mJhbFZ/KRjwUQkvWNR7YlalkUCoVCoVAoFAqFQqFQKBQKhUKhUCgUCoVCoVAoFAqFQqFQKBQKSKzn3v1/eNp6X4DT5fncG8DlsvUGcGlN4K+ny6U1gRcAnQk8/A+gMYFXAH0JvAFoS+ANQFcC7wCaEngH0JPARwAtCXwE0JHAZwANCXwG0I/AVwDtCHwF0I3AdwDNCHwH0IvANQCtCFwD0InAdQCNCFwH0IfALQBtCNwC0IXAbQBNCNwG0IPAPQAtCNwD0IHAw6+7F6A+gfV+/8sT+AlAeQI/AahO4GcAxQmcfu5/aQL35wANCOwBUJnAPgCFCewDUJfAXgBlCax7+1+UwJ45QGkC+wHUJDACoCSBEQAVCYwBKEhgDEA9AvvnAEUJnEb7X4zAOIBiBMYB1CJgAVCKgAVAJQKjc4ByBFZb/8sQsAIoQ8AKoAoBO4AiBOwAahCYAVCCwGmm/wUI2CaBhQjMAeAnMAuAnsAsAHYC8wDICazz/acmMDcHKEDAAwAzAR8AxAR8APAS8AJAS+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nbwfQ9iVoUtJ5AHIFqGfsBsCigoLeASBYgHoKVwBUWwmeApAsQOMObgFgH8IyeheAZAGaY5grAJpbRtFTAKIFaFrMCsB2FdMNvQ9AtgD1ZC0AzHHMnElZAAgXoJ7cBsBisoJsAKQLUM/UFQA9GH/lCGAvU4B6CicAZmf+QHYA4gVo9mZXADR3PVpfvgBNGboCOEwcj9YPQICm0VsAGD3a5Wj9EASoJ3MFQDu3o/WDEKCesSsAWquC2gGEIUA9n1wB0F/kACAQARrrIlcA5AIgEAGaH09gAYQhQHNdBAUQiABNGQIBBCNAPTkOQEAC1PMbCsBvIQlQDwrAj5IIIAKIACKACCACiAAigAggAogAIoAIIAKIAPoH4CcC1Z4INgWkGlvASSpYle5Ak27EVULwnOHWpQzZj5xcXiUEz5m2CeAH//8bFcirhOA3SdVHAZrvjUVvBPWQm14KUE8ueyOoh0x7KUDjEyLZG0H5k676KEA9g21/VkDnk/VSgHrGPVoBnU/RSwEaKujRCugdFfRRgObjkf6sgM4n76UA/22/DokAgGEgCE7dxEp5/WspDQgO+V0TN9dV0AHNbmQAm/MyAwAAAAAAAAAAsOgDnoXGy163DjEAAAAASUVORK5CYII=', currency: { - name: 'Binance Coin', + name: 'BNB', symbol: 'BNB', decimals: 18 }, @@ -1341,7 +1341,7 @@ id: '0x89', networkId: '137', label: 'Polygon', - fullName: 'Matic(Polygon) Mainnet', + fullName: 'Polygon Mainnet', logo: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAGFBMVEVHcEzZvfrQr/nEmvevdvShXvGSRO+NPO5VmlSmAAAAB3RSTlMAGThfi7/qvWAYyAAADJxJREFUeNrsnU1z2zYURUFB6dpTs107tTnZqp1K2kZeSNtGnpjbZKwY+9YU/n6pTOIh04qmiQsQj7hnmUUmPKF48fDxoAghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQghRKls+fuNWpchsa5+5U+kxK22DvUq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r6mUp+AoTvV+iP1TITIHy5Qn+umJkA4T38g9XMBAjvIV9pZSzA5i/wAjhCAdbwmAFlwbPGeLmDB03UYUoChG9XQAPAbbbg+BWctmY4hm9zssDm7WnPMHmZlTIgA5cKxzJ/npMi+sL1kQFwzB1mxgMzd44NgHFqPhIbHzpx+uoR104LmpvEk8xGZgJEJSp7e+nDA/jB09woRPLAowHkuAQQrRHZE7u7WlkuAUQLSPpIE3bkVgZtUR6QP7MKIdc3gOhVfALRoQPKrBNq1+8x5YAJQ03ywXAXmUKm/WhybJlTiMKX0waY+T8AURWTRKgsKMZqSGKeoQblGA5K4XqnsVaoHMNh0b5nHJ/xoBzDoTEXKIAQbnxUoSvff6c9SwfKMRwDq9CVzf1L2qJWfgIG0CuZc/Phnz/+fOdRQb4jAT/CKQcDBMRUQ/aTxgF4hNOeb+M2QLYRTpkUANCpFagj9gGBjXDKygA5JzpmYYD4EU5JZrkxoZBWwDrLjQtgOTDqDjj6kGtiBshghpkZINwM2We5cYKYZzjSPfBkZphdAQCeZ5hglhsv2s3RAGHzDLM1QJAZZmyAEDNMNMuNn9X4pnknppmjAUZvFGeyBczWGWazBcxkhhMoAI4xPgBnueVIFQJsllueVBPeAkb3xhMywGMznO4WMNQMs9wCBprhaL8CRFD6eXTA5zEz6YDPU83SANus5miAbVQzRwNso9w8OuCnyoG5dIDn0H6OBtjG+Hl0wOepZtIBn6eeYQHwkxnO0QCPT03naIDHZjjdLeCOCnz6uud+js8vCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCP+1B4cEAAAAAIL+v7a7AQAAAAAAAAAAACZ3ytyh8egOIwAAAABJRU5ErkJggg==', currency: { @@ -1354,7 +1354,17 @@ if(transaction) { return `https://polygonscan.com/tx/${transaction.id}` } if(token) { return `https://polygonscan.com/token/${token}` } }, - rpc: 'https://rpc-mainnet.matic.network' + rpc: 'https://rpc-mainnet.matic.network', + tokens: [ // only major tokens + {"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "symbol": "MATIC", "name": "Polygon", "decimals": 18, "logo": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAGFBMVEVHcEzZvfrQr/nEmvevdvShXvGSRO+NPO5VmlSmAAAAB3RSTlMAGThfi7/qvWAYyAAADJxJREFUeNrsnU1z2zYURUFB6dpTs107tTnZqp1K2kZeSNtGnpjbZKwY+9YU/n6pTOIh04qmiQsQj7hnmUUmPKF48fDxoAghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQghRKls+fuNWpchsa5+5U+kxK22DvUqNbGdbbFRirGyb40IlRWF/pLpSCXFjbdIGLo39Hw4XKhFmX5//vzyoNGgHYHphmG3tOY5JhGErABMMw0YAJhkFue3maeJRMDf2BQ5qyuizAZBGZdgOwPTC8GsF+DLH39VEaQVggmHYCsAEw/BcAKZSF+kzAZhKXdQMgBSjIOvx/JOeJNza13J8rybE0r6eakJhWNghPE0mDM8GYCKVYTsA0wvDdgWYXhi2BwDpheG5KdBk6qIzFWAydVFhXalER0Fu3ZE8SVgHIAC5k4R1AECQGoYZ6PnFhuHWopAZhkuLQ2IYugeg7LoIEYBNHoQZwASg3ChABWCTD0oOs53FI2j7SLayPpAzSdg/AB5rpheGvZ//yx8X9etyfT+xMMxNz9/07ffHuS6nNEmoez9/86M5ncqwdwBuhsVm7IdLsr7/l/uhA6fIo2A19MecTyMMl8M/58UUouDGJdBX8qMgd3qLs95REOvC+cy4rfzPSuEz5WvXGT5tRBeGc/fCPhf9CuwAY7lC8FdAQ9Z5ekbBPyo+3kFe3r5REGFhXGIq+p5R8JeKDY1a4NBG5m/gV9isXt5LpYqNHW5mu5BYFGYGOIbvEwWfVFxo5NpOnyj4W8XFG2gVq8uX/zoVFz+5B+DrTtdVKi7eAQKwyS/ShkJr9B6PQlgMlJAAbG2wnJKAOw/z65EVhAa/00+bqQh4uvAxxRhZOWRQAdikmISA48LPM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uCnyoG5dIDn0H6OBtjG+Hl0wOepZtIBn6eeYQHwkxnO0QCPT03naIDHZjjdLeCOCnz6uud+js8vCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCP+1B4cEAAAAAIL+v7a7AQAAAAAAAAAAACZ3ytyh8egOIwAAAABJRU5ErkJggg==", "type": "NATIVE"}, + {"address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", "symbol": "WMATIC", "name": "Wrapped Matic", "decimals": 18, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0/logo.png", "type": "20"}, + {"address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", "symbol": "WETH", "name": "Wrapped Ether", "decimals": 18, "logo": "https://info.quickswap.exchange/static/media/eth.5fc0c9bd.png", "type": "20"}, + {"address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", "symbol": "USDC", "name": "USD Coin", "decimals": 6, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png", "type": "20"}, + {"address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", "symbol": "USDT", "name": "Tether USD", "decimals": 6, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png", "type": "20"}, + {"address": "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1", "symbol": "miMATIC", "name": "miMATIC", "decimals": 18, "logo": "https://raw.githubusercontent.com/0xlaozi/qidao/main/images/mimatic-red.png", "type": "20"}, + {"address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", "symbol": "DAI", "name": "Dai Stablecoin", "decimals": 18, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png", "type": "20"}, + {"address": "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", "symbol": "WBTC", "name": "Wrapped BTC", "decimals": 8, "logo": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png", "type": "20"} + ] }; var unknown = { @@ -1410,7 +1420,8 @@ SYMBOL: 'ETH', CURRENCY: 'Ether', NAME: 'Ethereum', - USD: '0x6B175474E89094C44Da98b954EedeAC495271d0F' + USD: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + TRANSFER_GAS: 21000 }; let CONSTANTS$1 = { @@ -1420,15 +1431,30 @@ NATIVE: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', DECIMALS: 18, SYMBOL: 'BNB', - CURRENCY: 'Binance Coin', - NAME: 'Binance Smart Chain', - USD: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56' + CURRENCY: 'BNB', + NAME: 'BNB Smart Chain', + USD: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + TRANSFER_GAS: 21000 + }; + + let CONSTANTS$2 = { + ZERO: '0x0000000000000000000000000000000000000000', + MAXINT: '115792089237316195423570985008687907853269984665640564039457584007913129639935', + WRAPPED: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', + NATIVE: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', + DECIMALS: 18, + SYMBOL: 'MATIC', + CURRENCY: 'Polygon', + NAME: 'Polygon', + USD: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + TRANSFER_GAS: 21000 }; - let CONSTANTS$2 = {}; + let CONSTANTS$3 = {}; - CONSTANTS$2['ethereum'] = CONSTANTS; - CONSTANTS$2['bsc'] = CONSTANTS$1; + CONSTANTS$3['ethereum'] = CONSTANTS; + CONSTANTS$3['bsc'] = CONSTANTS$1; + CONSTANTS$3['polygon'] = CONSTANTS$2; var byteLength_1 = byteLength; var toByteArray_1 = toByteArray; @@ -9480,7 +9506,7 @@ })( module, commonjsGlobal); }); - const version$2 = "logger/5.5.0"; + const version$2 = "logger/5.6.0"; let _permanentCensorErrors = false; let _censorErrors = false; @@ -9659,6 +9685,40 @@ messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode.CALL_EXCEPTION: + case ErrorCode.INSUFFICIENT_FUNDS: + case ErrorCode.MISSING_NEW: + case ErrorCode.NONCE_EXPIRED: + case ErrorCode.REPLACEMENT_UNDERPRICED: + case ErrorCode.TRANSACTION_REPLACED: + case ErrorCode.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -9793,7 +9853,7 @@ Logger.levels = LogLevel; //# sourceMappingURL=index.js.map - const version$3 = "bytes/5.5.0"; + const version$3 = "bytes/5.6.1"; const logger = new Logger(version$3); /////////////////////////////// @@ -9863,7 +9923,7 @@ let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -10028,7 +10088,7 @@ return value; } - const version$4 = "bignumber/5.5.0"; + const version$4 = "bignumber/5.6.1"; var BN = bn.BN; const logger$1 = new Logger(version$4); @@ -10046,7 +10106,6 @@ let _warnedToStringRadix = false; class BigNumber { constructor(constructorGuard, hex) { - logger$1.checkNew(new.target, BigNumber); if (constructorGuard !== _constructorGuard) { logger$1.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { operation: "new (BigNumber)" @@ -10077,7 +10136,7 @@ div(other) { const o = BigNumber.from(other); if (o.isZero()) { - throwFault("division by zero", "div"); + throwFault("division-by-zero", "div"); } return toBigNumber(toBN(this).div(toBN(other))); } @@ -10087,53 +10146,53 @@ mod(other) { const value = toBN(other); if (value.isNeg()) { - throwFault("cannot modulo negative values", "mod"); + throwFault("division-by-zero", "mod"); } return toBigNumber(toBN(this).umod(value)); } pow(other) { const value = toBN(other); if (value.isNeg()) { - throwFault("cannot raise to negative values", "pow"); + throwFault("negative-power", "pow"); } return toBigNumber(toBN(this).pow(value)); } and(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'and' negative values", "and"); + throwFault("unbound-bitwise-result", "and"); } return toBigNumber(toBN(this).and(value)); } or(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'or' negative values", "or"); + throwFault("unbound-bitwise-result", "or"); } return toBigNumber(toBN(this).or(value)); } xor(other) { const value = toBN(other); if (this.isNegative() || value.isNeg()) { - throwFault("cannot 'xor' negative values", "xor"); + throwFault("unbound-bitwise-result", "xor"); } return toBigNumber(toBN(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault("cannot mask negative values", "mask"); + throwFault("negative-width", "mask"); } return toBigNumber(toBN(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shl"); + throwFault("negative-width", "shl"); } return toBigNumber(toBN(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault("cannot shift negative values", "shr"); + throwFault("negative-width", "shr"); } return toBigNumber(toBN(this).shrn(value)); } @@ -10494,7 +10553,6 @@ } class FixedNumber { constructor(constructorGuard, hex, value, format) { - logger$2.checkNew(new.target, FixedNumber); if (constructorGuard !== _constructorGuard$1) { logger$2.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" @@ -10675,7 +10733,7 @@ const ONE = FixedNumber.from(1); const BUMP = FixedNumber.from("0.5"); - const version$5 = "properties/5.5.0"; + const version$5 = "properties/5.6.0"; var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -10790,7 +10848,7 @@ } } - const version$6 = "abi/5.5.0"; + const version$6 = "abi/5.6.2"; const logger$4 = new Logger(version$6); const _constructorGuard$2 = {}; @@ -12429,7 +12487,7 @@ return '0x' + sha3.keccak_256(arrayify(data)); } - const version$7 = "rlp/5.5.0"; + const version$7 = "rlp/5.6.0"; const logger$6 = new Logger(version$7); function arrayifyInteger(value) { @@ -12473,7 +12531,7 @@ return hexlify(_encode(object)); } - const version$8 = "address/5.5.0"; + const version$8 = "address/5.6.0"; const logger$7 = new Logger(version$8); function getChecksumAddress(address) { @@ -12945,7 +13003,7 @@ } } - const version$9 = "strings/5.5.0"; + const version$9 = "strings/5.6.0"; const logger$9 = new Logger(version$9); /////////////////////////////// @@ -13233,7 +13291,6 @@ const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); class AbiCoder { constructor(coerceFunc) { - logger$a.checkNew(new.target, AbiCoder); defineReadOnly(this, "coerceFunc", coerceFunc || null); } _getCoder(param) { @@ -13348,7 +13405,6 @@ */ class Interface { constructor(fragments) { - logger$b.checkNew(new.target, Interface); let abi = []; if (typeof (fragments) === "string") { abi = JSON.parse(fragments); @@ -13604,6 +13660,7 @@ } let bytes = arrayify(data); let reason = null; + let message = ""; let errorArgs = null; let errorName = null; let errorSignature = null; @@ -13624,6 +13681,12 @@ if (builtin.reason) { reason = errorArgs[0]; } + if (errorName === "Error") { + message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`; + } + else if (errorName === "Panic") { + message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`; + } } else { try { @@ -13632,16 +13695,14 @@ errorName = error.name; errorSignature = error.format(); } - catch (error) { - console.log(error); - } + catch (error) { } } break; } } - return logger$b.throwError("call revert exception", Logger.errors.CALL_EXCEPTION, { + return logger$b.throwError("call revert exception" + message, Logger.errors.CALL_EXCEPTION, { method: functionFragment.format(), - errorArgs, errorName, errorSignature, reason + data: hexlify(data), errorArgs, errorName, errorSignature, reason }); } // Encode the result for a function call (e.g. for eth_call) @@ -13898,8 +13959,9 @@ return !!(value && value._isInterface); } } + //# sourceMappingURL=interface.js.map - const version$a = "abstract-provider/5.5.1"; + const version$a = "abstract-provider/5.6.0"; var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -13933,7 +13995,7 @@ // We may want to compute this more accurately in the future, // using the formula "check if the base fee is correct". // See: https://eips.ethereum.org/EIPS/eip-1559 - maxPriorityFeePerGas = BigNumber.from("2500000000"); + maxPriorityFeePerGas = BigNumber.from("1500000000"); maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); } return { maxFeePerGas, maxPriorityFeePerGas, gasPrice }; @@ -13952,7 +14014,7 @@ } } - const version$b = "abstract-signer/5.5.0"; + const version$b = "abstract-signer/5.6.1"; var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -13965,7 +14027,7 @@ }; const logger$d = new Logger(version$b); const allowedTransactionKeys = [ - "accessList", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" + "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors = [ Logger.errors.INSUFFICIENT_FUNDS, @@ -14225,7 +14287,6 @@ } class VoidSigner extends Signer { constructor(address, provider) { - logger$d.checkNew(new.target, VoidSigner); super(); defineReadOnly(this, "address", address); defineReadOnly(this, "provider", provider || null); @@ -14252,7 +14313,7 @@ } } - const version$c = "transactions/5.5.0"; + const version$c = "transactions/5.6.0"; const logger$e = new Logger(version$c); var TransactionTypes; @@ -14295,7 +14356,7 @@ return result; } - const version$d = "contracts/5.5.0"; + const version$d = "contracts/5.6.1"; var __awaiter$3 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -14463,6 +14524,9 @@ if (ro.customData) { tx.customData = shallowCopy(ro.customData); } + if (ro.ccipReadEnabled) { + tx.ccipReadEnabled = !!ro.ccipReadEnabled; + } // Remove the overrides delete overrides.nonce; delete overrides.gasLimit; @@ -14474,6 +14538,7 @@ delete overrides.maxFeePerGas; delete overrides.maxPriorityFeePerGas; delete overrides.customData; + delete overrides.ccipReadEnabled; // Make sure there are no stray overrides, which may indicate a // typo or using an unsupported key. const leftovers = Object.keys(overrides).filter((key) => (overrides[key] != null)); @@ -14750,7 +14815,6 @@ } class BaseContract { constructor(addressOrName, contractInterface, signerOrProvider) { - logger$f.checkNew(new.target, Contract); // @TODO: Maybe still check the addressOrName looks like a valid address or name? //address = getAddress(address); defineReadOnly(this, "interface", getStatic(new.target, "getInterface")(contractInterface)); @@ -14819,6 +14883,8 @@ }); } } + // Swallow bad ENS names to prevent Unhandled Exceptions + this.resolvedAddress.catch((e) => { }); const uniqueNames = {}; const uniqueSignatures = {}; Object.keys(this.interface.functions).forEach((signature) => { @@ -15172,7 +15238,7 @@ class Contract extends BaseContract { } - const version$e = "units/5.5.0"; + const version$e = "units/5.6.0"; const logger$g = new Logger(version$e); const names = [ @@ -15206,114 +15272,7 @@ return parseFixed(value, (unitName != null) ? unitName : 18); } - function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }let getWindow = () => { - if (typeof global$1 == 'object') return global$1 - return window - }; - - let getCacheStore = () => { - if (getWindow()._cacheStore == undefined) { - resetCache(); - } - return getWindow()._cacheStore - }; - - let getPromiseStore = () => { - if (getWindow()._promiseStore == undefined) { - resetCache(); - } - return getWindow()._promiseStore - }; - - let resetCache = () => { - getWindow()._cacheStore = {}; - getWindow()._promiseStore = {}; - }; - - let set = function ({ key, value, expires }) { - getCacheStore()[key] = { - expiresAt: Date.now() + expires, - value, - }; - }; - - let get = function ({ key, expires }) { - let cachedEntry = getCacheStore()[key]; - if (_optionalChain([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) { - return cachedEntry.value - } - }; - - let getPromise = function({ key }) { - return getPromiseStore()[key] - }; - - let setPromise = function({ key, promise }) { - getPromiseStore()[key] = promise; - return promise - }; - - let deletePromise = function({ key }) { - getPromiseStore()[key] = undefined; - }; - - let cache = function ({ call, key, expires = 0 }) { - return new Promise((resolve, reject)=>{ - let value; - key = JSON.stringify(key); - - // get existing promise (of a previous pending request asking for the exact same thing) - let existingPromise = getPromise({ key }); - if(existingPromise) { - return existingPromise - .then(resolve) - .catch(reject) - } - - setPromise({ key, promise: new Promise((resolveQueue, rejectQueue)=>{ - if (expires === 0) { - return call() - .then((value)=>{ - resolve(value); - resolveQueue(value); - }) - .catch((error)=>{ - reject(error); - rejectQueue(error); - }) - } - - // get cached value - value = get({ key, expires }); - if (value) { - resolve(value); - resolveQueue(value); - return value - } - - // set new cache value - call() - .then((value)=>{ - if (value) { - set({ key, value, expires }); - } - resolve(value); - resolveQueue(value); - }) - .catch((error)=>{ - reject(error); - rejectQueue(error); - }); - }) - }).then(()=>{ - deletePromise({ key }); - }).catch(()=>{ - deletePromise({ key }); - }); - }) - }; - - const version$f = "logger/5.4.1"; + const version$f = "logger/5.6.0"; let _permanentCensorErrors$1 = false; let _censorErrors$1 = false; @@ -15410,7 +15369,7 @@ // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficien funds (< value + gasLimit * gasPrice) + // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used @@ -15492,6 +15451,40 @@ messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$1.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$1.CALL_EXCEPTION: + case ErrorCode$1.INSUFFICIENT_FUNDS: + case ErrorCode$1.MISSING_NEW: + case ErrorCode$1.NONCE_EXPIRED: + case ErrorCode$1.REPLACEMENT_UNDERPRICED: + case ErrorCode$1.TRANSACTION_REPLACED: + case ErrorCode$1.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -15625,7 +15618,7 @@ Logger$1.errors = ErrorCode$1; Logger$1.levels = LogLevel$1; - const version$e$1 = "properties/5.4.1"; + const version$e$1 = "properties/5.6.0"; var __awaiter$7 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -15750,7 +15743,7 @@ } } - const version$d$1 = "bytes/5.4.0"; + const version$d$1 = "bytes/5.6.1"; const logger$f$1 = new Logger$1(version$d$1); /////////////////////////////// @@ -15770,6 +15763,9 @@ function isBytesLike$1(value) { return ((isHexString$1(value) && !(value.length % 2)) || isBytes$1(value)); } + function isInteger$1(value) { + return (typeof (value) === "number" && value == value && (value % 1) === 0); + } function isBytes$1(value) { if (value == null) { return false; @@ -15780,12 +15776,12 @@ if (typeof (value) === "string") { return false; } - if (value.length == null) { + if (!isInteger$1(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (typeof (v) !== "number" || v < 0 || v >= 256 || (v % 1)) { + if (!isInteger$1(v) || v < 0 || v >= 256) { return false; } } @@ -15817,7 +15813,7 @@ let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -16017,17 +16013,28 @@ s: "0x", _vs: "0x", recoveryParam: 0, - v: 0 + v: 0, + yParityAndS: "0x", + compact: "0x" }; if (isBytesLike$1(signature)) { - const bytes = arrayify$1(signature); - if (bytes.length !== 65) { - logger$f$1.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature); - } + let bytes = arrayify$1(signature); // Get the r, s and v - result.r = hexlify$1(bytes.slice(0, 32)); - result.s = hexlify$1(bytes.slice(32, 64)); - result.v = bytes[64]; + if (bytes.length === 64) { + // EIP-2098; pull the v from the top bit of s and clear it + result.v = 27 + (bytes[32] >> 7); + bytes[32] &= 0x7f; + result.r = hexlify$1(bytes.slice(0, 32)); + result.s = hexlify$1(bytes.slice(32, 64)); + } + else if (bytes.length === 65) { + result.r = hexlify$1(bytes.slice(0, 32)); + result.s = hexlify$1(bytes.slice(32, 64)); + result.v = bytes[64]; + } + else { + logger$f$1.throwArgumentError("invalid signature string", "signature", signature); + } // Allow a recid to be used as the v if (result.v < 27) { if (result.v === 0 || result.v === 1) { @@ -16090,8 +16097,11 @@ if (result.v == null) { result.v = 27 + result.recoveryParam; } - else if (result.recoveryParam !== (1 - (result.v % 2))) { - logger$f$1.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + else { + const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2)); + if (result.recoveryParam !== recId) { + logger$f$1.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + } } } if (result.r == null || !isHexString$1(result.r)) { @@ -16128,9 +16138,19 @@ logger$f$1.throwArgumentError("signature _vs mismatch v and s", "signature", signature); } } + result.yParityAndS = result._vs; + result.compact = result.r + result.yParityAndS.substring(2); return result; } + function decode$2(textData) { + textData = atob(textData); + const data = []; + for (let i = 0; i < textData.length; i++) { + data.push(textData.charCodeAt(i)); + } + return arrayify$1(data); + } function encode$2(data) { data = arrayify$1(data); let textData = ""; @@ -19595,7 +19615,7 @@ })(module, commonjsGlobal$1); }); - const version$c$1 = "bignumber/5.4.1"; + const version$c$1 = "bignumber/5.6.0"; var BN$1 = bn$1.BN; const logger$e$1 = new Logger$1(version$c$1); @@ -19636,7 +19656,7 @@ div(other) { const o = BigNumber$1.from(other); if (o.isZero()) { - throwFault$2("division by zero", "div"); + throwFault$2("division-by-zero", "div"); } return toBigNumber$1(toBN$1(this).div(toBN$1(other))); } @@ -19646,53 +19666,53 @@ mod(other) { const value = toBN$1(other); if (value.isNeg()) { - throwFault$2("cannot modulo negative values", "mod"); + throwFault$2("division-by-zero", "mod"); } return toBigNumber$1(toBN$1(this).umod(value)); } pow(other) { const value = toBN$1(other); if (value.isNeg()) { - throwFault$2("cannot raise to negative values", "pow"); + throwFault$2("negative-power", "pow"); } return toBigNumber$1(toBN$1(this).pow(value)); } and(other) { const value = toBN$1(other); if (this.isNegative() || value.isNeg()) { - throwFault$2("cannot 'and' negative values", "and"); + throwFault$2("unbound-bitwise-result", "and"); } return toBigNumber$1(toBN$1(this).and(value)); } or(other) { const value = toBN$1(other); if (this.isNegative() || value.isNeg()) { - throwFault$2("cannot 'or' negative values", "or"); + throwFault$2("unbound-bitwise-result", "or"); } return toBigNumber$1(toBN$1(this).or(value)); } xor(other) { const value = toBN$1(other); if (this.isNegative() || value.isNeg()) { - throwFault$2("cannot 'xor' negative values", "xor"); + throwFault$2("unbound-bitwise-result", "xor"); } return toBigNumber$1(toBN$1(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$2("cannot mask negative values", "mask"); + throwFault$2("negative-width", "mask"); } return toBigNumber$1(toBN$1(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$2("cannot shift negative values", "shl"); + throwFault$2("negative-width", "shl"); } return toBigNumber$1(toBN$1(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$2("cannot shift negative values", "shr"); + throwFault$2("negative-width", "shr"); } return toBigNumber$1(toBN$1(this).shrn(value)); } @@ -19789,7 +19809,7 @@ return BigNumber$1.from(hexlify$1(anyValue)); } if (anyValue) { - // Hexable interface (takes piority) + // Hexable interface (takes priority) if (anyValue.toHexString) { const hex = anyValue.toHexString(); if (typeof (hex) === "string") { @@ -19826,7 +19846,7 @@ if (value[0] === "-") { // Strip off the negative sign value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") + // Cannot have multiple negative signs (e.g. "--0x04") if (value[0] === "-") { logger$e$1.throwArgumentError("invalid hex", "value", value); } @@ -19883,7 +19903,7 @@ const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; - const version$b$1 = "strings/5.4.0"; + const version$b$1 = "strings/5.6.0"; const logger$d$1 = new Logger$1(version$b$1); /////////////////////////////// @@ -19917,7 +19937,7 @@ // - offset = start of this codepoint // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate"; - // The string is an overlong reperesentation + // The string is an overlong representation // - offset = start of this codepoint // - badCodepoint = the computed codepoint; already bounds checked Utf8ErrorReason["OVERLONG"] = "overlong representation"; @@ -20023,7 +20043,7 @@ res = (res << 6) | (nextChar & 0x3f); i++; } - // See above loop for invalid contimuation byte + // See above loop for invalid continuation byte if (res === null) { continue; } @@ -20285,7 +20305,7 @@ return name; } - const version$a$1 = "web/5.4.0"; + const version$a$1 = "web/5.6.0"; var __awaiter$6 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -20305,12 +20325,14 @@ method: (options.method || "GET"), headers: (options.headers || {}), body: (options.body || undefined), - mode: "cors", - cache: "no-cache", - credentials: "same-origin", - redirect: "follow", - referrer: "client", // no-referrer, *client }; + if (options.skipFetchSetup !== true) { + request.mode = "cors"; // no-cors, cors, *same-origin + request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached + request.credentials = "same-origin"; // include, *same-origin, omit + request.redirect = "follow"; // manual, *follow, error + request.referrer = "client"; // no-referrer, *client + } const response = yield fetch(href, request); const body = yield response.arrayBuffer(); const headers = {}; @@ -20379,6 +20401,7 @@ const throttleCallback = ((typeof (connection) === "object") ? connection.throttleCallback : null); const throttleSlotInterval = ((typeof (connection) === "object" && typeof (connection.throttleSlotInterval) === "number") ? connection.throttleSlotInterval : 100); logger$c$1.assertArgument((throttleSlotInterval > 0 && (throttleSlotInterval % 1) === 0), "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval); + const errorPassThrough = ((typeof (connection) === "object") ? !!(connection.errorPassThrough) : false); const headers = {}; let url = null; // @TODO: Allow ConnectionInfo to override some of these values @@ -20417,6 +20440,35 @@ value: "Basic " + encode$2(toUtf8Bytes$1(authorization)) }; } + if (connection.skipFetchSetup != null) { + options.skipFetchSetup = !!connection.skipFetchSetup; + } + } + const reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i"); + const dataMatch = ((url) ? url.match(reData) : null); + if (dataMatch) { + try { + const response = { + statusCode: 200, + statusMessage: "OK", + headers: { "content-type": dataMatch[1] }, + body: decode$2(dataMatch[2]) + }; + let result = response.body; + if (processFunc) { + result = processFunc(response.body, response); + } + return Promise.resolve(result); + } + catch (error) { + logger$c$1.throwError("processing response error", Logger$1.errors.SERVER_ERROR, { + body: bodyify(dataMatch[1], dataMatch[2]), + error: error, + requestBody: null, + requestMethod: "GET", + url: url + }); + } } if (body) { options.method = "POST"; @@ -20467,24 +20519,34 @@ let response = null; try { response = yield getUrl(url, options); - // Exponential back-off throttling - if (response.statusCode === 429 && attempt < attemptLimit) { - let tryAgain = true; - if (throttleCallback) { - tryAgain = yield throttleCallback(attempt, url); + if (attempt < attemptLimit) { + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirection; for now we only support absolute locataions + const location = response.headers.location || ""; + if (options.method === "GET" && location.match(/^https:/)) { + url = response.headers.location; + continue; + } } - if (tryAgain) { - let stall = 0; - const retryAfter = response.headers["retry-after"]; - if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { - stall = parseInt(retryAfter) * 1000; + else if (response.statusCode === 429) { + // Exponential back-off throttling + let tryAgain = true; + if (throttleCallback) { + tryAgain = yield throttleCallback(attempt, url); } - else { - stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + if (tryAgain) { + let stall = 0; + const retryAfter = response.headers["retry-after"]; + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1000; + } + else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + //console.log("Stalling 429"); + yield staller(stall); + continue; } - //console.log("Stalling 429"); - yield staller(stall); - continue; } } } @@ -20504,7 +20566,7 @@ if (allow304 && response.statusCode === 304) { body = null; } - else if (response.statusCode < 200 || response.statusCode >= 300) { + else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) { runningTimeout.cancel(); logger$c$1.throwError("bad response", Logger$1.errors.SERVER_ERROR, { status: response.statusCode, @@ -20546,7 +20608,7 @@ } } runningTimeout.cancel(); - // If we had a processFunc, it eitehr returned a T or threw above. + // If we had a processFunc, it either returned a T or threw above. // The "body" is now a Uint8Array. return body; } @@ -20680,7 +20742,7 @@ }); } - const version$9$1 = "abstract-provider/5.4.1"; + const version$9$1 = "abstract-provider/5.6.0"; var __awaiter$4 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -20722,7 +20784,7 @@ // We may want to compute this more accurately in the future, // using the formula "check if the base fee is correct". // See: https://eips.ethereum.org/EIPS/eip-1559 - maxPriorityFeePerGas = BigNumber$1.from("2500000000"); + maxPriorityFeePerGas = BigNumber$1.from("1500000000"); maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); } return { maxFeePerGas, maxPriorityFeePerGas, gasPrice }; @@ -20741,7 +20803,7 @@ } } - const version$8$1 = "networks/5.4.2"; + const version$8$1 = "networks/5.6.2"; const logger$a$1 = new Logger$1(version$8$1); function isRenetworkable(value) { @@ -20753,44 +20815,50 @@ options = {}; } const providerList = []; - if (providers.InfuraProvider) { + if (providers.InfuraProvider && options.infura !== "-") { try { providerList.push(new providers.InfuraProvider(network, options.infura)); } catch (error) { } } - if (providers.EtherscanProvider) { + if (providers.EtherscanProvider && options.etherscan !== "-") { try { providerList.push(new providers.EtherscanProvider(network, options.etherscan)); } catch (error) { } } - if (providers.AlchemyProvider) { + if (providers.AlchemyProvider && options.alchemy !== "-") { try { providerList.push(new providers.AlchemyProvider(network, options.alchemy)); } catch (error) { } } - if (providers.PocketProvider) { + if (providers.PocketProvider && options.pocket !== "-") { // These networks are currently faulty on Pocket as their // network does not handle the Berlin hardfork, which is // live on these ones. // @TODO: This goes away once Pocket has upgraded their nodes const skip = ["goerli", "ropsten", "rinkeby"]; try { - const provider = new providers.PocketProvider(network); + const provider = new providers.PocketProvider(network, options.pocket); if (provider.network && skip.indexOf(provider.network.name) === -1) { providerList.push(provider); } } catch (error) { } } - if (providers.CloudflareProvider) { + if (providers.CloudflareProvider && options.cloudflare !== "-") { try { providerList.push(new providers.CloudflareProvider(network)); } catch (error) { } } + if (providers.AnkrProvider && options.ankr !== "-") { + try { + providerList.push(new providers.AnkrProvider(network, options.ankr)); + } + catch (error) { } + } if (providerList.length === 0) { return null; } @@ -20840,6 +20908,7 @@ name: "classicMordor", _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor") }; + // See: https://chainlist.org const networks = { unspecified: { chainId: 0, name: "unspecified" }, homestead: homestead, @@ -20864,6 +20933,7 @@ name: "goerli", _defaultProvider: ethDefaultProvider("goerli") }, + kintsugi: { chainId: 1337702, name: "kintsugi" }, // ETC (See: #351) classic: { chainId: 61, @@ -20881,6 +20951,11 @@ xdai: { chainId: 100, name: "xdai" }, matic: { chainId: 137, name: "matic" }, maticmum: { chainId: 80001, name: "maticmum" }, + optimism: { chainId: 10, name: "optimism" }, + "optimism-kovan": { chainId: 69, name: "optimism-kovan" }, + "optimism-goerli": { chainId: 420, name: "optimism-goerli" }, + arbitrum: { chainId: 42161, name: "arbitrum" }, + "arbitrum-rinkeby": { chainId: 421611, name: "arbitrum-rinkeby" }, bnb: { chainId: 56, name: "bnb" }, bnbt: { chainId: 97, name: "bnbt" }, }; @@ -21072,553 +21147,737 @@ //console.log(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj")) //console.log(Base58.encode(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj"))) - /** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.5.7 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2016 - * @license MIT + /** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT */ var sha3$1 = createCommonjsModule$1(function (module) { - /*jslint bitwise: true */ - (function () { - - var root = typeof window === 'object' ? window : {}; - var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; - if (NODE_JS) { - root = commonjsGlobal$1; - } - var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; - var HEX_CHARS = '0123456789abcdef'.split(''); - var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; - var KECCAK_PADDING = [1, 256, 65536, 16777216]; - var PADDING = [6, 1536, 393216, 100663296]; - var SHIFT = [0, 8, 16, 24]; - var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, - 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, - 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, - 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, - 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; - var BITS = [224, 256, 384, 512]; - var SHAKE_BITS = [128, 256]; - var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; - - var createOutputMethod = function (bits, padding, outputType) { - return function (message) { - return new Keccak(bits, padding, bits).update(message)[outputType](); - }; - }; - - var createShakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits) { - return new Keccak(bits, padding, outputBits).update(message)[outputType](); - }; - }; - - var createMethod = function (bits, padding) { - var method = createOutputMethod(bits, padding, 'hex'); - method.create = function () { - return new Keccak(bits, padding, bits); - }; - method.update = function (message) { - return method.create().update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createOutputMethod(bits, padding, type); - } - return method; - }; - - var createShakeMethod = function (bits, padding) { - var method = createShakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits) { - return new Keccak(bits, padding, outputBits); - }; - method.update = function (message, outputBits) { - return method.create(outputBits).update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createShakeOutputMethod(bits, padding, type); - } - return method; - }; - - var algorithms = [ - {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod}, - {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod}, - {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod} - ]; - - var methods = {}, methodNames = []; - - for (var i = 0; i < algorithms.length; ++i) { - var algorithm = algorithms[i]; - var bits = algorithm.bits; - for (var j = 0; j < bits.length; ++j) { - var methodName = algorithm.name +'_' + bits[j]; - methodNames.push(methodName); - methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); - } - } - - function Keccak(bits, padding, outputBits) { - this.blocks = []; - this.s = []; - this.padding = padding; - this.outputBits = outputBits; - this.reset = true; - this.block = 0; - this.start = 0; - this.blockCount = (1600 - (bits << 1)) >> 5; - this.byteCount = this.blockCount << 2; - this.outputBlocks = outputBits >> 5; - this.extraBytes = (outputBits & 31) >> 3; - - for (var i = 0; i < 50; ++i) { - this.s[i] = 0; - } - } - - Keccak.prototype.update = function (message) { - var notString = typeof message !== 'string'; - if (notString && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } - var length = message.length, blocks = this.blocks, byteCount = this.byteCount, - blockCount = this.blockCount, index = 0, s = this.s, i, code; - - while (index < length) { - if (this.reset) { - this.reset = false; - blocks[0] = this.block; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - if (notString) { - for (i = this.start; index < length && i < byteCount; ++index) { - blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index < length && i < byteCount; ++index) { - code = message.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - if (i >= byteCount) { - this.start = i - byteCount; - this.block = blocks[blockCount]; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - this.reset = true; - } else { - this.start = i; - } - } - return this; - }; - - Keccak.prototype.finalize = function () { - var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; - blocks[i >> 2] |= this.padding[i & 3]; - if (this.lastByteIndex === this.byteCount) { - blocks[0] = blocks[blockCount]; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - blocks[blockCount - 1] |= 0x80000000; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - }; - - Keccak.prototype.toString = Keccak.prototype.hex = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var hex = '', block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + - HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + - HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + - HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; - } - if (j % blockCount === 0) { - f(s); - i = 0; - } - } - if (extraBytes) { - block = s[i]; - if (extraBytes > 0) { - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; - } - if (extraBytes > 1) { - hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; - } - if (extraBytes > 2) { - hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; - } - } - return hex; - }; - - Keccak.prototype.arrayBuffer = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var bytes = this.outputBits >> 3; - var buffer; - if (extraBytes) { - buffer = new ArrayBuffer((outputBlocks + 1) << 2); - } else { - buffer = new ArrayBuffer(bytes); - } - var array = new Uint32Array(buffer); - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - array[j] = s[i]; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - array[i] = s[i]; - buffer = buffer.slice(0, bytes); - } - return buffer; - }; - - Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - - Keccak.prototype.digest = Keccak.prototype.array = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var array = [], offset, block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - array[offset + 1] = (block >> 8) & 0xFF; - array[offset + 2] = (block >> 16) & 0xFF; - array[offset + 3] = (block >> 24) & 0xFF; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - offset = j << 2; - block = s[i]; - if (extraBytes > 0) { - array[offset] = block & 0xFF; - } - if (extraBytes > 1) { - array[offset + 1] = (block >> 8) & 0xFF; - } - if (extraBytes > 2) { - array[offset + 2] = (block >> 16) & 0xFF; - } - } - return array; - }; - - var f = function (s) { - var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, - b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, - b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; - for (n = 0; n < 48; n += 2) { - c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; - c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; - c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; - c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; - c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; - c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; - c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; - c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; - c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; - c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; - - h = c8 ^ ((c2 << 1) | (c3 >>> 31)); - l = c9 ^ ((c3 << 1) | (c2 >>> 31)); - s[0] ^= h; - s[1] ^= l; - s[10] ^= h; - s[11] ^= l; - s[20] ^= h; - s[21] ^= l; - s[30] ^= h; - s[31] ^= l; - s[40] ^= h; - s[41] ^= l; - h = c0 ^ ((c4 << 1) | (c5 >>> 31)); - l = c1 ^ ((c5 << 1) | (c4 >>> 31)); - s[2] ^= h; - s[3] ^= l; - s[12] ^= h; - s[13] ^= l; - s[22] ^= h; - s[23] ^= l; - s[32] ^= h; - s[33] ^= l; - s[42] ^= h; - s[43] ^= l; - h = c2 ^ ((c6 << 1) | (c7 >>> 31)); - l = c3 ^ ((c7 << 1) | (c6 >>> 31)); - s[4] ^= h; - s[5] ^= l; - s[14] ^= h; - s[15] ^= l; - s[24] ^= h; - s[25] ^= l; - s[34] ^= h; - s[35] ^= l; - s[44] ^= h; - s[45] ^= l; - h = c4 ^ ((c8 << 1) | (c9 >>> 31)); - l = c5 ^ ((c9 << 1) | (c8 >>> 31)); - s[6] ^= h; - s[7] ^= l; - s[16] ^= h; - s[17] ^= l; - s[26] ^= h; - s[27] ^= l; - s[36] ^= h; - s[37] ^= l; - s[46] ^= h; - s[47] ^= l; - h = c6 ^ ((c0 << 1) | (c1 >>> 31)); - l = c7 ^ ((c1 << 1) | (c0 >>> 31)); - s[8] ^= h; - s[9] ^= l; - s[18] ^= h; - s[19] ^= l; - s[28] ^= h; - s[29] ^= l; - s[38] ^= h; - s[39] ^= l; - s[48] ^= h; - s[49] ^= l; - - b0 = s[0]; - b1 = s[1]; - b32 = (s[11] << 4) | (s[10] >>> 28); - b33 = (s[10] << 4) | (s[11] >>> 28); - b14 = (s[20] << 3) | (s[21] >>> 29); - b15 = (s[21] << 3) | (s[20] >>> 29); - b46 = (s[31] << 9) | (s[30] >>> 23); - b47 = (s[30] << 9) | (s[31] >>> 23); - b28 = (s[40] << 18) | (s[41] >>> 14); - b29 = (s[41] << 18) | (s[40] >>> 14); - b20 = (s[2] << 1) | (s[3] >>> 31); - b21 = (s[3] << 1) | (s[2] >>> 31); - b2 = (s[13] << 12) | (s[12] >>> 20); - b3 = (s[12] << 12) | (s[13] >>> 20); - b34 = (s[22] << 10) | (s[23] >>> 22); - b35 = (s[23] << 10) | (s[22] >>> 22); - b16 = (s[33] << 13) | (s[32] >>> 19); - b17 = (s[32] << 13) | (s[33] >>> 19); - b48 = (s[42] << 2) | (s[43] >>> 30); - b49 = (s[43] << 2) | (s[42] >>> 30); - b40 = (s[5] << 30) | (s[4] >>> 2); - b41 = (s[4] << 30) | (s[5] >>> 2); - b22 = (s[14] << 6) | (s[15] >>> 26); - b23 = (s[15] << 6) | (s[14] >>> 26); - b4 = (s[25] << 11) | (s[24] >>> 21); - b5 = (s[24] << 11) | (s[25] >>> 21); - b36 = (s[34] << 15) | (s[35] >>> 17); - b37 = (s[35] << 15) | (s[34] >>> 17); - b18 = (s[45] << 29) | (s[44] >>> 3); - b19 = (s[44] << 29) | (s[45] >>> 3); - b10 = (s[6] << 28) | (s[7] >>> 4); - b11 = (s[7] << 28) | (s[6] >>> 4); - b42 = (s[17] << 23) | (s[16] >>> 9); - b43 = (s[16] << 23) | (s[17] >>> 9); - b24 = (s[26] << 25) | (s[27] >>> 7); - b25 = (s[27] << 25) | (s[26] >>> 7); - b6 = (s[36] << 21) | (s[37] >>> 11); - b7 = (s[37] << 21) | (s[36] >>> 11); - b38 = (s[47] << 24) | (s[46] >>> 8); - b39 = (s[46] << 24) | (s[47] >>> 8); - b30 = (s[8] << 27) | (s[9] >>> 5); - b31 = (s[9] << 27) | (s[8] >>> 5); - b12 = (s[18] << 20) | (s[19] >>> 12); - b13 = (s[19] << 20) | (s[18] >>> 12); - b44 = (s[29] << 7) | (s[28] >>> 25); - b45 = (s[28] << 7) | (s[29] >>> 25); - b26 = (s[38] << 8) | (s[39] >>> 24); - b27 = (s[39] << 8) | (s[38] >>> 24); - b8 = (s[48] << 14) | (s[49] >>> 18); - b9 = (s[49] << 14) | (s[48] >>> 18); - - s[0] = b0 ^ (~b2 & b4); - s[1] = b1 ^ (~b3 & b5); - s[10] = b10 ^ (~b12 & b14); - s[11] = b11 ^ (~b13 & b15); - s[20] = b20 ^ (~b22 & b24); - s[21] = b21 ^ (~b23 & b25); - s[30] = b30 ^ (~b32 & b34); - s[31] = b31 ^ (~b33 & b35); - s[40] = b40 ^ (~b42 & b44); - s[41] = b41 ^ (~b43 & b45); - s[2] = b2 ^ (~b4 & b6); - s[3] = b3 ^ (~b5 & b7); - s[12] = b12 ^ (~b14 & b16); - s[13] = b13 ^ (~b15 & b17); - s[22] = b22 ^ (~b24 & b26); - s[23] = b23 ^ (~b25 & b27); - s[32] = b32 ^ (~b34 & b36); - s[33] = b33 ^ (~b35 & b37); - s[42] = b42 ^ (~b44 & b46); - s[43] = b43 ^ (~b45 & b47); - s[4] = b4 ^ (~b6 & b8); - s[5] = b5 ^ (~b7 & b9); - s[14] = b14 ^ (~b16 & b18); - s[15] = b15 ^ (~b17 & b19); - s[24] = b24 ^ (~b26 & b28); - s[25] = b25 ^ (~b27 & b29); - s[34] = b34 ^ (~b36 & b38); - s[35] = b35 ^ (~b37 & b39); - s[44] = b44 ^ (~b46 & b48); - s[45] = b45 ^ (~b47 & b49); - s[6] = b6 ^ (~b8 & b0); - s[7] = b7 ^ (~b9 & b1); - s[16] = b16 ^ (~b18 & b10); - s[17] = b17 ^ (~b19 & b11); - s[26] = b26 ^ (~b28 & b20); - s[27] = b27 ^ (~b29 & b21); - s[36] = b36 ^ (~b38 & b30); - s[37] = b37 ^ (~b39 & b31); - s[46] = b46 ^ (~b48 & b40); - s[47] = b47 ^ (~b49 & b41); - s[8] = b8 ^ (~b0 & b2); - s[9] = b9 ^ (~b1 & b3); - s[18] = b18 ^ (~b10 & b12); - s[19] = b19 ^ (~b11 & b13); - s[28] = b28 ^ (~b20 & b22); - s[29] = b29 ^ (~b21 & b23); - s[38] = b38 ^ (~b30 & b32); - s[39] = b39 ^ (~b31 & b33); - s[48] = b48 ^ (~b40 & b42); - s[49] = b49 ^ (~b41 & b43); - - s[0] ^= RC[n]; - s[1] ^= RC[n + 1]; - } - }; - - if (COMMON_JS) { - module.exports = methods; - } else { - for (var i = 0; i < methodNames.length; ++i) { - root[methodNames[i]] = methods[methodNames[i]]; - } - } - })(); - }); + /*jslint bitwise: true */ + (function () { - var sha3$1$1 = sha3$1; + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; + if (NODE_JS) { + root = commonjsGlobal$1; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; - function keccak256$1(data) { - return '0x' + sha3$1$1.keccak_256(arrayify$1(data)); - } + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } - function id$2(text) { - return keccak256$1(toUtf8Bytes$1(text)); - } + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } - const version$7$1 = "hash/5.4.0"; + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; - const logger$9$1 = new Logger$1(version$7$1); - const Zeros = new Uint8Array(32); - Zeros.fill(0); - const Partition = new RegExp("^((.*)\\.)?([^.]+)$"); - function namehash(name) { - /* istanbul ignore if */ - if (typeof (name) !== "string") { - logger$9$1.throwArgumentError("invalid ENS name; not a string", "name", name); + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); } - let current = name; - let result = Zeros; - while (current.length) { - const partition = current.match(Partition); - if (partition == null || partition[2] === "") { - logger$9$1.throwArgumentError("invalid ENS address; missing component", "name", name); - } - const label = toUtf8Bytes$1(nameprep(partition[3])); - result = keccak256$1(concat$1([result, keccak256$1(label)])); - current = partition[2] || ""; + return method; + }; + + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + + var methods = {}, methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } } - return hexlify$1(result); - } + } - const version$6$1 = "rlp/5.4.0"; + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; - const logger$8$1 = new Logger$1(version$6$1); - function arrayifyInteger$1(value) { - const result = []; - while (value) { - result.unshift(value & 0xff); - value >>= 8; + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; } - return result; - } - function unarrayifyInteger(data, offset, length) { - let result = 0; - for (let i = 0; i < length; i++) { - result = (result * 256) + data[offset + i]; + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); } - return result; - } - function _encode$1(object) { - if (Array.isArray(object)) { - let payload = []; - object.forEach(function (child) { - payload = payload.concat(_encode$1(child)); - }); - if (payload.length <= 55) { - payload.unshift(0xc0 + payload.length); - return payload; + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } } - const length = arrayifyInteger$1(payload.length); - length.unshift(0xf7 + length.length); - return length.concat(payload); - } - if (!isBytesLike$1(object)) { - logger$8$1.throwArgumentError("RLP object must be BytesLike", "object", object); + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); + } + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } + } + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } + } + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); + } + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); + } + return buffer; + }; + + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; + + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } + + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } + })(); + }); + + var sha3$1$1 = sha3$1; + + function keccak256$1(data) { + return '0x' + sha3$1$1.keccak_256(arrayify$1(data)); + } + + function id$2(text) { + return keccak256$1(toUtf8Bytes$1(text)); + } + + const version$7$1 = "hash/5.6.0"; + + const logger$9$1 = new Logger$1(version$7$1); + const Zeros = new Uint8Array(32); + Zeros.fill(0); + const Partition = new RegExp("^((.*)\\.)?([^.]+)$"); + function namehash(name) { + /* istanbul ignore if */ + if (typeof (name) !== "string") { + logger$9$1.throwArgumentError("invalid ENS name; not a string", "name", name); + } + let current = name; + let result = Zeros; + while (current.length) { + const partition = current.match(Partition); + if (partition == null || partition[2] === "") { + logger$9$1.throwArgumentError("invalid ENS address; missing component", "name", name); + } + const label = toUtf8Bytes$1(nameprep(partition[3])); + result = keccak256$1(concat$1([result, keccak256$1(label)])); + current = partition[2] || ""; + } + return hexlify$1(result); + } + function dnsEncode(name) { + return hexlify$1(concat$1(name.split(".").map((comp) => { + // We jam in an _ prefix to fill in with the length later + // Note: Nameprep throws if the component is over 63 bytes + const bytes = toUtf8Bytes$1("_" + nameprep(comp)); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; + } + + const version$6$1 = "rlp/5.6.0"; + + const logger$8$1 = new Logger$1(version$6$1); + function arrayifyInteger$1(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; + } + function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; + } + function _encode$1(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode$1(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger$1(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + if (!isBytesLike$1(object)) { + logger$8$1.throwArgumentError("RLP object must be BytesLike", "object", object); } const data = Array.prototype.slice.call(arrayify$1(object)); if (data.length === 1 && data[0] <= 0x7f) { @@ -21702,7 +21961,7 @@ return decoded.result; } - const version$5$1 = "address/5.4.0"; + const version$5$1 = "address/5.6.0"; const logger$7$1 = new Logger$1(version$5$1); function getChecksumAddress$1(address) { @@ -23517,7 +23776,7 @@ var hash = hash_1; - const version$4$1 = "sha2/5.4.0"; + const version$4$1 = "sha2/5.6.0"; new Logger$1(version$4$1); function sha256(data) { @@ -23706,7 +23965,7 @@ fromWords: fromWords }; - const version$3$1 = "providers/5.4.5"; + const version$3$1 = "providers/5.6.5"; function createCommonjsModule$2(fn, basedir, module) { return module = { @@ -26134,7 +26393,7 @@ var EC$1 = elliptic_1.ec; - const version$2$1 = "signing-key/5.4.0"; + const version$2$1 = "signing-key/5.6.1"; const logger$5$1 = new Logger$1(version$2$1); let _curve = null; @@ -26148,6 +26407,9 @@ constructor(privateKey) { defineReadOnly$1(this, "curve", "secp256k1"); defineReadOnly$1(this, "privateKey", hexlify$1(privateKey)); + if (hexDataLength$1(this.privateKey) !== 32) { + logger$5$1.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + } const keyPair = getCurve().keyFromPrivate(arrayify$1(this.privateKey)); defineReadOnly$1(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); defineReadOnly$1(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); @@ -26209,7 +26471,7 @@ return logger$5$1.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } - const version$1$1 = "transactions/5.4.0"; + const version$1$1 = "transactions/5.6.0"; const logger$4$1 = new Logger$1(version$1$1); var TransactionTypes$1; @@ -26439,7 +26701,7 @@ tx.v = 0; } else { - // Signed Tranasaction + // Signed Transaction tx.chainId = Math.floor((tx.v - 35) / 2); if (tx.chainId < 0) { tx.chainId = 0; @@ -26568,7 +26830,7 @@ type: type }; formats.block = { - hash: hash, + hash: Formatter.allowNull(hash), parentHash: hash, number: number, timestamp: number, @@ -26576,7 +26838,7 @@ difficulty: this.difficulty.bind(this), gasLimit: bigNumber, gasUsed: bigNumber, - miner: address, + miner: Formatter.allowNull(address), extraData: data, transactions: Formatter.allowNull(Formatter.arrayOf(hash)), baseFeePerGas: Formatter.allowNull(bigNumber) @@ -26719,7 +26981,11 @@ if (value.author != null && value.miner == null) { value.miner = value.author; } - 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$1.from(difficulty)); + return result; } block(value) { return this._block(value, this.formats.block); @@ -26897,6 +27163,7 @@ }); }; const logger$2$1 = new Logger$1(version$3$1); + const MAX_CCIP_REDIRECTS = 10; ////////////////////////////// // Event Serializeing function checkTopic(topic) { @@ -26997,6 +27264,8 @@ defineReadOnly$1(this, "tag", tag); defineReadOnly$1(this, "listener", listener); defineReadOnly$1(this, "once", once); + this._lastBlockNumber = -2; + this._inflight = false; } get event() { switch (this.type) { @@ -27053,36 +27322,149 @@ function base58Encode(data) { return Base58.encode(concat$1([data, hexDataSlice$1(sha256(sha256(data)), 0, 4)])); } + const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); + const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), + ]; + function _parseString(result, start) { + try { + return toUtf8String$1(_parseBytes(result, start)); + } + catch (error) { } + return null; + } + function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + const offset = BigNumber$1.from(hexDataSlice$1(result, start, start + 32)).toNumber(); + const length = BigNumber$1.from(hexDataSlice$1(result, offset, offset + 32)).toNumber(); + return hexDataSlice$1(result, offset + 32, offset + 32 + length); + } + // Trim off the ipfs:// prefix and return the default gateway URL + function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + logger$2$1.throwArgumentError("unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; + } + function numPad(value) { + const result = arrayify$1(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; + } + function bytesPad(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; + } + // ABI Encodes a series of (bytes, bytes, ...) + function encodeBytes(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(null); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = arrayify$1(datas[i]); + // Update the bytes offset + result[i] = numPad(byteCount); + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return hexConcat$1(result); + } class Resolver { - constructor(provider, address, name) { + // The resolvedAddress is only for creating a ReverseLookup resolver + constructor(provider, address, name, resolvedAddress) { defineReadOnly$1(this, "provider", provider); defineReadOnly$1(this, "name", name); defineReadOnly$1(this, "address", provider.formatter.address(address)); + defineReadOnly$1(this, "_resolvedAddress", resolvedAddress); } - _fetchBytes(selector, parameters) { + supportsWildcard() { + if (!this._supportsEip2544) { + // supportsInterface(bytes4 = selector("resolve(bytes,bytes)")) + this._supportsEip2544 = this.provider.call({ + to: this.address, + data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000" + }).then((result) => { + return BigNumber$1.from(result).eq(1); + }).catch((error) => { + if (error.code === Logger$1.errors.CALL_EXCEPTION) { + return false; + } + // Rethrow the error: link is down, etc. Let future attempts retry. + this._supportsEip2544 = null; + throw error; + }); + } + return this._supportsEip2544; + } + _fetch(selector, parameters) { return __awaiter$2$1(this, void 0, void 0, function* () { - // keccak256("addr(bytes32,uint256)") - const transaction = { + // e.g. keccak256("addr(bytes32,uint256)") + const tx = { to: this.address, + ccipReadEnabled: true, data: hexConcat$1([selector, namehash(this.name), (parameters || "0x")]) }; + // Wildcard support; use EIP-2544 to resolve the request + let parseBytes = false; + if (yield this.supportsWildcard()) { + parseBytes = true; + // selector("resolve(bytes,bytes)") + tx.data = hexConcat$1(["0x9061b923", encodeBytes([dnsEncode(this.name), tx.data])]); + } try { - const result = yield this.provider.call(transaction); - if (result === "0x") { - return null; + let result = yield this.provider.call(tx); + if ((arrayify$1(result).length % 32) === 4) { + logger$2$1.throwError("resolver threw error", Logger$1.errors.CALL_EXCEPTION, { + transaction: tx, data: result + }); + } + if (parseBytes) { + result = _parseBytes(result, 0); } - const offset = BigNumber$1.from(hexDataSlice$1(result, 0, 32)).toNumber(); - const length = BigNumber$1.from(hexDataSlice$1(result, offset, offset + 32)).toNumber(); - return hexDataSlice$1(result, offset + 32, offset + 32 + length); + return result; } catch (error) { if (error.code === Logger$1.errors.CALL_EXCEPTION) { return null; } - return null; + throw error; } }); } + _fetchBytes(selector, parameters) { + return __awaiter$2$1(this, void 0, void 0, function* () { + const result = yield this._fetch(selector, parameters); + if (result != null) { + return _parseBytes(result, 0); + } + return null; + }); + } _getAddress(coinType, hexBytes) { const coinInfo = coinInfos[String(coinType)]; if (coinInfo == null) { @@ -27144,16 +27526,12 @@ if (coinType === 60) { try { // keccak256("addr(bytes32)") - const transaction = { - to: this.address, - data: ("0x3b3b57de" + namehash(this.name).substring(2)) - }; - const hexBytes = yield this.provider.call(transaction); + const result = yield this._fetch("0x3b3b57de"); // No address - if (hexBytes === "0x" || hexBytes === HashZero) { + if (result === "0x" || result === HashZero) { return null; } - return this.provider.formatter.callAddress(hexBytes); + return this.provider.formatter.callAddress(result); } catch (error) { if (error.code === Logger$1.errors.CALL_EXCEPTION) { @@ -27180,6 +27558,119 @@ return address; }); } + getAvatar() { + return __awaiter$2$1(this, void 0, void 0, function* () { + const linkage = [{ type: "name", content: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = yield this.getText("avatar"); + if (avatar == null) { + return null; + } + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + linkage.push({ type: "url", content: avatar }); + return { linkage, url: avatar }; + case "data": + linkage.push({ type: "data", content: avatar }); + return { linkage, url: avatar }; + case "ipfs": + linkage.push({ type: "ipfs", content: avatar }); + return { linkage, url: getIpfsLink(avatar) }; + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: scheme, content: avatar }); + // The owner of this name + const owner = (this._resolvedAddress || (yield this.getAddress())); + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return null; + } + const addr = yield this.provider.formatter.address(comps[0]); + const tokenId = hexZeroPad$1(BigNumber$1.from(comps[1]).toHexString(), 32); + // Check that this account owns the token + if (scheme === "erc721") { + // ownerOf(uint256 tokenId) + const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({ + to: addr, data: hexConcat$1(["0x6352211e", tokenId]) + })); + if (owner !== tokenOwner) { + return null; + } + linkage.push({ type: "owner", content: tokenOwner }); + } + else if (scheme === "erc1155") { + // balanceOf(address owner, uint256 tokenId) + const balance = BigNumber$1.from(yield this.provider.call({ + to: addr, data: hexConcat$1(["0x00fdd58e", hexZeroPad$1(owner, 32), tokenId]) + })); + if (balance.isZero()) { + return null; + } + linkage.push({ type: "balance", content: balance.toString() }); + } + // Call the token contract for the metadata URL + const tx = { + to: this.provider.formatter.address(comps[0]), + data: hexConcat$1([selector, tokenId]) + }; + let metadataUrl = _parseString(yield this.provider.call(tx), 0); + if (metadataUrl == null) { + return null; + } + linkage.push({ type: "metadata-url-base", content: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + linkage.push({ type: "metadata-url-expanded", content: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + // Get the token metadata + const metadata = yield fetchJson(metadataUrl); + if (!metadata) { + return null; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + return null; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + return null; + } + linkage.push({ type: "url-ipfs", content: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", content: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return null; + }); + } getContentHash() { return __awaiter$2$1(this, void 0, void 0, function* () { // keccak256("contenthash()") @@ -27196,6 +27687,14 @@ return "ipfs:/\/" + Base58.encode("0x" + ipfs[1]); } } + // IPNS (CID: 1, Type: libp2p-key) + const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipns) { + const length = parseInt(ipns[3], 16); + if (ipns[4].length === length * 2) { + return "ipns:/\/" + Base58.encode("0x" + ipns[1]); + } + } // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); if (swarm) { @@ -27246,6 +27745,7 @@ // Events being listened to this._events = []; this._emitted = { block: -2 }; + this.disableCcipRead = false; this.formatter = new.target.getFormatter(); // If network is any, this Provider allows the underlying // network to change dynamically, and we auto-detect the @@ -27262,7 +27762,7 @@ this._ready().catch((error) => { }); } else { - const knownNetwork = getStatic$1((new.target), "getNetwork")(network); + const knownNetwork = getStatic$1(new.target, "getNetwork")(network); if (knownNetwork) { defineReadOnly$1(this, "_network", knownNetwork); this.emit("network", knownNetwork, null); @@ -27273,6 +27773,7 @@ } this._maxInternalBlockNumber = -1024; this._lastBlockNumber = -2; + this._maxFilterBlockRange = 10; this._pollingInterval = 4000; this._fastQueryDate = 0; } @@ -27311,7 +27812,7 @@ } // This will always return the most recently established network. // For "any", this can change (a "network" event is emitted before - // any change is refelcted); otherwise this cannot change + // any change is reflected); otherwise this cannot change get ready() { return poll(() => { return this._ready().then((network) => { @@ -27336,6 +27837,40 @@ static getNetwork(network) { return getNetwork((network == null) ? "homestead" : network); } + ccipReadFetch(tx, calldata, urls) { + return __awaiter$2$1(this, void 0, void 0, function* () { + if (this.disableCcipRead || urls.length === 0) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + const json = (url.indexOf("{data}") >= 0) ? null : JSON.stringify({ data, sender }); + const result = yield fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + value.status = response.statusCode; + return value; + }); + if (result.data) { + return result.data; + } + const errorMessage = (result.message || "unknown error"); + // 4xx indicates the result is not present; stop + if (result.status >= 400 && result.status < 500) { + return logger$2$1.throwError(`response not found during CCIP fetch: ${errorMessage}`, Logger$1.errors.SERVER_ERROR, { url, errorMessage }); + } + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + return logger$2$1.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, Logger$1.errors.SERVER_ERROR, { + urls, errorMessages + }); + }); + } // Fetches the blockNumber, but will reuse any result that is less // than maxAge old or has been requested since the last request _getInternalBlockNumber(maxAge) { @@ -27483,20 +28018,44 @@ break; } case "filter": { - const filter = event.filter; - filter.fromBlock = this._lastBlockNumber + 1; - filter.toBlock = blockNumber; - const runner = this.getLogs(filter).then((logs) => { - if (logs.length === 0) { - return; + // We only allow a single getLogs to be in-flight at a time + if (!event._inflight) { + event._inflight = true; + // Filter from the last known event; due to load-balancing + // and some nodes returning updated block numbers before + // indexing events, a logs result with 0 entries cannot be + // trusted and we must retry a range which includes it again + const filter = event.filter; + filter.fromBlock = event._lastBlockNumber + 1; + filter.toBlock = blockNumber; + // Prevent fitler ranges from growing too wild + if (filter.toBlock - this._maxFilterBlockRange > filter.fromBlock) { + filter.fromBlock = filter.toBlock - this._maxFilterBlockRange; } - logs.forEach((log) => { - this._emitted["b:" + log.blockHash] = log.blockNumber; - this._emitted["t:" + log.transactionHash] = log.blockNumber; - this.emit(filter, log); + const runner = this.getLogs(filter).then((logs) => { + // Allow the next getLogs + event._inflight = false; + if (logs.length === 0) { + return; + } + logs.forEach((log) => { + // Only when we get an event for a given block number + // can we trust the events are indexed + if (log.blockNumber > event._lastBlockNumber) { + event._lastBlockNumber = log.blockNumber; + } + // Make sure we stall requests to fetch blocks and txs + this._emitted["b:" + log.blockHash] = log.blockNumber; + this._emitted["t:" + log.transactionHash] = log.blockNumber; + this.emit(filter, log); + }); + }).catch((error) => { + this.emit("error", error); + // Allow another getLogs (the range was not updated) + event._inflight = false; }); - }).catch((error) => { this.emit("error", error); }); - runners.push(runner); + runners.push(runner); + } break; } } @@ -28008,25 +28567,99 @@ return this.formatter.filter(yield resolveProperties$1(result)); }); } - call(transaction, blockTag) { + _call(transaction, blockTag, attempt) { return __awaiter$2$1(this, void 0, void 0, function* () { - yield this.getNetwork(); - const params = yield resolveProperties$1({ - transaction: this._getTransactionRequest(transaction), - blockTag: this._getBlockTag(blockTag) - }); - const result = yield this.perform("call", params); + if (attempt >= MAX_CCIP_REDIRECTS) { + logger$2$1.throwError("CCIP read exceeded maximum redirections", Logger$1.errors.SERVER_ERROR, { + redirects: attempt, transaction + }); + } + const txSender = transaction.to; + const result = yield this.perform("call", { transaction, blockTag }); + // CCIP Read request via OffchainLookup(address,string[],bytes,bytes4,bytes) + if (attempt >= 0 && blockTag === "latest" && txSender != null && result.substring(0, 10) === "0x556f1830" && (hexDataLength$1(result) % 32 === 4)) { + try { + const data = hexDataSlice$1(result, 4); + // Check the sender of the OffchainLookup matches the transaction + const sender = hexDataSlice$1(data, 0, 32); + if (!BigNumber$1.from(sender).eq(txSender)) { + logger$2$1.throwError("CCIP Read sender did not match", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + // Read the URLs from the response + const urls = []; + const urlsOffset = BigNumber$1.from(hexDataSlice$1(data, 32, 64)).toNumber(); + const urlsLength = BigNumber$1.from(hexDataSlice$1(data, urlsOffset, urlsOffset + 32)).toNumber(); + const urlsData = hexDataSlice$1(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + logger$2$1.throwError("CCIP Read contained corrupt URL string", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + urls.push(url); + } + // Get the CCIP calldata to forward + const calldata = _parseBytes(data, 64); + // Get the callbackSelector (bytes4) + if (!BigNumber$1.from(hexDataSlice$1(data, 100, 128)).isZero()) { + logger$2$1.throwError("CCIP Read callback selector included junk", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const callbackSelector = hexDataSlice$1(data, 96, 100); + // Get the extra data to send back to the contract as context + const extraData = _parseBytes(data, 128); + const ccipResult = yield this.ccipReadFetch(transaction, calldata, urls); + if (ccipResult == null) { + logger$2$1.throwError("CCIP Read disabled or provided no URLs", Logger$1.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const tx = { + to: txSender, + data: hexConcat$1([callbackSelector, encodeBytes([ccipResult, extraData])]) + }; + return this._call(tx, blockTag, attempt + 1); + } + catch (error) { + if (error.code === Logger$1.errors.SERVER_ERROR) { + throw error; + } + } + } try { return hexlify$1(result); } catch (error) { return logger$2$1.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "call", - params, result, error + params: { transaction, blockTag }, result, error }); } }); } + call(transaction, blockTag) { + return __awaiter$2$1(this, void 0, void 0, function* () { + yield this.getNetwork(); + const resolved = yield resolveProperties$1({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag), + ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled) + }); + return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0 : -1); + }); + } estimateGas(transaction) { return __awaiter$2$1(this, void 0, void 0, function* () { yield this.getNetwork(); @@ -28047,6 +28680,10 @@ } _getAddress(addressOrName) { return __awaiter$2$1(this, void 0, void 0, function* () { + addressOrName = yield addressOrName; + if (typeof (addressOrName) !== "string") { + logger$2$1.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } const address = yield this.resolveName(addressOrName); if (address == null) { logger$2$1.throwError("ENS name not configured", Logger$1.errors.UNSUPPORTED_OPERATION, { @@ -28070,7 +28707,7 @@ } else { try { - params.blockTag = this.formatter.blockTag(yield this._getBlockTag(blockHashOrBlockTag)); + params.blockTag = yield this._getBlockTag(blockHashOrBlockTag); if (isHexString$1(params.blockTag)) { blockNumber = parseInt(params.blockTag.substring(2), 16); } @@ -28236,43 +28873,54 @@ } getResolver(name) { return __awaiter$2$1(this, void 0, void 0, function* () { - try { - const address = yield this._getResolver(name); - if (address == null) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { return null; } - return new Resolver(this, address, name); - } - catch (error) { - if (error.code === Logger$1.errors.CALL_EXCEPTION) { + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { return null; } - return null; + // Check the current node for a resolver + const addr = yield this._getResolver(currentName, "getResolver"); + // Found a resolver! + if (addr != null) { + const resolver = new Resolver(this, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(yield resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); } }); } - _getResolver(name) { + _getResolver(name, operation) { return __awaiter$2$1(this, void 0, void 0, function* () { - // Get the resolver from the blockchain + if (operation == null) { + operation = "ENS"; + } const network = yield this.getNetwork(); // No ENS... if (!network.ensAddress) { - logger$2$1.throwError("network does not support ENS", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name }); + logger$2$1.throwError("network does not support ENS", Logger$1.errors.UNSUPPORTED_OPERATION, { operation, network: network.name }); } - // keccak256("resolver(bytes32)") - const transaction = { - to: network.ensAddress, - data: ("0x0178b8bf" + namehash(name).substring(2)) - }; try { - return this.formatter.callAddress(yield this.call(transaction)); + // keccak256("resolver(bytes32)") + const addrData = yield this.call({ + to: network.ensAddress, + data: ("0x0178b8bf" + namehash(name).substring(2)) + }); + return this.formatter.callAddress(addrData); } catch (error) { - if (error.code === Logger$1.errors.CALL_EXCEPTION) { - return null; - } - throw error; + // ENS registry cannot throw errors on resolver(bytes32) } + return null; }); } resolveName(name) { @@ -28291,7 +28939,7 @@ if (typeof (name) !== "string") { logger$2$1.throwArgumentError("invalid ENS name", "name", name); } - // Get the addr from the resovler + // Get the addr from the resolver const resolver = yield this.getResolver(name); if (!resolver) { return null; @@ -28303,39 +28951,75 @@ return __awaiter$2$1(this, void 0, void 0, function* () { address = yield address; address = this.formatter.address(address); - const reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; - const resolverAddress = yield this._getResolver(reverseName); - if (!resolverAddress) { + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddr = yield this._getResolver(node, "lookupAddress"); + if (resolverAddr == null) { return null; } // keccak("name(bytes32)") - let bytes = arrayify$1(yield this.call({ - to: resolverAddress, - data: ("0x691f3431" + namehash(reverseName).substring(2)) - })); - // Strip off the dynamic string pointer (0x20) - if (bytes.length < 32 || !BigNumber$1.from(bytes.slice(0, 32)).eq(32)) { + const name = _parseString(yield this.call({ + to: resolverAddr, + data: ("0x691f3431" + namehash(node).substring(2)) + }), 0); + const addr = yield this.resolveName(name); + if (addr != address) { return null; } - bytes = bytes.slice(32); - // Not a length-prefixed string - if (bytes.length < 32) { - return null; + return name; + }); + } + getAvatar(nameOrAddress) { + return __awaiter$2$1(this, void 0, void 0, function* () { + let resolver = null; + if (isHexString$1(nameOrAddress)) { + // Address; reverse lookup + const address = this.formatter.address(nameOrAddress); + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddress = yield this._getResolver(node, "getAvatar"); + if (!resolverAddress) { + return null; + } + // Try resolving the avatar against the addr.reverse resolver + resolver = new Resolver(this, resolverAddress, node); + try { + const avatar = yield resolver.getAvatar(); + if (avatar) { + return avatar.url; + } + } + catch (error) { + if (error.code !== Logger$1.errors.CALL_EXCEPTION) { + throw error; + } + } + // Try getting the name and performing forward lookup; allowing wildcards + try { + // keccak("name(bytes32)") + const name = _parseString(yield this.call({ + to: resolverAddress, + data: ("0x691f3431" + namehash(node).substring(2)) + }), 0); + resolver = yield this.getResolver(name); + } + catch (error) { + if (error.code !== Logger$1.errors.CALL_EXCEPTION) { + throw error; + } + return null; + } } - // Get the length of the string (from the length-prefix) - const length = BigNumber$1.from(bytes.slice(0, 32)).toNumber(); - bytes = bytes.slice(32); - // Length longer than available data - if (length > bytes.length) { - return null; + else { + // ENS name; forward lookup with wildcard + resolver = yield this.getResolver(nameOrAddress); + if (!resolver) { + return null; + } } - const name = toUtf8String$1(bytes.slice(0, length)); - // Make sure the reverse record matches the foward record - const addr = yield this.resolveName(name); - if (addr != address) { + const avatar = yield resolver.getAvatar(); + if (avatar == null) { return null; } - return name; + return avatar.url; }); } perform(method, params) { @@ -28440,7 +29124,7 @@ } } - const version$g = "abstract-signer/5.4.1"; + const version$g = "abstract-signer/5.6.0"; var __awaiter$1$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -28453,7 +29137,7 @@ }; const logger$1$1 = new Logger$1(version$g); const allowedTransactionKeys$1 = [ - "accessList", "chainId", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" + "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors$1 = [ Logger$1.errors.INSUFFICIENT_FUNDS, @@ -28481,7 +29165,7 @@ return yield this.provider.getTransactionCount(this.getAddress(), blockTag); }); } - // Populates "from" if unspecified, and estimates the gas for the transation + // Populates "from" if unspecified, and estimates the gas for the transaction estimateGas(transaction) { return __awaiter$1$1(this, void 0, void 0, function* () { this._checkProvider("estimateGas"); @@ -28489,7 +29173,7 @@ return yield this.provider.estimateGas(tx); }); } - // Populates "from" if unspecified, and calls with the transation + // Populates "from" if unspecified, and calls with the transaction call(transaction, blockTag) { return __awaiter$1$1(this, void 0, void 0, function* () { this._checkProvider("call"); @@ -28588,7 +29272,7 @@ // Prevent this error from causing an UnhandledPromiseException tx.to.catch((error) => { }); } - // Do not allow mixing pre-eip-1559 and eip-1559 proerties + // Do not allow mixing pre-eip-1559 and eip-1559 properties const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null); if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { logger$1$1.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); @@ -28723,18 +29407,46 @@ }; const logger$h = new Logger$1(version$3$1); const errorGas = ["call", "estimateGas"]; + function spelunk(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match("reverted") && isHexString$1(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunk(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunk(JSON.parse(value)); + } + catch (error) { } + } + return null; + } function checkError(method, error, params) { // Undo the "convenience" some nodes are attempting to prevent backwards // incompatibility; maybe for v6 consider forwarding reverts as errors - if (method === "call" && error.code === Logger$1.errors.SERVER_ERROR) { - const e = error.error; - if (e && e.message.match("reverted") && isHexString$1(e.data)) { - return e.data; + if (method === "call") { + const result = spelunk(error); + if (result) { + return result.data; } - logger$h.throwError("missing revert data in call exception", Logger$1.errors.CALL_EXCEPTION, { + logger$h.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger$1.errors.CALL_EXCEPTION, { error, data: "0x" }); } + // @TODO: Should we spelunk for message too? let message = error.message; if (error.code === Logger$1.errors.SERVER_ERROR && error.error && typeof (error.error.message) === "string") { message = error.error.message; @@ -28748,25 +29460,25 @@ message = (message || "").toLowerCase(); const transaction = params.transaction || params.signedTransaction; // "insufficient funds for gas * price + value + cost(data)" - if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { logger$h.throwError("insufficient funds for intrinsic transaction cost", Logger$1.errors.INSUFFICIENT_FUNDS, { error, method, transaction }); } // "nonce too low" - if (message.match(/nonce too low/)) { + if (message.match(/nonce (is )?too low/i)) { logger$h.throwError("nonce has already been used", Logger$1.errors.NONCE_EXPIRED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/replacement transaction underpriced/)) { + if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) { logger$h.throwError("replacement fee too low", Logger$1.errors.REPLACEMENT_UNDERPRICED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/only replay-protected/)) { + if (message.match(/only replay-protected/i)) { logger$h.throwError("legacy pre-eip-155 transactions not supported", Logger$1.errors.UNSUPPORTED_OPERATION, { error, method, transaction }); @@ -28922,6 +29634,13 @@ }); } signMessage(message) { + return __awaiter$8(this, void 0, void 0, function* () { + const data = ((typeof (message) === "string") ? toUtf8Bytes$1(message) : message); + const address = yield this.getAddress(); + return yield this.provider.send("personal_sign", [hexlify$1(data), address.toLowerCase()]); + }); + } + _legacySignMessage(message) { return __awaiter$8(this, void 0, void 0, function* () { const data = ((typeof (message) === "string") ? toUtf8Bytes$1(message) : message); const address = yield this.getAddress(); @@ -29160,7 +29879,7 @@ if (method === "call" || method === "estimateGas") { const tx = params.transaction; if (tx && tx.type != null && BigNumber$1.from(tx.type).isZero()) { - // If there are no EIP-1559 properties, it might be non-EIP-a559 + // If there are no EIP-1559 properties, it might be non-EIP-1559 if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { const feeData = yield this.getFeeData(); if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { @@ -29257,12 +29976,12 @@ } checkProperties(transaction, allowed); const result = {}; - // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. - ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { if (transaction[key] == null) { return; } - const value = hexValue(transaction[key]); + const value = hexValue(BigNumber$1.from(transaction[key])); if (key === "gasLimit") { key = "gas"; } @@ -29436,6 +30155,63 @@ } } + let provider$3; + + const getProvider$2 = ()=> { + + if(provider$3) { return provider$3 } + + setProviderEndpoints$3(['https://bsc-dataseed.binance.org']); + + return provider$3 + }; + + const setProviderEndpoints$3 = (endpoints)=> { + setProvider$3( + new StaticJsonRpcBatchProvider( + endpoints[0], 'bsc' + ) + ); + }; + + const setProvider$3 = (givenProvider)=> { + provider$3 = givenProvider; + }; + + const getContractArguments = ({ contract, method, params })=>{ + let fragment = contract.interface.fragments.find((fragment) => { + return fragment.name == method + }); + + if(params instanceof Array) { + return params + } else if (params instanceof Object) { + return fragment.inputs.map((input) => { + return params[input.name] + }) + } else { + throw 'Contract params have wrong type!' + } + }; + + var estimate$1 = async ({ provider, from, to, value, method, api, params }) => { + let contract = new Contract(to, api, provider); + return contract.estimateGas[method](...getContractArguments({ contract, method, params }), { from, value }) + }; + + var estimateBsc = async ({ from, to, value, method, api, params }) => { + let provider = getProvider$2(); + return estimate$1({ + provider, + from, + to, + value, + method, + api, + params + }) + }; + let provider$2; const getProvider$1 = ()=> { @@ -29459,6 +30235,207 @@ provider$2 = givenProvider; }; + var estimateEthereum = async ({ from, to, value, method, api, params }) => { + let provider = getProvider$1(); + return estimate$1({ + provider, + from, + to, + value, + method, + api, + params + }) + }; + + let provider$1; + + const getProvider = ()=> { + + if(provider$1) { return provider$1 } + + setProviderEndpoints$1(['https://polygon-rpc.com']); + + return provider$1 + }; + + const setProviderEndpoints$1 = (endpoints)=> { + setProvider$1( + new StaticJsonRpcBatchProvider( + endpoints[0], 'polygon' + ) + ); + }; + + const setProvider$1 = (givenProvider)=> { + provider$1 = givenProvider; + }; + + var estimatePolygon = async ({ from, to, value, method, api, params }) => { + let provider = getProvider(); + return estimate$1({ + provider, + from, + to, + value, + method, + api, + params + }) + }; + + function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }let getWindow = () => { + if (typeof global$1 == 'object') return global$1 + return window + }; + + let getCacheStore = () => { + if (getWindow()._cacheStore == undefined) { + resetCache(); + } + return getWindow()._cacheStore + }; + + let getPromiseStore = () => { + if (getWindow()._promiseStore == undefined) { + resetCache(); + } + return getWindow()._promiseStore + }; + + let resetCache = () => { + getWindow()._cacheStore = {}; + getWindow()._promiseStore = {}; + }; + + let set = function ({ key, value, expires }) { + getCacheStore()[key] = { + expiresAt: Date.now() + expires, + value, + }; + }; + + let get = function ({ key, expires }) { + let cachedEntry = getCacheStore()[key]; + if (_optionalChain([cachedEntry, 'optionalAccess', _ => _.expiresAt]) > Date.now()) { + return cachedEntry.value + } + }; + + let getPromise = function({ key }) { + return getPromiseStore()[key] + }; + + let setPromise = function({ key, promise }) { + getPromiseStore()[key] = promise; + return promise + }; + + let deletePromise = function({ key }) { + getPromiseStore()[key] = undefined; + }; + + let cache = function ({ call, key, expires = 0 }) { + return new Promise((resolve, reject)=>{ + let value; + key = JSON.stringify(key); + + // get existing promise (of a previous pending request asking for the exact same thing) + let existingPromise = getPromise({ key }); + if(existingPromise) { + return existingPromise + .then(resolve) + .catch(reject) + } + + setPromise({ key, promise: new Promise((resolveQueue, rejectQueue)=>{ + if (expires === 0) { + return call() + .then((value)=>{ + resolve(value); + resolveQueue(value); + }) + .catch((error)=>{ + reject(error); + rejectQueue(error); + }) + } + + // get cached value + value = get({ key, expires }); + if (value) { + resolve(value); + resolveQueue(value); + return value + } + + // set new cache value + call() + .then((value)=>{ + if (value) { + set({ key, value, expires }); + } + resolve(value); + resolveQueue(value); + }) + .catch((error)=>{ + reject(error); + rejectQueue(error); + }); + }) + }).then(()=>{ + deletePromise({ key }); + }).catch(()=>{ + deletePromise({ key }); + }); + }) + }; + + let estimate = async function ({ blockchain, from, to, value, method, api, params, cache: cache$1 }) { + if(!['ethereum', 'bsc', 'polygon'].includes(blockchain)) { throw 'Unknown blockchain: ' + blockchain } + if(typeof value == 'undefined') { value = '0'; } + + let result = await cache({ + expires: cache$1 || 0, + key: [blockchain, from, to, value, method, params], + call: async () => { + switch (blockchain) { + + case 'ethereum': + return estimateEthereum({ from, to, value, method, api, params }) + + case 'bsc': + return estimateBsc({ from, to, value, method, api, params }) + + case 'polygon': + return estimatePolygon({ from, to, value, method, api, params }) + + } + }, + }); + return result + }; + + var parseUrl = (url) => { + if (typeof url == 'object') { + return url + } + let deconstructed = url.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+))?/); + + if(deconstructed.groups.part2 == undefined) { + return { + blockchain: deconstructed.groups.blockchain, + method: deconstructed.groups.part1 + } + } else { + return { + blockchain: deconstructed.groups.blockchain, + address: deconstructed.groups.part1, + method: deconstructed.groups.part2 + } + } + }; + let paramsToContractArgs = ({ contract, method, params }) => { let fragment = contract.interface.fragments.find((fragment) => { return fragment.name == method @@ -29493,8 +30470,8 @@ } }; - var requestEthereum = async ({ address, api, method, params }) => { - let provider = getProvider$1(); + var requestBsc = async ({ address, api, method, params }) => { + let provider = getProvider$2(); return request$1({ provider, @@ -29505,30 +30482,19 @@ }) }; - let provider$1; - - const getProvider = ()=> { - - if(provider$1) { return provider$1 } - - setProviderEndpoints$1(['https://bsc-dataseed.binance.org']); - - return provider$1 - }; - - const setProviderEndpoints$1 = (endpoints)=> { - setProvider$1( - new StaticJsonRpcBatchProvider( - endpoints[0], 'bsc' - ) - ); - }; + var requestEthereum = async ({ address, api, method, params }) => { + let provider = getProvider$1(); - const setProvider$1 = (givenProvider)=> { - provider$1 = givenProvider; + return request$1({ + provider, + address, + api, + method, + params + }) }; - var requestBsc = async ({ address, api, method, params }) => { + var requestPolygon = async ({ address, api, method, params }) => { let provider = getProvider(); return request$1({ @@ -29540,30 +30506,10 @@ }) }; - var parseUrl = (url) => { - if (typeof url == 'object') { - return url - } - let deconstructed = url.match(/(?\w+):\/\/(?[\w\d]+)(\/(?[\w\d]+))?/); - - if(deconstructed.groups.part2 == undefined) { - return { - blockchain: deconstructed.groups.blockchain, - method: deconstructed.groups.part1 - } - } else { - return { - blockchain: deconstructed.groups.blockchain, - address: deconstructed.groups.part1, - method: deconstructed.groups.part2 - } - } - }; - let request = async function (url, options) { let { blockchain, address, method } = parseUrl(url); let { api, params, cache: cache$1 } = options || {}; - if(!['ethereum', 'bsc'].includes(blockchain)) { throw 'Unknown blockchain: ' + blockchain } + if(!['ethereum', 'bsc', 'polygon'].includes(blockchain)) { throw 'Unknown blockchain: ' + blockchain } let result = await cache({ expires: cache$1 || 0, key: [blockchain, address, method, params], @@ -29575,6 +30521,9 @@ case 'bsc': return requestBsc({ address, api, method, params }) + + case 'polygon': + return requestPolygon({ address, api, method, params }) } }, @@ -29590,6 +30539,9 @@ return getProvider$1() case 'bsc': + return getProvider$2() + + case 'polygon': return getProvider() default: @@ -29605,6 +30557,9 @@ return setProviderEndpoints$2(endpoints) case 'bsc': + return setProviderEndpoints$3(endpoints) + + case 'polygon': return setProviderEndpoints$1(endpoints) default: @@ -33120,7 +34075,7 @@ })(module, commonjsGlobal$2); }); - const version$j = "logger/5.4.1"; + const version$i = "logger/5.6.0"; let _permanentCensorErrors$2 = false; let _censorErrors$2 = false; @@ -33217,7 +34172,7 @@ // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficien funds (< value + gasLimit * gasPrice) + // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used @@ -33299,6 +34254,40 @@ messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$2.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$2.CALL_EXCEPTION: + case ErrorCode$2.INSUFFICIENT_FUNDS: + case ErrorCode$2.MISSING_NEW: + case ErrorCode$2.NONCE_EXPIRED: + case ErrorCode$2.REPLACEMENT_UNDERPRICED: + case ErrorCode$2.TRANSACTION_REPLACED: + case ErrorCode$2.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -33396,7 +34385,7 @@ } static globalLogger() { if (!_globalLogger$2) { - _globalLogger$2 = new Logger$2(version$j); + _globalLogger$2 = new Logger$2(version$i); } return _globalLogger$2; } @@ -33432,9 +34421,9 @@ Logger$2.errors = ErrorCode$2; Logger$2.levels = LogLevel$2; - const version$i = "bytes/5.4.0"; + const version$h = "bytes/5.6.1"; - const logger$q = new Logger$2(version$i); + const logger$p = new Logger$2(version$h); /////////////////////////////// function isHexable$2(value) { return !!(value.toHexString); @@ -33452,6 +34441,9 @@ function isBytesLike$2(value) { return ((isHexString$2(value) && !(value.length % 2)) || isBytes$2(value)); } + function isInteger$2(value) { + return (typeof (value) === "number" && value == value && (value % 1) === 0); + } function isBytes$2(value) { if (value == null) { return false; @@ -33462,12 +34454,12 @@ if (typeof (value) === "string") { return false; } - if (value.length == null) { + if (!isInteger$2(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (typeof (v) !== "number" || v < 0 || v >= 256 || (v % 1)) { + if (!isInteger$2(v) || v < 0 || v >= 256) { return false; } } @@ -33478,7 +34470,7 @@ options = {}; } if (typeof (value) === "number") { - logger$q.checkSafeUint53(value, "invalid arrayify value"); + logger$p.checkSafeUint53(value, "invalid arrayify value"); const result = []; while (value) { result.unshift(value & 0xff); @@ -33499,13 +34491,13 @@ let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; } else { - logger$q.throwArgumentError("hex data is odd-length", "value", value); + logger$p.throwArgumentError("hex data is odd-length", "value", value); } } const result = []; @@ -33517,7 +34509,7 @@ if (isBytes$2(value)) { return addSlice$2(new Uint8Array(value)); } - return logger$q.throwArgumentError("invalid arrayify value", "value", value); + return logger$p.throwArgumentError("invalid arrayify value", "value", value); } function concat$2(items) { const objects = items.map(item => arrayify$2(item)); @@ -33548,7 +34540,7 @@ function zeroPad$1(value, length) { value = arrayify$2(value); if (value.length > length) { - logger$q.throwArgumentError("value out of range", "value", arguments[0]); + logger$p.throwArgumentError("value out of range", "value", arguments[0]); } const result = new Uint8Array(length); result.set(value, length - value.length); @@ -33569,7 +34561,7 @@ options = {}; } if (typeof (value) === "number") { - logger$q.checkSafeUint53(value, "invalid hexlify value"); + logger$p.checkSafeUint53(value, "invalid hexlify value"); let hex = ""; while (value) { hex = HexCharacters$2[value & 0xf] + hex; @@ -33605,7 +34597,7 @@ value += "0"; } else { - logger$q.throwArgumentError("hex data is odd-length", "value", value); + logger$p.throwArgumentError("hex data is odd-length", "value", value); } } return value.toLowerCase(); @@ -33618,7 +34610,7 @@ } return result; } - return logger$q.throwArgumentError("invalid hexlify value", "value", value); + return logger$p.throwArgumentError("invalid hexlify value", "value", value); } /* function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number { @@ -33642,7 +34634,7 @@ data = hexlify$2(data); } else if (!isHexString$2(data) || (data.length % 2)) { - logger$q.throwArgumentError("invalid hexData", "value", data); + logger$p.throwArgumentError("invalid hexData", "value", data); } offset = 2 + 2 * offset; if (endOffset != null) { @@ -33669,7 +34661,7 @@ value = hexlify$2(value); } if (!isHexString$2(value)) { - logger$q.throwArgumentError("invalid hex string", "value", value); + logger$p.throwArgumentError("invalid hex string", "value", value); } value = value.substring(2); let offset = 0; @@ -33683,10 +34675,10 @@ value = hexlify$2(value); } else if (!isHexString$2(value)) { - logger$q.throwArgumentError("invalid hex string", "value", value); + logger$p.throwArgumentError("invalid hex string", "value", value); } if (value.length > 2 * length + 2) { - logger$q.throwArgumentError("value out of range", "value", arguments[1]); + logger$p.throwArgumentError("value out of range", "value", arguments[1]); } while (value.length < 2 * length + 2) { value = "0x0" + value.substring(2); @@ -33699,24 +34691,35 @@ s: "0x", _vs: "0x", recoveryParam: 0, - v: 0 + v: 0, + yParityAndS: "0x", + compact: "0x" }; if (isBytesLike$2(signature)) { - const bytes = arrayify$2(signature); - if (bytes.length !== 65) { - logger$q.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature); - } + let bytes = arrayify$2(signature); // Get the r, s and v - result.r = hexlify$2(bytes.slice(0, 32)); - result.s = hexlify$2(bytes.slice(32, 64)); - result.v = bytes[64]; + if (bytes.length === 64) { + // EIP-2098; pull the v from the top bit of s and clear it + result.v = 27 + (bytes[32] >> 7); + bytes[32] &= 0x7f; + result.r = hexlify$2(bytes.slice(0, 32)); + result.s = hexlify$2(bytes.slice(32, 64)); + } + else if (bytes.length === 65) { + result.r = hexlify$2(bytes.slice(0, 32)); + result.s = hexlify$2(bytes.slice(32, 64)); + result.v = bytes[64]; + } + else { + logger$p.throwArgumentError("invalid signature string", "signature", signature); + } // Allow a recid to be used as the v if (result.v < 27) { if (result.v === 0 || result.v === 1) { result.v += 27; } else { - logger$q.throwArgumentError("signature invalid v byte", "signature", signature); + logger$p.throwArgumentError("signature invalid v byte", "signature", signature); } } // Compute recoveryParam from v @@ -33744,7 +34747,7 @@ result.recoveryParam = recoveryParam; } else if (result.recoveryParam !== recoveryParam) { - logger$q.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); + logger$p.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); } // Set or check the s vs[0] &= 0x7f; @@ -33753,13 +34756,13 @@ result.s = s; } else if (result.s !== s) { - logger$q.throwArgumentError("signature v mismatch _vs", "signature", signature); + logger$p.throwArgumentError("signature v mismatch _vs", "signature", signature); } } // Use recid and v to populate each other if (result.recoveryParam == null) { if (result.v == null) { - logger$q.throwArgumentError("signature missing v and recoveryParam", "signature", signature); + logger$p.throwArgumentError("signature missing v and recoveryParam", "signature", signature); } else if (result.v === 0 || result.v === 1) { result.recoveryParam = result.v; @@ -33772,25 +34775,28 @@ if (result.v == null) { result.v = 27 + result.recoveryParam; } - else if (result.recoveryParam !== (1 - (result.v % 2))) { - logger$q.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + else { + const recId = (result.v === 0 || result.v === 1) ? result.v : (1 - (result.v % 2)); + if (result.recoveryParam !== recId) { + logger$p.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + } } } if (result.r == null || !isHexString$2(result.r)) { - logger$q.throwArgumentError("signature missing or invalid r", "signature", signature); + logger$p.throwArgumentError("signature missing or invalid r", "signature", signature); } else { result.r = hexZeroPad$2(result.r, 32); } if (result.s == null || !isHexString$2(result.s)) { - logger$q.throwArgumentError("signature missing or invalid s", "signature", signature); + logger$p.throwArgumentError("signature missing or invalid s", "signature", signature); } else { result.s = hexZeroPad$2(result.s, 32); } const vs = arrayify$2(result.s); if (vs[0] >= 128) { - logger$q.throwArgumentError("signature s out of range", "signature", signature); + logger$p.throwArgumentError("signature s out of range", "signature", signature); } if (result.recoveryParam) { vs[0] |= 0x80; @@ -33798,7 +34804,7 @@ const _vs = hexlify$2(vs); if (result._vs) { if (!isHexString$2(result._vs)) { - logger$q.throwArgumentError("signature invalid _vs", "signature", signature); + logger$p.throwArgumentError("signature invalid _vs", "signature", signature); } result._vs = hexZeroPad$2(result._vs, 32); } @@ -33807,20 +34813,22 @@ result._vs = _vs; } else if (result._vs !== _vs) { - logger$q.throwArgumentError("signature _vs mismatch v and s", "signature", signature); + logger$p.throwArgumentError("signature _vs mismatch v and s", "signature", signature); } } + result.yParityAndS = result._vs; + result.compact = result.r + result.yParityAndS.substring(2); return result; } - const version$h = "bignumber/5.4.1"; + const version$g$1 = "bignumber/5.6.0"; - var BN$1$1 = bn$2.BN; - const logger$p = new Logger$2(version$h); - const _constructorGuard$4 = {}; - const MAX_SAFE$1$1 = 0x1fffffffffffff; + var BN$2 = bn$2.BN; + const logger$o = new Logger$2(version$g$1); + const _constructorGuard$3$1 = {}; + const MAX_SAFE$2 = 0x1fffffffffffff; function isBigNumberish$1(value) { - return (value != null) && (BigNumber$1$1.isBigNumber(value) || + return (value != null) && (BigNumber$2.isBigNumber(value) || (typeof (value) === "number" && (value % 1) === 0) || (typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) || isHexString$2(value) || @@ -33828,12 +34836,12 @@ isBytes$2(value)); } // Only warn about passing 10 into radix once - let _warnedToStringRadix$1$1 = false; - class BigNumber$1$1 { + let _warnedToStringRadix$2 = false; + class BigNumber$2 { constructor(constructorGuard, hex) { - logger$p.checkNew(new.target, BigNumber$1$1); - if (constructorGuard !== _constructorGuard$4) { - logger$p.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$o.checkNew(new.target, BigNumber$2); + if (constructorGuard !== _constructorGuard$3$1) { + logger$o.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new (BigNumber)" }); } @@ -33842,113 +34850,113 @@ Object.freeze(this); } fromTwos(value) { - return toBigNumber$1$1(toBN$1$1(this).fromTwos(value)); + return toBigNumber$2(toBN$2(this).fromTwos(value)); } toTwos(value) { - return toBigNumber$1$1(toBN$1$1(this).toTwos(value)); + return toBigNumber$2(toBN$2(this).toTwos(value)); } abs() { if (this._hex[0] === "-") { - return BigNumber$1$1.from(this._hex.substring(1)); + return BigNumber$2.from(this._hex.substring(1)); } return this; } add(other) { - return toBigNumber$1$1(toBN$1$1(this).add(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).add(toBN$2(other))); } sub(other) { - return toBigNumber$1$1(toBN$1$1(this).sub(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).sub(toBN$2(other))); } div(other) { - const o = BigNumber$1$1.from(other); + const o = BigNumber$2.from(other); if (o.isZero()) { - throwFault$2$1("division by zero", "div"); + throwFault$1$1("division-by-zero", "div"); } - return toBigNumber$1$1(toBN$1$1(this).div(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).div(toBN$2(other))); } mul(other) { - return toBigNumber$1$1(toBN$1$1(this).mul(toBN$1$1(other))); + return toBigNumber$2(toBN$2(this).mul(toBN$2(other))); } mod(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (value.isNeg()) { - throwFault$2$1("cannot modulo negative values", "mod"); + throwFault$1$1("division-by-zero", "mod"); } - return toBigNumber$1$1(toBN$1$1(this).umod(value)); + return toBigNumber$2(toBN$2(this).umod(value)); } pow(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (value.isNeg()) { - throwFault$2$1("cannot raise to negative values", "pow"); + throwFault$1$1("negative-power", "pow"); } - return toBigNumber$1$1(toBN$1$1(this).pow(value)); + return toBigNumber$2(toBN$2(this).pow(value)); } and(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (this.isNegative() || value.isNeg()) { - throwFault$2$1("cannot 'and' negative values", "and"); + throwFault$1$1("unbound-bitwise-result", "and"); } - return toBigNumber$1$1(toBN$1$1(this).and(value)); + return toBigNumber$2(toBN$2(this).and(value)); } or(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (this.isNegative() || value.isNeg()) { - throwFault$2$1("cannot 'or' negative values", "or"); + throwFault$1$1("unbound-bitwise-result", "or"); } - return toBigNumber$1$1(toBN$1$1(this).or(value)); + return toBigNumber$2(toBN$2(this).or(value)); } xor(other) { - const value = toBN$1$1(other); + const value = toBN$2(other); if (this.isNegative() || value.isNeg()) { - throwFault$2$1("cannot 'xor' negative values", "xor"); + throwFault$1$1("unbound-bitwise-result", "xor"); } - return toBigNumber$1$1(toBN$1$1(this).xor(value)); + return toBigNumber$2(toBN$2(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$2$1("cannot mask negative values", "mask"); + throwFault$1$1("negative-width", "mask"); } - return toBigNumber$1$1(toBN$1$1(this).maskn(value)); + return toBigNumber$2(toBN$2(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$2$1("cannot shift negative values", "shl"); + throwFault$1$1("negative-width", "shl"); } - return toBigNumber$1$1(toBN$1$1(this).shln(value)); + return toBigNumber$2(toBN$2(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$2$1("cannot shift negative values", "shr"); + throwFault$1$1("negative-width", "shr"); } - return toBigNumber$1$1(toBN$1$1(this).shrn(value)); + return toBigNumber$2(toBN$2(this).shrn(value)); } eq(other) { - return toBN$1$1(this).eq(toBN$1$1(other)); + return toBN$2(this).eq(toBN$2(other)); } lt(other) { - return toBN$1$1(this).lt(toBN$1$1(other)); + return toBN$2(this).lt(toBN$2(other)); } lte(other) { - return toBN$1$1(this).lte(toBN$1$1(other)); + return toBN$2(this).lte(toBN$2(other)); } gt(other) { - return toBN$1$1(this).gt(toBN$1$1(other)); + return toBN$2(this).gt(toBN$2(other)); } gte(other) { - return toBN$1$1(this).gte(toBN$1$1(other)); + return toBN$2(this).gte(toBN$2(other)); } isNegative() { return (this._hex[0] === "-"); } isZero() { - return toBN$1$1(this).isZero(); + return toBN$2(this).isZero(); } toNumber() { try { - return toBN$1$1(this).toNumber(); + return toBN$2(this).toNumber(); } catch (error) { - throwFault$2$1("overflow", "toNumber", this.toString()); + throwFault$1$1("overflow", "toNumber", this.toString()); } return null; } @@ -33957,7 +34965,7 @@ return BigInt(this.toString()); } catch (e) { } - return logger$p.throwError("this platform does not support BigInt", Logger$2.errors.UNSUPPORTED_OPERATION, { + return logger$o.throwError("this platform does not support BigInt", Logger$2.errors.UNSUPPORTED_OPERATION, { value: this.toString() }); } @@ -33965,19 +34973,19 @@ // Lots of people expect this, which we do not support, so check (See: #889) if (arguments.length > 0) { if (arguments[0] === 10) { - if (!_warnedToStringRadix$1$1) { - _warnedToStringRadix$1$1 = true; - logger$p.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); + if (!_warnedToStringRadix$2) { + _warnedToStringRadix$2 = true; + logger$o.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); } } else if (arguments[0] === 16) { - logger$p.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); + logger$o.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); } else { - logger$p.throwError("BigNumber.toString does not accept parameters", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); + logger$o.throwError("BigNumber.toString does not accept parameters", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); } } - return toBN$1$1(this).toString(10); + return toBN$2(this).toString(10); } toHexString() { return this._hex; @@ -33986,40 +34994,40 @@ return { type: "BigNumber", hex: this.toHexString() }; } static from(value) { - if (value instanceof BigNumber$1$1) { + if (value instanceof BigNumber$2) { return value; } if (typeof (value) === "string") { if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber$1$1(_constructorGuard$4, toHex$2$1(value)); + return new BigNumber$2(_constructorGuard$3$1, toHex$1$2(value)); } if (value.match(/^-?[0-9]+$/)) { - return new BigNumber$1$1(_constructorGuard$4, toHex$2$1(new BN$1$1(value))); + return new BigNumber$2(_constructorGuard$3$1, toHex$1$2(new BN$2(value))); } - return logger$p.throwArgumentError("invalid BigNumber string", "value", value); + return logger$o.throwArgumentError("invalid BigNumber string", "value", value); } if (typeof (value) === "number") { if (value % 1) { - throwFault$2$1("underflow", "BigNumber.from", value); + throwFault$1$1("underflow", "BigNumber.from", value); } - if (value >= MAX_SAFE$1$1 || value <= -MAX_SAFE$1$1) { - throwFault$2$1("overflow", "BigNumber.from", value); + if (value >= MAX_SAFE$2 || value <= -MAX_SAFE$2) { + throwFault$1$1("overflow", "BigNumber.from", value); } - return BigNumber$1$1.from(String(value)); + return BigNumber$2.from(String(value)); } const anyValue = value; if (typeof (anyValue) === "bigint") { - return BigNumber$1$1.from(anyValue.toString()); + return BigNumber$2.from(anyValue.toString()); } if (isBytes$2(anyValue)) { - return BigNumber$1$1.from(hexlify$2(anyValue)); + return BigNumber$2.from(hexlify$2(anyValue)); } if (anyValue) { - // Hexable interface (takes piority) + // Hexable interface (takes priority) if (anyValue.toHexString) { const hex = anyValue.toHexString(); if (typeof (hex) === "string") { - return BigNumber$1$1.from(hex); + return BigNumber$2.from(hex); } } else { @@ -34031,33 +35039,33 @@ } if (typeof (hex) === "string") { if (isHexString$2(hex) || (hex[0] === "-" && isHexString$2(hex.substring(1)))) { - return BigNumber$1$1.from(hex); + return BigNumber$2.from(hex); } } } } - return logger$p.throwArgumentError("invalid BigNumber value", "value", value); + return logger$o.throwArgumentError("invalid BigNumber value", "value", value); } static isBigNumber(value) { return !!(value && value._isBigNumber); } } // Normalize the hex string - function toHex$2$1(value) { + function toHex$1$2(value) { // For BN, call on the hex string if (typeof (value) !== "string") { - return toHex$2$1(value.toString(16)); + return toHex$1$2(value.toString(16)); } // If negative, prepend the negative sign to the normalized positive value if (value[0] === "-") { // Strip off the negative sign value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") + // Cannot have multiple negative signs (e.g. "--0x04") if (value[0] === "-") { - logger$p.throwArgumentError("invalid hex", "value", value); + logger$o.throwArgumentError("invalid hex", "value", value); } // Call toHex on the positive component - value = toHex$2$1(value); + value = toHex$1$2(value); // Do not allow "-0x00" if (value === "0x00") { return value; @@ -34083,38 +35091,38 @@ } return value; } - function toBigNumber$1$1(value) { - return BigNumber$1$1.from(toHex$2$1(value)); + function toBigNumber$2(value) { + return BigNumber$2.from(toHex$1$2(value)); } - function toBN$1$1(value) { - const hex = BigNumber$1$1.from(value).toHexString(); + function toBN$2(value) { + const hex = BigNumber$2.from(value).toHexString(); if (hex[0] === "-") { - return (new BN$1$1("-" + hex.substring(3), 16)); + return (new BN$2("-" + hex.substring(3), 16)); } - return new BN$1$1(hex.substring(2), 16); + return new BN$2(hex.substring(2), 16); } - function throwFault$2$1(fault, operation, value) { + function throwFault$1$1(fault, operation, value) { const params = { fault: fault, operation: operation }; if (value != null) { params.value = value; } - return logger$p.throwError(fault, Logger$2.errors.NUMERIC_FAULT, params); + return logger$o.throwError(fault, Logger$2.errors.NUMERIC_FAULT, params); } // value should have no prefix function _base36To16$2(value) { - return (new BN$1$1(value, 36)).toString(16); + return (new BN$2(value, 36)).toString(16); } - const logger$o = new Logger$2(version$h); - const _constructorGuard$3$1 = {}; - const Zero$2$1 = BigNumber$1$1.from(0); - const NegativeOne$2$1 = BigNumber$1$1.from(-1); - function throwFault$1$1(message, fault, operation, value) { + const logger$n = new Logger$2(version$g$1); + const _constructorGuard$2$1 = {}; + const Zero$2$1 = BigNumber$2.from(0); + const NegativeOne$2$1 = BigNumber$2.from(-1); + function throwFault$3(message, fault, operation, value) { const params = { fault: fault, operation: operation }; if (value !== undefined) { params.value = value; } - return logger$o.throwError(message, Logger$2.errors.NUMERIC_FAULT, params); + return logger$n.throwError(message, Logger$2.errors.NUMERIC_FAULT, params); } // Constant to pull zeros from for multipliers let zeros$1 = "0"; @@ -34125,14 +35133,14 @@ function getMultiplier$1(decimals) { if (typeof (decimals) !== "number") { try { - decimals = BigNumber$1$1.from(decimals).toNumber(); + decimals = BigNumber$2.from(decimals).toNumber(); } catch (e) { } } if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) { return ("1" + zeros$1.substring(0, decimals)); } - return logger$o.throwArgumentError("invalid decimal size", "decimals", decimals); + return logger$n.throwArgumentError("invalid decimal size", "decimals", decimals); } function formatFixed$1(value, decimals) { if (decimals == null) { @@ -34140,7 +35148,7 @@ } const multiplier = getMultiplier$1(decimals); // Make sure wei is a big number (convert as necessary) - value = BigNumber$1$1.from(value); + value = BigNumber$2.from(value); const negative = value.lt(Zero$2$1); if (negative) { value = value.mul(NegativeOne$2$1); @@ -34168,8 +35176,8 @@ decimals = 0; } const multiplier = getMultiplier$1(decimals); - if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) { - logger$o.throwArgumentError("invalid decimal value", "value", value); + if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) { + logger$n.throwArgumentError("invalid decimal value", "value", value); } // Is it negative? const negative = (value.substring(0, 1) === "-"); @@ -34177,12 +35185,12 @@ value = value.substring(1); } if (value === ".") { - logger$o.throwArgumentError("missing value", "value", value); + logger$n.throwArgumentError("missing value", "value", value); } // Split it into a whole and fractional part const comps = value.split("."); if (comps.length > 2) { - logger$o.throwArgumentError("too many decimal points", "value", value); + logger$n.throwArgumentError("too many decimal points", "value", value); } let whole = comps[0], fraction = comps[1]; if (!whole) { @@ -34191,19 +35199,24 @@ if (!fraction) { fraction = "0"; } - // Get significant digits to check truncation for underflow - { - const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig)); - if (sigFraction.length > multiplier.length - 1) { - throwFault$1$1("fractional component exceeds decimals", "underflow", "parseFixed"); - } + // Trim trailing zeros + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + // Check the fraction doesn't exceed our decimals size + if (fraction.length > multiplier.length - 1) { + throwFault$3("fractional component exceeds decimals", "underflow", "parseFixed"); + } + // If decimals is 0, we have an empty string for fraction + if (fraction === "") { + fraction = "0"; } // Fully pad the string with zeros to get to wei while (fraction.length < multiplier.length - 1) { fraction += "0"; } - const wholeValue = BigNumber$1$1.from(whole); - const fractionValue = BigNumber$1$1.from(fraction); + const wholeValue = BigNumber$2.from(whole); + const fractionValue = BigNumber$2.from(fraction); let wei = (wholeValue.mul(multiplier)).add(fractionValue); if (negative) { wei = wei.mul(NegativeOne$2$1); @@ -34212,8 +35225,8 @@ } class FixedFormat$1 { constructor(constructorGuard, signed, width, decimals) { - if (constructorGuard !== _constructorGuard$3$1) { - logger$o.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$2.errors.UNSUPPORTED_OPERATION, { + if (constructorGuard !== _constructorGuard$2$1) { + logger$n.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } @@ -34242,7 +35255,7 @@ else { const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); if (!match) { - logger$o.throwArgumentError("invalid fixed format", "format", value); + logger$n.throwArgumentError("invalid fixed format", "format", value); } signed = (match[1] !== "u"); width = parseInt(match[2]); @@ -34255,7 +35268,7 @@ return defaultValue; } if (typeof (value[key]) !== type) { - logger$o.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]); + logger$n.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]); } return value[key]; }; @@ -34264,19 +35277,19 @@ decimals = check("decimals", "number", decimals); } if (width % 8) { - logger$o.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width); + logger$n.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width); } if (decimals > 80) { - logger$o.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); + logger$n.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); } - return new FixedFormat$1(_constructorGuard$3$1, signed, width, decimals); + return new FixedFormat$1(_constructorGuard$2$1, signed, width, decimals); } } class FixedNumber$1 { constructor(constructorGuard, hex, value, format) { - logger$o.checkNew(new.target, FixedNumber$1); - if (constructorGuard !== _constructorGuard$3$1) { - logger$o.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$n.checkNew(new.target, FixedNumber$1); + if (constructorGuard !== _constructorGuard$2$1) { + logger$n.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } @@ -34288,7 +35301,7 @@ } _checkFormat(other) { if (this.format.name !== other.format.name) { - logger$o.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); + logger$n.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); } } addUnsafe(other) { @@ -34350,7 +35363,7 @@ comps.push("0"); } if (decimals < 0 || decimals > 80 || (decimals % 1)) { - logger$o.throwArgumentError("invalid decimal count", "decimals", decimals); + logger$n.throwArgumentError("invalid decimal count", "decimals", decimals); } if (comps[1].length <= decimals) { return this; @@ -34371,9 +35384,9 @@ return this._hex; } if (width % 8) { - logger$o.throwArgumentError("invalid byte width", "width", width); + logger$n.throwArgumentError("invalid byte width", "width", width); } - const hex = BigNumber$1$1.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + const hex = BigNumber$2.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); return hexZeroPad$2(hex, width / 8); } toUnsafeFloat() { return parseFloat(this.toString()); } @@ -34401,7 +35414,7 @@ const fixedFormat = FixedFormat$1.from(format); const numeric = parseFixed$1(value, fixedFormat.decimals); if (!fixedFormat.signed && numeric.lt(Zero$2$1)) { - throwFault$1$1("unsigned value cannot be negative", "overflow", "value", value); + throwFault$3("unsigned value cannot be negative", "overflow", "value", value); } let hex = null; if (fixedFormat.signed) { @@ -34412,7 +35425,7 @@ hex = hexZeroPad$2(hex, fixedFormat.width / 8); } const decimal = formatFixed$1(numeric, fixedFormat.decimals); - return new FixedNumber$1(_constructorGuard$3$1, hex, decimal, fixedFormat); + return new FixedNumber$1(_constructorGuard$2$1, hex, decimal, fixedFormat); } static fromBytes(value, format) { if (format == null) { @@ -34422,13 +35435,13 @@ if (arrayify$2(value).length > fixedFormat.width / 8) { throw new Error("overflow"); } - let numeric = BigNumber$1$1.from(value); + let numeric = BigNumber$2.from(value); if (fixedFormat.signed) { numeric = numeric.fromTwos(fixedFormat.width); } const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); const decimal = formatFixed$1(numeric, fixedFormat.decimals); - return new FixedNumber$1(_constructorGuard$3$1, hex, decimal, fixedFormat); + return new FixedNumber$1(_constructorGuard$2$1, hex, decimal, fixedFormat); } static from(value, format) { if (typeof (value) === "string") { @@ -34446,7 +35459,7 @@ throw error; } } - return logger$o.throwArgumentError("invalid FixedNumber value", "value", value); + return logger$n.throwArgumentError("invalid FixedNumber value", "value", value); } static isFixedNumber(value) { return !!(value && value._isFixedNumber); @@ -34455,7 +35468,7 @@ const ONE$1 = FixedNumber$1.from(1); const BUMP$1 = FixedNumber$1.from("0.5"); - const version$g$1 = "properties/5.4.1"; + const version$f$1 = "properties/5.6.0"; var __awaiter$8$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -34466,7 +35479,7 @@ step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; - const logger$n = new Logger$2(version$g$1); + const logger$m = new Logger$2(version$f$1); function defineReadOnly$2(object, name, value) { Object.defineProperty(object, name, { enumerable: true, @@ -34502,11 +35515,11 @@ } function checkProperties$1(object, properties) { if (!object || typeof (object) !== "object") { - logger$n.throwArgumentError("invalid object", "object", object); + logger$m.throwArgumentError("invalid object", "object", object); } Object.keys(object).forEach((key) => { if (!properties[key]) { - logger$n.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); + logger$m.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); } }); } @@ -34544,7 +35557,7 @@ } return true; } - return logger$n.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); + return logger$m.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); } // Returns a new copy of object, such that no properties may be replaced. // New properties may be added only to objects. @@ -34567,7 +35580,7 @@ } return result; } - return logger$n.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); + return logger$m.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object); } function deepCopy$2(object) { return _deepCopy$2(object); @@ -34580,10 +35593,10 @@ } } - const version$f$1 = "abi/5.4.1"; + const version$e$2 = "abi/5.6.1"; - const logger$m = new Logger$2(version$f$1); - const _constructorGuard$2$1 = {}; + const logger$l = new Logger$2(version$e$2); + const _constructorGuard$1$2 = {}; let ModifiersBytes$1 = { calldata: true, memory: true, storage: true }; let ModifiersNest$1 = { calldata: true, memory: true }; function checkModifier$1(type, name) { @@ -34603,7 +35616,7 @@ } } if (ModifiersBytes$1[name] || name === "payable") { - logger$m.throwArgumentError("invalid modifier", "name", name); + logger$l.throwArgumentError("invalid modifier", "name", name); } return false; } @@ -34611,7 +35624,7 @@ function parseParamType$1(param, allowIndexed) { let originalParam = param; function throwError(i) { - logger$m.throwArgumentError(`unexpected character at position ${i}`, "param", param); + logger$l.throwArgumentError(`unexpected character at position ${i}`, "param", param); } param = param.replace(/\s/g, " "); function newNode(parent) { @@ -34750,7 +35763,7 @@ } } if (node.parent) { - logger$m.throwArgumentError("unexpected eof", "param", param); + logger$l.throwArgumentError("unexpected eof", "param", param); } delete parent.state; if (node.name === "indexed") { @@ -34779,7 +35792,7 @@ sighash: "sighash", // Human-Readable with Minimal spacing and without names (compact human-readable) minimal: "minimal", - // Human-Readble with nice spacing, including all names + // Human-Readable with nice spacing, including all names full: "full", // JSON-format a la Solidity json: "json" @@ -34787,8 +35800,8 @@ const paramTypeArray$1 = new RegExp(/^(.*)\[([0-9]*)\]$/); class ParamType$1 { constructor(constructorGuard, params) { - if (constructorGuard !== _constructorGuard$2$1) { - logger$m.throwError("use fromString", Logger$2.errors.UNSUPPORTED_OPERATION, { + if (constructorGuard !== _constructorGuard$1$2) { + logger$l.throwError("use fromString", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new ParamType()" }); } @@ -34817,13 +35830,13 @@ // Format the parameter fragment // - sighash: "(uint256,address)" // - minimal: "tuple(uint256,address) indexed" - // - full: "tuple(uint256 foo, addres bar) indexed baz" + // - full: "tuple(uint256 foo, address bar) indexed baz" format(format) { if (!format) { format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { let result = { @@ -34875,7 +35888,7 @@ if (ParamType$1.isParamType(value)) { return value; } - return new ParamType$1(_constructorGuard$2$1, { + return new ParamType$1(_constructorGuard$1$2, { name: (value.name || null), type: verifyType$1(value.type), indexed: ((value.indexed == null) ? null : !!value.indexed), @@ -34902,8 +35915,8 @@ } class Fragment$1 { constructor(constructorGuard, params) { - if (constructorGuard !== _constructorGuard$2$1) { - logger$m.throwError("use a static from method", Logger$2.errors.UNSUPPORTED_OPERATION, { + if (constructorGuard !== _constructorGuard$1$2) { + logger$l.throwError("use a static from method", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new Fragment()" }); } @@ -34938,7 +35951,7 @@ // @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment? return null; } - return logger$m.throwArgumentError("invalid fragment object", "value", value); + return logger$l.throwArgumentError("invalid fragment object", "value", value); } static fromString(value) { // Make sure the "returns" is surrounded by a space and all whitespace is exactly one space @@ -34957,7 +35970,7 @@ else if (value.split(" ")[0] === "error") { return ErrorFragment$1.fromString(value.substring(5).trim()); } - return logger$m.throwArgumentError("unsupported fragment", "value", value); + return logger$l.throwArgumentError("unsupported fragment", "value", value); } static isFragment(value) { return !!(value && value._isFragment); @@ -34969,7 +35982,7 @@ format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -35002,7 +36015,7 @@ return value; } if (value.type !== "event") { - logger$m.throwArgumentError("invalid event object", "value", value); + logger$l.throwArgumentError("invalid event object", "value", value); } const params = { name: verifyIdentifier$1(value.name), @@ -35010,12 +36023,12 @@ inputs: (value.inputs ? value.inputs.map(ParamType$1.fromObject) : []), type: "event" }; - return new EventFragment$1(_constructorGuard$2$1, params); + return new EventFragment$1(_constructorGuard$1$2, params); } static fromString(value) { let match = value.match(regexParen$1); if (!match) { - logger$m.throwArgumentError("invalid event string", "value", value); + logger$l.throwArgumentError("invalid event string", "value", value); } let anonymous = false; match[3].split(" ").forEach((modifier) => { @@ -35026,7 +36039,7 @@ case "": break; default: - logger$m.warn("unknown modifier: " + modifier); + logger$l.warn("unknown modifier: " + modifier); } }); return EventFragment$1.fromObject({ @@ -35045,12 +36058,12 @@ let comps = value.split("@"); if (comps.length !== 1) { if (comps.length > 2) { - logger$m.throwArgumentError("invalid human-readable ABI signature", "value", value); + logger$l.throwArgumentError("invalid human-readable ABI signature", "value", value); } if (!comps[1].match(/^[0-9]+$/)) { - logger$m.throwArgumentError("invalid human-readable ABI signature gas", "value", value); + logger$l.throwArgumentError("invalid human-readable ABI signature gas", "value", value); } - params.gas = BigNumber$1$1.from(comps[1]); + params.gas = BigNumber$2.from(comps[1]); return comps[0]; } return value; @@ -35101,14 +36114,14 @@ result.constant = (result.stateMutability === "view" || result.stateMutability === "pure"); if (value.constant != null) { if ((!!value.constant) !== result.constant) { - logger$m.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); + logger$l.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); } } // Set (and check things are consistent) the payable property result.payable = (result.stateMutability === "payable"); if (value.payable != null) { if ((!!value.payable) !== result.payable) { - logger$m.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); + logger$l.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); } } } @@ -35116,7 +36129,7 @@ result.payable = !!value.payable; // If payable we can assume non-constant; otherwise we can't assume if (value.constant == null && !result.payable && value.type !== "constructor") { - logger$m.throwArgumentError("unable to determine stateMutability", "value", value); + logger$l.throwArgumentError("unable to determine stateMutability", "value", value); } result.constant = !!value.constant; if (result.constant) { @@ -35126,7 +36139,7 @@ result.stateMutability = (result.payable ? "payable" : "nonpayable"); } if (result.payable && result.constant) { - logger$m.throwArgumentError("cannot have constant payable function", "value", value); + logger$l.throwArgumentError("cannot have constant payable function", "value", value); } } else if (value.constant != null) { @@ -35135,7 +36148,7 @@ result.stateMutability = (result.constant ? "view" : "payable"); } else if (value.type !== "constructor") { - logger$m.throwArgumentError("unable to determine stateMutability", "value", value); + logger$l.throwArgumentError("unable to determine stateMutability", "value", value); } return result; } @@ -35145,7 +36158,7 @@ format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -35157,7 +36170,7 @@ }); } if (format === FormatTypes$1.sighash) { - logger$m.throwError("cannot format a constructor for sighash", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$l.throwError("cannot format a constructor for sighash", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "format(sighash)" }); } @@ -35178,11 +36191,11 @@ return value; } if (value.type !== "constructor") { - logger$m.throwArgumentError("invalid constructor object", "value", value); + logger$l.throwArgumentError("invalid constructor object", "value", value); } let state = verifyState$1(value); if (state.constant) { - logger$m.throwArgumentError("constructor cannot be constant", "value", value); + logger$l.throwArgumentError("constructor cannot be constant", "value", value); } const params = { name: null, @@ -35190,16 +36203,16 @@ inputs: (value.inputs ? value.inputs.map(ParamType$1.fromObject) : []), payable: state.payable, stateMutability: state.stateMutability, - gas: (value.gas ? BigNumber$1$1.from(value.gas) : null) + gas: (value.gas ? BigNumber$2.from(value.gas) : null) }; - return new ConstructorFragment$1(_constructorGuard$2$1, params); + return new ConstructorFragment$1(_constructorGuard$1$2, params); } static fromString(value) { let params = { type: "constructor" }; value = parseGas$1(value, params); let parens = value.match(regexParen$1); if (!parens || parens[1].trim() !== "constructor") { - logger$m.throwArgumentError("invalid constructor string", "value", value); + logger$l.throwArgumentError("invalid constructor string", "value", value); } params.inputs = parseParams$1(parens[2].trim(), false); parseModifiers$1(parens[3].trim(), params); @@ -35215,7 +36228,7 @@ format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -35263,7 +36276,7 @@ return value; } if (value.type !== "function") { - logger$m.throwArgumentError("invalid function object", "value", value); + logger$l.throwArgumentError("invalid function object", "value", value); } let state = verifyState$1(value); const params = { @@ -35274,20 +36287,20 @@ outputs: (value.outputs ? value.outputs.map(ParamType$1.fromObject) : []), payable: state.payable, stateMutability: state.stateMutability, - gas: (value.gas ? BigNumber$1$1.from(value.gas) : null) + gas: (value.gas ? BigNumber$2.from(value.gas) : null) }; - return new FunctionFragment$1(_constructorGuard$2$1, params); + return new FunctionFragment$1(_constructorGuard$1$2, params); } static fromString(value) { let params = { type: "function" }; value = parseGas$1(value, params); let comps = value.split(" returns "); if (comps.length > 2) { - logger$m.throwArgumentError("invalid function string", "value", value); + logger$l.throwArgumentError("invalid function string", "value", value); } let parens = comps[0].match(regexParen$1); if (!parens) { - logger$m.throwArgumentError("invalid function signature", "value", value); + logger$l.throwArgumentError("invalid function signature", "value", value); } params.name = parens[1].trim(); if (params.name) { @@ -35299,7 +36312,7 @@ if (comps.length > 1) { let returns = comps[1].match(regexParen$1); if (returns[1].trim() != "" || returns[3].trim() != "") { - logger$m.throwArgumentError("unexpected tokens", "value", value); + logger$l.throwArgumentError("unexpected tokens", "value", value); } params.outputs = parseParams$1(returns[2], false); } @@ -35317,7 +36330,7 @@ function checkForbidden$1(fragment) { const sig = fragment.format(); if (sig === "Error(string)" || sig === "Panic(uint256)") { - logger$m.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment); + logger$l.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment); } return fragment; } @@ -35327,7 +36340,7 @@ format = FormatTypes$1.sighash; } if (!FormatTypes$1[format]) { - logger$m.throwArgumentError("invalid format type", "format", format); + logger$l.throwArgumentError("invalid format type", "format", format); } if (format === FormatTypes$1.json) { return JSON.stringify({ @@ -35354,20 +36367,20 @@ return value; } if (value.type !== "error") { - logger$m.throwArgumentError("invalid error object", "value", value); + logger$l.throwArgumentError("invalid error object", "value", value); } const params = { type: value.type, name: verifyIdentifier$1(value.name), inputs: (value.inputs ? value.inputs.map(ParamType$1.fromObject) : []) }; - return checkForbidden$1(new ErrorFragment$1(_constructorGuard$2$1, params)); + return checkForbidden$1(new ErrorFragment$1(_constructorGuard$1$2, params)); } static fromString(value) { let params = { type: "error" }; let parens = value.match(regexParen$1); if (!parens) { - logger$m.throwArgumentError("invalid error signature", "value", value); + logger$l.throwArgumentError("invalid error signature", "value", value); } params.name = parens[1].trim(); if (params.name) { @@ -35395,7 +36408,7 @@ const regexIdentifier$1 = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); function verifyIdentifier$1(value) { if (!value || !value.match(regexIdentifier$1)) { - logger$m.throwArgumentError(`invalid identifier "${value}"`, "value", value); + logger$l.throwArgumentError(`invalid identifier "${value}"`, "value", value); } return value; } @@ -35419,7 +36432,7 @@ else if (c === ")") { depth--; if (depth === -1) { - logger$m.throwArgumentError("unbalanced parenthesis", "value", value); + logger$l.throwArgumentError("unbalanced parenthesis", "value", value); } } } @@ -35430,7 +36443,7 @@ return result; } - const logger$l = new Logger$2(version$f$1); + const logger$k = new Logger$2(version$e$2); function checkResultErrors$1(result) { // Find the first error (if any) const errors = []; @@ -35461,7 +36474,7 @@ this.dynamic = dynamic; } _throwError(message, value) { - logger$l.throwArgumentError(message, this.localName, value); + logger$k.throwArgumentError(message, this.localName, value); } } class Writer$1 { @@ -35493,9 +36506,9 @@ return this._writeData(bytes); } _getValue(value) { - let bytes = arrayify$2(BigNumber$1$1.from(value)); + let bytes = arrayify$2(BigNumber$2.from(value)); if (bytes.length > this.wordSize) { - logger$l.throwError("value out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { + logger$k.throwError("value out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { length: this.wordSize, offset: bytes.length }); @@ -35517,535 +36530,710 @@ this._data[offset] = this._getValue(value); }; } - } - class Reader$1 { - constructor(data, wordSize, coerceFunc, allowLoose) { - defineReadOnly$2(this, "_data", arrayify$2(data)); - defineReadOnly$2(this, "wordSize", wordSize || 32); - defineReadOnly$2(this, "_coerceFunc", coerceFunc); - defineReadOnly$2(this, "allowLoose", allowLoose); - this._offset = 0; + } + class Reader$1 { + constructor(data, wordSize, coerceFunc, allowLoose) { + defineReadOnly$2(this, "_data", arrayify$2(data)); + defineReadOnly$2(this, "wordSize", wordSize || 32); + defineReadOnly$2(this, "_coerceFunc", coerceFunc); + defineReadOnly$2(this, "allowLoose", allowLoose); + this._offset = 0; + } + get data() { return hexlify$2(this._data); } + get consumed() { return this._offset; } + // The default Coerce function + static coerce(name, value) { + let match = name.match("^u?int([0-9]+)$"); + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + return value; + } + coerce(name, value) { + if (this._coerceFunc) { + return this._coerceFunc(name, value); + } + return Reader$1.coerce(name, value); + } + _peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; + if (this._offset + alignedLength > this._data.length) { + if (this.allowLoose && loose && this._offset + length <= this._data.length) { + alignedLength = length; + } + else { + logger$k.throwError("data out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + return this._data.slice(this._offset, this._offset + alignedLength); + } + subReader(offset) { + return new Reader$1(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + } + readBytes(length, loose) { + let bytes = this._peekBytes(0, length, !!loose); + this._offset += bytes.length; + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + readValue() { + return BigNumber$2.from(this.readBytes(this.wordSize)); + } + } + + /** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ + + var sha3$2 = createCommonjsModule$1$1(function (module) { + /*jslint bitwise: true */ + (function () { + + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; + if (NODE_JS) { + root = commonjsGlobal$2; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; + + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } + + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } + + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; + + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); + } + return method; + }; + + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + + var methods = {}, methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } + + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); + } + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; } - get data() { return hexlify$2(this._data); } - get consumed() { return this._offset; } - // The default Coerce function - static coerce(name, value) { - let match = name.match("^u?int([0-9]+)$"); - if (match && parseInt(match[1]) <= 48) { - value = value.toNumber(); - } - return value; + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } } - coerce(name, value) { - if (this._coerceFunc) { - return this._coerceFunc(name, value); - } - return Reader$1.coerce(name, value); + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } } - _peekBytes(offset, length, loose) { - let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; - if (this._offset + alignedLength > this._data.length) { - if (this.allowLoose && loose && this._offset + length <= this._data.length) { - alignedLength = length; - } - else { - logger$l.throwError("data out-of-bounds", Logger$2.errors.BUFFER_OVERRUN, { - length: this._data.length, - offset: this._offset + alignedLength - }); - } - } - return this._data.slice(this._offset, this._offset + alignedLength); + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); } - subReader(offset) { - return new Reader$1(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } } - readBytes(length, loose) { - let bytes = this._peekBytes(0, length, !!loose); - this._offset += bytes.length; - // @TODO: Make sure the length..end bytes are all 0? - return bytes.slice(0, length); + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); } - readValue() { - return BigNumber$1$1.from(this.readBytes(this.wordSize)); + return buffer; + }; + + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } } - } + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; - /** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.5.7 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2016 - * @license MIT - */ + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } - var sha3$2 = createCommonjsModule$1$1(function (module) { - /*jslint bitwise: true */ - (function () { - - var root = typeof window === 'object' ? window : {}; - var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; - if (NODE_JS) { - root = commonjsGlobal$2; - } - var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; - var HEX_CHARS = '0123456789abcdef'.split(''); - var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; - var KECCAK_PADDING = [1, 256, 65536, 16777216]; - var PADDING = [6, 1536, 393216, 100663296]; - var SHIFT = [0, 8, 16, 24]; - var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, - 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, - 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, - 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, - 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; - var BITS = [224, 256, 384, 512]; - var SHAKE_BITS = [128, 256]; - var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; - - var createOutputMethod = function (bits, padding, outputType) { - return function (message) { - return new Keccak(bits, padding, bits).update(message)[outputType](); - }; - }; - - var createShakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits) { - return new Keccak(bits, padding, outputBits).update(message)[outputType](); - }; - }; - - var createMethod = function (bits, padding) { - var method = createOutputMethod(bits, padding, 'hex'); - method.create = function () { - return new Keccak(bits, padding, bits); - }; - method.update = function (message) { - return method.create().update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createOutputMethod(bits, padding, type); - } - return method; - }; - - var createShakeMethod = function (bits, padding) { - var method = createShakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits) { - return new Keccak(bits, padding, outputBits); - }; - method.update = function (message, outputBits) { - return method.create(outputBits).update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createShakeOutputMethod(bits, padding, type); - } - return method; - }; - - var algorithms = [ - {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod}, - {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod}, - {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod} - ]; - - var methods = {}, methodNames = []; - - for (var i = 0; i < algorithms.length; ++i) { - var algorithm = algorithms[i]; - var bits = algorithm.bits; - for (var j = 0; j < bits.length; ++j) { - var methodName = algorithm.name +'_' + bits[j]; - methodNames.push(methodName); - methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); - } - } - - function Keccak(bits, padding, outputBits) { - this.blocks = []; - this.s = []; - this.padding = padding; - this.outputBits = outputBits; - this.reset = true; - this.block = 0; - this.start = 0; - this.blockCount = (1600 - (bits << 1)) >> 5; - this.byteCount = this.blockCount << 2; - this.outputBlocks = outputBits >> 5; - this.extraBytes = (outputBits & 31) >> 3; - - for (var i = 0; i < 50; ++i) { - this.s[i] = 0; - } - } - - Keccak.prototype.update = function (message) { - var notString = typeof message !== 'string'; - if (notString && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } - var length = message.length, blocks = this.blocks, byteCount = this.byteCount, - blockCount = this.blockCount, index = 0, s = this.s, i, code; - - while (index < length) { - if (this.reset) { - this.reset = false; - blocks[0] = this.block; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - if (notString) { - for (i = this.start; index < length && i < byteCount; ++index) { - blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index < length && i < byteCount; ++index) { - code = message.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - if (i >= byteCount) { - this.start = i - byteCount; - this.block = blocks[blockCount]; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - this.reset = true; - } else { - this.start = i; - } - } - return this; - }; - - Keccak.prototype.finalize = function () { - var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; - blocks[i >> 2] |= this.padding[i & 3]; - if (this.lastByteIndex === this.byteCount) { - blocks[0] = blocks[blockCount]; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - blocks[blockCount - 1] |= 0x80000000; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - }; - - Keccak.prototype.toString = Keccak.prototype.hex = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var hex = '', block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + - HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + - HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + - HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; - } - if (j % blockCount === 0) { - f(s); - i = 0; - } - } - if (extraBytes) { - block = s[i]; - if (extraBytes > 0) { - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; - } - if (extraBytes > 1) { - hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; - } - if (extraBytes > 2) { - hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; - } - } - return hex; - }; - - Keccak.prototype.arrayBuffer = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var bytes = this.outputBits >> 3; - var buffer; - if (extraBytes) { - buffer = new ArrayBuffer((outputBlocks + 1) << 2); - } else { - buffer = new ArrayBuffer(bytes); - } - var array = new Uint32Array(buffer); - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - array[j] = s[i]; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - array[i] = s[i]; - buffer = buffer.slice(0, bytes); - } - return buffer; - }; - - Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - - Keccak.prototype.digest = Keccak.prototype.array = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var array = [], offset, block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - array[offset + 1] = (block >> 8) & 0xFF; - array[offset + 2] = (block >> 16) & 0xFF; - array[offset + 3] = (block >> 24) & 0xFF; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - offset = j << 2; - block = s[i]; - if (extraBytes > 0) { - array[offset] = block & 0xFF; - } - if (extraBytes > 1) { - array[offset + 1] = (block >> 8) & 0xFF; - } - if (extraBytes > 2) { - array[offset + 2] = (block >> 16) & 0xFF; - } - } - return array; - }; - - var f = function (s) { - var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, - b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, - b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; - for (n = 0; n < 48; n += 2) { - c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; - c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; - c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; - c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; - c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; - c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; - c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; - c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; - c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; - c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; - - h = c8 ^ ((c2 << 1) | (c3 >>> 31)); - l = c9 ^ ((c3 << 1) | (c2 >>> 31)); - s[0] ^= h; - s[1] ^= l; - s[10] ^= h; - s[11] ^= l; - s[20] ^= h; - s[21] ^= l; - s[30] ^= h; - s[31] ^= l; - s[40] ^= h; - s[41] ^= l; - h = c0 ^ ((c4 << 1) | (c5 >>> 31)); - l = c1 ^ ((c5 << 1) | (c4 >>> 31)); - s[2] ^= h; - s[3] ^= l; - s[12] ^= h; - s[13] ^= l; - s[22] ^= h; - s[23] ^= l; - s[32] ^= h; - s[33] ^= l; - s[42] ^= h; - s[43] ^= l; - h = c2 ^ ((c6 << 1) | (c7 >>> 31)); - l = c3 ^ ((c7 << 1) | (c6 >>> 31)); - s[4] ^= h; - s[5] ^= l; - s[14] ^= h; - s[15] ^= l; - s[24] ^= h; - s[25] ^= l; - s[34] ^= h; - s[35] ^= l; - s[44] ^= h; - s[45] ^= l; - h = c4 ^ ((c8 << 1) | (c9 >>> 31)); - l = c5 ^ ((c9 << 1) | (c8 >>> 31)); - s[6] ^= h; - s[7] ^= l; - s[16] ^= h; - s[17] ^= l; - s[26] ^= h; - s[27] ^= l; - s[36] ^= h; - s[37] ^= l; - s[46] ^= h; - s[47] ^= l; - h = c6 ^ ((c0 << 1) | (c1 >>> 31)); - l = c7 ^ ((c1 << 1) | (c0 >>> 31)); - s[8] ^= h; - s[9] ^= l; - s[18] ^= h; - s[19] ^= l; - s[28] ^= h; - s[29] ^= l; - s[38] ^= h; - s[39] ^= l; - s[48] ^= h; - s[49] ^= l; - - b0 = s[0]; - b1 = s[1]; - b32 = (s[11] << 4) | (s[10] >>> 28); - b33 = (s[10] << 4) | (s[11] >>> 28); - b14 = (s[20] << 3) | (s[21] >>> 29); - b15 = (s[21] << 3) | (s[20] >>> 29); - b46 = (s[31] << 9) | (s[30] >>> 23); - b47 = (s[30] << 9) | (s[31] >>> 23); - b28 = (s[40] << 18) | (s[41] >>> 14); - b29 = (s[41] << 18) | (s[40] >>> 14); - b20 = (s[2] << 1) | (s[3] >>> 31); - b21 = (s[3] << 1) | (s[2] >>> 31); - b2 = (s[13] << 12) | (s[12] >>> 20); - b3 = (s[12] << 12) | (s[13] >>> 20); - b34 = (s[22] << 10) | (s[23] >>> 22); - b35 = (s[23] << 10) | (s[22] >>> 22); - b16 = (s[33] << 13) | (s[32] >>> 19); - b17 = (s[32] << 13) | (s[33] >>> 19); - b48 = (s[42] << 2) | (s[43] >>> 30); - b49 = (s[43] << 2) | (s[42] >>> 30); - b40 = (s[5] << 30) | (s[4] >>> 2); - b41 = (s[4] << 30) | (s[5] >>> 2); - b22 = (s[14] << 6) | (s[15] >>> 26); - b23 = (s[15] << 6) | (s[14] >>> 26); - b4 = (s[25] << 11) | (s[24] >>> 21); - b5 = (s[24] << 11) | (s[25] >>> 21); - b36 = (s[34] << 15) | (s[35] >>> 17); - b37 = (s[35] << 15) | (s[34] >>> 17); - b18 = (s[45] << 29) | (s[44] >>> 3); - b19 = (s[44] << 29) | (s[45] >>> 3); - b10 = (s[6] << 28) | (s[7] >>> 4); - b11 = (s[7] << 28) | (s[6] >>> 4); - b42 = (s[17] << 23) | (s[16] >>> 9); - b43 = (s[16] << 23) | (s[17] >>> 9); - b24 = (s[26] << 25) | (s[27] >>> 7); - b25 = (s[27] << 25) | (s[26] >>> 7); - b6 = (s[36] << 21) | (s[37] >>> 11); - b7 = (s[37] << 21) | (s[36] >>> 11); - b38 = (s[47] << 24) | (s[46] >>> 8); - b39 = (s[46] << 24) | (s[47] >>> 8); - b30 = (s[8] << 27) | (s[9] >>> 5); - b31 = (s[9] << 27) | (s[8] >>> 5); - b12 = (s[18] << 20) | (s[19] >>> 12); - b13 = (s[19] << 20) | (s[18] >>> 12); - b44 = (s[29] << 7) | (s[28] >>> 25); - b45 = (s[28] << 7) | (s[29] >>> 25); - b26 = (s[38] << 8) | (s[39] >>> 24); - b27 = (s[39] << 8) | (s[38] >>> 24); - b8 = (s[48] << 14) | (s[49] >>> 18); - b9 = (s[49] << 14) | (s[48] >>> 18); - - s[0] = b0 ^ (~b2 & b4); - s[1] = b1 ^ (~b3 & b5); - s[10] = b10 ^ (~b12 & b14); - s[11] = b11 ^ (~b13 & b15); - s[20] = b20 ^ (~b22 & b24); - s[21] = b21 ^ (~b23 & b25); - s[30] = b30 ^ (~b32 & b34); - s[31] = b31 ^ (~b33 & b35); - s[40] = b40 ^ (~b42 & b44); - s[41] = b41 ^ (~b43 & b45); - s[2] = b2 ^ (~b4 & b6); - s[3] = b3 ^ (~b5 & b7); - s[12] = b12 ^ (~b14 & b16); - s[13] = b13 ^ (~b15 & b17); - s[22] = b22 ^ (~b24 & b26); - s[23] = b23 ^ (~b25 & b27); - s[32] = b32 ^ (~b34 & b36); - s[33] = b33 ^ (~b35 & b37); - s[42] = b42 ^ (~b44 & b46); - s[43] = b43 ^ (~b45 & b47); - s[4] = b4 ^ (~b6 & b8); - s[5] = b5 ^ (~b7 & b9); - s[14] = b14 ^ (~b16 & b18); - s[15] = b15 ^ (~b17 & b19); - s[24] = b24 ^ (~b26 & b28); - s[25] = b25 ^ (~b27 & b29); - s[34] = b34 ^ (~b36 & b38); - s[35] = b35 ^ (~b37 & b39); - s[44] = b44 ^ (~b46 & b48); - s[45] = b45 ^ (~b47 & b49); - s[6] = b6 ^ (~b8 & b0); - s[7] = b7 ^ (~b9 & b1); - s[16] = b16 ^ (~b18 & b10); - s[17] = b17 ^ (~b19 & b11); - s[26] = b26 ^ (~b28 & b20); - s[27] = b27 ^ (~b29 & b21); - s[36] = b36 ^ (~b38 & b30); - s[37] = b37 ^ (~b39 & b31); - s[46] = b46 ^ (~b48 & b40); - s[47] = b47 ^ (~b49 & b41); - s[8] = b8 ^ (~b0 & b2); - s[9] = b9 ^ (~b1 & b3); - s[18] = b18 ^ (~b10 & b12); - s[19] = b19 ^ (~b11 & b13); - s[28] = b28 ^ (~b20 & b22); - s[29] = b29 ^ (~b21 & b23); - s[38] = b38 ^ (~b30 & b32); - s[39] = b39 ^ (~b31 & b33); - s[48] = b48 ^ (~b40 & b42); - s[49] = b49 ^ (~b41 & b43); - - s[0] ^= RC[n]; - s[1] ^= RC[n + 1]; - } - }; - - if (COMMON_JS) { - module.exports = methods; - } else { - for (var i = 0; i < methodNames.length; ++i) { - root[methodNames[i]] = methods[methodNames[i]]; - } - } + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } })(); }); @@ -36055,9 +37243,9 @@ return '0x' + sha3$1$2.keccak_256(arrayify$2(data)); } - const version$e$2 = "rlp/5.4.0"; + const version$d$2 = "rlp/5.6.0"; - const logger$k = new Logger$2(version$e$2); + const logger$j = new Logger$2(version$d$2); function arrayifyInteger$2(value) { const result = []; while (value) { @@ -36088,7 +37276,7 @@ return length.concat(payload); } if (!isBytesLike$2(object)) { - logger$k.throwArgumentError("RLP object must be BytesLike", "object", object); + logger$j.throwArgumentError("RLP object must be BytesLike", "object", object); } const data = Array.prototype.slice.call(arrayify$2(object)); if (data.length === 1 && data[0] <= 0x7f) { @@ -36112,7 +37300,7 @@ result.push(decoded.result); childOffset += decoded.consumed; if (childOffset > offset + 1 + length) { - logger$k.throwError("child data too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("child data too short", Logger$2.errors.BUFFER_OVERRUN, {}); } } return { consumed: (1 + length), result: result }; @@ -36120,35 +37308,35 @@ // returns { consumed: number, result: Object } function _decode$1(data, offset) { if (data.length === 0) { - logger$k.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); } // Array with extra length prefix if (data[offset] >= 0xf8) { const lengthLength = data[offset] - 0xf7; if (offset + 1 + lengthLength > data.length) { - logger$k.throwError("data short segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data short segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger$1(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { - logger$k.throwError("data long segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data long segment too short", Logger$2.errors.BUFFER_OVERRUN, {}); } return _decodeChildren$1(data, offset, offset + 1 + lengthLength, lengthLength + length); } else if (data[offset] >= 0xc0) { const length = data[offset] - 0xc0; if (offset + 1 + length > data.length) { - logger$k.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); } return _decodeChildren$1(data, offset, offset + 1, length); } else if (data[offset] >= 0xb8) { const lengthLength = data[offset] - 0xb7; if (offset + 1 + lengthLength > data.length) { - logger$k.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger$1(data, offset + 1, lengthLength); if (offset + 1 + lengthLength + length > data.length) { - logger$k.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data array too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const result = hexlify$2(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); return { consumed: (1 + lengthLength + length), result: result }; @@ -36156,28 +37344,28 @@ else if (data[offset] >= 0x80) { const length = data[offset] - 0x80; if (offset + 1 + length > data.length) { - logger$k.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); + logger$j.throwError("data too short", Logger$2.errors.BUFFER_OVERRUN, {}); } const result = hexlify$2(data.slice(offset + 1, offset + 1 + length)); return { consumed: (1 + length), result: result }; } return { consumed: 1, result: hexlify$2(data[offset]) }; } - function decode$1$1(data) { + function decode$2$1(data) { const bytes = arrayify$2(data); const decoded = _decode$1(bytes, 0); if (decoded.consumed !== bytes.length) { - logger$k.throwArgumentError("invalid rlp data", "data", data); + logger$j.throwArgumentError("invalid rlp data", "data", data); } return decoded.result; } - const version$d$2 = "address/5.4.0"; + const version$c$2 = "address/5.6.0"; - const logger$j = new Logger$2(version$d$2); + const logger$i = new Logger$2(version$c$2); function getChecksumAddress$2(address) { if (!isHexString$2(address, 20)) { - logger$j.throwArgumentError("invalid address", "address", address); + logger$i.throwArgumentError("invalid address", "address", address); } address = address.toLowerCase(); const chars = address.substring(2).split(""); @@ -36233,7 +37421,7 @@ function getAddress$2(address) { let result = null; if (typeof (address) !== "string") { - logger$j.throwArgumentError("invalid address", "address", address); + logger$i.throwArgumentError("invalid address", "address", address); } if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { // Missing the 0x prefix @@ -36243,14 +37431,14 @@ result = getChecksumAddress$2(address); // It is a checksummed address with a bad checksum if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { - logger$j.throwArgumentError("bad address checksum", "address", address); + logger$i.throwArgumentError("bad address checksum", "address", address); } // Maybe ICAP? (we only support direct mode) } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { // It is an ICAP address with a bad checksum if (address.substring(2, 4) !== ibanChecksum$2(address)) { - logger$j.throwArgumentError("bad icap checksum", "address", address); + logger$i.throwArgumentError("bad icap checksum", "address", address); } result = _base36To16$2(address.substring(4)); while (result.length < 40) { @@ -36259,7 +37447,7 @@ result = getChecksumAddress$2("0x" + result); } else { - logger$j.throwArgumentError("invalid address", "address", address); + logger$i.throwArgumentError("invalid address", "address", address); } return result; } @@ -36270,9 +37458,9 @@ from = getAddress$2(transaction.from); } catch (error) { - logger$j.throwArgumentError("missing from address", "transaction", transaction); + logger$i.throwArgumentError("missing from address", "transaction", transaction); } - const nonce = stripZeros$2(arrayify$2(BigNumber$1$1.from(transaction.nonce).toHexString())); + const nonce = stripZeros$2(arrayify$2(BigNumber$2.from(transaction.nonce).toHexString())); return getAddress$2(hexDataSlice$2(keccak256$2(encode$2$1([from, nonce])), 12)); } @@ -36314,7 +37502,7 @@ } } - const logger$i = new Logger$2(version$f$1); + const logger$h$1 = new Logger$2(version$e$2); function pack$1(writer, coders, values) { let arrayValues = null; if (Array.isArray(values)) { @@ -36325,14 +37513,14 @@ arrayValues = coders.map((coder) => { const name = coder.localName; if (!name) { - logger$i.throwError("cannot encode object for signature with missing names", Logger$2.errors.INVALID_ARGUMENT, { + logger$h$1.throwError("cannot encode object for signature with missing names", Logger$2.errors.INVALID_ARGUMENT, { argument: "values", coder: coder, value: values }); } if (unique[name]) { - logger$i.throwError("cannot encode object for signature with duplicate names", Logger$2.errors.INVALID_ARGUMENT, { + logger$h$1.throwError("cannot encode object for signature with duplicate names", Logger$2.errors.INVALID_ARGUMENT, { argument: "values", coder: coder, value: values @@ -36343,10 +37531,10 @@ }); } else { - logger$i.throwArgumentError("invalid tuple value", "tuple", values); + logger$h$1.throwArgumentError("invalid tuple value", "tuple", values); } if (coders.length !== arrayValues.length) { - logger$i.throwArgumentError("types/value length mismatch", "tuple", values); + logger$h$1.throwArgumentError("types/value length mismatch", "tuple", values); } let staticWriter = new Writer$1(writer.wordSize); let dynamicWriter = new Writer$1(writer.wordSize); @@ -36487,7 +37675,7 @@ count = value.length; writer.writeValue(value.length); } - logger$i.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + logger$h$1.checkArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); let coders = []; for (let i = 0; i < value.length; i++) { coders.push(this.coder); @@ -36504,7 +37692,7 @@ // bytes as a link to the data). This could use a much // tighter bound, but we are erroring on the side of safety. if (count * 32 > reader._data.length) { - logger$i.throwError("insufficient data length", Logger$2.errors.BUFFER_OVERRUN, { + logger$h$1.throwError("insufficient data length", Logger$2.errors.BUFFER_OVERRUN, { length: reader._data.length, count: count }); @@ -36602,10 +37790,10 @@ const AddressZero$1 = "0x0000000000000000000000000000000000000000"; - const NegativeOne$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(-1)); - const Zero$1$2 = ( /*#__PURE__*/BigNumber$1$1.from(0)); - const One$1$1 = ( /*#__PURE__*/BigNumber$1$1.from(1)); - const MaxUint256$1$1 = ( /*#__PURE__*/BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); + const NegativeOne$1$1 = ( /*#__PURE__*/BigNumber$2.from(-1)); + const Zero$1$2 = ( /*#__PURE__*/BigNumber$2.from(0)); + const One$1$1 = ( /*#__PURE__*/BigNumber$2.from(1)); + const MaxUint256$1$1 = ( /*#__PURE__*/BigNumber$2.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); const HashZero$1 = "0x0000000000000000000000000000000000000000000000000000000000000000"; @@ -36620,7 +37808,7 @@ return 0; } encode(writer, value) { - let v = BigNumber$1$1.from(value); + let v = BigNumber$2.from(value); // Check bounds are safe for encoding let maxUintValue = MaxUint256$1$1.mask(writer.wordSize * 8); if (this.signed) { @@ -36647,9 +37835,9 @@ } } - const version$c$2 = "strings/5.4.0"; + const version$b$2 = "strings/5.6.0"; - const logger$h$1 = new Logger$2(version$c$2); + const logger$g$2 = new Logger$2(version$b$2); /////////////////////////////// var UnicodeNormalizationForm$2; (function (UnicodeNormalizationForm) { @@ -36681,13 +37869,13 @@ // - offset = start of this codepoint // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate"; - // The string is an overlong reperesentation + // The string is an overlong representation // - offset = start of this codepoint // - badCodepoint = the computed codepoint; already bounds checked Utf8ErrorReason["OVERLONG"] = "overlong representation"; })(Utf8ErrorReason$2 || (Utf8ErrorReason$2 = {})); function errorFunc$2(reason, offset, bytes, output, badCodepoint) { - return logger$h$1.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); + return logger$g$2.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); } function ignoreFunc$2(reason, offset, bytes, output, badCodepoint) { // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes @@ -36787,7 +37975,7 @@ res = (res << 6) | (nextChar & 0x3f); i++; } - // See above loop for invalid contimuation byte + // See above loop for invalid continuation byte if (res === null) { continue; } @@ -36813,7 +38001,7 @@ // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array function toUtf8Bytes$2(str, form = UnicodeNormalizationForm$2.current) { if (form != UnicodeNormalizationForm$2.current) { - logger$h$1.checkNormalize(); + logger$g$2.checkNormalize(); str = str.normalize(form); } let result = []; @@ -37118,12 +38306,12 @@ } } - const logger$g$2 = new Logger$2(version$f$1); + const logger$f$2 = new Logger$2(version$e$2); const paramTypeBytes$1 = new RegExp(/^bytes([0-9]*)$/); const paramTypeNumber$1 = new RegExp(/^(u?int)([0-9]*)$/); class AbiCoder$1 { constructor(coerceFunc) { - logger$g$2.checkNew(new.target, AbiCoder$1); + logger$f$2.checkNew(new.target, AbiCoder$1); defineReadOnly$2(this, "coerceFunc", coerceFunc || null); } _getCoder(param) { @@ -37150,7 +38338,7 @@ if (match) { let size = parseInt(match[2] || "256"); if (size === 0 || size > 256 || (size % 8) !== 0) { - logger$g$2.throwArgumentError("invalid " + match[1] + " bit length", "param", param); + logger$f$2.throwArgumentError("invalid " + match[1] + " bit length", "param", param); } return new NumberCoder$1(size / 8, (match[1] === "int"), param.name); } @@ -37159,11 +38347,11 @@ if (match) { let size = parseInt(match[1]); if (size === 0 || size > 32) { - logger$g$2.throwArgumentError("invalid bytes length", "param", param); + logger$f$2.throwArgumentError("invalid bytes length", "param", param); } return new FixedBytesCoder$1(size, param.name); } - return logger$g$2.throwArgumentError("invalid type", "type", param.type); + return logger$f$2.throwArgumentError("invalid type", "type", param.type); } _getWordSize() { return 32; } _getReader(data, allowLoose) { @@ -37179,7 +38367,7 @@ } encode(types, values) { if (types.length !== values.length) { - logger$g$2.throwError("types/values length mismatch", Logger$2.errors.INVALID_ARGUMENT, { + logger$f$2.throwError("types/values length mismatch", Logger$2.errors.INVALID_ARGUMENT, { count: { types: types.length, values: values.length }, value: { types: types, values: values } }); @@ -37202,23 +38390,23 @@ return keccak256$2(toUtf8Bytes$2(text)); } - const version$b$2 = "hash/5.4.0"; + const version$a$2 = "hash/5.6.0"; - const logger$f$2 = new Logger$2(version$b$2); + const logger$e$2 = new Logger$2(version$a$2); const Zeros$1 = new Uint8Array(32); Zeros$1.fill(0); const Partition$1 = new RegExp("^((.*)\\.)?([^.]+)$"); function namehash$1(name) { /* istanbul ignore if */ if (typeof (name) !== "string") { - logger$f$2.throwArgumentError("invalid ENS name; not a string", "name", name); + logger$e$2.throwArgumentError("invalid ENS name; not a string", "name", name); } let current = name; let result = Zeros$1; while (current.length) { const partition = current.match(Partition$1); if (partition == null || partition[2] === "") { - logger$f$2.throwArgumentError("invalid ENS address; missing component", "name", name); + logger$e$2.throwArgumentError("invalid ENS address; missing component", "name", name); } const label = toUtf8Bytes$2(nameprep$1(partition[3])); result = keccak256$2(concat$2([result, keccak256$2(label)])); @@ -37226,6 +38414,15 @@ } return hexlify$2(result); } + function dnsEncode$1(name) { + return hexlify$2(concat$2(name.split(".").map((comp) => { + // We jam in an _ prefix to fill in with the length later + // Note: Nameprep throws if the component is over 63 bytes + const bytes = toUtf8Bytes$2("_" + nameprep$1(comp)); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; + } var __awaiter$7$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -37236,13 +38433,13 @@ step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; - const logger$e$2 = new Logger$2(version$b$2); + const logger$d$2 = new Logger$2(version$a$2); const padding$1 = new Uint8Array(32); padding$1.fill(0); - const NegativeOne$3 = BigNumber$1$1.from(-1); - const Zero$3 = BigNumber$1$1.from(0); - const One$2 = BigNumber$1$1.from(1); - const MaxUint256$2 = BigNumber$1$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + const NegativeOne$3 = BigNumber$2.from(-1); + const Zero$3 = BigNumber$2.from(0); + const One$2 = BigNumber$2.from(1); + const MaxUint256$2 = BigNumber$2.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); function hexPadRight$1(value) { const bytes = arrayify$2(value); const padOffset = bytes.length % 32; @@ -37266,7 +38463,7 @@ function checkString$1(key) { return function (value) { if (typeof (value) !== "string") { - logger$e$2.throwArgumentError(`invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + logger$d$2.throwArgumentError(`invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); } return value; }; @@ -37276,17 +38473,17 @@ version: checkString$1("version"), chainId: function (value) { try { - return BigNumber$1$1.from(value).toString(); + return BigNumber$2.from(value).toString(); } catch (error) { } - return logger$e$2.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value); + return logger$d$2.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value); }, verifyingContract: function (value) { try { return getAddress$2(value).toLowerCase(); } catch (error) { } - return logger$e$2.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + return logger$d$2.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value); }, salt: function (value) { try { @@ -37297,7 +38494,7 @@ return hexlify$2(bytes); } catch (error) { } - return logger$e$2.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value); + return logger$d$2.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value); } }; function getBaseEncoder$1(type) { @@ -37308,14 +38505,14 @@ const signed = (match[1] === ""); const width = parseInt(match[2] || "256"); if (width % 8 !== 0 || width > 256 || (match[2] && match[2] !== String(width))) { - logger$e$2.throwArgumentError("invalid numeric width", "type", type); + logger$d$2.throwArgumentError("invalid numeric width", "type", type); } const boundsUpper = MaxUint256$2.mask(signed ? (width - 1) : width); const boundsLower = signed ? boundsUpper.add(One$2).mul(NegativeOne$3) : Zero$3; return function (value) { - const v = BigNumber$1$1.from(value); + const v = BigNumber$2.from(value); if (v.lt(boundsLower) || v.gt(boundsUpper)) { - logger$e$2.throwArgumentError(`value out-of-bounds for ${type}`, "value", value); + logger$d$2.throwArgumentError(`value out-of-bounds for ${type}`, "value", value); } return hexZeroPad$2(v.toTwos(256).toHexString(), 32); }; @@ -37327,12 +38524,12 @@ if (match) { const width = parseInt(match[1]); if (width === 0 || width > 32 || match[1] !== String(width)) { - logger$e$2.throwArgumentError("invalid bytes width", "type", type); + logger$d$2.throwArgumentError("invalid bytes width", "type", type); } return function (value) { const bytes = arrayify$2(value); if (bytes.length !== width) { - logger$e$2.throwArgumentError(`invalid length for ${type}`, "value", value); + logger$d$2.throwArgumentError(`invalid length for ${type}`, "value", value); } return hexPadRight$1(value); }; @@ -37378,13 +38575,13 @@ types[name].forEach((field) => { // Check each field has a unique name if (uniqueNames[field.name]) { - logger$e$2.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); + logger$d$2.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); } uniqueNames[field.name] = true; // Get the base type (drop any array specifiers) const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; if (baseType === name) { - logger$e$2.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types); + logger$d$2.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types); } // Is this a base encoding type? const encoder = getBaseEncoder$1(baseType); @@ -37392,7 +38589,7 @@ return; } if (!parents[baseType]) { - logger$e$2.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types); + logger$d$2.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types); } // Add linkage parents[baseType].push(name); @@ -37402,16 +38599,16 @@ // Deduce the primary type const primaryTypes = Object.keys(parents).filter((n) => (parents[n].length === 0)); if (primaryTypes.length === 0) { - logger$e$2.throwArgumentError("missing primary type", "types", types); + logger$d$2.throwArgumentError("missing primary type", "types", types); } else if (primaryTypes.length > 1) { - logger$e$2.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types); + logger$d$2.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types); } defineReadOnly$2(this, "primaryType", primaryTypes[0]); // Check for circular type references function checkCircular(type, found) { if (found[type]) { - logger$e$2.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types); + logger$d$2.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types); } found[type] = true; Object.keys(links[type]).forEach((child) => { @@ -37458,7 +38655,7 @@ const length = parseInt(match[3]); return (value) => { if (length >= 0 && value.length !== length) { - logger$e$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + logger$d$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); } let result = value.map(subEncoder); if (this._types[subtype]) { @@ -37483,12 +38680,12 @@ return hexConcat$2(values); }; } - return logger$e$2.throwArgumentError(`unknown type: ${type}`, "type", type); + return logger$d$2.throwArgumentError(`unknown type: ${type}`, "type", type); } encodeType(name) { const result = this._types[name]; if (!result) { - logger$e$2.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name); + logger$d$2.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name); } return result; } @@ -37518,7 +38715,7 @@ const subtype = match[1]; const length = parseInt(match[3]); if (length >= 0 && value.length !== length) { - logger$e$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + logger$d$2.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); } return value.map((v) => this._visit(subtype, v, callback)); } @@ -37530,7 +38727,7 @@ return accum; }, {}); } - return logger$e$2.throwArgumentError(`unknown type: ${type}`, "type", type); + return logger$d$2.throwArgumentError(`unknown type: ${type}`, "type", type); } visit(value, callback) { return this._visit(this.primaryType, value, callback); @@ -37549,7 +38746,7 @@ for (const name in domain) { const type = domainFieldTypes$1[name]; if (!type) { - logger$e$2.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + logger$d$2.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); } domainFields.push({ name, type }); } @@ -37623,7 +38820,7 @@ const encoder = TypedDataEncoder$1.from(types); const typesWithDomain = shallowCopy$2(types); if (typesWithDomain.EIP712Domain) { - logger$e$2.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + logger$d$2.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); } else { typesWithDomain.EIP712Domain = domainTypes; @@ -37641,7 +38838,7 @@ } // uint or int if (type.match(/^u?int/)) { - return BigNumber$1$1.from(value).toString(); + return BigNumber$2.from(value).toString(); } switch (type) { case "address": @@ -37650,17 +38847,17 @@ return !!value; case "string": if (typeof (value) !== "string") { - logger$e$2.throwArgumentError(`invalid string`, "value", value); + logger$d$2.throwArgumentError(`invalid string`, "value", value); } return value; } - return logger$e$2.throwArgumentError("unsupported type", "type", type); + return logger$d$2.throwArgumentError("unsupported type", "type", type); }) }; } } - const logger$d$2 = new Logger$2(version$f$1); + const logger$c$2 = new Logger$2(version$e$2); class LogDescription$1 extends Description$2 { } class TransactionDescription$1 extends Description$2 { @@ -37696,7 +38893,7 @@ */ class Interface$1 { constructor(fragments) { - logger$d$2.checkNew(new.target, Interface$1); + logger$c$2.checkNew(new.target, Interface$1); let abi = []; if (typeof (fragments) === "string") { abi = JSON.parse(fragments); @@ -37707,7 +38904,7 @@ defineReadOnly$2(this, "fragments", abi.map((fragment) => { return Fragment$1.from(fragment); }).filter((fragment) => (fragment != null))); - defineReadOnly$2(this, "_abiCoder", getStatic$2((new.target), "getAbiCoder")()); + defineReadOnly$2(this, "_abiCoder", getStatic$2(new.target, "getAbiCoder")()); defineReadOnly$2(this, "functions", {}); defineReadOnly$2(this, "errors", {}); defineReadOnly$2(this, "events", {}); @@ -37718,7 +38915,7 @@ switch (fragment.type) { case "constructor": if (this.deploy) { - logger$d$2.warn("duplicate definition - constructor"); + logger$c$2.warn("duplicate definition - constructor"); return; } //checkNames(fragment, "input", fragment.inputs); @@ -37741,7 +38938,7 @@ } let signature = fragment.format(); if (bucket[signature]) { - logger$d$2.warn("duplicate definition - " + signature); + logger$c$2.warn("duplicate definition - " + signature); return; } bucket[signature] = fragment; @@ -37760,7 +38957,7 @@ format = FormatTypes$1.full; } if (format === FormatTypes$1.sighash) { - logger$d$2.throwArgumentError("interface does not support formatting sighash", "format", format); + logger$c$2.throwArgumentError("interface does not support formatting sighash", "format", format); } const abi = this.fragments.map((fragment) => fragment.format(format)); // We need to re-bundle the JSON fragments a bit @@ -37790,24 +38987,24 @@ return this.functions[name]; } } - logger$d$2.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrSighash.indexOf("(") === -1) { const name = nameOrSignatureOrSighash.trim(); const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { - logger$d$2.throwArgumentError("no matching function", "name", name); + logger$c$2.throwArgumentError("no matching function", "name", name); } else if (matching.length > 1) { - logger$d$2.throwArgumentError("multiple matching functions", "name", name); + logger$c$2.throwArgumentError("multiple matching functions", "name", name); } return this.functions[matching[0]]; } - // Normlize the signature and lookup the function + // Normalize the signature and lookup the function const result = this.functions[FunctionFragment$1.fromString(nameOrSignatureOrSighash).format()]; if (!result) { - logger$d$2.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); } return result; } @@ -37820,24 +39017,24 @@ return this.events[name]; } } - logger$d$2.throwArgumentError("no matching event", "topichash", topichash); + logger$c$2.throwArgumentError("no matching event", "topichash", topichash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrTopic.indexOf("(") === -1) { const name = nameOrSignatureOrTopic.trim(); const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { - logger$d$2.throwArgumentError("no matching event", "name", name); + logger$c$2.throwArgumentError("no matching event", "name", name); } else if (matching.length > 1) { - logger$d$2.throwArgumentError("multiple matching events", "name", name); + logger$c$2.throwArgumentError("multiple matching events", "name", name); } return this.events[matching[0]]; } - // Normlize the signature and lookup the function + // Normalize the signature and lookup the function const result = this.events[EventFragment$1.fromString(nameOrSignatureOrTopic).format()]; if (!result) { - logger$d$2.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + logger$c$2.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); } return result; } @@ -37851,24 +39048,24 @@ return this.errors[name]; } } - logger$d$2.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); } // It is a bare name, look up the function (will return null if ambiguous) if (nameOrSignatureOrSighash.indexOf("(") === -1) { const name = nameOrSignatureOrSighash.trim(); const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name)); if (matching.length === 0) { - logger$d$2.throwArgumentError("no matching error", "name", name); + logger$c$2.throwArgumentError("no matching error", "name", name); } else if (matching.length > 1) { - logger$d$2.throwArgumentError("multiple matching errors", "name", name); + logger$c$2.throwArgumentError("multiple matching errors", "name", name); } return this.errors[matching[0]]; } - // Normlize the signature and lookup the function + // Normalize the signature and lookup the function const result = this.errors[FunctionFragment$1.fromString(nameOrSignatureOrSighash).format()]; if (!result) { - logger$d$2.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + logger$c$2.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); } return result; } @@ -37911,7 +39108,7 @@ } const bytes = arrayify$2(data); if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(fragment)) { - logger$d$2.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$2(bytes)); + logger$c$2.throwArgumentError(`data signature does not match error ${fragment.name}.`, "data", hexlify$2(bytes)); } return this._decodeParams(fragment.inputs, bytes.slice(4)); } @@ -37931,7 +39128,7 @@ } const bytes = arrayify$2(data); if (hexlify$2(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { - logger$d$2.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$2(bytes)); + logger$c$2.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify$2(bytes)); } return this._decodeParams(functionFragment.inputs, bytes.slice(4)); } @@ -37952,6 +39149,7 @@ } let bytes = arrayify$2(data); let reason = null; + let message = ""; let errorArgs = null; let errorName = null; let errorSignature = null; @@ -37972,6 +39170,12 @@ if (builtin.reason) { reason = errorArgs[0]; } + if (errorName === "Error") { + message = `; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(errorArgs[0])}`; + } + else if (errorName === "Panic") { + message = `; VM Exception while processing transaction: reverted with panic code ${errorArgs[0]}`; + } } else { try { @@ -37980,16 +39184,14 @@ errorName = error.name; errorSignature = error.format(); } - catch (error) { - console.log(error); - } + catch (error) { } } break; } } - return logger$d$2.throwError("call revert exception", Logger$2.errors.CALL_EXCEPTION, { + return logger$c$2.throwError("call revert exception" + message, Logger$2.errors.CALL_EXCEPTION, { method: functionFragment.format(), - errorArgs, errorName, errorSignature, reason + data: hexlify$2(data), errorArgs, errorName, errorSignature, reason }); } // Encode the result for a function call (e.g. for eth_call) @@ -38005,7 +39207,7 @@ eventFragment = this.getEvent(eventFragment); } if (values.length > eventFragment.inputs.length) { - logger$d$2.throwError("too many arguments for " + eventFragment.format(), Logger$2.errors.UNEXPECTED_ARGUMENT, { + logger$c$2.throwError("too many arguments for " + eventFragment.format(), Logger$2.errors.UNEXPECTED_ARGUMENT, { argument: "values", value: values }); @@ -38031,7 +39233,7 @@ let param = eventFragment.inputs[index]; if (!param.indexed) { if (value != null) { - logger$d$2.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + logger$c$2.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); } return; } @@ -38039,7 +39241,7 @@ topics.push(null); } else if (param.baseType === "array" || param.baseType === "tuple") { - logger$d$2.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + logger$c$2.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); } else if (Array.isArray(value)) { topics.push(value.map((value) => encodeTopic(param, value))); @@ -38065,7 +39267,7 @@ topics.push(this.getEventTopic(eventFragment)); } if (values.length !== eventFragment.inputs.length) { - logger$d$2.throwArgumentError("event arguments/values mismatch", "values", values); + logger$c$2.throwArgumentError("event arguments/values mismatch", "values", values); } eventFragment.inputs.forEach((param, index) => { const value = values[index]; @@ -38077,7 +39279,7 @@ topics.push(keccak256$2(value)); } else if (param.baseType === "tuple" || param.baseType === "array") { - // @TOOD + // @TODO throw new Error("not implemented"); } else { @@ -38102,7 +39304,7 @@ if (topics != null && !eventFragment.anonymous) { let topicHash = this.getEventTopic(eventFragment); if (!isHexString$2(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { - logger$d$2.throwError("fragment/topic mismatch", Logger$2.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); + logger$c$2.throwError("fragment/topic mismatch", Logger$2.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); } topics = topics.slice(1); } @@ -38194,7 +39396,7 @@ name: fragment.name, signature: fragment.format(), sighash: this.getSighash(fragment), - value: BigNumber$1$1.from(tx.value || "0"), + value: BigNumber$2.from(tx.value || "0"), }); } // @TODO @@ -38208,7 +39410,7 @@ } // @TODO: If anonymous, and the only method, and the input count matches, should we parse? // Probably not, because just because it is the only event in the ABI does - // not mean we have the full ABI; maybe jsut a fragment? + // not mean we have the full ABI; maybe just a fragment? return new LogDescription$1({ eventFragment: fragment, name: fragment.name, @@ -38247,7 +39449,7 @@ } } - const version$a$2 = "abstract-provider/5.4.1"; + const version$9$2 = "abstract-provider/5.6.0"; var __awaiter$6$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -38258,7 +39460,7 @@ step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; - const logger$c$2 = new Logger$2(version$a$2); + const logger$b$2 = new Logger$2(version$9$2); //export type CallTransactionable = { // call(transaction: TransactionRequest): Promise; //}; @@ -38271,7 +39473,7 @@ // Exported Abstracts class Provider$2 { constructor() { - logger$c$2.checkAbstract(new.target, Provider$2); + logger$b$2.checkAbstract(new.target, Provider$2); defineReadOnly$2(this, "_isProvider", true); } getFeeData() { @@ -38289,7 +39491,7 @@ // We may want to compute this more accurately in the future, // using the formula "check if the base fee is correct". // See: https://eips.ethereum.org/EIPS/eip-1559 - maxPriorityFeePerGas = BigNumber$1$1.from("2500000000"); + maxPriorityFeePerGas = BigNumber$2.from("1500000000"); maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); } return { maxFeePerGas, maxPriorityFeePerGas, gasPrice }; @@ -38308,7 +39510,7 @@ } } - const version$9$2 = "abstract-signer/5.4.1"; + const version$8$2 = "abstract-signer/5.6.0"; var __awaiter$5$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -38319,9 +39521,9 @@ step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; - const logger$b$2 = new Logger$2(version$9$2); + const logger$a$2 = new Logger$2(version$8$2); const allowedTransactionKeys$1$1 = [ - "accessList", "chainId", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" + "accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors$2 = [ Logger$2.errors.INSUFFICIENT_FUNDS, @@ -38332,7 +39534,7 @@ /////////////////// // Sub-classes MUST call super constructor() { - logger$b$2.checkAbstract(new.target, Signer$2); + logger$a$2.checkAbstract(new.target, Signer$2); defineReadOnly$2(this, "_isSigner", true); } /////////////////// @@ -38349,7 +39551,7 @@ return yield this.provider.getTransactionCount(this.getAddress(), blockTag); }); } - // Populates "from" if unspecified, and estimates the gas for the transation + // Populates "from" if unspecified, and estimates the gas for the transaction estimateGas(transaction) { return __awaiter$5$1(this, void 0, void 0, function* () { this._checkProvider("estimateGas"); @@ -38357,7 +39559,7 @@ return yield this.provider.estimateGas(tx); }); } - // Populates "from" if unspecified, and calls with the transation + // Populates "from" if unspecified, and calls with the transaction call(transaction, blockTag) { return __awaiter$5$1(this, void 0, void 0, function* () { this._checkProvider("call"); @@ -38411,7 +39613,7 @@ checkTransaction(transaction) { for (const key in transaction) { if (allowedTransactionKeys$1$1.indexOf(key) === -1) { - logger$b$2.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); + logger$a$2.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); } } const tx = shallowCopy$2(transaction); @@ -38425,7 +39627,7 @@ this.getAddress() ]).then((result) => { if (result[0].toLowerCase() !== result[1].toLowerCase()) { - logger$b$2.throwArgumentError("from address mismatch", "transaction", transaction); + logger$a$2.throwArgumentError("from address mismatch", "transaction", transaction); } return result[0]; }); @@ -38449,20 +39651,20 @@ } const address = yield this.resolveName(to); if (address == null) { - logger$b$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + logger$a$2.throwArgumentError("provided ENS name resolves to null", "tx.to", to); } return address; })); // Prevent this error from causing an UnhandledPromiseException tx.to.catch((error) => { }); } - // Do not allow mixing pre-eip-1559 and eip-1559 proerties + // Do not allow mixing pre-eip-1559 and eip-1559 properties const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null); if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { - logger$b$2.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); + logger$a$2.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); } else if ((tx.type === 0 || tx.type === 1) && hasEip1559) { - logger$b$2.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); + logger$a$2.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); } if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) { // Fully-formed EIP-1559 transaction (skip getFeeData) @@ -38506,7 +39708,7 @@ // Network doesn't support EIP-1559... // ...but they are trying to use EIP-1559 properties if (hasEip1559) { - logger$b$2.throwError("network does not support EIP-1559", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$a$2.throwError("network does not support EIP-1559", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "populateTransaction" }); } @@ -38519,7 +39721,7 @@ } else { // getFeeData has failed us. - logger$b$2.throwError("failed to get consistent fee data", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$a$2.throwError("failed to get consistent fee data", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "signer.getFeeData" }); } @@ -38543,7 +39745,7 @@ if (forwardErrors$2.indexOf(error.code) >= 0) { throw error; } - return logger$b$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$2.errors.UNPREDICTABLE_GAS_LIMIT, { + return logger$a$2.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$2.errors.UNPREDICTABLE_GAS_LIMIT, { error: error, tx: tx }); @@ -38558,7 +39760,7 @@ this.getChainId() ]).then((results) => { if (results[1] !== 0 && results[0] !== results[1]) { - logger$b$2.throwArgumentError("chainId address mismatch", "transaction", transaction); + logger$a$2.throwArgumentError("chainId address mismatch", "transaction", transaction); } return results[0]; }); @@ -38570,7 +39772,7 @@ // Sub-classes SHOULD leave these alone _checkProvider(operation) { if (!this.provider) { - logger$b$2.throwError("missing provider", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$a$2.throwError("missing provider", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: (operation || "_checkProvider") }); } @@ -38581,7 +39783,7 @@ } class VoidSigner$1 extends Signer$2 { constructor(address, provider) { - logger$b$2.checkNew(new.target, VoidSigner$1); + logger$a$2.checkNew(new.target, VoidSigner$1); super(); defineReadOnly$2(this, "address", address); defineReadOnly$2(this, "provider", provider || null); @@ -38591,7 +39793,7 @@ } _fail(message, operation) { return Promise.resolve().then(() => { - logger$b$2.throwError(message, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: operation }); + logger$a$2.throwError(message, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: operation }); }); } signMessage(message) { @@ -38721,13 +39923,13 @@ } var toArray_1$1 = toArray$1; - function toHex$1$2(msg) { + function toHex$3(msg) { var res = ''; for (var i = 0; i < msg.length; i++) res += zero2$1(msg[i].toString(16)); return res; } - var toHex_1$1 = toHex$1$2; + var toHex_1$1 = toHex$3; function htonl$1(w) { var res = (w >>> 24) | @@ -42312,9 +43514,9 @@ var EC$1$1 = elliptic_1$1.ec; - const version$8$2 = "signing-key/5.4.0"; + const version$7$2 = "signing-key/5.6.1"; - const logger$a$2 = new Logger$2(version$8$2); + const logger$9$2 = new Logger$2(version$7$2); let _curve$1 = null; function getCurve$1() { if (!_curve$1) { @@ -42326,6 +43528,9 @@ constructor(privateKey) { defineReadOnly$2(this, "curve", "secp256k1"); defineReadOnly$2(this, "privateKey", hexlify$2(privateKey)); + if (hexDataLength$2(this.privateKey) !== 32) { + logger$9$2.throwArgumentError("invalid private key", "privateKey", "[[ REDACTED ]]"); + } const keyPair = getCurve$1().keyFromPrivate(arrayify$2(this.privateKey)); defineReadOnly$2(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); defineReadOnly$2(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); @@ -42340,7 +43545,7 @@ const keyPair = getCurve$1().keyFromPrivate(arrayify$2(this.privateKey)); const digestBytes = arrayify$2(digest); if (digestBytes.length !== 32) { - logger$a$2.throwArgumentError("bad digest length", "digest", digest); + logger$9$2.throwArgumentError("bad digest length", "digest", digest); } const signature = keyPair.sign(digestBytes, { canonical: true }); return splitSignature$1({ @@ -42384,12 +43589,12 @@ } return "0x" + getCurve$1().keyFromPublic(bytes).getPublic(true, "hex"); } - return logger$a$2.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + return logger$9$2.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); } - const version$7$2 = "transactions/5.4.0"; + const version$6$2 = "transactions/5.6.0"; - const logger$9$2 = new Logger$2(version$7$2); + const logger$8$2 = new Logger$2(version$6$2); var TransactionTypes$2; (function (TransactionTypes) { TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy"; @@ -42407,7 +43612,7 @@ if (value === "0x") { return Zero$1$2; } - return BigNumber$1$1.from(value); + return BigNumber$2.from(value); } function computeAddress$1(key) { const publicKey = computePublicKey$1(key); @@ -42417,9 +43622,9 @@ return computeAddress$1(recoverPublicKey$1(arrayify$2(digest), signature)); } function formatNumber$1(value, name) { - const result = stripZeros$2(BigNumber$1$1.from(value).toHexString()); + const result = stripZeros$2(BigNumber$2.from(value).toHexString()); if (result.length > 32) { - logger$9$2.throwArgumentError("invalid length for " + name, ("transaction:" + name), value); + logger$8$2.throwArgumentError("invalid length for " + name, ("transaction:" + name), value); } return result; } @@ -42428,7 +43633,7 @@ address: getAddress$2(addr), storageKeys: (storageKeys || []).map((storageKey, index) => { if (hexDataLength$2(storageKey) !== 32) { - logger$9$2.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey); + logger$8$2.throwArgumentError("invalid access list storageKey", `accessList[${addr}:${index}]`, storageKey); } return storageKey.toLowerCase(); }) @@ -42439,7 +43644,7 @@ return value.map((set, index) => { if (Array.isArray(set)) { if (set.length > 2) { - logger$9$2.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set); + logger$8$2.throwArgumentError("access list expected to be [ address, storageKeys[] ]", `value[${index}]`, set); } return accessSetify$2(set[0], set[1]); } @@ -42464,10 +43669,10 @@ // EIP-1559 fees; otherwise they may not understand what they // think they are setting in terms of fee. if (transaction.gasPrice != null) { - const gasPrice = BigNumber$1$1.from(transaction.gasPrice); - const maxFeePerGas = BigNumber$1$1.from(transaction.maxFeePerGas || 0); + const gasPrice = BigNumber$2.from(transaction.gasPrice); + const maxFeePerGas = BigNumber$2.from(transaction.maxFeePerGas || 0); if (!gasPrice.eq(maxFeePerGas)) { - logger$9$2.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + logger$8$2.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { gasPrice, maxFeePerGas }); } @@ -42519,7 +43724,7 @@ tx.v = recid; } catch (error) { - logger$9$2.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); + logger$8$2.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); } tx.r = hexZeroPad$2(fields[1], 32); tx.s = hexZeroPad$2(fields[2], 32); @@ -42532,9 +43737,9 @@ } } function _parseEip1559$1(payload) { - const transaction = decode$1$1(payload.slice(1)); + const transaction = decode$2$1(payload.slice(1)); if (transaction.length !== 9 && transaction.length !== 12) { - logger$9$2.throwArgumentError("invalid component count for transaction type: 2", "payload", hexlify$2(payload)); + logger$8$2.throwArgumentError("invalid component count for transaction type: 2", "payload", hexlify$2(payload)); } const maxPriorityFeePerGas = handleNumber$1(transaction[2]); const maxFeePerGas = handleNumber$1(transaction[3]); @@ -42560,9 +43765,9 @@ return tx; } function _parseEip2930$1(payload) { - const transaction = decode$1$1(payload.slice(1)); + const transaction = decode$2$1(payload.slice(1)); if (transaction.length !== 8 && transaction.length !== 11) { - logger$9$2.throwArgumentError("invalid component count for transaction type: 1", "payload", hexlify$2(payload)); + logger$8$2.throwArgumentError("invalid component count for transaction type: 1", "payload", hexlify$2(payload)); } const tx = { type: 1, @@ -42585,9 +43790,9 @@ } // Legacy Transactions and EIP-155 function _parse$1(rawTransaction) { - const transaction = decode$1$1(rawTransaction); + const transaction = decode$2$1(rawTransaction); if (transaction.length !== 9 && transaction.length !== 6) { - logger$9$2.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); + logger$8$2.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); } const tx = { nonce: handleNumber$1(transaction[0]).toNumber(), @@ -42603,7 +43808,7 @@ return tx; } try { - tx.v = BigNumber$1$1.from(transaction[6]).toNumber(); + tx.v = BigNumber$2.from(transaction[6]).toNumber(); } catch (error) { console.log(error); @@ -42611,13 +43816,13 @@ } tx.r = hexZeroPad$2(transaction[7], 32); tx.s = hexZeroPad$2(transaction[8], 32); - if (BigNumber$1$1.from(tx.r).isZero() && BigNumber$1$1.from(tx.s).isZero()) { + if (BigNumber$2.from(tx.r).isZero() && BigNumber$2.from(tx.s).isZero()) { // EIP-155 unsigned transaction tx.chainId = tx.v; tx.v = 0; } else { - // Signed Tranasaction + // Signed Transaction tx.chainId = Math.floor((tx.v - 35) / 2); if (tx.chainId < 0) { tx.chainId = 0; @@ -42655,13 +43860,13 @@ case 2: return _parseEip1559$1(payload); } - return logger$9$2.throwError(`unsupported transaction type: ${payload[0]}`, Logger$2.errors.UNSUPPORTED_OPERATION, { + return logger$8$2.throwError(`unsupported transaction type: ${payload[0]}`, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "parseTransaction", transactionType: payload[0] }); } - const version$6$2 = "contracts/5.4.1"; + const version$5$2 = "contracts/5.6.0"; var __awaiter$4$1 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -42672,23 +43877,26 @@ step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; - const logger$8$2 = new Logger$2(version$6$2); + const logger$7$2 = new Logger$2(version$5$2); function resolveName$1(resolver, nameOrPromise) { return __awaiter$4$1(this, void 0, void 0, function* () { const name = yield nameOrPromise; + if (typeof (name) !== "string") { + logger$7$2.throwArgumentError("invalid address or ENS name", "name", name); + } // If it is already an address, just use it (after adding checksum) try { return getAddress$2(name); } catch (error) { } if (!resolver) { - logger$8$2.throwError("a provider or signer is needed to resolve ENS names", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("a provider or signer is needed to resolve ENS names", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "resolveName" }); } const address = yield resolver.resolveName(name); if (address == null) { - logger$8$2.throwArgumentError("resolver or addr is not configured for ENS name", "name", name); + logger$7$2.throwArgumentError("resolver or addr is not configured for ENS name", "name", name); } return address; }); @@ -42709,7 +43917,10 @@ } if (paramType.baseType === "array") { if (!Array.isArray(value)) { - return Promise.reject(new Error("invalid value for array")); + return Promise.reject(logger$7$2.makeError("invalid value for array", Logger$2.errors.INVALID_ARGUMENT, { + argument: "value", + value + })); } return yield Promise.all(value.map((v) => resolveAddresses$1(resolver, v, paramType.arrayChildren))); } @@ -42724,7 +43935,7 @@ overrides = shallowCopy$2(args.pop()); } // Make sure the parameter count matches - logger$8$2.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); + logger$7$2.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); // Populate "from" override (allow promises) if (contract.signer) { if (overrides.from) { @@ -42735,7 +43946,7 @@ signer: contract.signer.getAddress() }).then((check) => __awaiter$4$1(this, void 0, void 0, function* () { if (getAddress$2(check.signer) !== check.override) { - logger$8$2.throwError("Contract with a Signer cannot override from", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("Contract with a Signer cannot override from", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "overrides.from" }); } @@ -42769,19 +43980,19 @@ const ro = resolved.overrides; // Populate simple overrides if (ro.nonce != null) { - tx.nonce = BigNumber$1$1.from(ro.nonce).toNumber(); + tx.nonce = BigNumber$2.from(ro.nonce).toNumber(); } if (ro.gasLimit != null) { - tx.gasLimit = BigNumber$1$1.from(ro.gasLimit); + tx.gasLimit = BigNumber$2.from(ro.gasLimit); } if (ro.gasPrice != null) { - tx.gasPrice = BigNumber$1$1.from(ro.gasPrice); + tx.gasPrice = BigNumber$2.from(ro.gasPrice); } if (ro.maxFeePerGas != null) { - tx.maxFeePerGas = BigNumber$1$1.from(ro.maxFeePerGas); + tx.maxFeePerGas = BigNumber$2.from(ro.maxFeePerGas); } if (ro.maxPriorityFeePerGas != null) { - tx.maxPriorityFeePerGas = BigNumber$1$1.from(ro.maxPriorityFeePerGas); + tx.maxPriorityFeePerGas = BigNumber$2.from(ro.maxPriorityFeePerGas); } if (ro.from != null) { tx.from = ro.from; @@ -42794,7 +44005,7 @@ } // If there was no "gasLimit" override, but the ABI specifies a default, use it if (tx.gasLimit == null && fragment.gas != null) { - // Conmpute the intrinisic gas cost for this transaction + // Compute the intrinsic gas cost for this transaction // @TODO: This is based on the yellow paper as of Petersburg; this is something // we may wish to parameterize in v6 as part of the Network object. Since this // is always a non-nil to address, we can ignore G_create, but may wish to add @@ -42807,20 +44018,26 @@ intrinsic += 64; } } - tx.gasLimit = BigNumber$1$1.from(fragment.gas).add(intrinsic); + tx.gasLimit = BigNumber$2.from(fragment.gas).add(intrinsic); } // Populate "value" override if (ro.value) { - const roValue = BigNumber$1$1.from(ro.value); + const roValue = BigNumber$2.from(ro.value); if (!roValue.isZero() && !fragment.payable) { - logger$8$2.throwError("non-payable method cannot override value", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("non-payable method cannot override value", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "overrides.value", value: overrides.value }); } tx.value = roValue; } - // Remvoe the overrides + if (ro.customData) { + tx.customData = shallowCopy$2(ro.customData); + } + if (ro.ccipReadEnabled) { + tx.ccipReadEnabled = !!ro.ccipReadEnabled; + } + // Remove the overrides delete overrides.nonce; delete overrides.gasLimit; delete overrides.gasPrice; @@ -42830,11 +44047,13 @@ delete overrides.accessList; delete overrides.maxFeePerGas; delete overrides.maxPriorityFeePerGas; + delete overrides.customData; + delete overrides.ccipReadEnabled; // Make sure there are no stray overrides, which may indicate a // typo or using an unsupported key. const leftovers = Object.keys(overrides).filter((key) => (overrides[key] != null)); if (leftovers.length) { - logger$8$2.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "overrides", overrides: leftovers }); @@ -42852,7 +44071,7 @@ return function (...args) { return __awaiter$4$1(this, void 0, void 0, function* () { if (!signerOrProvider) { - logger$8$2.throwError("estimate require a provider or signer", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("estimate require a provider or signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); } @@ -42861,6 +44080,43 @@ }); }; } + function addContractWait$1(contract, tx) { + const wait = tx.wait.bind(tx); + tx.wait = (confirmations) => { + return wait(confirmations).then((receipt) => { + receipt.events = receipt.logs.map((log) => { + let event = deepCopy$2(log); + let parsed = null; + try { + parsed = contract.interface.parseLog(log); + } + catch (e) { } + // Successfully parsed the event log; include it + if (parsed) { + event.args = parsed.args; + event.decode = (data, topics) => { + return contract.interface.decodeEventLog(parsed.eventFragment, data, topics); + }; + event.event = parsed.name; + event.eventSignature = parsed.signature; + } + // Useful operations + event.removeListener = () => { return contract.provider; }; + event.getBlock = () => { + return contract.provider.getBlock(receipt.blockHash); + }; + event.getTransaction = () => { + return contract.provider.getTransaction(receipt.transactionHash); + }; + event.getTransactionReceipt = () => { + return Promise.resolve(receipt); + }; + return event; + }); + return receipt; + }); + }; + } function buildCall$1(contract, fragment, collapseSimple) { const signerOrProvider = (contract.signer || contract.provider); return function (...args) { @@ -42904,52 +44160,18 @@ return function (...args) { return __awaiter$4$1(this, void 0, void 0, function* () { if (!contract.signer) { - logger$8$2.throwError("sending a transaction requires a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("sending a transaction requires a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); } - // If the contract was just deployed, wait until it is minded + // If the contract was just deployed, wait until it is mined if (contract.deployTransaction != null) { yield contract._deployed(); } const txRequest = yield populateTransaction$1(contract, fragment, args); const tx = yield contract.signer.sendTransaction(txRequest); - // Tweak the tw.wait so the receipt has extra properties - const wait = tx.wait.bind(tx); - tx.wait = (confirmations) => { - return wait(confirmations).then((receipt) => { - receipt.events = receipt.logs.map((log) => { - let event = deepCopy$2(log); - let parsed = null; - try { - parsed = contract.interface.parseLog(log); - } - catch (e) { } - // Successfully parsed the event log; include it - if (parsed) { - event.args = parsed.args; - event.decode = (data, topics) => { - return contract.interface.decodeEventLog(parsed.eventFragment, data, topics); - }; - event.event = parsed.name; - event.eventSignature = parsed.signature; - } - // Useful operations - event.removeListener = () => { return contract.provider; }; - event.getBlock = () => { - return contract.provider.getBlock(receipt.blockHash); - }; - event.getTransaction = () => { - return contract.provider.getTransaction(receipt.transactionHash); - }; - event.getTransactionReceipt = () => { - return Promise.resolve(receipt); - }; - return event; - }); - return receipt; - }); - }; + // Tweak the tx.wait so the receipt has extra properties + addContractWait$1(contract, tx); return tx; }); }; @@ -43028,7 +44250,7 @@ // or have a common abstract super class, with enough constructor // options to configure both. // A Fragment Event will populate all the properties that Wildcard - // will, and additioanlly dereference the arguments when emitting + // will, and additionally dereference the arguments when emitting class FragmentRunningEvent$1 extends RunningEvent$1 { constructor(address, contractInterface, fragment, topics) { const filter = { @@ -43037,7 +44259,7 @@ let topic = contractInterface.getEventTopic(fragment); if (topics) { if (topic !== topics[0]) { - logger$8$2.throwArgumentError("topic mismatch", "topics", topics); + logger$7$2.throwArgumentError("topic mismatch", "topics", topics); } filter.topics = topics.slice(); } @@ -43074,7 +44296,7 @@ return args; } } - // A Wildard Event will attempt to populate: + // A Wildcard Event will attempt to populate: // - event The name of the event name // - eventSignature The full signature of the event // - decode A function to decode data and topics @@ -43103,10 +44325,10 @@ } class BaseContract$1 { constructor(addressOrName, contractInterface, signerOrProvider) { - logger$8$2.checkNew(new.target, Contract$1); + logger$7$2.checkNew(new.target, Contract$1); // @TODO: Maybe still check the addressOrName looks like a valid address or name? //address = getAddress(address); - defineReadOnly$2(this, "interface", getStatic$2((new.target), "getInterface")(contractInterface)); + defineReadOnly$2(this, "interface", getStatic$2(new.target, "getInterface")(contractInterface)); if (signerOrProvider == null) { defineReadOnly$2(this, "provider", null); defineReadOnly$2(this, "signer", null); @@ -43120,7 +44342,7 @@ defineReadOnly$2(this, "signer", null); } else { - logger$8$2.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); + logger$7$2.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); } defineReadOnly$2(this, "callStatic", {}); defineReadOnly$2(this, "estimateGas", {}); @@ -43148,14 +44370,14 @@ defineReadOnly$2(this.filters, name, this.filters[filters[0]]); } else { - logger$8$2.warn(`Duplicate definition of ${name} (${filters.join(", ")})`); + logger$7$2.warn(`Duplicate definition of ${name} (${filters.join(", ")})`); } }); } defineReadOnly$2(this, "_runningEvents", {}); defineReadOnly$2(this, "_wrappedEmits", {}); if (addressOrName == null) { - logger$8$2.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); + logger$7$2.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); } defineReadOnly$2(this, "address", addressOrName); if (this.provider) { @@ -43167,11 +44389,13 @@ } catch (error) { // Without a provider, we cannot use ENS names - logger$8$2.throwError("provider is required to use ENS name as contract address", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("provider is required to use ENS name as contract address", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "new Contract" }); } } + // Swallow bad ENS names to prevent Unhandled Exceptions + this.resolvedAddress.catch((e) => { }); const uniqueNames = {}; const uniqueSignatures = {}; Object.keys(this.interface.functions).forEach((signature) => { @@ -43179,7 +44403,7 @@ // Check that the signature is unique; if not the ABI generation has // not been cleaned or may be incorrectly generated if (uniqueSignatures[signature]) { - logger$8$2.warn(`Duplicate ABI entry for ${JSON.stringify(signature)}`); + logger$7$2.warn(`Duplicate ABI entry for ${JSON.stringify(signature)}`); return; } uniqueSignatures[signature] = true; @@ -43187,10 +44411,10 @@ // are ambiguous { const name = fragment.name; - if (!uniqueNames[name]) { - uniqueNames[name] = []; + if (!uniqueNames[`%${name}`]) { + uniqueNames[`%${name}`] = []; } - uniqueNames[name].push(signature); + uniqueNames[`%${name}`].push(signature); } if (this[signature] == null) { defineReadOnly$2(this, signature, buildDefault$1(this, fragment, true)); @@ -43217,6 +44441,8 @@ if (signatures.length > 1) { return; } + // Strip off the leading "%" used for prototype protection + name = name.substring(1); const signature = signatures[0]; // If overwriting a member property that is null, swallow the error try { @@ -43266,7 +44492,7 @@ // Otherwise, poll for our code to be deployed this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code) => { if (code === "0x") { - logger$8$2.throwError("contract not deployed", Logger$2.errors.UNSUPPORTED_OPERATION, { + logger$7$2.throwError("contract not deployed", Logger$2.errors.UNSUPPORTED_OPERATION, { contractAddress: this.address, operation: "getDeployed" }); @@ -43283,14 +44509,14 @@ // estimateDeploy(bytecode: string, ...args): Promise fallback(overrides) { if (!this.signer) { - logger$8$2.throwError("sending a transactions require a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); + logger$7$2.throwError("sending a transactions require a signer", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); } const tx = shallowCopy$2(overrides || {}); ["from", "to"].forEach(function (key) { if (tx[key] == null) { return; } - logger$8$2.throwError("cannot override " + key, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: key }); + logger$7$2.throwError("cannot override " + key, Logger$2.errors.UNSUPPORTED_OPERATION, { operation: key }); }); tx.to = this.resolvedAddress; return this.deployed().then(() => { @@ -43393,7 +44619,7 @@ } _addEventListener(runningEvent, listener, once) { if (!this.provider) { - logger$8$2.throwError("events require a provider or a signer with a provider", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "once" }); + logger$7$2.throwError("events require a provider or a signer with a provider", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "once" }); } runningEvent.addListener(listener, once); // Track this running event and its listeners (may already be there; but no hard in updating) @@ -43433,7 +44659,7 @@ const filter = shallowCopy$2(runningEvent.filter); if (typeof (fromBlockOrBlockhash) === "string" && isHexString$2(fromBlockOrBlockhash, 32)) { if (toBlock != null) { - logger$8$2.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock); + logger$7$2.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock); } filter.blockHash = fromBlockOrBlockhash; } @@ -43523,286 +44749,6 @@ class Contract$1 extends BaseContract$1 { } - const version$5$2 = "bignumber/5.4.2"; - - var BN$2 = bn$2.BN; - const logger$7$2 = new Logger$2(version$5$2); - const _constructorGuard$1$2 = {}; - const MAX_SAFE$2 = 0x1fffffffffffff; - // Only warn about passing 10 into radix once - let _warnedToStringRadix$2 = false; - class BigNumber$2 { - constructor(constructorGuard, hex) { - logger$7$2.checkNew(new.target, BigNumber$2); - if (constructorGuard !== _constructorGuard$1$2) { - logger$7$2.throwError("cannot call constructor directly; use BigNumber.from", Logger$2.errors.UNSUPPORTED_OPERATION, { - operation: "new (BigNumber)" - }); - } - this._hex = hex; - this._isBigNumber = true; - Object.freeze(this); - } - fromTwos(value) { - return toBigNumber$2(toBN$2(this).fromTwos(value)); - } - toTwos(value) { - return toBigNumber$2(toBN$2(this).toTwos(value)); - } - abs() { - if (this._hex[0] === "-") { - return BigNumber$2.from(this._hex.substring(1)); - } - return this; - } - add(other) { - return toBigNumber$2(toBN$2(this).add(toBN$2(other))); - } - sub(other) { - return toBigNumber$2(toBN$2(this).sub(toBN$2(other))); - } - div(other) { - const o = BigNumber$2.from(other); - if (o.isZero()) { - throwFault$3("division by zero", "div"); - } - return toBigNumber$2(toBN$2(this).div(toBN$2(other))); - } - mul(other) { - return toBigNumber$2(toBN$2(this).mul(toBN$2(other))); - } - mod(other) { - const value = toBN$2(other); - if (value.isNeg()) { - throwFault$3("cannot modulo negative values", "mod"); - } - return toBigNumber$2(toBN$2(this).umod(value)); - } - pow(other) { - const value = toBN$2(other); - if (value.isNeg()) { - throwFault$3("cannot raise to negative values", "pow"); - } - return toBigNumber$2(toBN$2(this).pow(value)); - } - and(other) { - const value = toBN$2(other); - if (this.isNegative() || value.isNeg()) { - throwFault$3("cannot 'and' negative values", "and"); - } - return toBigNumber$2(toBN$2(this).and(value)); - } - or(other) { - const value = toBN$2(other); - if (this.isNegative() || value.isNeg()) { - throwFault$3("cannot 'or' negative values", "or"); - } - return toBigNumber$2(toBN$2(this).or(value)); - } - xor(other) { - const value = toBN$2(other); - if (this.isNegative() || value.isNeg()) { - throwFault$3("cannot 'xor' negative values", "xor"); - } - return toBigNumber$2(toBN$2(this).xor(value)); - } - mask(value) { - if (this.isNegative() || value < 0) { - throwFault$3("cannot mask negative values", "mask"); - } - return toBigNumber$2(toBN$2(this).maskn(value)); - } - shl(value) { - if (this.isNegative() || value < 0) { - throwFault$3("cannot shift negative values", "shl"); - } - return toBigNumber$2(toBN$2(this).shln(value)); - } - shr(value) { - if (this.isNegative() || value < 0) { - throwFault$3("cannot shift negative values", "shr"); - } - return toBigNumber$2(toBN$2(this).shrn(value)); - } - eq(other) { - return toBN$2(this).eq(toBN$2(other)); - } - lt(other) { - return toBN$2(this).lt(toBN$2(other)); - } - lte(other) { - return toBN$2(this).lte(toBN$2(other)); - } - gt(other) { - return toBN$2(this).gt(toBN$2(other)); - } - gte(other) { - return toBN$2(this).gte(toBN$2(other)); - } - isNegative() { - return (this._hex[0] === "-"); - } - isZero() { - return toBN$2(this).isZero(); - } - toNumber() { - try { - return toBN$2(this).toNumber(); - } - catch (error) { - throwFault$3("overflow", "toNumber", this.toString()); - } - return null; - } - toBigInt() { - try { - return BigInt(this.toString()); - } - catch (e) { } - return logger$7$2.throwError("this platform does not support BigInt", Logger$2.errors.UNSUPPORTED_OPERATION, { - value: this.toString() - }); - } - toString() { - // Lots of people expect this, which we do not support, so check (See: #889) - if (arguments.length > 0) { - if (arguments[0] === 10) { - if (!_warnedToStringRadix$2) { - _warnedToStringRadix$2 = true; - logger$7$2.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); - } - } - else if (arguments[0] === 16) { - logger$7$2.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); - } - else { - logger$7$2.throwError("BigNumber.toString does not accept parameters", Logger$2.errors.UNEXPECTED_ARGUMENT, {}); - } - } - return toBN$2(this).toString(10); - } - toHexString() { - return this._hex; - } - toJSON(key) { - return { type: "BigNumber", hex: this.toHexString() }; - } - static from(value) { - if (value instanceof BigNumber$2) { - return value; - } - if (typeof (value) === "string") { - if (value.match(/^-?0x[0-9a-f]+$/i)) { - return new BigNumber$2(_constructorGuard$1$2, toHex$3(value)); - } - if (value.match(/^-?[0-9]+$/)) { - return new BigNumber$2(_constructorGuard$1$2, toHex$3(new BN$2(value))); - } - return logger$7$2.throwArgumentError("invalid BigNumber string", "value", value); - } - if (typeof (value) === "number") { - if (value % 1) { - throwFault$3("underflow", "BigNumber.from", value); - } - if (value >= MAX_SAFE$2 || value <= -MAX_SAFE$2) { - throwFault$3("overflow", "BigNumber.from", value); - } - return BigNumber$2.from(String(value)); - } - const anyValue = value; - if (typeof (anyValue) === "bigint") { - return BigNumber$2.from(anyValue.toString()); - } - if (isBytes$2(anyValue)) { - return BigNumber$2.from(hexlify$2(anyValue)); - } - if (anyValue) { - // Hexable interface (takes piority) - if (anyValue.toHexString) { - const hex = anyValue.toHexString(); - if (typeof (hex) === "string") { - return BigNumber$2.from(hex); - } - } - else { - // For now, handle legacy JSON-ified values (goes away in v6) - let hex = anyValue._hex; - // New-form JSON - if (hex == null && anyValue.type === "BigNumber") { - hex = anyValue.hex; - } - if (typeof (hex) === "string") { - if (isHexString$2(hex) || (hex[0] === "-" && isHexString$2(hex.substring(1)))) { - return BigNumber$2.from(hex); - } - } - } - } - return logger$7$2.throwArgumentError("invalid BigNumber value", "value", value); - } - static isBigNumber(value) { - return !!(value && value._isBigNumber); - } - } - // Normalize the hex string - function toHex$3(value) { - // For BN, call on the hex string - if (typeof (value) !== "string") { - return toHex$3(value.toString(16)); - } - // If negative, prepend the negative sign to the normalized positive value - if (value[0] === "-") { - // Strip off the negative sign - value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") - if (value[0] === "-") { - logger$7$2.throwArgumentError("invalid hex", "value", value); - } - // Call toHex on the positive component - value = toHex$3(value); - // Do not allow "-0x00" - if (value === "0x00") { - return value; - } - // Negate the value - return "-" + value; - } - // Add a "0x" prefix if missing - if (value.substring(0, 2) !== "0x") { - value = "0x" + value; - } - // Normalize zero - if (value === "0x") { - return "0x00"; - } - // Make the string even length - if (value.length % 2) { - value = "0x0" + value.substring(2); - } - // Trim to smallest even-length string - while (value.length > 4 && value.substring(0, 4) === "0x00") { - value = "0x" + value.substring(4); - } - return value; - } - function toBigNumber$2(value) { - return BigNumber$2.from(toHex$3(value)); - } - function toBN$2(value) { - const hex = BigNumber$2.from(value).toHexString(); - if (hex[0] === "-") { - return (new BN$2("-" + hex.substring(3), 16)); - } - return new BN$2(hex.substring(2), 16); - } - function throwFault$3(fault, operation, value) { - const params = { fault: fault, operation: operation }; - if (value != null) { - params.value = value; - } - return logger$7$2.throwError(fault, Logger$2.errors.NUMERIC_FAULT, params); - } - /** * var basex = require("base-x"); * @@ -43919,14 +44865,14 @@ //console.log(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj")) //console.log(Base58.encode(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj"))) - const version$4$2 = "sha2/5.4.0"; + const version$4$2 = "sha2/5.6.0"; new Logger$2(version$4$2); function sha256$2(data) { return "0x" + (hash$1.sha256().update(arrayify$2(data)).digest("hex")); } - const version$3$2 = "networks/5.4.2"; + const version$3$2 = "networks/5.6.2"; const logger$6$2 = new Logger$2(version$3$2); function isRenetworkable$1(value) { @@ -43938,44 +44884,50 @@ options = {}; } const providerList = []; - if (providers.InfuraProvider) { + if (providers.InfuraProvider && options.infura !== "-") { try { providerList.push(new providers.InfuraProvider(network, options.infura)); } catch (error) { } } - if (providers.EtherscanProvider) { + if (providers.EtherscanProvider && options.etherscan !== "-") { try { providerList.push(new providers.EtherscanProvider(network, options.etherscan)); } catch (error) { } } - if (providers.AlchemyProvider) { + if (providers.AlchemyProvider && options.alchemy !== "-") { try { providerList.push(new providers.AlchemyProvider(network, options.alchemy)); } catch (error) { } } - if (providers.PocketProvider) { + if (providers.PocketProvider && options.pocket !== "-") { // These networks are currently faulty on Pocket as their // network does not handle the Berlin hardfork, which is // live on these ones. // @TODO: This goes away once Pocket has upgraded their nodes const skip = ["goerli", "ropsten", "rinkeby"]; try { - const provider = new providers.PocketProvider(network); + const provider = new providers.PocketProvider(network, options.pocket); if (provider.network && skip.indexOf(provider.network.name) === -1) { providerList.push(provider); } } catch (error) { } } - if (providers.CloudflareProvider) { + if (providers.CloudflareProvider && options.cloudflare !== "-") { try { providerList.push(new providers.CloudflareProvider(network)); } catch (error) { } } + if (providers.AnkrProvider && options.ankr !== "-") { + try { + providerList.push(new providers.AnkrProvider(network, options.ankr)); + } + catch (error) { } + } if (providerList.length === 0) { return null; } @@ -44025,6 +44977,7 @@ name: "classicMordor", _defaultProvider: etcDefaultProvider$1("https://www.ethercluster.com/mordor", "classicMordor") }; + // See: https://chainlist.org const networks$1 = { unspecified: { chainId: 0, name: "unspecified" }, homestead: homestead$1, @@ -44049,6 +45002,7 @@ name: "goerli", _defaultProvider: ethDefaultProvider$1("goerli") }, + kintsugi: { chainId: 1337702, name: "kintsugi" }, // ETC (See: #351) classic: { chainId: 61, @@ -44066,6 +45020,11 @@ xdai: { chainId: 100, name: "xdai" }, matic: { chainId: 137, name: "matic" }, maticmum: { chainId: 80001, name: "maticmum" }, + optimism: { chainId: 10, name: "optimism" }, + "optimism-kovan": { chainId: 69, name: "optimism-kovan" }, + "optimism-goerli": { chainId: 420, name: "optimism-goerli" }, + arbitrum: { chainId: 42161, name: "arbitrum" }, + "arbitrum-rinkeby": { chainId: 421611, name: "arbitrum-rinkeby" }, bnb: { chainId: 56, name: "bnb" }, bnbt: { chainId: 97, name: "bnbt" }, }; @@ -44141,6 +45100,14 @@ }; } + function decode$1$1(textData) { + textData = atob(textData); + const data = []; + for (let i = 0; i < textData.length; i++) { + data.push(textData.charCodeAt(i)); + } + return arrayify$2(data); + } function encode$1$1(data) { data = arrayify$2(data); let textData = ""; @@ -44150,7 +45117,7 @@ return btoa(textData); } - const version$2$2 = "web/5.4.0"; + const version$2$2 = "web/5.6.0"; var __awaiter$3$2 = function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -44170,12 +45137,14 @@ method: (options.method || "GET"), headers: (options.headers || {}), body: (options.body || undefined), - mode: "cors", - cache: "no-cache", - credentials: "same-origin", - redirect: "follow", - referrer: "client", // no-referrer, *client }; + if (options.skipFetchSetup !== true) { + request.mode = "cors"; // no-cors, cors, *same-origin + request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached + request.credentials = "same-origin"; // include, *same-origin, omit + request.redirect = "follow"; // manual, *follow, error + request.referrer = "client"; // no-referrer, *client + } const response = yield fetch(href, request); const body = yield response.arrayBuffer(); const headers = {}; @@ -44244,6 +45213,7 @@ const throttleCallback = ((typeof (connection) === "object") ? connection.throttleCallback : null); const throttleSlotInterval = ((typeof (connection) === "object" && typeof (connection.throttleSlotInterval) === "number") ? connection.throttleSlotInterval : 100); logger$5$2.assertArgument((throttleSlotInterval > 0 && (throttleSlotInterval % 1) === 0), "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval); + const errorPassThrough = ((typeof (connection) === "object") ? !!(connection.errorPassThrough) : false); const headers = {}; let url = null; // @TODO: Allow ConnectionInfo to override some of these values @@ -44282,6 +45252,35 @@ value: "Basic " + encode$1$1(toUtf8Bytes$2(authorization)) }; } + if (connection.skipFetchSetup != null) { + options.skipFetchSetup = !!connection.skipFetchSetup; + } + } + const reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i"); + const dataMatch = ((url) ? url.match(reData) : null); + if (dataMatch) { + try { + const response = { + statusCode: 200, + statusMessage: "OK", + headers: { "content-type": dataMatch[1] }, + body: decode$1$1(dataMatch[2]) + }; + let result = response.body; + if (processFunc) { + result = processFunc(response.body, response); + } + return Promise.resolve(result); + } + catch (error) { + logger$5$2.throwError("processing response error", Logger$2.errors.SERVER_ERROR, { + body: bodyify$1(dataMatch[1], dataMatch[2]), + error: error, + requestBody: null, + requestMethod: "GET", + url: url + }); + } } if (body) { options.method = "POST"; @@ -44332,24 +45331,34 @@ let response = null; try { response = yield getUrl$1(url, options); - // Exponential back-off throttling - if (response.statusCode === 429 && attempt < attemptLimit) { - let tryAgain = true; - if (throttleCallback) { - tryAgain = yield throttleCallback(attempt, url); + if (attempt < attemptLimit) { + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirection; for now we only support absolute locataions + const location = response.headers.location || ""; + if (options.method === "GET" && location.match(/^https:/)) { + url = response.headers.location; + continue; + } } - if (tryAgain) { - let stall = 0; - const retryAfter = response.headers["retry-after"]; - if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { - stall = parseInt(retryAfter) * 1000; + else if (response.statusCode === 429) { + // Exponential back-off throttling + let tryAgain = true; + if (throttleCallback) { + tryAgain = yield throttleCallback(attempt, url); } - else { - stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + if (tryAgain) { + let stall = 0; + const retryAfter = response.headers["retry-after"]; + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1000; + } + else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + //console.log("Stalling 429"); + yield staller$1(stall); + continue; } - //console.log("Stalling 429"); - yield staller$1(stall); - continue; } } } @@ -44369,7 +45378,7 @@ if (allow304 && response.statusCode === 304) { body = null; } - else if (response.statusCode < 200 || response.statusCode >= 300) { + else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) { runningTimeout.cancel(); logger$5$2.throwError("bad response", Logger$2.errors.SERVER_ERROR, { status: response.statusCode, @@ -44411,7 +45420,7 @@ } } runningTimeout.cancel(); - // If we had a processFunc, it eitehr returned a T or threw above. + // If we had a processFunc, it either returned a T or threw above. // The "body" is now a Uint8Array. return body; } @@ -44658,7 +45667,7 @@ if (typeof res === 'object') return res } - function decode$2 (str) { + function decode$3 (str) { var res = __decode$1.apply(null, arguments); if (typeof res === 'object') return res @@ -44719,7 +45728,7 @@ var bech32$1 = { decodeUnsafe: decodeUnsafe$1, - decode: decode$2, + decode: decode$3, encode: encode$4, toWordsUnsafe: toWordsUnsafe$1, toWords: toWords$1, @@ -44727,7 +45736,7 @@ fromWords: fromWords$1 }; - const version$1$2 = "providers/5.4.5"; + const version$1$2 = "providers/5.6.5"; const logger$4$2 = new Logger$2(version$1$2); class Formatter$1 { @@ -44814,7 +45823,7 @@ type: type }; formats.block = { - hash: hash, + hash: Formatter$1.allowNull(hash), parentHash: hash, number: number, timestamp: number, @@ -44822,7 +45831,7 @@ difficulty: this.difficulty.bind(this), gasLimit: bigNumber, gasUsed: bigNumber, - miner: address, + miner: Formatter$1.allowNull(address), extraData: data, transactions: Formatter$1.allowNull(Formatter$1.arrayOf(hash)), baseFeePerGas: Formatter$1.allowNull(bigNumber) @@ -44858,17 +45867,17 @@ if (number === "0x") { return 0; } - return BigNumber$1$1.from(number).toNumber(); + return BigNumber$2.from(number).toNumber(); } type(number) { if (number === "0x" || number == null) { return 0; } - return BigNumber$1$1.from(number).toNumber(); + return BigNumber$2.from(number).toNumber(); } // Strict! Used on input. bigNumber(value) { - return BigNumber$1$1.from(value); + return BigNumber$2.from(value); } // Requires a boolean, "true" or "false"; returns a boolean boolean(value) { @@ -44948,7 +45957,7 @@ if (value == null) { return null; } - const v = BigNumber$1$1.from(value); + const v = BigNumber$2.from(value); try { return v.toNumber(); } @@ -44965,7 +45974,11 @@ if (value.author != null && value.miner == null) { value.miner = value.author; } - return Formatter$1.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$1.check(format, value); + result._difficulty = ((difficulty == null) ? null : BigNumber$2.from(difficulty)); + return result; } block(value) { return this._block(value, this.formats.block); @@ -44984,7 +45997,7 @@ } // Some clients (TestRPC) do strange things like return 0x0 for the // 0 address; correct this to be a real address - if (transaction.to && BigNumber$1$1.from(transaction.to).isZero()) { + if (transaction.to && BigNumber$2.from(transaction.to).isZero()) { transaction.to = "0x0000000000000000000000000000000000000000"; } // Rename input to data @@ -45002,7 +46015,7 @@ if (transaction.chainId != null) { let chainId = transaction.chainId; if (isHexString$2(chainId)) { - chainId = BigNumber$1$1.from(chainId).toNumber(); + chainId = BigNumber$2.from(chainId).toNumber(); } result.chainId = chainId; } @@ -45013,7 +46026,7 @@ chainId = transaction.chainId; } if (isHexString$2(chainId)) { - chainId = BigNumber$1$1.from(chainId).toNumber(); + chainId = BigNumber$2.from(chainId).toNumber(); } if (typeof (chainId) !== "number" && result.v != null) { chainId = (result.v - 35) / 2; @@ -45045,7 +46058,7 @@ if (result.root != null) { if (result.root.length <= 4) { // Could be 0x00, 0x0, 0x01 or 0x1 - const value = BigNumber$1$1.from(result.root).toNumber(); + const value = BigNumber$2.from(result.root).toNumber(); if (value === 0 || value === 1) { // Make sure if both are specified, they match if (result.status != null && (result.status !== value)) { @@ -45143,6 +46156,7 @@ }); }; const logger$3$2 = new Logger$2(version$1$2); + const MAX_CCIP_REDIRECTS$1 = 10; ////////////////////////////// // Event Serializeing function checkTopic$1(topic) { @@ -45243,6 +46257,8 @@ defineReadOnly$2(this, "tag", tag); defineReadOnly$2(this, "listener", listener); defineReadOnly$2(this, "once", once); + this._lastBlockNumber = -2; + this._inflight = false; } get event() { switch (this.type) { @@ -45293,42 +46309,155 @@ "700": { symbol: "xdai", ilk: "eth" }, }; function bytes32ify$1(value) { - return hexZeroPad$2(BigNumber$1$1.from(value).toHexString(), 32); + return hexZeroPad$2(BigNumber$2.from(value).toHexString(), 32); } // Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d) function base58Encode$1(data) { return Base58$1.encode(concat$2([data, hexDataSlice$2(sha256$2(sha256$2(data)), 0, 4)])); } + const matcherIpfs$1 = new RegExp("^(ipfs):/\/(.*)$", "i"); + const matchers$1 = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs$1, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), + ]; + function _parseString$1(result, start) { + try { + return toUtf8String$2(_parseBytes$1(result, start)); + } + catch (error) { } + return null; + } + function _parseBytes$1(result, start) { + if (result === "0x") { + return null; + } + const offset = BigNumber$2.from(hexDataSlice$2(result, start, start + 32)).toNumber(); + const length = BigNumber$2.from(hexDataSlice$2(result, offset, offset + 32)).toNumber(); + return hexDataSlice$2(result, offset + 32, offset + 32 + length); + } + // Trim off the ipfs:// prefix and return the default gateway URL + function getIpfsLink$1(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + logger$3$2.throwArgumentError("unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; + } + function numPad$1(value) { + const result = arrayify$2(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; + } + function bytesPad$1(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; + } + // ABI Encodes a series of (bytes, bytes, ...) + function encodeBytes$1(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(null); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = arrayify$2(datas[i]); + // Update the bytes offset + result[i] = numPad$1(byteCount); + // The length and padded value of data + result.push(numPad$1(data.length)); + result.push(bytesPad$1(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return hexConcat$2(result); + } class Resolver$1 { - constructor(provider, address, name) { + // The resolvedAddress is only for creating a ReverseLookup resolver + constructor(provider, address, name, resolvedAddress) { defineReadOnly$2(this, "provider", provider); defineReadOnly$2(this, "name", name); defineReadOnly$2(this, "address", provider.formatter.address(address)); + defineReadOnly$2(this, "_resolvedAddress", resolvedAddress); } - _fetchBytes(selector, parameters) { + supportsWildcard() { + if (!this._supportsEip2544) { + // supportsInterface(bytes4 = selector("resolve(bytes,bytes)")) + this._supportsEip2544 = this.provider.call({ + to: this.address, + data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000" + }).then((result) => { + return BigNumber$2.from(result).eq(1); + }).catch((error) => { + if (error.code === Logger$2.errors.CALL_EXCEPTION) { + return false; + } + // Rethrow the error: link is down, etc. Let future attempts retry. + this._supportsEip2544 = null; + throw error; + }); + } + return this._supportsEip2544; + } + _fetch(selector, parameters) { return __awaiter$1$2(this, void 0, void 0, function* () { - // keccak256("addr(bytes32,uint256)") - const transaction = { + // e.g. keccak256("addr(bytes32,uint256)") + const tx = { to: this.address, + ccipReadEnabled: true, data: hexConcat$2([selector, namehash$1(this.name), (parameters || "0x")]) }; + // Wildcard support; use EIP-2544 to resolve the request + let parseBytes = false; + if (yield this.supportsWildcard()) { + parseBytes = true; + // selector("resolve(bytes,bytes)") + tx.data = hexConcat$2(["0x9061b923", encodeBytes$1([dnsEncode$1(this.name), tx.data])]); + } try { - const result = yield this.provider.call(transaction); - if (result === "0x") { - return null; + let result = yield this.provider.call(tx); + if ((arrayify$2(result).length % 32) === 4) { + logger$3$2.throwError("resolver threw error", Logger$2.errors.CALL_EXCEPTION, { + transaction: tx, data: result + }); } - const offset = BigNumber$1$1.from(hexDataSlice$2(result, 0, 32)).toNumber(); - const length = BigNumber$1$1.from(hexDataSlice$2(result, offset, offset + 32)).toNumber(); - return hexDataSlice$2(result, offset + 32, offset + 32 + length); + if (parseBytes) { + result = _parseBytes$1(result, 0); + } + return result; } catch (error) { if (error.code === Logger$2.errors.CALL_EXCEPTION) { return null; } - return null; + throw error; } }); } + _fetchBytes(selector, parameters) { + return __awaiter$1$2(this, void 0, void 0, function* () { + const result = yield this._fetch(selector, parameters); + if (result != null) { + return _parseBytes$1(result, 0); + } + return null; + }); + } _getAddress(coinType, hexBytes) { const coinInfo = coinInfos$1[String(coinType)]; if (coinInfo == null) { @@ -45390,16 +46519,12 @@ if (coinType === 60) { try { // keccak256("addr(bytes32)") - const transaction = { - to: this.address, - data: ("0x3b3b57de" + namehash$1(this.name).substring(2)) - }; - const hexBytes = yield this.provider.call(transaction); + const result = yield this._fetch("0x3b3b57de"); // No address - if (hexBytes === "0x" || hexBytes === HashZero$1) { + if (result === "0x" || result === HashZero$1) { return null; } - return this.provider.formatter.callAddress(hexBytes); + return this.provider.formatter.callAddress(result); } catch (error) { if (error.code === Logger$2.errors.CALL_EXCEPTION) { @@ -45426,6 +46551,119 @@ return address; }); } + getAvatar() { + return __awaiter$1$2(this, void 0, void 0, function* () { + const linkage = [{ type: "name", content: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = yield this.getText("avatar"); + if (avatar == null) { + return null; + } + for (let i = 0; i < matchers$1.length; i++) { + const match = avatar.match(matchers$1[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + linkage.push({ type: "url", content: avatar }); + return { linkage, url: avatar }; + case "data": + linkage.push({ type: "data", content: avatar }); + return { linkage, url: avatar }; + case "ipfs": + linkage.push({ type: "ipfs", content: avatar }); + return { linkage, url: getIpfsLink$1(avatar) }; + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: scheme, content: avatar }); + // The owner of this name + const owner = (this._resolvedAddress || (yield this.getAddress())); + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return null; + } + const addr = yield this.provider.formatter.address(comps[0]); + const tokenId = hexZeroPad$2(BigNumber$2.from(comps[1]).toHexString(), 32); + // Check that this account owns the token + if (scheme === "erc721") { + // ownerOf(uint256 tokenId) + const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({ + to: addr, data: hexConcat$2(["0x6352211e", tokenId]) + })); + if (owner !== tokenOwner) { + return null; + } + linkage.push({ type: "owner", content: tokenOwner }); + } + else if (scheme === "erc1155") { + // balanceOf(address owner, uint256 tokenId) + const balance = BigNumber$2.from(yield this.provider.call({ + to: addr, data: hexConcat$2(["0x00fdd58e", hexZeroPad$2(owner, 32), tokenId]) + })); + if (balance.isZero()) { + return null; + } + linkage.push({ type: "balance", content: balance.toString() }); + } + // Call the token contract for the metadata URL + const tx = { + to: this.provider.formatter.address(comps[0]), + data: hexConcat$2([selector, tokenId]) + }; + let metadataUrl = _parseString$1(yield this.provider.call(tx), 0); + if (metadataUrl == null) { + return null; + } + linkage.push({ type: "metadata-url-base", content: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + linkage.push({ type: "metadata-url-expanded", content: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink$1(metadataUrl); + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + // Get the token metadata + const metadata = yield fetchJson$1(metadataUrl); + if (!metadata) { + return null; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + return null; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs$1); + if (ipfs == null) { + return null; + } + linkage.push({ type: "url-ipfs", content: imageUrl }); + imageUrl = getIpfsLink$1(imageUrl); + } + linkage.push({ type: "url", content: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return null; + }); + } getContentHash() { return __awaiter$1$2(this, void 0, void 0, function* () { // keccak256("contenthash()") @@ -45442,6 +46680,14 @@ return "ipfs:/\/" + Base58$1.encode("0x" + ipfs[1]); } } + // IPNS (CID: 1, Type: libp2p-key) + const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipns) { + const length = parseInt(ipns[3], 16); + if (ipns[4].length === length * 2) { + return "ipns:/\/" + Base58$1.encode("0x" + ipns[1]); + } + } // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); if (swarm) { @@ -45492,6 +46738,7 @@ // Events being listened to this._events = []; this._emitted = { block: -2 }; + this.disableCcipRead = false; this.formatter = new.target.getFormatter(); // If network is any, this Provider allows the underlying // network to change dynamically, and we auto-detect the @@ -45508,7 +46755,7 @@ this._ready().catch((error) => { }); } else { - const knownNetwork = getStatic$2((new.target), "getNetwork")(network); + const knownNetwork = getStatic$2(new.target, "getNetwork")(network); if (knownNetwork) { defineReadOnly$2(this, "_network", knownNetwork); this.emit("network", knownNetwork, null); @@ -45519,6 +46766,7 @@ } this._maxInternalBlockNumber = -1024; this._lastBlockNumber = -2; + this._maxFilterBlockRange = 10; this._pollingInterval = 4000; this._fastQueryDate = 0; } @@ -45557,7 +46805,7 @@ } // This will always return the most recently established network. // For "any", this can change (a "network" event is emitted before - // any change is refelcted); otherwise this cannot change + // any change is reflected); otherwise this cannot change get ready() { return poll$1(() => { return this._ready().then((network) => { @@ -45582,6 +46830,40 @@ static getNetwork(network) { return getNetwork$1((network == null) ? "homestead" : network); } + ccipReadFetch(tx, calldata, urls) { + return __awaiter$1$2(this, void 0, void 0, function* () { + if (this.disableCcipRead || urls.length === 0) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + const json = (url.indexOf("{data}") >= 0) ? null : JSON.stringify({ data, sender }); + const result = yield fetchJson$1({ url: href, errorPassThrough: true }, json, (value, response) => { + value.status = response.statusCode; + return value; + }); + if (result.data) { + return result.data; + } + const errorMessage = (result.message || "unknown error"); + // 4xx indicates the result is not present; stop + if (result.status >= 400 && result.status < 500) { + return logger$3$2.throwError(`response not found during CCIP fetch: ${errorMessage}`, Logger$2.errors.SERVER_ERROR, { url, errorMessage }); + } + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + return logger$3$2.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, Logger$2.errors.SERVER_ERROR, { + urls, errorMessages + }); + }); + } // Fetches the blockNumber, but will reuse any result that is less // than maxAge old or has been requested since the last request _getInternalBlockNumber(maxAge) { @@ -45626,7 +46908,7 @@ throw networkError; } const respTime = getTime$1(); - blockNumber = BigNumber$1$1.from(blockNumber).toNumber(); + blockNumber = BigNumber$2.from(blockNumber).toNumber(); if (blockNumber < this._maxInternalBlockNumber) { blockNumber = this._maxInternalBlockNumber; } @@ -45729,20 +47011,44 @@ break; } case "filter": { - const filter = event.filter; - filter.fromBlock = this._lastBlockNumber + 1; - filter.toBlock = blockNumber; - const runner = this.getLogs(filter).then((logs) => { - if (logs.length === 0) { - return; + // We only allow a single getLogs to be in-flight at a time + if (!event._inflight) { + event._inflight = true; + // Filter from the last known event; due to load-balancing + // and some nodes returning updated block numbers before + // indexing events, a logs result with 0 entries cannot be + // trusted and we must retry a range which includes it again + const filter = event.filter; + filter.fromBlock = event._lastBlockNumber + 1; + filter.toBlock = blockNumber; + // Prevent fitler ranges from growing too wild + if (filter.toBlock - this._maxFilterBlockRange > filter.fromBlock) { + filter.fromBlock = filter.toBlock - this._maxFilterBlockRange; } - logs.forEach((log) => { - this._emitted["b:" + log.blockHash] = log.blockNumber; - this._emitted["t:" + log.transactionHash] = log.blockNumber; - this.emit(filter, log); + const runner = this.getLogs(filter).then((logs) => { + // Allow the next getLogs + event._inflight = false; + if (logs.length === 0) { + return; + } + logs.forEach((log) => { + // Only when we get an event for a given block number + // can we trust the events are indexed + if (log.blockNumber > event._lastBlockNumber) { + event._lastBlockNumber = log.blockNumber; + } + // Make sure we stall requests to fetch blocks and txs + this._emitted["b:" + log.blockHash] = log.blockNumber; + this._emitted["t:" + log.transactionHash] = log.blockNumber; + this.emit(filter, log); + }); + }).catch((error) => { + this.emit("error", error); + // Allow another getLogs (the range was not updated) + event._inflight = false; }); - }).catch((error) => { this.emit("error", error); }); - runners.push(runner); + runners.push(runner); + } break; } } @@ -46045,7 +47351,7 @@ yield this.getNetwork(); const result = yield this.perform("getGasPrice", {}); try { - return BigNumber$1$1.from(result); + return BigNumber$2.from(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46064,7 +47370,7 @@ }); const result = yield this.perform("getBalance", params); try { - return BigNumber$1$1.from(result); + return BigNumber$2.from(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46083,7 +47389,7 @@ }); const result = yield this.perform("getTransactionCount", params); try { - return BigNumber$1$1.from(result).toNumber(); + return BigNumber$2.from(result).toNumber(); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46212,7 +47518,7 @@ if (values[key] == null) { return; } - tx[key] = Promise.resolve(values[key]).then((v) => (v ? BigNumber$1$1.from(v) : null)); + tx[key] = Promise.resolve(values[key]).then((v) => (v ? BigNumber$2.from(v) : null)); }); ["type"].forEach((key) => { if (values[key] == null) { @@ -46254,25 +47560,99 @@ return this.formatter.filter(yield resolveProperties$2(result)); }); } - call(transaction, blockTag) { + _call(transaction, blockTag, attempt) { return __awaiter$1$2(this, void 0, void 0, function* () { - yield this.getNetwork(); - const params = yield resolveProperties$2({ - transaction: this._getTransactionRequest(transaction), - blockTag: this._getBlockTag(blockTag) - }); - const result = yield this.perform("call", params); + if (attempt >= MAX_CCIP_REDIRECTS$1) { + logger$3$2.throwError("CCIP read exceeded maximum redirections", Logger$2.errors.SERVER_ERROR, { + redirects: attempt, transaction + }); + } + const txSender = transaction.to; + const result = yield this.perform("call", { transaction, blockTag }); + // CCIP Read request via OffchainLookup(address,string[],bytes,bytes4,bytes) + if (attempt >= 0 && blockTag === "latest" && txSender != null && result.substring(0, 10) === "0x556f1830" && (hexDataLength$2(result) % 32 === 4)) { + try { + const data = hexDataSlice$2(result, 4); + // Check the sender of the OffchainLookup matches the transaction + const sender = hexDataSlice$2(data, 0, 32); + if (!BigNumber$2.from(sender).eq(txSender)) { + logger$3$2.throwError("CCIP Read sender did not match", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + // Read the URLs from the response + const urls = []; + const urlsOffset = BigNumber$2.from(hexDataSlice$2(data, 32, 64)).toNumber(); + const urlsLength = BigNumber$2.from(hexDataSlice$2(data, urlsOffset, urlsOffset + 32)).toNumber(); + const urlsData = hexDataSlice$2(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString$1(urlsData, u * 32); + if (url == null) { + logger$3$2.throwError("CCIP Read contained corrupt URL string", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + urls.push(url); + } + // Get the CCIP calldata to forward + const calldata = _parseBytes$1(data, 64); + // Get the callbackSelector (bytes4) + if (!BigNumber$2.from(hexDataSlice$2(data, 100, 128)).isZero()) { + logger$3$2.throwError("CCIP Read callback selector included junk", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const callbackSelector = hexDataSlice$2(data, 96, 100); + // Get the extra data to send back to the contract as context + const extraData = _parseBytes$1(data, 128); + const ccipResult = yield this.ccipReadFetch(transaction, calldata, urls); + if (ccipResult == null) { + logger$3$2.throwError("CCIP Read disabled or provided no URLs", Logger$2.errors.CALL_EXCEPTION, { + name: "OffchainLookup", + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + transaction, data: result + }); + } + const tx = { + to: txSender, + data: hexConcat$2([callbackSelector, encodeBytes$1([ccipResult, extraData])]) + }; + return this._call(tx, blockTag, attempt + 1); + } + catch (error) { + if (error.code === Logger$2.errors.SERVER_ERROR) { + throw error; + } + } + } try { return hexlify$2(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { method: "call", - params, result, error + params: { transaction, blockTag }, result, error }); } }); } + call(transaction, blockTag) { + return __awaiter$1$2(this, void 0, void 0, function* () { + yield this.getNetwork(); + const resolved = yield resolveProperties$2({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag), + ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled) + }); + return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0 : -1); + }); + } estimateGas(transaction) { return __awaiter$1$2(this, void 0, void 0, function* () { yield this.getNetwork(); @@ -46281,7 +47661,7 @@ }); const result = yield this.perform("estimateGas", params); try { - return BigNumber$1$1.from(result); + return BigNumber$2.from(result); } catch (error) { return logger$3$2.throwError("bad result from backend", Logger$2.errors.SERVER_ERROR, { @@ -46293,6 +47673,10 @@ } _getAddress(addressOrName) { return __awaiter$1$2(this, void 0, void 0, function* () { + addressOrName = yield addressOrName; + if (typeof (addressOrName) !== "string") { + logger$3$2.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } const address = yield this.resolveName(addressOrName); if (address == null) { logger$3$2.throwError("ENS name not configured", Logger$2.errors.UNSUPPORTED_OPERATION, { @@ -46316,7 +47700,7 @@ } else { try { - params.blockTag = this.formatter.blockTag(yield this._getBlockTag(blockHashOrBlockTag)); + params.blockTag = yield this._getBlockTag(blockHashOrBlockTag); if (isHexString$2(params.blockTag)) { blockNumber = parseInt(params.blockTag.substring(2), 16); } @@ -46482,43 +47866,54 @@ } getResolver(name) { return __awaiter$1$2(this, void 0, void 0, function* () { - try { - const address = yield this._getResolver(name); - if (address == null) { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { return null; } - return new Resolver$1(this, address, name); - } - catch (error) { - if (error.code === Logger$2.errors.CALL_EXCEPTION) { + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { return null; } - return null; + // Check the current node for a resolver + const addr = yield this._getResolver(currentName, "getResolver"); + // Found a resolver! + if (addr != null) { + const resolver = new Resolver$1(this, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(yield resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); } }); } - _getResolver(name) { + _getResolver(name, operation) { return __awaiter$1$2(this, void 0, void 0, function* () { - // Get the resolver from the blockchain + if (operation == null) { + operation = "ENS"; + } const network = yield this.getNetwork(); // No ENS... if (!network.ensAddress) { - logger$3$2.throwError("network does not support ENS", Logger$2.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name }); + logger$3$2.throwError("network does not support ENS", Logger$2.errors.UNSUPPORTED_OPERATION, { operation, network: network.name }); } - // keccak256("resolver(bytes32)") - const transaction = { - to: network.ensAddress, - data: ("0x0178b8bf" + namehash$1(name).substring(2)) - }; try { - return this.formatter.callAddress(yield this.call(transaction)); + // keccak256("resolver(bytes32)") + const addrData = yield this.call({ + to: network.ensAddress, + data: ("0x0178b8bf" + namehash$1(name).substring(2)) + }); + return this.formatter.callAddress(addrData); } catch (error) { - if (error.code === Logger$2.errors.CALL_EXCEPTION) { - return null; - } - throw error; + // ENS registry cannot throw errors on resolver(bytes32) } + return null; }); } resolveName(name) { @@ -46537,7 +47932,7 @@ if (typeof (name) !== "string") { logger$3$2.throwArgumentError("invalid ENS name", "name", name); } - // Get the addr from the resovler + // Get the addr from the resolver const resolver = yield this.getResolver(name); if (!resolver) { return null; @@ -46549,39 +47944,75 @@ return __awaiter$1$2(this, void 0, void 0, function* () { address = yield address; address = this.formatter.address(address); - const reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; - const resolverAddress = yield this._getResolver(reverseName); - if (!resolverAddress) { + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddr = yield this._getResolver(node, "lookupAddress"); + if (resolverAddr == null) { return null; } // keccak("name(bytes32)") - let bytes = arrayify$2(yield this.call({ - to: resolverAddress, - data: ("0x691f3431" + namehash$1(reverseName).substring(2)) - })); - // Strip off the dynamic string pointer (0x20) - if (bytes.length < 32 || !BigNumber$1$1.from(bytes.slice(0, 32)).eq(32)) { + const name = _parseString$1(yield this.call({ + to: resolverAddr, + data: ("0x691f3431" + namehash$1(node).substring(2)) + }), 0); + const addr = yield this.resolveName(name); + if (addr != address) { return null; } - bytes = bytes.slice(32); - // Not a length-prefixed string - if (bytes.length < 32) { - return null; + return name; + }); + } + getAvatar(nameOrAddress) { + return __awaiter$1$2(this, void 0, void 0, function* () { + let resolver = null; + if (isHexString$2(nameOrAddress)) { + // Address; reverse lookup + const address = this.formatter.address(nameOrAddress); + const node = address.substring(2).toLowerCase() + ".addr.reverse"; + const resolverAddress = yield this._getResolver(node, "getAvatar"); + if (!resolverAddress) { + return null; + } + // Try resolving the avatar against the addr.reverse resolver + resolver = new Resolver$1(this, resolverAddress, node); + try { + const avatar = yield resolver.getAvatar(); + if (avatar) { + return avatar.url; + } + } + catch (error) { + if (error.code !== Logger$2.errors.CALL_EXCEPTION) { + throw error; + } + } + // Try getting the name and performing forward lookup; allowing wildcards + try { + // keccak("name(bytes32)") + const name = _parseString$1(yield this.call({ + to: resolverAddress, + data: ("0x691f3431" + namehash$1(node).substring(2)) + }), 0); + resolver = yield this.getResolver(name); + } + catch (error) { + if (error.code !== Logger$2.errors.CALL_EXCEPTION) { + throw error; + } + return null; + } } - // Get the length of the string (from the length-prefix) - const length = BigNumber$1$1.from(bytes.slice(0, 32)).toNumber(); - bytes = bytes.slice(32); - // Length longer than available data - if (length > bytes.length) { - return null; + else { + // ENS name; forward lookup with wildcard + resolver = yield this.getResolver(nameOrAddress); + if (!resolver) { + return null; + } } - const name = toUtf8String$2(bytes.slice(0, length)); - // Make sure the reverse record matches the foward record - const addr = yield this.resolveName(name); - if (addr != address) { + const avatar = yield resolver.getAvatar(); + if (avatar == null) { return null; } - return name; + return avatar.url; }); } perform(method, params) { @@ -46697,18 +48128,46 @@ }; const logger$2$2 = new Logger$2(version$1$2); const errorGas$1 = ["call", "estimateGas"]; + function spelunk$1(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match("reverted") && isHexString$2(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunk$1(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunk$1(JSON.parse(value)); + } + catch (error) { } + } + return null; + } function checkError$1(method, error, params) { // Undo the "convenience" some nodes are attempting to prevent backwards // incompatibility; maybe for v6 consider forwarding reverts as errors - if (method === "call" && error.code === Logger$2.errors.SERVER_ERROR) { - const e = error.error; - if (e && e.message.match("reverted") && isHexString$2(e.data)) { - return e.data; + if (method === "call") { + const result = spelunk$1(error); + if (result) { + return result.data; } - logger$2$2.throwError("missing revert data in call exception", Logger$2.errors.CALL_EXCEPTION, { + logger$2$2.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger$2.errors.CALL_EXCEPTION, { error, data: "0x" }); } + // @TODO: Should we spelunk for message too? let message = error.message; if (error.code === Logger$2.errors.SERVER_ERROR && error.error && typeof (error.error.message) === "string") { message = error.error.message; @@ -46722,25 +48181,25 @@ message = (message || "").toLowerCase(); const transaction = params.transaction || params.signedTransaction; // "insufficient funds for gas * price + value + cost(data)" - if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { logger$2$2.throwError("insufficient funds for intrinsic transaction cost", Logger$2.errors.INSUFFICIENT_FUNDS, { error, method, transaction }); } // "nonce too low" - if (message.match(/nonce too low/)) { + if (message.match(/nonce (is )?too low/i)) { logger$2$2.throwError("nonce has already been used", Logger$2.errors.NONCE_EXPIRED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/replacement transaction underpriced/)) { + if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) { logger$2$2.throwError("replacement fee too low", Logger$2.errors.REPLACEMENT_UNDERPRICED, { error, method, transaction }); } // "replacement transaction underpriced" - if (message.match(/only replay-protected/)) { + if (message.match(/only replay-protected/i)) { logger$2$2.throwError("legacy pre-eip-155 transactions not supported", Logger$2.errors.UNSUPPORTED_OPERATION, { error, method, transaction }); @@ -46773,12 +48232,12 @@ } return value; } - const _constructorGuard$5 = {}; + const _constructorGuard$4 = {}; class JsonRpcSigner$1 extends Signer$2 { constructor(constructorGuard, provider, addressOrIndex) { logger$2$2.checkNew(new.target, JsonRpcSigner$1); super(); - if (constructorGuard !== _constructorGuard$5) { + if (constructorGuard !== _constructorGuard$4) { throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); } defineReadOnly$2(this, "provider", provider); @@ -46803,7 +48262,7 @@ }); } connectUnchecked() { - return new UncheckedJsonRpcSigner$1(_constructorGuard$5, this.provider, this._address || this._index); + return new UncheckedJsonRpcSigner$1(_constructorGuard$4, this.provider, this._address || this._index); } getAddress() { if (this._address) { @@ -46896,6 +48355,13 @@ }); } signMessage(message) { + return __awaiter$9(this, void 0, void 0, function* () { + const data = ((typeof (message) === "string") ? toUtf8Bytes$2(message) : message); + const address = yield this.getAddress(); + return yield this.provider.send("personal_sign", [hexlify$2(data), address.toLowerCase()]); + }); + } + _legacySignMessage(message) { return __awaiter$9(this, void 0, void 0, function* () { const data = ((typeof (message) === "string") ? toUtf8Bytes$2(message) : message); const address = yield this.getAddress(); @@ -47013,7 +48479,7 @@ if (chainId != null) { const getNetwork = getStatic$2(this.constructor, "getNetwork"); try { - return getNetwork(BigNumber$1$1.from(chainId).toNumber()); + return getNetwork(BigNumber$2.from(chainId).toNumber()); } catch (error) { return logger$2$2.throwError("could not detect network", Logger$2.errors.NETWORK_ERROR, { @@ -47029,7 +48495,7 @@ }); } getSigner(addressOrIndex) { - return new JsonRpcSigner$1(_constructorGuard$5, this, addressOrIndex); + return new JsonRpcSigner$1(_constructorGuard$4, this, addressOrIndex); } getUncheckedSigner(addressOrIndex) { return this.getSigner(addressOrIndex).connectUnchecked(); @@ -47133,8 +48599,8 @@ // is fair), so we delete type if it is 0 and a non-EIP-1559 network if (method === "call" || method === "estimateGas") { const tx = params.transaction; - if (tx && tx.type != null && BigNumber$1$1.from(tx.type).isZero()) { - // If there are no EIP-1559 properties, it might be non-EIP-a559 + if (tx && tx.type != null && BigNumber$2.from(tx.type).isZero()) { + // If there are no EIP-1559 properties, it might be non-EIP-1559 if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { const feeData = yield this.getFeeData(); if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { @@ -47231,12 +48697,12 @@ } checkProperties$1(transaction, allowed); const result = {}; - // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. - ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { if (transaction[key] == null) { return; } - const value = hexValue$1(transaction[key]); + const value = hexValue$1(BigNumber$2.from(transaction[key])); if (key === "gasLimit") { key = "gas"; } @@ -47260,12 +48726,6 @@ function buildWeb3LegacyFetcher(provider, sendFunc) { const fetcher = "Web3LegacyFetcher"; 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 = { method: method, params: params, @@ -47313,12 +48773,6 @@ if (params == null) { 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 = { method, params }; this.emit("debug", { action: "request", @@ -47394,9 +48848,9 @@ } } - const version$k = "units/5.4.0"; + const version$j = "units/5.6.0"; - const logger$r = new Logger$2(version$k); + const logger$q = new Logger$2(version$j); const names$1 = [ "wei", "kwei", @@ -47408,7 +48862,7 @@ ]; function parseUnits$1(value, unitName) { if (typeof (value) !== "string") { - logger$r.throwArgumentError("value must be a string", "value", value); + logger$q.throwArgumentError("value must be a string", "value", value); } if (typeof (unitName) === "string") { const index = names$1.indexOf(unitName); @@ -47419,22 +48873,26 @@ return parseFixed$1(value, (unitName != null) ? unitName : 18); } - function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } class Transaction { - constructor({ blockchain, from, nonce, to, api, method, params, value, sent, confirmed, failed }) { + constructor({ blockchain, from, to, value, api, method, params, sent, confirmed, failed }) { + // required this.blockchain = blockchain; this.from = from; - this.nonce = nonce; this.to = to; + this.value = _optionalChain$3([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); + + // optional this.api = api; this.method = method; this.params = params; - this.value = _optionalChain$6([Transaction, 'access', _ => _.bigNumberify, 'call', _2 => _2(value, blockchain), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); this.sent = sent; this.confirmed = confirmed; this.failed = failed; + + // internal this._confirmed = false; this._failed = false; } @@ -47445,7 +48903,7 @@ static bigNumberify(value, blockchain) { if (typeof value === 'number') { - return parseUnits$1(value.toString(), CONSTANTS$2[blockchain].DECIMALS) + return parseUnits$1(value.toString(), CONSTANTS$3[blockchain].DECIMALS) } else if (value && value.toString) { return BigNumber$2.from(value.toString()) } else { @@ -47453,8 +48911,8 @@ } } - getContractArguments ({ contract }) { - let fragment = contract.interface.fragments.find((fragment) => { + getContractArguments() { + let fragment = this.getContract().interface.fragments.find((fragment) => { return fragment.name == this.method }); @@ -47469,6 +48927,17 @@ } } + getContract() { + return new Contract$1(this.to, this.api) + } + + async getData() { + let populatedTransaction = await this.getContract().populateTransaction[this.method].apply( + null, this.getContractArguments() + ); + return populatedTransaction.data + } + confirmation() { if (this._confirmed) { return Promise.resolve(this) @@ -47496,18 +48965,6 @@ } } - function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } - const estimate$2 = async ({ transaction, wallet })=> { - transaction = new Transaction(transaction); - if((await wallet.connectedTo(transaction.blockchain)) == false) { - await wallet.switchTo(transaction.blockchain); - } - let provider = new Web3Provider(window.ethereum, 'any'); - let signer = provider.getSigner(0); - let contract = new Contract$1(transaction.to, _optionalChain$5([transaction, 'optionalAccess', _ => _.api]), provider); - return contract.connect(signer).estimateGas[transaction.method](...transaction.getContractArguments({ contract }), { value: transaction.value }) - }; - const sendTransaction$2 = async ({ transaction, wallet })=> { transaction = new Transaction(transaction); if((await wallet.connectedTo(transaction.blockchain)) == false) { @@ -47574,13 +49031,13 @@ }) }; - function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } class Web3Wallet { static __initStatic() {this.info = { name: 'Web3 Wallet', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 446.42 376.77'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23828487;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M408.69,171.4H473.4V107.77a46.55,46.55,0,0,0-46.55-46.55H73.53A46.55,46.55,0,0,0,27,107.77v65.09H62.7L89.56,146a9.46,9.46,0,0,1,5.73-2.73h0l.41,0h78.59a47.2,47.2,0,1,1,82.63,39.56q-1.41,1.71-3,3.31t-3.31,3a47.21,47.21,0,0,1-76.31-26.9H100.21L73.34,189.07a9.43,9.43,0,0,1-5.73,2.73h0l-.41,0h-.07l-.48,0H27v74H55.83l18.25-18.24a9.39,9.39,0,0,1,5.73-2.74h0l.41,0h29.9a47.16,47.16,0,1,1,0,19H84.72L66.48,282.11a9.42,9.42,0,0,1-5.72,2.74h0l-.39,0H27V319H83.29a4,4,0,0,1,.49,0h.06l.41,0h0A9.41,9.41,0,0,1,90,321.78l28,28h57.66a47.2,47.2,0,1,1,81.48,40.9c-.6.67-1.22,1.32-1.86,2s-1.3,1.26-2,1.86a47.22,47.22,0,0,1-77.65-25.73H114.09a9.5,9.5,0,0,1-3.09-.52l-.08,0-.29-.11-.17-.07-.19-.08-.27-.12-.08,0a9.38,9.38,0,0,1-2.55-1.81l-28-28H27v53.46A46.55,46.55,0,0,0,73.53,438H426.86a46.55,46.55,0,0,0,46.54-46.55V327.82H408.69a78.22,78.22,0,0,1-78.21-78.21h0A78.22,78.22,0,0,1,408.69,171.4Z' transform='translate(-26.98 -61.22)'/%3E%3Cpath class='cls-1' d='M247.91,359.29a26,26,0,1,0-26,26A26,26,0,0,0,247.91,359.29Z' transform='translate(-26.98 -61.22)'/%3E%3Cpath class='cls-1' d='M246.55,152.71a26,26,0,1,0-26,26A26,26,0,0,0,246.55,152.71Z' transform='translate(-26.98 -61.22)'/%3E%3Ccircle class='cls-1' cx='129.39' cy='193.15' r='25.99'/%3E%3Cpath class='cls-1' d='M409.17,190h-.48a59.57,59.57,0,0,0-59.57,59.57h0a59.57,59.57,0,0,0,59.57,59.57h.48a59.58,59.58,0,0,0,59.58-59.57h0A59.58,59.58,0,0,0,409.17,190Zm14.45,90.61h-31l8.88-32.53a15.5,15.5,0,1,1,13.29,0Z' transform='translate(-26.98 -61.22)'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'] + blockchains: ['ethereum', 'bsc', 'polygon'] };} constructor () { @@ -47594,12 +49051,6 @@ transaction }) }; - this.estimate = (transaction)=> { - return estimate$2({ - wallet: this, - transaction - }) - }; } async account() { @@ -47607,13 +49058,13 @@ } async accounts() { - if(!_optionalChain$4([window, 'optionalAccess', _ => _.ethereum])) { return [] } + if(!_optionalChain$2([window, 'optionalAccess', _ => _.ethereum])) { return [] } const accounts = await window.ethereum.request({ method: 'eth_accounts' }); return accounts } async connect() { - if(!_optionalChain$4([window, 'optionalAccess', _2 => _2.ethereum])) { return [] } + if(!_optionalChain$2([window, 'optionalAccess', _2 => _2.ethereum])) { return [] } const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); return accounts } @@ -47721,7 +49172,7 @@ static __initStatic() {this.info = { name: 'Coinbase', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 488.96 488.96'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:url(%23linear-gradient);%7D.cls-2%7Bfill:%234361ad;%7D%3C/style%3E%3ClinearGradient id='linear-gradient' x1='250' y1='7.35' x2='250' y2='496.32' gradientTransform='matrix(1, 0, 0, -1, 0, 502)' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%233d5ba9'/%3E%3Cstop offset='1' stop-color='%234868b1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath class='cls-1' d='M250,5.68C114.87,5.68,5.52,115,5.52,250.17S114.87,494.65,250,494.65,494.48,385.29,494.48,250.17,385.13,5.68,250,5.68Zm0,387.54A143.06,143.06,0,1,1,393.05,250.17,143.11,143.11,0,0,1,250,393.22Z' transform='translate(-5.52 -5.68)'/%3E%3Cpath class='cls-2' d='M284.69,296.09H215.31a11,11,0,0,1-10.9-10.9V215.48a11,11,0,0,1,10.9-10.91H285a11,11,0,0,1,10.9,10.91v69.71A11.07,11.07,0,0,1,284.69,296.09Z' transform='translate(-5.52 -5.68)'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'], + blockchains: ['ethereum', 'bsc', 'polygon'], install: 'https://wallet.coinbase.com' };} } Coinbase.__initStatic(); @@ -47731,34 +49182,12 @@ static __initStatic() {this.info = { name: 'MetaMask', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 485.93 450.56'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23828487;%7D.cls-2%7Bfill:%23e27726;stroke:%23e27726;%7D.cls-10,.cls-11,.cls-2,.cls-3,.cls-4,.cls-5,.cls-6,.cls-7,.cls-8,.cls-9%7Bstroke-linecap:round;stroke-linejoin:round;%7D.cls-3%7Bfill:%23e37725;stroke:%23e37725;%7D.cls-4%7Bfill:%23d6c0b3;stroke:%23d6c0b3;%7D.cls-5%7Bfill:%23243447;stroke:%23243447;%7D.cls-6%7Bfill:%23cd6328;stroke:%23cd6328;%7D.cls-7%7Bfill:%23e37525;stroke:%23e37525;%7D.cls-8%7Bfill:%23f6851f;stroke:%23f6851f;%7D.cls-9%7Bfill:%23c1ae9e;stroke:%23c1ae9e;%7D.cls-10%7Bfill:%23171717;stroke:%23171717;%7D.cls-11%7Bfill:%23763e1a;stroke:%23763e1a;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M247.91,356.29a26,26,0,1,0-26,26A26,26,0,0,0,247.91,356.29Z' transform='translate(-7.97 -21.33)'/%3E%3Cpath class='cls-1' d='M246.55,149.71a26,26,0,1,0-26,26A26,26,0,0,0,246.55,149.71Z' transform='translate(-7.97 -21.33)'/%3E%3Ccircle class='cls-1' cx='148.4' cy='230.05' r='25.99'/%3E%3Cpolygon class='cls-2' points='461.28 0.5 272.06 141.03 307.05 58.12 461.28 0.5'/%3E%3Cpolygon class='cls-3' points='24.46 0.5 212.16 142.37 178.88 58.12 24.46 0.5'/%3E%3Cpolygon class='cls-3' points='393.2 326.26 342.81 403.47 450.63 433.14 481.63 327.97 393.2 326.26'/%3E%3Cpolygon class='cls-3' points='4.49 327.97 35.3 433.14 143.13 403.47 92.73 326.26 4.49 327.97'/%3E%3Cpolygon class='cls-3' points='137.04 195.8 107 241.25 214.06 246.01 210.26 130.96 137.04 195.8'/%3E%3Cpolygon class='cls-3' points='348.7 195.8 274.53 129.63 272.06 246.01 378.94 241.25 348.7 195.8'/%3E%3Cpolygon class='cls-3' points='143.13 403.47 207.41 372.09 151.88 328.73 143.13 403.47'/%3E%3Cpolygon class='cls-3' points='278.34 372.09 342.81 403.47 333.87 328.73 278.34 372.09'/%3E%3Cpolygon class='cls-4' points='342.81 403.47 278.34 372.09 283.47 414.12 282.9 431.81 342.81 403.47'/%3E%3Cpolygon class='cls-4' points='143.13 403.47 203.03 431.81 202.65 414.12 207.41 372.09 143.13 403.47'/%3E%3Cpolygon class='cls-5' points='203.98 300.97 150.35 285.18 188.2 267.88 203.98 300.97'/%3E%3Cpolygon class='cls-5' points='281.76 300.97 297.55 267.88 335.58 285.18 281.76 300.97'/%3E%3Cpolygon class='cls-6' points='143.13 403.47 152.25 326.26 92.73 327.97 143.13 403.47'/%3E%3Cpolygon class='cls-6' points='333.68 326.26 342.81 403.47 393.2 327.97 333.68 326.26'/%3E%3Cpolygon class='cls-6' points='378.94 241.25 272.06 246.01 281.95 300.97 297.74 267.88 335.77 285.18 378.94 241.25'/%3E%3Cpolygon class='cls-6' points='150.35 285.18 188.39 267.88 203.98 300.97 214.06 246.01 107 241.25 150.35 285.18'/%3E%3Cpolygon class='cls-7' points='107 241.25 151.88 328.73 150.35 285.18 107 241.25'/%3E%3Cpolygon class='cls-7' points='335.77 285.18 333.87 328.73 378.94 241.25 335.77 285.18'/%3E%3Cpolygon class='cls-7' points='214.06 246.01 203.98 300.97 216.53 365.82 219.38 280.43 214.06 246.01'/%3E%3Cpolygon class='cls-7' points='272.06 246.01 266.93 280.24 269.21 365.82 281.95 300.97 272.06 246.01'/%3E%3Cpolygon class='cls-8' points='281.95 300.97 269.21 365.82 278.34 372.09 333.87 328.73 335.77 285.18 281.95 300.97'/%3E%3Cpolygon class='cls-8' points='150.35 285.18 151.88 328.73 207.41 372.09 216.53 365.82 203.98 300.97 150.35 285.18'/%3E%3Cpolygon class='cls-9' points='282.9 431.81 283.47 414.12 278.72 409.94 207.02 409.94 202.65 414.12 203.03 431.81 143.13 403.47 164.05 420.58 206.45 450.06 279.29 450.06 321.89 420.58 342.81 403.47 282.9 431.81'/%3E%3Cpolygon class='cls-10' points='278.34 372.09 269.21 365.82 216.53 365.82 207.41 372.09 202.65 414.12 207.02 409.94 278.72 409.94 283.47 414.12 278.34 372.09'/%3E%3Cpolygon class='cls-11' points='469.27 150.16 485.43 72.57 461.28 0.5 278.34 136.28 348.7 195.8 448.16 224.9 470.22 199.23 460.71 192.38 475.92 178.5 464.13 169.37 479.35 157.77 469.27 150.16'/%3E%3Cpolygon class='cls-11' points='0.5 72.57 16.66 150.16 6.39 157.77 21.61 169.37 10.01 178.5 25.22 192.38 15.71 199.23 37.58 224.9 137.04 195.8 207.41 136.28 24.46 0.5 0.5 72.57'/%3E%3Cpolygon class='cls-8' points='448.16 224.9 348.7 195.8 378.94 241.25 333.87 328.73 393.2 327.97 481.63 327.97 448.16 224.9'/%3E%3Cpolygon class='cls-8' points='137.04 195.8 37.58 224.9 4.49 327.97 92.73 327.97 151.88 328.73 107 241.25 137.04 195.8'/%3E%3Cpolygon class='cls-8' points='272.06 246.01 278.34 136.28 307.24 58.12 178.88 58.12 207.41 136.28 214.06 246.01 216.34 280.62 216.53 365.82 269.21 365.82 269.59 280.62 272.06 246.01'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'], + blockchains: ['ethereum', 'bsc', 'polygon'], install: 'https://metamask.io/download.html' };} } MetaMask.__initStatic(); - function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } - const estimate$1 = async ({ transaction, wallet })=> { - transaction = new Transaction(transaction); - if((await wallet.connectedTo(transaction.blockchain)) == false) { - throw({ code: 'WRONG_NETWORK' }) - } - let from = await wallet.account(); - let contract = new Contract$1(transaction.to, transaction.api); - let populatedTransaction = await contract.populateTransaction[transaction.method].apply( - null, transaction.getContractArguments({ contract }) - ); - return wallet.connector.sendCustomRequest({ - method: 'eth_estimateGas', - params: [{ - from, - to: transaction.to, - value: _optionalChain$3([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]), - data: populatedTransaction.data - }] - }) - }; - - function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } const sendTransaction$1 = async ({ transaction, wallet })=> { transaction = new Transaction(transaction); await transaction.prepare({ wallet }); @@ -47827,17 +49256,12 @@ }; const submitContractInteraction$1 = async ({ transaction, wallet })=>{ - let contract = new Contract$1(transaction.to, transaction.api); - - let populatedTransaction = await contract.populateTransaction[transaction.method].apply( - null, transaction.getContractArguments({ contract }) - ); - return wallet.connector.sendTransaction({ from: transaction.from, to: transaction.to, - value: _optionalChain$2([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]), - data: populatedTransaction.data + value: _optionalChain$1([transaction, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]), + data: await transaction.getData(), + gas: (await estimate(transaction)).toString() }) }; @@ -47845,11 +49269,12 @@ return wallet.connector.sendTransaction({ from: transaction.from, to: transaction.to, - value: _optionalChain$2([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]) + value: _optionalChain$1([transaction, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]), + gas: CONSTANTS$3[transaction.blockchain].TRANSFER_GAS }) }; - function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } const setConnectedInstance$1 = (value)=>{ window._connectedWalletConnectInstance = value; }; @@ -47863,7 +49288,7 @@ static __initStatic() {this.info = { name: 'WalletConnect', logo: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 25.4.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 500 500' style='enable-background:new 0 0 500 500;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%235991CD;%7D%0A%3C/style%3E%3Cg id='Page-1'%3E%3Cg id='walletconnect-logo-alt'%3E%3Cpath id='WalletConnect' class='st0' d='M102.7,162c81.5-79.8,213.6-79.8,295.1,0l9.8,9.6c4.1,4,4.1,10.5,0,14.4L374,218.9 c-2,2-5.3,2-7.4,0l-13.5-13.2c-56.8-55.7-149-55.7-205.8,0l-14.5,14.1c-2,2-5.3,2-7.4,0L91.9,187c-4.1-4-4.1-10.5,0-14.4 L102.7,162z M467.1,229.9l29.9,29.2c4.1,4,4.1,10.5,0,14.4L362.3,405.4c-4.1,4-10.7,4-14.8,0c0,0,0,0,0,0L252,311.9 c-1-1-2.7-1-3.7,0h0l-95.5,93.5c-4.1,4-10.7,4-14.8,0c0,0,0,0,0,0L3.4,273.6c-4.1-4-4.1-10.5,0-14.4l29.9-29.2 c4.1-4,10.7-4,14.8,0l95.5,93.5c1,1,2.7,1,3.7,0c0,0,0,0,0,0l95.5-93.5c4.1-4,10.7-4,14.8,0c0,0,0,0,0,0l95.5,93.5 c1,1,2.7,1,3.7,0l95.5-93.5C456.4,225.9,463,225.9,467.1,229.9z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A", - blockchains: ['ethereum', 'bsc'] + blockchains: ['ethereum', 'bsc', 'polygon'] };} constructor() { @@ -47877,12 +49302,6 @@ transaction }) }; - this.estimate = (transaction)=> { - return estimate$1({ - wallet: this, - transaction - }) - }; } newWalletConnectInstance() { @@ -47940,7 +49359,7 @@ this.connector = this.newWalletConnectInstance(); } - const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$1([options, 'optionalAccess', _ => _.chainId]) }); + const { accounts, chainId } = await this.connector.connect({ chainId: _optionalChain$4([options, 'optionalAccess', _ => _.chainId]) }); if(accounts instanceof Array && accounts.length) { setConnectedInstance$1(this); @@ -48035,18 +49454,6 @@ } } WalletConnect$1.__initStatic(); - function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } - const estimate = async ({ transaction, wallet })=> { - transaction = new Transaction(transaction); - if((await wallet.connectedTo(transaction.blockchain)) == false) { - await wallet.switchTo(transaction.blockchain); - } - let provider = new Web3Provider(wallet.connector, 'any'); - let signer = provider.getSigner(0); - let contract = new Contract$1(transaction.to, _optionalChain$7([transaction, 'optionalAccess', _ => _.api]), provider); - return contract.connect(signer).estimateGas[transaction.method](...transaction.getContractArguments({ contract }), { value: transaction.value }) - }; - const sendTransaction = async ({ transaction, wallet })=> { transaction = new Transaction(transaction); if((await wallet.connectedTo(transaction.blockchain)) == false) { @@ -48126,7 +49533,7 @@ static __initStatic() {this.info = { name: 'Coinbase', logo: "data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 488.96 488.96'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:url(%23linear-gradient);%7D.cls-2%7Bfill:%234361ad;%7D%3C/style%3E%3ClinearGradient id='linear-gradient' x1='250' y1='7.35' x2='250' y2='496.32' gradientTransform='matrix(1, 0, 0, -1, 0, 502)' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%233d5ba9'/%3E%3Cstop offset='1' stop-color='%234868b1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath class='cls-1' d='M250,5.68C114.87,5.68,5.52,115,5.52,250.17S114.87,494.65,250,494.65,494.48,385.29,494.48,250.17,385.13,5.68,250,5.68Zm0,387.54A143.06,143.06,0,1,1,393.05,250.17,143.11,143.11,0,0,1,250,393.22Z' transform='translate(-5.52 -5.68)'/%3E%3Cpath class='cls-2' d='M284.69,296.09H215.31a11,11,0,0,1-10.9-10.9V215.48a11,11,0,0,1,10.9-10.91H285a11,11,0,0,1,10.9,10.91v69.71A11.07,11.07,0,0,1,284.69,296.09Z' transform='translate(-5.52 -5.68)'/%3E%3C/svg%3E", - blockchains: ['ethereum', 'bsc'], + blockchains: ['ethereum', 'bsc', 'polygon'], install: 'https://www.coinbase.com/wallet' };} @@ -48141,12 +49548,6 @@ transaction }) }; - this.estimate = (transaction)=> { - return estimate({ - wallet: this, - transaction - }) - }; } newWalletLinkInstance() { @@ -53813,6 +55214,124 @@ }, ]; + var ERC20onPolygon = [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'approve', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_from', type: 'address' }, + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [{ name: '', type: 'uint8' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_owner', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: 'balance', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_to', type: 'address' }, + { name: '_value', type: 'uint256' }, + ], + name: 'transfer', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { name: '_owner', type: 'address' }, + { name: '_spender', type: 'address' }, + ], + name: 'allowance', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { payable: true, stateMutability: 'payable', type: 'fallback' }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'owner', type: 'address' }, + { indexed: true, name: 'spender', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'from', type: 'address' }, + { indexed: true, name: 'to', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Transfer', + type: 'event' + }, + ]; + class Token { constructor({ blockchain, address }) { @@ -53821,8 +55340,8 @@ } async decimals() { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return CONSTANTS$2[this.blockchain].DECIMALS + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return CONSTANTS$3[this.blockchain].DECIMALS } let decimals = 0; try { @@ -53842,8 +55361,8 @@ } async symbol() { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return CONSTANTS$2[this.blockchain].SYMBOL + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return CONSTANTS$3[this.blockchain].SYMBOL } return await request( { @@ -53859,8 +55378,8 @@ } async name() { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return CONSTANTS$2[this.blockchain].CURRENCY + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return CONSTANTS$3[this.blockchain].CURRENCY } return await request( { @@ -53876,7 +55395,7 @@ } async balance(account) { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { return await request( { blockchain: this.blockchain, @@ -53904,8 +55423,8 @@ } async allowance(owner, spender) { - if (this.address == CONSTANTS$2[this.blockchain].NATIVE) { - return BigNumber.from(CONSTANTS$2[this.blockchain].MAXINT) + if (this.address == CONSTANTS$3[this.blockchain].NATIVE) { + return BigNumber.from(CONSTANTS$3[this.blockchain].MAXINT) } else { return await request( { @@ -53963,6 +55482,11 @@ BEP20 }; + Token.polygon = { + DEFAULT: ERC20onPolygon, + ERC20: ERC20onPolygon + }; + var route$7 = () => {}; let getAmount = async ({ amount, blockchain, address }) => { @@ -57619,7 +59143,7 @@ })(module, commonjsGlobal$3); }); - const version$4$3 = "logger/5.4.1"; + const version$4$3 = "logger/5.6.0"; let _permanentCensorErrors$3 = false; let _censorErrors$3 = false; @@ -57716,7 +59240,7 @@ // - errorArgs?: The EIP848 error parameters // - reason: The reason (only for EIP848 "Error(string)") ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; - // Insufficien funds (< value + gasLimit * gasPrice) + // Insufficient funds (< value + gasLimit * gasPrice) // - transaction: the transaction attempted ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used @@ -57798,6 +59322,40 @@ messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$3.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$3.CALL_EXCEPTION: + case ErrorCode$3.INSUFFICIENT_FUNDS: + case ErrorCode$3.MISSING_NEW: + case ErrorCode$3.NONCE_EXPIRED: + case ErrorCode$3.REPLACEMENT_UNDERPRICED: + case ErrorCode$3.TRANSACTION_REPLACED: + case ErrorCode$3.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -57931,7 +59489,7 @@ Logger$3.errors = ErrorCode$3; Logger$3.levels = LogLevel$3; - const version$3$3 = "bytes/5.4.0"; + const version$3$3 = "bytes/5.6.1"; const logger$4$3 = new Logger$3(version$3$3); /////////////////////////////// @@ -57948,6 +59506,9 @@ }; return array; } + function isInteger$3(value) { + return (typeof (value) === "number" && value == value && (value % 1) === 0); + } function isBytes$3(value) { if (value == null) { return false; @@ -57958,12 +59519,12 @@ if (typeof (value) === "string") { return false; } - if (value.length == null) { + if (!isInteger$3(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (typeof (v) !== "number" || v < 0 || v >= 256 || (v % 1)) { + if (!isInteger$3(v) || v < 0 || v >= 256) { return false; } } @@ -57995,7 +59556,7 @@ let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -58097,7 +59658,7 @@ return value; } - const version$2$3 = "bignumber/5.4.1"; + const version$2$3 = "bignumber/5.6.0"; var BN$3 = bn$3.BN; const logger$3$3 = new Logger$3(version$2$3); @@ -58146,7 +59707,7 @@ div(other) { const o = BigNumber$3.from(other); if (o.isZero()) { - throwFault$1$2("division by zero", "div"); + throwFault$1$2("division-by-zero", "div"); } return toBigNumber$3(toBN$3(this).div(toBN$3(other))); } @@ -58156,53 +59717,53 @@ mod(other) { const value = toBN$3(other); if (value.isNeg()) { - throwFault$1$2("cannot modulo negative values", "mod"); + throwFault$1$2("division-by-zero", "mod"); } return toBigNumber$3(toBN$3(this).umod(value)); } pow(other) { const value = toBN$3(other); if (value.isNeg()) { - throwFault$1$2("cannot raise to negative values", "pow"); + throwFault$1$2("negative-power", "pow"); } return toBigNumber$3(toBN$3(this).pow(value)); } and(other) { const value = toBN$3(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$2("cannot 'and' negative values", "and"); + throwFault$1$2("unbound-bitwise-result", "and"); } return toBigNumber$3(toBN$3(this).and(value)); } or(other) { const value = toBN$3(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$2("cannot 'or' negative values", "or"); + throwFault$1$2("unbound-bitwise-result", "or"); } return toBigNumber$3(toBN$3(this).or(value)); } xor(other) { const value = toBN$3(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$2("cannot 'xor' negative values", "xor"); + throwFault$1$2("unbound-bitwise-result", "xor"); } return toBigNumber$3(toBN$3(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$1$2("cannot mask negative values", "mask"); + throwFault$1$2("negative-width", "mask"); } return toBigNumber$3(toBN$3(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$1$2("cannot shift negative values", "shl"); + throwFault$1$2("negative-width", "shl"); } return toBigNumber$3(toBN$3(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$1$2("cannot shift negative values", "shr"); + throwFault$1$2("negative-width", "shr"); } return toBigNumber$3(toBN$3(this).shrn(value)); } @@ -58299,7 +59860,7 @@ return BigNumber$3.from(hexlify$3(anyValue)); } if (anyValue) { - // Hexable interface (takes piority) + // Hexable interface (takes priority) if (anyValue.toHexString) { const hex = anyValue.toHexString(); if (typeof (hex) === "string") { @@ -58336,7 +59897,7 @@ if (value[0] === "-") { // Strip off the negative sign value = value.substring(1); - // Cannot have mulitple negative signs (e.g. "--0x04") + // Cannot have multiple negative signs (e.g. "--0x04") if (value[0] === "-") { logger$3$3.throwArgumentError("invalid hex", "value", value); } @@ -58390,7 +59951,7 @@ } const logger$2$3 = new Logger$3(version$2$3); - const _constructorGuard$6 = {}; + const _constructorGuard$5 = {}; const Zero$4 = BigNumber$3.from(0); const NegativeOne$4 = BigNumber$3.from(-1); function throwFault$4(message, fault, operation, value) { @@ -58452,7 +60013,7 @@ decimals = 0; } const multiplier = getMultiplier$2(decimals); - if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) { + if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) { logger$2$3.throwArgumentError("invalid decimal value", "value", value); } // Is it negative? @@ -58475,12 +60036,17 @@ if (!fraction) { fraction = "0"; } - // Get significant digits to check truncation for underflow - { - const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig)); - if (sigFraction.length > multiplier.length - 1) { - throwFault$4("fractional component exceeds decimals", "underflow", "parseFixed"); - } + // Trim trailing zeros + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + // Check the fraction doesn't exceed our decimals size + if (fraction.length > multiplier.length - 1) { + throwFault$4("fractional component exceeds decimals", "underflow", "parseFixed"); + } + // If decimals is 0, we have an empty string for fraction + if (fraction === "") { + fraction = "0"; } // Fully pad the string with zeros to get to wei while (fraction.length < multiplier.length - 1) { @@ -58496,7 +60062,7 @@ } class FixedFormat$2 { constructor(constructorGuard, signed, width, decimals) { - if (constructorGuard !== _constructorGuard$6) { + if (constructorGuard !== _constructorGuard$5) { logger$2$3.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -58553,13 +60119,13 @@ if (decimals > 80) { logger$2$3.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); } - return new FixedFormat$2(_constructorGuard$6, signed, width, decimals); + return new FixedFormat$2(_constructorGuard$5, signed, width, decimals); } } class FixedNumber$2 { constructor(constructorGuard, hex, value, format) { logger$2$3.checkNew(new.target, FixedNumber$2); - if (constructorGuard !== _constructorGuard$6) { + if (constructorGuard !== _constructorGuard$5) { logger$2$3.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -58643,577 +60209,752 @@ const bump = BUMP$2.toFormat(this.format); return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); } - isZero() { - return (this._value === "0.0" || this._value === "0"); + isZero() { + return (this._value === "0.0" || this._value === "0"); + } + isNegative() { + return (this._value[0] === "-"); + } + toString() { return this._value; } + toHexString(width) { + if (width == null) { + return this._hex; + } + if (width % 8) { + logger$2$3.throwArgumentError("invalid byte width", "width", width); + } + const hex = BigNumber$3.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + return hexZeroPad$3(hex, width / 8); + } + toUnsafeFloat() { return parseFloat(this.toString()); } + toFormat(format) { + return FixedNumber$2.fromString(this._value, format); + } + static fromValue(value, decimals, format) { + // If decimals looks more like a format, and there is no format, shift the parameters + if (format == null && decimals != null && !isBigNumberish$2(decimals)) { + format = decimals; + decimals = null; + } + if (decimals == null) { + decimals = 0; + } + if (format == null) { + format = "fixed"; + } + return FixedNumber$2.fromString(formatFixed$2(value, decimals), FixedFormat$2.from(format)); + } + static fromString(value, format) { + if (format == null) { + format = "fixed"; + } + const fixedFormat = FixedFormat$2.from(format); + const numeric = parseFixed$2(value, fixedFormat.decimals); + if (!fixedFormat.signed && numeric.lt(Zero$4)) { + throwFault$4("unsigned value cannot be negative", "overflow", "value", value); + } + let hex = null; + if (fixedFormat.signed) { + hex = numeric.toTwos(fixedFormat.width).toHexString(); + } + else { + hex = numeric.toHexString(); + hex = hexZeroPad$3(hex, fixedFormat.width / 8); + } + const decimal = formatFixed$2(numeric, fixedFormat.decimals); + return new FixedNumber$2(_constructorGuard$5, hex, decimal, fixedFormat); + } + static fromBytes(value, format) { + if (format == null) { + format = "fixed"; + } + const fixedFormat = FixedFormat$2.from(format); + if (arrayify$3(value).length > fixedFormat.width / 8) { + throw new Error("overflow"); + } + let numeric = BigNumber$3.from(value); + if (fixedFormat.signed) { + numeric = numeric.fromTwos(fixedFormat.width); + } + const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); + const decimal = formatFixed$2(numeric, fixedFormat.decimals); + return new FixedNumber$2(_constructorGuard$5, hex, decimal, fixedFormat); + } + static from(value, format) { + if (typeof (value) === "string") { + return FixedNumber$2.fromString(value, format); + } + if (isBytes$3(value)) { + return FixedNumber$2.fromBytes(value, format); + } + try { + return FixedNumber$2.fromValue(value, 0, format); + } + catch (error) { + // Allow NUMERIC_FAULT to bubble up + if (error.code !== Logger$3.errors.INVALID_ARGUMENT) { + throw error; + } + } + return logger$2$3.throwArgumentError("invalid FixedNumber value", "value", value); + } + static isFixedNumber(value) { + return !!(value && value._isFixedNumber); + } + } + const ONE$2 = FixedNumber$2.from(1); + const BUMP$2 = FixedNumber$2.from("0.5"); + + /** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ + + var sha3$3 = createCommonjsModule$4(function (module) { + /*jslint bitwise: true */ + (function () { + + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = typeof window === 'object'; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; + if (NODE_JS) { + root = commonjsGlobal$3; + } else if (WEB_WORKER) { + root = self; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, + 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, + 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, + 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, + 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; + + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } + + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } + + var createOutputMethod = function (bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; + + var createShakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function (bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function (bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function (method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); + } + return method; + }; + + var createMethod = function (bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function (bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function (bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [ + { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, + { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, + { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }, + { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod }, + { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } + ]; + + var methods = {}, methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } + + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = (1600 - (bits << 1)) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + var notString, type = typeof message; + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, + blockCount = this.blockCount, index = 0, s = this.s, i, code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); + blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, type = typeof str; + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + notString = true; + } + var bytes = 0, length = str.length; + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff)); + bytes += 4; + } + } + } + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); } - isNegative() { - return (this._value[0] === "-"); + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; } - toString() { return this._value; } - toHexString(width) { - if (width == null) { - return this._hex; - } - if (width % 8) { - logger$2$3.throwArgumentError("invalid byte width", "width", width); - } - const hex = BigNumber$3.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); - return hexZeroPad$3(hex, width / 8); + this.finalized = true; + var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } } - toUnsafeFloat() { return parseFloat(this.toString()); } - toFormat(format) { - return FixedNumber$2.fromString(this._value, format); + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; } - static fromValue(value, decimals, format) { - // If decimals looks more like a format, and there is no format, shift the parameters - if (format == null && decimals != null && !isBigNumberish$2(decimals)) { - format = decimals; - decimals = null; - } - if (decimals == null) { - decimals = 0; - } - if (format == null) { - format = "fixed"; - } - return FixedNumber$2.fromString(formatFixed$2(value, decimals), FixedFormat$2.from(format)); + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var hex = '', block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + + HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + + HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + + HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } } - static fromString(value, format) { - if (format == null) { - format = "fixed"; - } - const fixedFormat = FixedFormat$2.from(format); - const numeric = parseFixed$2(value, fixedFormat.decimals); - if (!fixedFormat.signed && numeric.lt(Zero$4)) { - throwFault$4("unsigned value cannot be negative", "overflow", "value", value); - } - let hex = null; - if (fixedFormat.signed) { - hex = numeric.toTwos(fixedFormat.width).toHexString(); - } - else { - hex = numeric.toHexString(); - hex = hexZeroPad$3(hex, fixedFormat.width / 8); - } - const decimal = formatFixed$2(numeric, fixedFormat.decimals); - return new FixedNumber$2(_constructorGuard$6, hex, decimal, fixedFormat); + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; + if (extraBytes > 1) { + hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; + } } - static fromBytes(value, format) { - if (format == null) { - format = "fixed"; - } - const fixedFormat = FixedFormat$2.from(format); - if (arrayify$3(value).length > fixedFormat.width / 8) { - throw new Error("overflow"); - } - let numeric = BigNumber$3.from(value); - if (fixedFormat.signed) { - numeric = numeric.fromTwos(fixedFormat.width); - } - const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); - const decimal = formatFixed$2(numeric, fixedFormat.decimals); - return new FixedNumber$2(_constructorGuard$6, hex, decimal, fixedFormat); + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer((outputBlocks + 1) << 2); + } else { + buffer = new ArrayBuffer(bytes); } - static from(value, format) { - if (typeof (value) === "string") { - return FixedNumber$2.fromString(value, format); - } - if (isBytes$3(value)) { - return FixedNumber$2.fromBytes(value, format); - } - try { - return FixedNumber$2.fromValue(value, 0, format); - } - catch (error) { - // Allow NUMERIC_FAULT to bubble up - if (error.code !== Logger$3.errors.INVALID_ARGUMENT) { - throw error; - } - } - return logger$2$3.throwArgumentError("invalid FixedNumber value", "value", value); + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } } - static isFixedNumber(value) { - return !!(value && value._isFixedNumber); + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); } - } - const ONE$2 = FixedNumber$2.from(1); - const BUMP$2 = FixedNumber$2.from("0.5"); + return buffer; + }; - /** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.5.7 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2016 - * @license MIT - */ + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - var sha3$3 = createCommonjsModule$4(function (module) { - /*jslint bitwise: true */ - (function () { - - var root = typeof window === 'object' ? window : {}; - var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof browser$1 === 'object' && browser$1.versions && browser$1.versions.node; - if (NODE_JS) { - root = commonjsGlobal$3; - } - var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports; - var HEX_CHARS = '0123456789abcdef'.split(''); - var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; - var KECCAK_PADDING = [1, 256, 65536, 16777216]; - var PADDING = [6, 1536, 393216, 100663296]; - var SHIFT = [0, 8, 16, 24]; - var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, - 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, - 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, - 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, - 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; - var BITS = [224, 256, 384, 512]; - var SHAKE_BITS = [128, 256]; - var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; - - var createOutputMethod = function (bits, padding, outputType) { - return function (message) { - return new Keccak(bits, padding, bits).update(message)[outputType](); - }; - }; - - var createShakeOutputMethod = function (bits, padding, outputType) { - return function (message, outputBits) { - return new Keccak(bits, padding, outputBits).update(message)[outputType](); - }; - }; - - var createMethod = function (bits, padding) { - var method = createOutputMethod(bits, padding, 'hex'); - method.create = function () { - return new Keccak(bits, padding, bits); - }; - method.update = function (message) { - return method.create().update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createOutputMethod(bits, padding, type); - } - return method; - }; - - var createShakeMethod = function (bits, padding) { - var method = createShakeOutputMethod(bits, padding, 'hex'); - method.create = function (outputBits) { - return new Keccak(bits, padding, outputBits); - }; - method.update = function (message, outputBits) { - return method.create(outputBits).update(message); - }; - for (var i = 0; i < OUTPUT_TYPES.length; ++i) { - var type = OUTPUT_TYPES[i]; - method[type] = createShakeOutputMethod(bits, padding, type); - } - return method; - }; - - var algorithms = [ - {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod}, - {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod}, - {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod} - ]; - - var methods = {}, methodNames = []; - - for (var i = 0; i < algorithms.length; ++i) { - var algorithm = algorithms[i]; - var bits = algorithm.bits; - for (var j = 0; j < bits.length; ++j) { - var methodName = algorithm.name +'_' + bits[j]; - methodNames.push(methodName); - methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); - } - } - - function Keccak(bits, padding, outputBits) { - this.blocks = []; - this.s = []; - this.padding = padding; - this.outputBits = outputBits; - this.reset = true; - this.block = 0; - this.start = 0; - this.blockCount = (1600 - (bits << 1)) >> 5; - this.byteCount = this.blockCount << 2; - this.outputBlocks = outputBits >> 5; - this.extraBytes = (outputBits & 31) >> 3; - - for (var i = 0; i < 50; ++i) { - this.s[i] = 0; - } - } - - Keccak.prototype.update = function (message) { - var notString = typeof message !== 'string'; - if (notString && message.constructor === ArrayBuffer) { - message = new Uint8Array(message); - } - var length = message.length, blocks = this.blocks, byteCount = this.byteCount, - blockCount = this.blockCount, index = 0, s = this.s, i, code; - - while (index < length) { - if (this.reset) { - this.reset = false; - blocks[0] = this.block; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - if (notString) { - for (i = this.start; index < length && i < byteCount; ++index) { - blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; - } - } else { - for (i = this.start; index < length && i < byteCount; ++index) { - code = message.charCodeAt(index); - if (code < 0x80) { - blocks[i >> 2] |= code << SHIFT[i++ & 3]; - } else if (code < 0x800) { - blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else if (code < 0xd800 || code >= 0xe000) { - blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } else { - code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); - blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; - blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; - } - } - } - this.lastByteIndex = i; - if (i >= byteCount) { - this.start = i - byteCount; - this.block = blocks[blockCount]; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - this.reset = true; - } else { - this.start = i; - } - } - return this; - }; - - Keccak.prototype.finalize = function () { - var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s; - blocks[i >> 2] |= this.padding[i & 3]; - if (this.lastByteIndex === this.byteCount) { - blocks[0] = blocks[blockCount]; - for (i = 1; i < blockCount + 1; ++i) { - blocks[i] = 0; - } - } - blocks[blockCount - 1] |= 0x80000000; - for (i = 0; i < blockCount; ++i) { - s[i] ^= blocks[i]; - } - f(s); - }; - - Keccak.prototype.toString = Keccak.prototype.hex = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var hex = '', block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - block = s[i]; - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] + - HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] + - HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] + - HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F]; - } - if (j % blockCount === 0) { - f(s); - i = 0; - } - } - if (extraBytes) { - block = s[i]; - if (extraBytes > 0) { - hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F]; - } - if (extraBytes > 1) { - hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F]; - } - if (extraBytes > 2) { - hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F]; - } - } - return hex; - }; - - Keccak.prototype.arrayBuffer = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var bytes = this.outputBits >> 3; - var buffer; - if (extraBytes) { - buffer = new ArrayBuffer((outputBlocks + 1) << 2); - } else { - buffer = new ArrayBuffer(bytes); - } - var array = new Uint32Array(buffer); - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - array[j] = s[i]; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - array[i] = s[i]; - buffer = buffer.slice(0, bytes); - } - return buffer; - }; - - Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - - Keccak.prototype.digest = Keccak.prototype.array = function () { - this.finalize(); - - var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, - extraBytes = this.extraBytes, i = 0, j = 0; - var array = [], offset, block; - while (j < outputBlocks) { - for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { - offset = j << 2; - block = s[i]; - array[offset] = block & 0xFF; - array[offset + 1] = (block >> 8) & 0xFF; - array[offset + 2] = (block >> 16) & 0xFF; - array[offset + 3] = (block >> 24) & 0xFF; - } - if (j % blockCount === 0) { - f(s); - } - } - if (extraBytes) { - offset = j << 2; - block = s[i]; - if (extraBytes > 0) { - array[offset] = block & 0xFF; - } - if (extraBytes > 1) { - array[offset + 1] = (block >> 8) & 0xFF; - } - if (extraBytes > 2) { - array[offset + 2] = (block >> 16) & 0xFF; - } - } - return array; - }; - - var f = function (s) { - var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, - b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, - b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, - b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; - for (n = 0; n < 48; n += 2) { - c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; - c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; - c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; - c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; - c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; - c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; - c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; - c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; - c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; - c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; - - h = c8 ^ ((c2 << 1) | (c3 >>> 31)); - l = c9 ^ ((c3 << 1) | (c2 >>> 31)); - s[0] ^= h; - s[1] ^= l; - s[10] ^= h; - s[11] ^= l; - s[20] ^= h; - s[21] ^= l; - s[30] ^= h; - s[31] ^= l; - s[40] ^= h; - s[41] ^= l; - h = c0 ^ ((c4 << 1) | (c5 >>> 31)); - l = c1 ^ ((c5 << 1) | (c4 >>> 31)); - s[2] ^= h; - s[3] ^= l; - s[12] ^= h; - s[13] ^= l; - s[22] ^= h; - s[23] ^= l; - s[32] ^= h; - s[33] ^= l; - s[42] ^= h; - s[43] ^= l; - h = c2 ^ ((c6 << 1) | (c7 >>> 31)); - l = c3 ^ ((c7 << 1) | (c6 >>> 31)); - s[4] ^= h; - s[5] ^= l; - s[14] ^= h; - s[15] ^= l; - s[24] ^= h; - s[25] ^= l; - s[34] ^= h; - s[35] ^= l; - s[44] ^= h; - s[45] ^= l; - h = c4 ^ ((c8 << 1) | (c9 >>> 31)); - l = c5 ^ ((c9 << 1) | (c8 >>> 31)); - s[6] ^= h; - s[7] ^= l; - s[16] ^= h; - s[17] ^= l; - s[26] ^= h; - s[27] ^= l; - s[36] ^= h; - s[37] ^= l; - s[46] ^= h; - s[47] ^= l; - h = c6 ^ ((c0 << 1) | (c1 >>> 31)); - l = c7 ^ ((c1 << 1) | (c0 >>> 31)); - s[8] ^= h; - s[9] ^= l; - s[18] ^= h; - s[19] ^= l; - s[28] ^= h; - s[29] ^= l; - s[38] ^= h; - s[39] ^= l; - s[48] ^= h; - s[49] ^= l; - - b0 = s[0]; - b1 = s[1]; - b32 = (s[11] << 4) | (s[10] >>> 28); - b33 = (s[10] << 4) | (s[11] >>> 28); - b14 = (s[20] << 3) | (s[21] >>> 29); - b15 = (s[21] << 3) | (s[20] >>> 29); - b46 = (s[31] << 9) | (s[30] >>> 23); - b47 = (s[30] << 9) | (s[31] >>> 23); - b28 = (s[40] << 18) | (s[41] >>> 14); - b29 = (s[41] << 18) | (s[40] >>> 14); - b20 = (s[2] << 1) | (s[3] >>> 31); - b21 = (s[3] << 1) | (s[2] >>> 31); - b2 = (s[13] << 12) | (s[12] >>> 20); - b3 = (s[12] << 12) | (s[13] >>> 20); - b34 = (s[22] << 10) | (s[23] >>> 22); - b35 = (s[23] << 10) | (s[22] >>> 22); - b16 = (s[33] << 13) | (s[32] >>> 19); - b17 = (s[32] << 13) | (s[33] >>> 19); - b48 = (s[42] << 2) | (s[43] >>> 30); - b49 = (s[43] << 2) | (s[42] >>> 30); - b40 = (s[5] << 30) | (s[4] >>> 2); - b41 = (s[4] << 30) | (s[5] >>> 2); - b22 = (s[14] << 6) | (s[15] >>> 26); - b23 = (s[15] << 6) | (s[14] >>> 26); - b4 = (s[25] << 11) | (s[24] >>> 21); - b5 = (s[24] << 11) | (s[25] >>> 21); - b36 = (s[34] << 15) | (s[35] >>> 17); - b37 = (s[35] << 15) | (s[34] >>> 17); - b18 = (s[45] << 29) | (s[44] >>> 3); - b19 = (s[44] << 29) | (s[45] >>> 3); - b10 = (s[6] << 28) | (s[7] >>> 4); - b11 = (s[7] << 28) | (s[6] >>> 4); - b42 = (s[17] << 23) | (s[16] >>> 9); - b43 = (s[16] << 23) | (s[17] >>> 9); - b24 = (s[26] << 25) | (s[27] >>> 7); - b25 = (s[27] << 25) | (s[26] >>> 7); - b6 = (s[36] << 21) | (s[37] >>> 11); - b7 = (s[37] << 21) | (s[36] >>> 11); - b38 = (s[47] << 24) | (s[46] >>> 8); - b39 = (s[46] << 24) | (s[47] >>> 8); - b30 = (s[8] << 27) | (s[9] >>> 5); - b31 = (s[9] << 27) | (s[8] >>> 5); - b12 = (s[18] << 20) | (s[19] >>> 12); - b13 = (s[19] << 20) | (s[18] >>> 12); - b44 = (s[29] << 7) | (s[28] >>> 25); - b45 = (s[28] << 7) | (s[29] >>> 25); - b26 = (s[38] << 8) | (s[39] >>> 24); - b27 = (s[39] << 8) | (s[38] >>> 24); - b8 = (s[48] << 14) | (s[49] >>> 18); - b9 = (s[49] << 14) | (s[48] >>> 18); - - s[0] = b0 ^ (~b2 & b4); - s[1] = b1 ^ (~b3 & b5); - s[10] = b10 ^ (~b12 & b14); - s[11] = b11 ^ (~b13 & b15); - s[20] = b20 ^ (~b22 & b24); - s[21] = b21 ^ (~b23 & b25); - s[30] = b30 ^ (~b32 & b34); - s[31] = b31 ^ (~b33 & b35); - s[40] = b40 ^ (~b42 & b44); - s[41] = b41 ^ (~b43 & b45); - s[2] = b2 ^ (~b4 & b6); - s[3] = b3 ^ (~b5 & b7); - s[12] = b12 ^ (~b14 & b16); - s[13] = b13 ^ (~b15 & b17); - s[22] = b22 ^ (~b24 & b26); - s[23] = b23 ^ (~b25 & b27); - s[32] = b32 ^ (~b34 & b36); - s[33] = b33 ^ (~b35 & b37); - s[42] = b42 ^ (~b44 & b46); - s[43] = b43 ^ (~b45 & b47); - s[4] = b4 ^ (~b6 & b8); - s[5] = b5 ^ (~b7 & b9); - s[14] = b14 ^ (~b16 & b18); - s[15] = b15 ^ (~b17 & b19); - s[24] = b24 ^ (~b26 & b28); - s[25] = b25 ^ (~b27 & b29); - s[34] = b34 ^ (~b36 & b38); - s[35] = b35 ^ (~b37 & b39); - s[44] = b44 ^ (~b46 & b48); - s[45] = b45 ^ (~b47 & b49); - s[6] = b6 ^ (~b8 & b0); - s[7] = b7 ^ (~b9 & b1); - s[16] = b16 ^ (~b18 & b10); - s[17] = b17 ^ (~b19 & b11); - s[26] = b26 ^ (~b28 & b20); - s[27] = b27 ^ (~b29 & b21); - s[36] = b36 ^ (~b38 & b30); - s[37] = b37 ^ (~b39 & b31); - s[46] = b46 ^ (~b48 & b40); - s[47] = b47 ^ (~b49 & b41); - s[8] = b8 ^ (~b0 & b2); - s[9] = b9 ^ (~b1 & b3); - s[18] = b18 ^ (~b10 & b12); - s[19] = b19 ^ (~b11 & b13); - s[28] = b28 ^ (~b20 & b22); - s[29] = b29 ^ (~b21 & b23); - s[38] = b38 ^ (~b30 & b32); - s[39] = b39 ^ (~b31 & b33); - s[48] = b48 ^ (~b40 & b42); - s[49] = b49 ^ (~b41 & b43); - - s[0] ^= RC[n]; - s[1] ^= RC[n + 1]; - } - }; - - if (COMMON_JS) { - module.exports = methods; - } else { - for (var i = 0; i < methodNames.length; ++i) { - root[methodNames[i]] = methods[methodNames[i]]; - } - } + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, i = 0, j = 0; + var array = [], offset, block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = (block >> 8) & 0xFF; + array[offset + 2] = (block >> 16) & 0xFF; + array[offset + 3] = (block >> 24) & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + if (extraBytes > 1) { + array[offset + 1] = (block >> 8) & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = (block >> 16) & 0xFF; + } + } + return array; + }; + + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } + + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function (s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, + b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, + b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, + b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ ((c2 << 1) | (c3 >>> 31)); + l = c9 ^ ((c3 << 1) | (c2 >>> 31)); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ ((c4 << 1) | (c5 >>> 31)); + l = c1 ^ ((c5 << 1) | (c4 >>> 31)); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ ((c6 << 1) | (c7 >>> 31)); + l = c3 ^ ((c7 << 1) | (c6 >>> 31)); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ ((c8 << 1) | (c9 >>> 31)); + l = c5 ^ ((c9 << 1) | (c8 >>> 31)); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ ((c0 << 1) | (c1 >>> 31)); + l = c7 ^ ((c1 << 1) | (c0 >>> 31)); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = (s[11] << 4) | (s[10] >>> 28); + b33 = (s[10] << 4) | (s[11] >>> 28); + b14 = (s[20] << 3) | (s[21] >>> 29); + b15 = (s[21] << 3) | (s[20] >>> 29); + b46 = (s[31] << 9) | (s[30] >>> 23); + b47 = (s[30] << 9) | (s[31] >>> 23); + b28 = (s[40] << 18) | (s[41] >>> 14); + b29 = (s[41] << 18) | (s[40] >>> 14); + b20 = (s[2] << 1) | (s[3] >>> 31); + b21 = (s[3] << 1) | (s[2] >>> 31); + b2 = (s[13] << 12) | (s[12] >>> 20); + b3 = (s[12] << 12) | (s[13] >>> 20); + b34 = (s[22] << 10) | (s[23] >>> 22); + b35 = (s[23] << 10) | (s[22] >>> 22); + b16 = (s[33] << 13) | (s[32] >>> 19); + b17 = (s[32] << 13) | (s[33] >>> 19); + b48 = (s[42] << 2) | (s[43] >>> 30); + b49 = (s[43] << 2) | (s[42] >>> 30); + b40 = (s[5] << 30) | (s[4] >>> 2); + b41 = (s[4] << 30) | (s[5] >>> 2); + b22 = (s[14] << 6) | (s[15] >>> 26); + b23 = (s[15] << 6) | (s[14] >>> 26); + b4 = (s[25] << 11) | (s[24] >>> 21); + b5 = (s[24] << 11) | (s[25] >>> 21); + b36 = (s[34] << 15) | (s[35] >>> 17); + b37 = (s[35] << 15) | (s[34] >>> 17); + b18 = (s[45] << 29) | (s[44] >>> 3); + b19 = (s[44] << 29) | (s[45] >>> 3); + b10 = (s[6] << 28) | (s[7] >>> 4); + b11 = (s[7] << 28) | (s[6] >>> 4); + b42 = (s[17] << 23) | (s[16] >>> 9); + b43 = (s[16] << 23) | (s[17] >>> 9); + b24 = (s[26] << 25) | (s[27] >>> 7); + b25 = (s[27] << 25) | (s[26] >>> 7); + b6 = (s[36] << 21) | (s[37] >>> 11); + b7 = (s[37] << 21) | (s[36] >>> 11); + b38 = (s[47] << 24) | (s[46] >>> 8); + b39 = (s[46] << 24) | (s[47] >>> 8); + b30 = (s[8] << 27) | (s[9] >>> 5); + b31 = (s[9] << 27) | (s[8] >>> 5); + b12 = (s[18] << 20) | (s[19] >>> 12); + b13 = (s[19] << 20) | (s[18] >>> 12); + b44 = (s[29] << 7) | (s[28] >>> 25); + b45 = (s[28] << 7) | (s[29] >>> 25); + b26 = (s[38] << 8) | (s[39] >>> 24); + b27 = (s[39] << 8) | (s[38] >>> 24); + b8 = (s[48] << 14) | (s[49] >>> 18); + b9 = (s[49] << 14) | (s[48] >>> 18); + + s[0] = b0 ^ (~b2 & b4); + s[1] = b1 ^ (~b3 & b5); + s[10] = b10 ^ (~b12 & b14); + s[11] = b11 ^ (~b13 & b15); + s[20] = b20 ^ (~b22 & b24); + s[21] = b21 ^ (~b23 & b25); + s[30] = b30 ^ (~b32 & b34); + s[31] = b31 ^ (~b33 & b35); + s[40] = b40 ^ (~b42 & b44); + s[41] = b41 ^ (~b43 & b45); + s[2] = b2 ^ (~b4 & b6); + s[3] = b3 ^ (~b5 & b7); + s[12] = b12 ^ (~b14 & b16); + s[13] = b13 ^ (~b15 & b17); + s[22] = b22 ^ (~b24 & b26); + s[23] = b23 ^ (~b25 & b27); + s[32] = b32 ^ (~b34 & b36); + s[33] = b33 ^ (~b35 & b37); + s[42] = b42 ^ (~b44 & b46); + s[43] = b43 ^ (~b45 & b47); + s[4] = b4 ^ (~b6 & b8); + s[5] = b5 ^ (~b7 & b9); + s[14] = b14 ^ (~b16 & b18); + s[15] = b15 ^ (~b17 & b19); + s[24] = b24 ^ (~b26 & b28); + s[25] = b25 ^ (~b27 & b29); + s[34] = b34 ^ (~b36 & b38); + s[35] = b35 ^ (~b37 & b39); + s[44] = b44 ^ (~b46 & b48); + s[45] = b45 ^ (~b47 & b49); + s[6] = b6 ^ (~b8 & b0); + s[7] = b7 ^ (~b9 & b1); + s[16] = b16 ^ (~b18 & b10); + s[17] = b17 ^ (~b19 & b11); + s[26] = b26 ^ (~b28 & b20); + s[27] = b27 ^ (~b29 & b21); + s[36] = b36 ^ (~b38 & b30); + s[37] = b37 ^ (~b39 & b31); + s[46] = b46 ^ (~b48 & b40); + s[47] = b47 ^ (~b49 & b41); + s[8] = b8 ^ (~b0 & b2); + s[9] = b9 ^ (~b1 & b3); + s[18] = b18 ^ (~b10 & b12); + s[19] = b19 ^ (~b11 & b13); + s[28] = b28 ^ (~b20 & b22); + s[29] = b29 ^ (~b21 & b23); + s[38] = b38 ^ (~b30 & b32); + s[39] = b39 ^ (~b31 & b33); + s[48] = b48 ^ (~b40 & b42); + s[49] = b49 ^ (~b41 & b43); + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } })(); }); @@ -59223,7 +60964,7 @@ return '0x' + sha3$1$3.keccak_256(arrayify$3(data)); } - const version$1$3 = "address/5.4.0"; + const version$1$3 = "address/5.6.0"; const logger$1$3 = new Logger$3(version$1$3); function getChecksumAddress$3(address) { @@ -59315,9 +61056,9 @@ return result; } - const version$l = "units/5.4.0"; + const version$k = "units/5.6.0"; - const logger$s = new Logger$3(version$l); + const logger$r = new Logger$3(version$k); const names$2 = [ "wei", "kwei", @@ -59329,7 +61070,7 @@ ]; function parseUnits$2(value, unitName) { if (typeof (value) !== "string") { - logger$s.throwArgumentError("value must be a string", "value", value); + logger$r.throwArgumentError("value must be a string", "value", value); } if (typeof (unitName) === "string") { const index = names$2.indexOf(unitName); @@ -59351,18 +61092,18 @@ let fixUniswapPath$1 = (path) => { let fixedPath = path.map((token, index) => { if ( - token === CONSTANTS$2.bsc.NATIVE && path[index+1] != CONSTANTS$2.bsc.WRAPPED && - path[index-1] != CONSTANTS$2.bsc.WRAPPED + token === CONSTANTS$3.bsc.NATIVE && path[index+1] != CONSTANTS$3.bsc.WRAPPED && + path[index-1] != CONSTANTS$3.bsc.WRAPPED ) { - return CONSTANTS$2.bsc.WRAPPED + return CONSTANTS$3.bsc.WRAPPED } else { return token } }); - if(fixedPath[0] == CONSTANTS$2.bsc.NATIVE && fixedPath[1] == CONSTANTS$2.bsc.WRAPPED) { + if(fixedPath[0] == CONSTANTS$3.bsc.NATIVE && fixedPath[1] == CONSTANTS$3.bsc.WRAPPED) { fixedPath.splice(0, 1); - } else if(fixedPath[fixedPath.length-1] == CONSTANTS$2.bsc.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$2.bsc.WRAPPED) { + } else if(fixedPath[fixedPath.length-1] == CONSTANTS$3.bsc.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$3.bsc.WRAPPED) { fixedPath.splice(fixedPath.length-1, 1); } @@ -59390,18 +61131,18 @@ cache: 3600000, params: fixUniswapPath$1(path), }); - if(pair == CONSTANTS$2.bsc.ZERO) { return false } + if(pair == CONSTANTS$3.bsc.ZERO) { return false } let [reserves, token0, token1] = await Promise.all([ request({ blockchain: 'bsc', address: pair, method: 'getReserves' }, { api: basics$3.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'bsc', address: pair, method: 'token0' }, { api: basics$3.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'bsc', address: pair, method: 'token1' }, { api: basics$3.contracts.pair.api, cache: 3600000 }) ]); - if(path.includes(CONSTANTS$2.bsc.WRAPPED)) { - return minReserveRequirements$1({ min: 1, token: CONSTANTS$2.bsc.WRAPPED, decimals: CONSTANTS$2.bsc.DECIMALS, reserves, token0, token1 }) - } else if (path.includes(CONSTANTS$2.bsc.USD)) { - let token = new Token({ blockchain: 'bsc', address: CONSTANTS$2.bsc.USD }); + if(path.includes(CONSTANTS$3.bsc.WRAPPED)) { + return minReserveRequirements$1({ min: 1, token: CONSTANTS$3.bsc.WRAPPED, decimals: CONSTANTS$3.bsc.DECIMALS, reserves, token0, token1 }) + } else if (path.includes(CONSTANTS$3.bsc.USD)) { + let token = new Token({ blockchain: 'bsc', address: CONSTANTS$3.bsc.USD }); let decimals = await token.decimals(); - return minReserveRequirements$1({ min: 1000, token: CONSTANTS$2.bsc.USD, decimals, reserves, token0, token1 }) + return minReserveRequirements$1({ min: 1000, token: CONSTANTS$3.bsc.USD, decimals, reserves, token0, token1 }) } else { return true } @@ -59409,8 +61150,8 @@ let findPath$1 = async ({ tokenIn, tokenOut }) => { if( - [tokenIn, tokenOut].includes(CONSTANTS$2.bsc.NATIVE) && - [tokenIn, tokenOut].includes(CONSTANTS$2.bsc.WRAPPED) + [tokenIn, tokenOut].includes(CONSTANTS$3.bsc.NATIVE) && + [tokenIn, tokenOut].includes(CONSTANTS$3.bsc.WRAPPED) ) { return } let path; @@ -59418,37 +61159,37 @@ // direct path path = [tokenIn, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([tokenIn, CONSTANTS$2.bsc.WRAPPED]) && - tokenOut != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([tokenOut, CONSTANTS$2.bsc.WRAPPED]) + tokenIn != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([tokenIn, CONSTANTS$3.bsc.WRAPPED]) && + tokenOut != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([tokenOut, CONSTANTS$3.bsc.WRAPPED]) ) { // path via WRAPPED - path = [tokenIn, CONSTANTS$2.bsc.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.bsc.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.bsc.USD && - await pathExists$1([tokenIn, CONSTANTS$2.bsc.USD]) && - tokenOut != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([CONSTANTS$2.bsc.WRAPPED, tokenOut]) + tokenIn != CONSTANTS$3.bsc.USD && + await pathExists$1([tokenIn, CONSTANTS$3.bsc.USD]) && + tokenOut != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([CONSTANTS$3.bsc.WRAPPED, tokenOut]) ) { // path via tokenIn -> USD -> WRAPPED -> tokenOut - path = [tokenIn, CONSTANTS$2.bsc.USD, CONSTANTS$2.bsc.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.bsc.USD, CONSTANTS$3.bsc.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.bsc.WRAPPED && - await pathExists$1([tokenIn, CONSTANTS$2.bsc.WRAPPED]) && - tokenOut != CONSTANTS$2.bsc.USD && - await pathExists$1([CONSTANTS$2.bsc.USD, tokenOut]) + tokenIn != CONSTANTS$3.bsc.WRAPPED && + await pathExists$1([tokenIn, CONSTANTS$3.bsc.WRAPPED]) && + tokenOut != CONSTANTS$3.bsc.USD && + await pathExists$1([CONSTANTS$3.bsc.USD, tokenOut]) ) { // path via tokenIn -> WRAPPED -> USD -> tokenOut - path = [tokenIn, CONSTANTS$2.bsc.WRAPPED, CONSTANTS$2.bsc.USD, tokenOut]; + path = [tokenIn, CONSTANTS$3.bsc.WRAPPED, CONSTANTS$3.bsc.USD, tokenOut]; } // Add WRAPPED to route path if things start or end with NATIVE // because that actually reflects how things are routed in reality: - if(_optionalChain$1$1([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$2.bsc.NATIVE) { - path.splice(1, 0, CONSTANTS$2.bsc.WRAPPED); - } else if(_optionalChain$1$1([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$2.bsc.NATIVE) { - path.splice(path.length-1, 0, CONSTANTS$2.bsc.WRAPPED); + if(_optionalChain$1$1([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$3.bsc.NATIVE) { + path.splice(1, 0, CONSTANTS$3.bsc.WRAPPED); + } else if(_optionalChain$1$1([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$3.bsc.NATIVE) { + path.splice(path.length-1, 0, CONSTANTS$3.bsc.WRAPPED); } return path @@ -59556,7 +61297,7 @@ api: basics$3.contracts.router.api, }; - if (path[0] === CONSTANTS$2[blockchain].NATIVE) { + if (path[0] === CONSTANTS$3[blockchain].NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactETHForTokens'; transaction.value = amountIn.toString(); @@ -59566,7 +61307,7 @@ transaction.value = amountInMax.toString(); transaction.params = { amountOut: amountOut.toString() }; } - } else if (path[path.length - 1] === CONSTANTS$2[blockchain].NATIVE) { + } else if (path[path.length - 1] === CONSTANTS$3[blockchain].NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactTokensForETH'; transaction.params = { amountIn: amountIn.toString(), amountOutMin: amountOutMin.toString() }; @@ -59690,7 +61431,7 @@ } }; - function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } // Uniswap replaces 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with // the wrapped token 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 and implies wrapping. // @@ -59701,18 +61442,18 @@ let fixUniswapPath = (path) => { let fixedPath = path.map((token, index) => { if ( - token === CONSTANTS$2.ethereum.NATIVE && path[index+1] != CONSTANTS$2.ethereum.WRAPPED && - path[index-1] != CONSTANTS$2.ethereum.WRAPPED + token === CONSTANTS$3.ethereum.NATIVE && path[index+1] != CONSTANTS$3.ethereum.WRAPPED && + path[index-1] != CONSTANTS$3.ethereum.WRAPPED ) { - return CONSTANTS$2.ethereum.WRAPPED + return CONSTANTS$3.ethereum.WRAPPED } else { return token } }); - if(fixedPath[0] == CONSTANTS$2.ethereum.NATIVE && fixedPath[1] == CONSTANTS$2.ethereum.WRAPPED) { + if(fixedPath[0] == CONSTANTS$3.ethereum.NATIVE && fixedPath[1] == CONSTANTS$3.ethereum.WRAPPED) { fixedPath.splice(0, 1); - } else if(fixedPath[fixedPath.length-1] == CONSTANTS$2.ethereum.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$2.ethereum.WRAPPED) { + } else if(fixedPath[fixedPath.length-1] == CONSTANTS$3.ethereum.NATIVE && fixedPath[fixedPath.length-2] == CONSTANTS$3.ethereum.WRAPPED) { fixedPath.splice(fixedPath.length-1, 1); } @@ -59736,18 +61477,18 @@ address: basics$2.contracts.factory.address, method: 'getPair' }, { api: basics$2.contracts.factory.api, cache: 3600000, params: fixUniswapPath(path) }); - if(pair == CONSTANTS$2.ethereum.ZERO) { return false } + if(pair == CONSTANTS$3.ethereum.ZERO) { return false } let [reserves, token0, token1] = await Promise.all([ request({ blockchain: 'ethereum', address: pair, method: 'getReserves' }, { api: basics$2.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'ethereum', address: pair, method: 'token0' }, { api: basics$2.contracts.pair.api, cache: 3600000 }), request({ blockchain: 'ethereum', address: pair, method: 'token1' }, { api: basics$2.contracts.pair.api, cache: 3600000 }) ]); - if(path.includes(CONSTANTS$2.ethereum.WRAPPED)) { - return minReserveRequirements({ min: 1, token: CONSTANTS$2.ethereum.WRAPPED, decimals: CONSTANTS$2.ethereum.DECIMALS, reserves, token0, token1 }) - } else if (path.includes(CONSTANTS$2.ethereum.USD)) { - let token = new Token({ blockchain: 'ethereum', address: CONSTANTS$2.ethereum.USD }); + if(path.includes(CONSTANTS$3.ethereum.WRAPPED)) { + return minReserveRequirements({ min: 1, token: CONSTANTS$3.ethereum.WRAPPED, decimals: CONSTANTS$3.ethereum.DECIMALS, reserves, token0, token1 }) + } else if (path.includes(CONSTANTS$3.ethereum.USD)) { + let token = new Token({ blockchain: 'ethereum', address: CONSTANTS$3.ethereum.USD }); let decimals = await token.decimals(); - return minReserveRequirements({ min: 1000, token: CONSTANTS$2.ethereum.USD, decimals, reserves, token0, token1 }) + return minReserveRequirements({ min: 1000, token: CONSTANTS$3.ethereum.USD, decimals, reserves, token0, token1 }) } else { return true } @@ -59755,8 +61496,8 @@ let findPath = async ({ tokenIn, tokenOut }) => { if( - [tokenIn, tokenOut].includes(CONSTANTS$2.ethereum.NATIVE) && - [tokenIn, tokenOut].includes(CONSTANTS$2.ethereum.WRAPPED) + [tokenIn, tokenOut].includes(CONSTANTS$3.ethereum.NATIVE) && + [tokenIn, tokenOut].includes(CONSTANTS$3.ethereum.WRAPPED) ) { return } let path; @@ -59764,37 +61505,37 @@ // direct path path = [tokenIn, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([tokenIn, CONSTANTS$2.ethereum.WRAPPED]) && - tokenOut != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([tokenOut, CONSTANTS$2.ethereum.WRAPPED]) + tokenIn != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([tokenIn, CONSTANTS$3.ethereum.WRAPPED]) && + tokenOut != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([tokenOut, CONSTANTS$3.ethereum.WRAPPED]) ) { // path via WRAPPED - path = [tokenIn, CONSTANTS$2.ethereum.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.ethereum.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.ethereum.USD && - await pathExists([tokenIn, CONSTANTS$2.ethereum.USD]) && - tokenOut != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([CONSTANTS$2.ethereum.WRAPPED, tokenOut]) + tokenIn != CONSTANTS$3.ethereum.USD && + await pathExists([tokenIn, CONSTANTS$3.ethereum.USD]) && + tokenOut != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([CONSTANTS$3.ethereum.WRAPPED, tokenOut]) ) { // path via tokenIn -> USD -> WRAPPED -> tokenOut - path = [tokenIn, CONSTANTS$2.ethereum.USD, CONSTANTS$2.ethereum.WRAPPED, tokenOut]; + path = [tokenIn, CONSTANTS$3.ethereum.USD, CONSTANTS$3.ethereum.WRAPPED, tokenOut]; } else if ( - tokenIn != CONSTANTS$2.ethereum.WRAPPED && - await pathExists([tokenIn, CONSTANTS$2.ethereum.WRAPPED]) && - tokenOut != CONSTANTS$2.ethereum.USD && - await pathExists([CONSTANTS$2.ethereum.USD, tokenOut]) + tokenIn != CONSTANTS$3.ethereum.WRAPPED && + await pathExists([tokenIn, CONSTANTS$3.ethereum.WRAPPED]) && + tokenOut != CONSTANTS$3.ethereum.USD && + await pathExists([CONSTANTS$3.ethereum.USD, tokenOut]) ) { // path via tokenIn -> WRAPPED -> USD -> tokenOut - path = [tokenIn, CONSTANTS$2.ethereum.WRAPPED, CONSTANTS$2.ethereum.USD, tokenOut]; + path = [tokenIn, CONSTANTS$3.ethereum.WRAPPED, CONSTANTS$3.ethereum.USD, tokenOut]; } // Add WRAPPED to route path if things start or end with NATIVE // because that actually reflects how things are routed in reality: - if(_optionalChain$8([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$2.ethereum.NATIVE) { - path.splice(1, 0, CONSTANTS$2.ethereum.WRAPPED); - } else if(_optionalChain$8([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$2.ethereum.NATIVE) { - path.splice(path.length-1, 0, CONSTANTS$2.ethereum.WRAPPED); + if(_optionalChain$5([path, 'optionalAccess', _ => _.length]) && path[0] == CONSTANTS$3.ethereum.NATIVE) { + path.splice(1, 0, CONSTANTS$3.ethereum.WRAPPED); + } else if(_optionalChain$5([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == CONSTANTS$3.ethereum.NATIVE) { + path.splice(path.length-1, 0, CONSTANTS$3.ethereum.WRAPPED); } return path @@ -59900,7 +61641,7 @@ api: basics$2.contracts.router.api, }; - if (path[0] === CONSTANTS$2.ethereum.NATIVE) { + if (path[0] === CONSTANTS$3.ethereum.NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactETHForTokens'; transaction.value = amountIn.toString(); @@ -59910,7 +61651,7 @@ transaction.value = amountInMax.toString(); transaction.params = { amountOut: amountOut.toString() }; } - } else if (path[path.length - 1] === CONSTANTS$2.ethereum.NATIVE) { + } else if (path[path.length - 1] === CONSTANTS$3.ethereum.NATIVE) { if (amountInInput || amountOutMinInput) { transaction.method = 'swapExactTokensForETH'; transaction.params = { amountIn: amountIn.toString(), amountOutMin: amountOutMin.toString() }; @@ -60015,7 +61756,7 @@ logo: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAAAeFBMVEVHcEz8/Pz19fXq6ura2trHx8eurq6Pj49vb29UVFS+TH+goKDd3d2KQWJNP0XiQIg1LjEiHh95eXkYEhTz6u78+vsNCQv///8AAADsHHlsaWozMDGTk5NWUlNIQ0Xdz9W0tLRrDDfDF2Q2FSOXZ3yZEk66h57aq8BOoFiQAAAAF3RSTlMAAwkUJDdQb5CxwsTGx8zV1+Ty9vf8/KyVU3MAABwDSURBVHja7Jxbc+I4EIUB32SqEFIJhANFKNuA//8/HDvJhCSAL7hly/b5nnZnH2Zrzunu021lZgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIC9zB3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hKWkGMd/imIgAv6HZ0YaAsNS6jxP39E28BZMYCoExhavxmdUXj+A5sehBErA+VX7fdA/JMqAUgEofHxm5HoxT+NSfAO/bllK1DlQcNSBJ3nP7DH6QYiyoFr9H0SfzfEm30XQiEHVDmqfj+r/7Zfhv05B9ZzB1rD259D55gXP9OkpDKgp3t3XwhUWVyao6/Nn3IGjIXg5CwJVGl4+o+oce/9sH4f+gr6eDhbbwdtWQgNEFT4e2Iys8DvdmCtFKjWUPYXhp+g9rtnj3wrME/3eTifXgy9IfYLaeiHfyAj2QZu0H0afJxP6snI96GvJPydhuLkZyQmsBdYgjz2ifBxPp9aNRX106kcAi9e/2kED4q/T0XgJ1p2XXc8Hj9HjseuR1oceQQ52+8BEZHNAAp0TnbunyHxpA84RxJ1/TgFrFCROfj4CymnwCzSy9q/2r+GUKdKfX78V+Lct4nACo3/j//KPiNrDztC5olPQ/8CEi4DAUd/ZJ8Ki74JWWTuleH3dA6EXQfqPAlC9s3mgKX/ECeHFJmvfs+zJFkVWjOow2z7s4UglMFAVlkY4/7TRGnueyVoRMYvf5Z9klnYpGOkFlkajtPzGlGfBbU/taCp8jR4sf+XWpDmtNNA1iLvXz2H/hV2cZr1eUDGLdBNXYm8jzu/+f/btWMVhGEoDKPYmzTtElqEvv+jeoPddKwocs4SMn//kCHXijqG0L+8hMz77NvmWiJKKbXWOeWRlwjRP+6WU5hbW5a1922/4hPecRz3tA9b6r2vwzK0dAaOyfv9F01TlKG+VV7FaUo3TQEAAAAAAAAAAAAAAAAAAPgjD3Wdsa++sjjFAAAAAElFTkSuQmCC', contracts: { wrapper: { - address: CONSTANTS$2.ethereum.WRAPPED, + address: CONSTANTS$3.ethereum.WRAPPED, api: WETH }, } @@ -60035,19 +61776,19 @@ return new Promise(async (resolve)=> { if( - ![CONSTANTS$2.ethereum.NATIVE, CONSTANTS$2.ethereum.WRAPPED].includes(tokenIn) && - ![CONSTANTS$2.ethereum.NATIVE, CONSTANTS$2.ethereum.WRAPPED].includes(tokenOut) + ![CONSTANTS$3.ethereum.NATIVE, CONSTANTS$3.ethereum.WRAPPED].includes(tokenIn) && + ![CONSTANTS$3.ethereum.NATIVE, CONSTANTS$3.ethereum.WRAPPED].includes(tokenOut) ) { return resolve() } amountIn = amountInMax = amountOut = amountOutMin = [amountIn, amountInMax, amountOut, amountOutMin].filter(Boolean)[0]; let route; - if(tokenIn === CONSTANTS$2.ethereum.NATIVE && tokenOut === CONSTANTS$2.ethereum.WRAPPED) { + if(tokenIn === CONSTANTS$3.ethereum.NATIVE && tokenOut === CONSTANTS$3.ethereum.WRAPPED) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.ethereum.NATIVE, CONSTANTS$2.ethereum.WRAPPED], + path: [CONSTANTS$3.ethereum.NATIVE, CONSTANTS$3.ethereum.WRAPPED], amountIn, amountInMax, amountOut, @@ -60058,17 +61799,17 @@ transaction: { blockchain: 'ethereum', from: fromAddress, - to: CONSTANTS$2.ethereum.WRAPPED, + to: CONSTANTS$3.ethereum.WRAPPED, api: WETH, method: 'deposit', value: amountOut.toString() } }); - } else if(tokenIn === CONSTANTS$2.ethereum.WRAPPED && tokenOut === CONSTANTS$2.ethereum.NATIVE) { + } else if(tokenIn === CONSTANTS$3.ethereum.WRAPPED && tokenOut === CONSTANTS$3.ethereum.NATIVE) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.ethereum.WRAPPED, CONSTANTS$2.ethereum.NATIVE], + path: [CONSTANTS$3.ethereum.WRAPPED, CONSTANTS$3.ethereum.NATIVE], amountIn, amountInMax, amountOut, @@ -60079,7 +61820,7 @@ transaction: { blockchain: 'ethereum', from: fromAddress, - to: CONSTANTS$2.ethereum.WRAPPED, + to: CONSTANTS$3.ethereum.WRAPPED, api: WETH, method: 'withdraw', params: [amountOut] @@ -60105,7 +61846,7 @@ logo: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIABAMAAAAGVsnJAAAAMFBMVEVHcEz65KT545343IT21Gf0zErzw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X4yboDR/Uqe+KDAbL2XAAN0cLBK/LCglER2hJ4s5IkvCiztMOr8+a+ViTcWLLtOEdL2ap54ZMX1f3NZPcTC1lqFeGXBstPz0GArTzyz4tKuKwY8fP7Dq4JlZ+/Gna0y8dCKS7vUQSyg1Mvnf8GAixejTsPP5++IAUpbi5W8rwKQ3NIOwryN6++/ncaWv8snJCjMbGAyQGlroUC8tmB2p4n1akR5u76aJ55bobr8Auf1mNH+dqVAvLegVNs5hN8HlA4O6gskDRYUMIIBpe3VQp6kw4qz9UYXUgNK+41tX48/EyGoLh1COgJGT7ZTtPxIgeJSrcFgIKA0bGwvVvMkXRZUa1BFNOzEi+yvvgKLtSalljuB0rCdwsd/uQ+Wmx3L16NBp53Kx3+pwMzSzgtq6gpoFPvXFlL6+K9eEHeaHcNMSafTOFitkHRbUKguru90qSYGbPj0txeqhTxJvQXFpZ1GQwcDxgedRuNgrXoDVn9BQXFmqdboUZWYwIb/VXt7baFSKJCbY8WZ9Z1Go9Hp8XgVorXzQbvdOKhvL1TIDbNCoTCzuB4lC95bOPbcIxu069uL1UqhkCc3z4YOsV6vD1HodAZXXqHX63TajUbjoF6vry1WC+TmWqFQKFZnltZr9Uazc3lIGkTLr2+vrw0ffeEmr/8iKFRnFtdrEQeXAkTPfnt9caFayZPMMssss8wyyyyzzDLLLLPMMssM3f4fl5DWWgmVTDoAAAAASUVORK5CYII=', contracts: { wrapper: { - address: CONSTANTS$2.bsc.WRAPPED, + address: CONSTANTS$3.bsc.WRAPPED, api: WBNB }, } @@ -60125,19 +61866,19 @@ return new Promise(async (resolve)=> { if( - ![CONSTANTS$2.bsc.NATIVE, CONSTANTS$2.bsc.WRAPPED].includes(tokenIn) && - ![CONSTANTS$2.bsc.NATIVE, CONSTANTS$2.bsc.WRAPPED].includes(tokenOut) + ![CONSTANTS$3.bsc.NATIVE, CONSTANTS$3.bsc.WRAPPED].includes(tokenIn) && + ![CONSTANTS$3.bsc.NATIVE, CONSTANTS$3.bsc.WRAPPED].includes(tokenOut) ) { return resolve() } amountIn = amountInMax = amountOut = amountOutMin = [amountIn, amountInMax, amountOut, amountOutMin].filter(Boolean)[0]; let route; - if(tokenIn === CONSTANTS$2.bsc.NATIVE && tokenOut === CONSTANTS$2.bsc.WRAPPED) { + if(tokenIn === CONSTANTS$3.bsc.NATIVE && tokenOut === CONSTANTS$3.bsc.WRAPPED) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.bsc.NATIVE, CONSTANTS$2.bsc.WRAPPED], + path: [CONSTANTS$3.bsc.NATIVE, CONSTANTS$3.bsc.WRAPPED], amountIn, amountInMax, amountOut, @@ -60148,17 +61889,17 @@ transaction: { blockchain: 'bsc', from: fromAddress, - to: CONSTANTS$2.bsc.WRAPPED, + to: CONSTANTS$3.bsc.WRAPPED, api: WBNB, method: 'deposit', value: amountOut.toString() } }); - } else if(tokenIn === CONSTANTS$2.bsc.WRAPPED && tokenOut === CONSTANTS$2.bsc.NATIVE) { + } else if(tokenIn === CONSTANTS$3.bsc.WRAPPED && tokenOut === CONSTANTS$3.bsc.NATIVE) { route = new Route({ tokenIn, tokenOut, - path: [CONSTANTS$2.bsc.WRAPPED, CONSTANTS$2.bsc.NATIVE], + path: [CONSTANTS$3.bsc.WRAPPED, CONSTANTS$3.bsc.NATIVE], amountIn, amountInMax, amountOut, @@ -60169,7 +61910,7 @@ transaction: { blockchain: 'bsc', from: fromAddress, - to: CONSTANTS$2.bsc.WRAPPED, + to: CONSTANTS$3.bsc.WRAPPED, api: WBNB, method: 'withdraw', params: [amountOut] @@ -60692,10 +62433,10 @@ } const ensureNativeTokenAsset = async ({ address, options, assets, blockchain }) => { - if(options.only && options.only[blockchain] && !options.only[blockchain].find((only)=>(only.toLowerCase() == CONSTANTS$2[blockchain].NATIVE.toLowerCase()))){ return assets } - if(options.exclude && options.exclude[blockchain] && !!options.exclude[blockchain].find((exclude)=>(exclude.toLowerCase() == CONSTANTS$2[blockchain].NATIVE.toLowerCase()))){ return assets } + if(options.only && options.only[blockchain] && !options.only[blockchain].find((only)=>(only.toLowerCase() == CONSTANTS$3[blockchain].NATIVE.toLowerCase()))){ return assets } + if(options.exclude && options.exclude[blockchain] && !!options.exclude[blockchain].find((exclude)=>(exclude.toLowerCase() == CONSTANTS$3[blockchain].NATIVE.toLowerCase()))){ return assets } - const nativeTokenMissing = !assets.find((asset)=>(asset.address.toLowerCase() == CONSTANTS$2[blockchain].NATIVE.toLowerCase())); + const nativeTokenMissing = !assets.find((asset)=>(asset.address.toLowerCase() == CONSTANTS$3[blockchain].NATIVE.toLowerCase())); if(nativeTokenMissing) { let balance = await request( { @@ -60706,9 +62447,9 @@ { cache: 30000 } ); assets = [{ - name: CONSTANTS$2[blockchain].CURRENCY, - symbol: CONSTANTS$2[blockchain].SYMBOL, - address: CONSTANTS$2[blockchain].NATIVE, + name: CONSTANTS$3[blockchain].CURRENCY, + symbol: CONSTANTS$3[blockchain].SYMBOL, + address: CONSTANTS$3[blockchain].NATIVE, type: 'NATIVE', blockchain, balance: balance.toString() @@ -60886,14 +62627,14 @@ transaction.params.path = transaction.params.path.filter((token, index, path)=>{ if( index == 1 && - token == CONSTANTS$2[transaction.blockchain].WRAPPED && - path[0] == CONSTANTS$2[transaction.blockchain].NATIVE + token == CONSTANTS$3[transaction.blockchain].WRAPPED && + path[0] == CONSTANTS$3[transaction.blockchain].NATIVE ) { return false } else if ( index == path.length-2 && - token == CONSTANTS$2[transaction.blockchain].WRAPPED && - path[path.length-1] == CONSTANTS$2[transaction.blockchain].NATIVE + token == CONSTANTS$3[transaction.blockchain].WRAPPED && + path[path.length-1] == CONSTANTS$3[transaction.blockchain].NATIVE ) { return false } else { @@ -64447,7 +66188,7 @@ })(module, commonjsGlobal$4); }); - const version$3$4 = "logger/5.5.0"; + const version$3$4 = "logger/5.6.0"; let _permanentCensorErrors$4 = false; let _censorErrors$4 = false; @@ -64626,6 +66367,40 @@ messageDetails.push(`code=${code}`); messageDetails.push(`version=${this.version}`); const reason = message; + let url = ""; + switch (code) { + case ErrorCode$4.NUMERIC_FAULT: { + url = "NUMERIC_FAULT"; + const fault = message; + switch (fault) { + case "overflow": + case "underflow": + case "division-by-zero": + url += "-" + fault; + break; + case "negative-power": + case "negative-width": + url += "-unsupported"; + break; + case "unbound-bitwise-result": + url += "-unbound-result"; + break; + } + break; + } + case ErrorCode$4.CALL_EXCEPTION: + case ErrorCode$4.INSUFFICIENT_FUNDS: + case ErrorCode$4.MISSING_NEW: + case ErrorCode$4.NONCE_EXPIRED: + case ErrorCode$4.REPLACEMENT_UNDERPRICED: + case ErrorCode$4.TRANSACTION_REPLACED: + case ErrorCode$4.UNPREDICTABLE_GAS_LIMIT: + url = code; + break; + } + if (url) { + message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]"; + } if (messageDetails.length) { message += " (" + messageDetails.join(", ") + ")"; } @@ -64759,7 +66534,7 @@ Logger$4.errors = ErrorCode$4; Logger$4.levels = LogLevel$4; - const version$2$4 = "bytes/5.5.0"; + const version$2$4 = "bytes/5.6.1"; const logger$3$4 = new Logger$4(version$2$4); /////////////////////////////// @@ -64776,7 +66551,7 @@ }; return array; } - function isInteger$1(value) { + function isInteger$4(value) { return (typeof (value) === "number" && value == value && (value % 1) === 0); } function isBytes$4(value) { @@ -64789,12 +66564,12 @@ if (typeof (value) === "string") { return false; } - if (!isInteger$1(value.length) || value.length < 0) { + if (!isInteger$4(value.length) || value.length < 0) { return false; } for (let i = 0; i < value.length; i++) { const v = value[i]; - if (!isInteger$1(v) || v < 0 || v >= 256) { + if (!isInteger$4(v) || v < 0 || v >= 256) { return false; } } @@ -64826,7 +66601,7 @@ let hex = value.substring(2); if (hex.length % 2) { if (options.hexPad === "left") { - hex = "0x0" + hex.substring(2); + hex = "0" + hex; } else if (options.hexPad === "right") { hex += "0"; @@ -64928,7 +66703,7 @@ return value; } - const version$1$4 = "bignumber/5.5.0"; + const version$1$4 = "bignumber/5.6.0"; var BN$4 = bn$4.BN; const logger$2$4 = new Logger$4(version$1$4); @@ -64977,7 +66752,7 @@ div(other) { const o = BigNumber$4.from(other); if (o.isZero()) { - throwFault$1$3("division by zero", "div"); + throwFault$1$3("division-by-zero", "div"); } return toBigNumber$4(toBN$4(this).div(toBN$4(other))); } @@ -64987,53 +66762,53 @@ mod(other) { const value = toBN$4(other); if (value.isNeg()) { - throwFault$1$3("cannot modulo negative values", "mod"); + throwFault$1$3("division-by-zero", "mod"); } return toBigNumber$4(toBN$4(this).umod(value)); } pow(other) { const value = toBN$4(other); if (value.isNeg()) { - throwFault$1$3("cannot raise to negative values", "pow"); + throwFault$1$3("negative-power", "pow"); } return toBigNumber$4(toBN$4(this).pow(value)); } and(other) { const value = toBN$4(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$3("cannot 'and' negative values", "and"); + throwFault$1$3("unbound-bitwise-result", "and"); } return toBigNumber$4(toBN$4(this).and(value)); } or(other) { const value = toBN$4(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$3("cannot 'or' negative values", "or"); + throwFault$1$3("unbound-bitwise-result", "or"); } return toBigNumber$4(toBN$4(this).or(value)); } xor(other) { const value = toBN$4(other); if (this.isNegative() || value.isNeg()) { - throwFault$1$3("cannot 'xor' negative values", "xor"); + throwFault$1$3("unbound-bitwise-result", "xor"); } return toBigNumber$4(toBN$4(this).xor(value)); } mask(value) { if (this.isNegative() || value < 0) { - throwFault$1$3("cannot mask negative values", "mask"); + throwFault$1$3("negative-width", "mask"); } return toBigNumber$4(toBN$4(this).maskn(value)); } shl(value) { if (this.isNegative() || value < 0) { - throwFault$1$3("cannot shift negative values", "shl"); + throwFault$1$3("negative-width", "shl"); } return toBigNumber$4(toBN$4(this).shln(value)); } shr(value) { if (this.isNegative() || value < 0) { - throwFault$1$3("cannot shift negative values", "shr"); + throwFault$1$3("negative-width", "shr"); } return toBigNumber$4(toBN$4(this).shrn(value)); } @@ -65217,7 +66992,7 @@ } const logger$1$4 = new Logger$4(version$1$4); - const _constructorGuard$7 = {}; + const _constructorGuard$6 = {}; const Zero$5 = BigNumber$4.from(0); const NegativeOne$5 = BigNumber$4.from(-1); function throwFault$5(message, fault, operation, value) { @@ -65328,7 +67103,7 @@ } class FixedFormat$3 { constructor(constructorGuard, signed, width, decimals) { - if (constructorGuard !== _constructorGuard$7) { + if (constructorGuard !== _constructorGuard$6) { logger$1$4.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$4.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -65385,13 +67160,13 @@ if (decimals > 80) { logger$1$4.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); } - return new FixedFormat$3(_constructorGuard$7, signed, width, decimals); + return new FixedFormat$3(_constructorGuard$6, signed, width, decimals); } } class FixedNumber$3 { constructor(constructorGuard, hex, value, format) { logger$1$4.checkNew(new.target, FixedNumber$3); - if (constructorGuard !== _constructorGuard$7) { + if (constructorGuard !== _constructorGuard$6) { logger$1$4.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$4.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); @@ -65528,7 +67303,7 @@ hex = hexZeroPad$4(hex, fixedFormat.width / 8); } const decimal = formatFixed$3(numeric, fixedFormat.decimals); - return new FixedNumber$3(_constructorGuard$7, hex, decimal, fixedFormat); + return new FixedNumber$3(_constructorGuard$6, hex, decimal, fixedFormat); } static fromBytes(value, format) { if (format == null) { @@ -65544,7 +67319,7 @@ } const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); const decimal = formatFixed$3(numeric, fixedFormat.decimals); - return new FixedNumber$3(_constructorGuard$7, hex, decimal, fixedFormat); + return new FixedNumber$3(_constructorGuard$6, hex, decimal, fixedFormat); } static from(value, format) { if (typeof (value) === "string") { @@ -65571,9 +67346,9 @@ const ONE$3 = FixedNumber$3.from(1); const BUMP$3 = FixedNumber$3.from("0.5"); - const version$m = "units/5.5.0"; + const version$l = "units/5.6.0"; - const logger$t = new Logger$4(version$m); + const logger$s = new Logger$4(version$l); const names$3 = [ "wei", "kwei", @@ -65585,7 +67360,7 @@ ]; function parseUnits$3(value, unitName) { if (typeof (value) !== "string") { - logger$t.throwArgumentError("value must be a string", "value", value); + logger$s.throwArgumentError("value must be a string", "value", value); } if (typeof (unitName) === "string") { const index = names$3.indexOf(unitName); @@ -65624,7 +67399,7 @@ let transactionAddress = ({ paymentRoute, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return paymentRoute.toAddress } else { return paymentRoute.toToken.address @@ -65636,7 +67411,7 @@ let transactionApi = ({ paymentRoute, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return undefined } else { return Token[paymentRoute.blockchain].DEFAULT @@ -65648,7 +67423,7 @@ let transactionMethod = ({ paymentRoute, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return undefined } else { return 'transfer' @@ -65660,7 +67435,7 @@ let transactionParams = ({ paymentRoute, exchangeRoute, event, fee })=> { if(paymentRoute.directTransfer && !fee) { - if(paymentRoute.toToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.toToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { return undefined } else { return [paymentRoute.toAddress, paymentRoute.toAmount] @@ -65772,7 +67547,7 @@ }; let transactionValue = ({ paymentRoute, exchangeRoute })=> { - if(paymentRoute.fromToken.address == CONSTANTS$2[paymentRoute.blockchain].NATIVE) { + if(paymentRoute.fromToken.address == CONSTANTS$3[paymentRoute.blockchain].NATIVE) { if(exchangeRoute) { return exchangeRoute.amountIn.toString() } else { // direct payment @@ -82982,17 +84757,17 @@ }.call(commonjsGlobal$4)); }); - function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } class PaymentRoute { constructor({ blockchain, fromAddress, fromToken, fromDecimals, fromAmount, fromBalance, toToken, toDecimals, toAmount, toAddress, toContract }) { this.blockchain = blockchain; this.fromAddress = fromAddress; this.fromToken = fromToken; - this.fromAmount = _optionalChain$9([fromAmount, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]); + this.fromAmount = _optionalChain$6([fromAmount, 'optionalAccess', _ => _.toString, 'call', _2 => _2()]); this.fromDecimals = fromDecimals; this.fromBalance = fromBalance; this.toToken = toToken; - this.toAmount = _optionalChain$9([toAmount, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); + this.toAmount = _optionalChain$6([toAmount, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]); this.toDecimals = toDecimals; this.toAddress = toAddress; this.toContract = toContract; @@ -83199,7 +84974,7 @@ if( ( route.directTransfer || - route.fromToken.address.toLowerCase() == CONSTANTS$2[route.blockchain].NATIVE.toLowerCase() + route.fromToken.address.toLowerCase() == CONSTANTS$3[route.blockchain].NATIVE.toLowerCase() ) && route.toContract == undefined ) { routes[index].approvalRequired = false; @@ -83211,7 +84986,7 @@ to: route.fromToken.address, api: Token[route.blockchain].DEFAULT, method: 'approve', - params: [routers[route.blockchain].address, CONSTANTS$2[route.blockchain].MAXINT] + params: [routers[route.blockchain].address, CONSTANTS$3[route.blockchain].MAXINT] }; } } @@ -83231,7 +85006,7 @@ let addRouteAmounts = (routes)=> { return routes.map((route)=>{ if(route.directTransfer && !route.fee) { - if(route.fromToken.address.toLowerCase() == CONSTANTS$2[route.blockchain].NATIVE.toLowerCase()) { + if(route.fromToken.address.toLowerCase() == CONSTANTS$3[route.blockchain].NATIVE.toLowerCase()) { route.fromAmount = route.transaction.value; route.toAmount = route.transaction.value; } else { @@ -83296,10 +85071,10 @@ return aWins } - if (a.fromToken.address.toLowerCase() == CONSTANTS$2[a.blockchain].NATIVE.toLowerCase()) { + if (a.fromToken.address.toLowerCase() == CONSTANTS$3[a.blockchain].NATIVE.toLowerCase()) { return aWins } - if (b.fromToken.address.toLowerCase() == CONSTANTS$2[b.blockchain].NATIVE.toLowerCase()) { + if (b.fromToken.address.toLowerCase() == CONSTANTS$3[b.blockchain].NATIVE.toLowerCase()) { return bWins } @@ -84990,7 +86765,7 @@ const address = props.address; react.useEffect(()=>{ - if(CONSTANTS$2[blockchain].NATIVE.toLowerCase() == address.toLowerCase()) { + if(CONSTANTS$3[blockchain].NATIVE.toLowerCase() == address.toLowerCase()) { setSrc(Blockchain.findByName(blockchain).logo); } else { setSrc(trustWalletAddress({ blockchain, address })); @@ -87121,13 +88896,13 @@ })); } else { Promise.all(props.accept.map(function (configuration) { - if (CONSTANTS$2[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) { + if (CONSTANTS$3[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) { return 1.00 / conversionRate; } return route({ blockchain: configuration.blockchain, - tokenIn: CONSTANTS$2[configuration.blockchain].USD, + tokenIn: CONSTANTS$3[configuration.blockchain].USD, amountIn: 1.00 / conversionRate * amount, tokenOut: configuration.token, fromAddress: account, @@ -87202,7 +88977,7 @@ setMaxAmount(maxAmount > 10 ? Math.round(maxAmount) : round$1(maxAmount)); })["catch"](setError); })["catch"](setError); - } else if (maxRoute.fromToken.address == CONSTANTS$2[maxRoute.blockchain].USD) { + } else if (maxRoute.fromToken.address == CONSTANTS$3[maxRoute.blockchain].USD) { var _maxAmount = parseFloat(new Decimal(readableMaxAmount).mul(conversionRate).toString()); setMaxAmount(_maxAmount > 10 ? Math.round(_maxAmount) : _maxAmount); @@ -87210,7 +88985,7 @@ route({ blockchain: maxRoute.blockchain, tokenIn: maxRoute.fromToken.address, - tokenOut: CONSTANTS$2[maxRoute.blockchain].USD, + tokenOut: CONSTANTS$3[maxRoute.blockchain].USD, amountIn: parseFloat(readableMaxAmount), fromAddress: account, toAddress: account @@ -87222,7 +88997,7 @@ Token.readable({ amount: routes[0].amountOut, blockchain: maxRoute.blockchain, - address: CONSTANTS$2[maxRoute.blockchain].USD + address: CONSTANTS$3[maxRoute.blockchain].USD }).then(function (readableMaxAmount) { var slippage = 1.01; var maxAmount = parseFloat(new Decimal(readableMaxAmount).div(slippage).mul(conversionRate).toString()); @@ -87889,7 +89664,7 @@ Promise.all([route({ blockchain: payment.route.blockchain, tokenIn: payment.route.toToken.address, - tokenOut: CONSTANTS$2[payment.route.blockchain].USD, + tokenOut: CONSTANTS$3[payment.route.blockchain].USD, amountIn: payment.route.toAmount, fromAddress: account, toAddress: account @@ -87902,7 +89677,7 @@ toAddress: account }) : Promise.resolve([]), new Token({ blockchain: payment.route.blockchain, - address: CONSTANTS$2[payment.route.blockchain].USD + address: CONSTANTS$3[payment.route.blockchain].USD }).decimals()]).then(function (_ref2) { var _ref3 = _slicedToArray(_ref2, 3), toTokenUSDExchangeRoutes = _ref3[0], @@ -87926,7 +89701,7 @@ var toTokenUSDAmount; - if (payment.route.toToken.address.toLowerCase() == CONSTANTS$2[payment.route.blockchain].USD.toLowerCase()) { + if (payment.route.toToken.address.toLowerCase() == CONSTANTS$3[payment.route.blockchain].USD.toLowerCase()) { toTokenUSDAmount = payment.route.toAmount.toString(); } else if (toTokenUSDRoute == undefined) { setPaymentValue(''); diff --git a/package.json b/package.json index 8cf5697..ecf8f04 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/buttons", "moduleName": "DePayButtons", - "version": "6.29.0", + "version": "6.30.0", "description": "A simple button brings Web3 Payments to your website or App. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion with state-of-the-art widgets.", "main": "./dist/umd/index.js", "module": "./dist/esm/index.js", @@ -37,7 +37,7 @@ "peerDependencies": { "react": "^17", "react-dom": "^17", - "@depay/widgets": "^6.29.0", + "@depay/widgets": "^6.30.0", "@depay/react-shadow-dom": "^4.0.0" }, "devDependencies": { @@ -46,7 +46,7 @@ "@babel/preset-env": "^7.12.7", "@babel/preset-react": "^7.12.7", "@cypress/react": "^5.9.1", - "@depay/widgets": "^6.29.0", + "@depay/widgets": "^6.30.0", "@depay/react-shadow-dom": "^4.0.0", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-commonjs": "^17.1.0", @@ -62,7 +62,7 @@ "eslint-plugin-import": "^2.22.1", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", - "ethers": "^5.4.6", + "ethers": "^5.6.5", "jest": "^26.6.3", "react": "^17.0.1", "react-dom": "^17", diff --git a/yarn.lock b/yarn.lock index 2d3e9d8..2733a43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1260,45 +1260,45 @@ resolved "https://registry.yarnpkg.com/@depay/web3-assets/-/web3-assets-6.2.1.tgz#c43a77807a955a4b574a8e9222b92ae76e5e1f4b" integrity sha512-RXVNYGHsK53uX69bN8JSPQ+lrTFehwpcQ85259l4Fh67O/s9YWc9tcyj8pZkRoX2A7FynHK5h4SMS+KZAnX8XQ== -"@depay/web3-blockchains@^4.3.0": - version "4.3.0" - resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-4.3.0.tgz#d6269f29cd716c5e26465fc88a24858c2b326ca5" - integrity sha512-7mUK8nDIp1wAPhFs0L6TtLoHjeIeK00c04vdwFRBao+GnWCQZXaVouNv55dWbko40RGLDbBg6AvoYF3zzFeS9Q== +"@depay/web3-blockchains@^4.5.0": + version "4.5.0" + resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-4.5.0.tgz#b959b3cb57300a4d163b26ea42aee792ad89d3ce" + integrity sha512-UhHb+uRjEnQRNC65Jdnq9dP9ANg/gzO8IE5eXx3uG6rr1rTAmq0jRmB447JtPDgestZ/BDOryhHSWUlGT6ak7Q== -"@depay/web3-client@^8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@depay/web3-client/-/web3-client-8.0.0.tgz#e48fbab16cf0f07dfbdd12160e3ab55d714cdd4e" - integrity sha512-QY7jIxCayOuZqHAm+Sdl25CtvnBGDw/gr/CpTBi9HXzwccbx0J6INb6K6Nk8aDPLHaN6ynEOXYyXcBqR3S3j3g== +"@depay/web3-client@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@depay/web3-client/-/web3-client-8.2.0.tgz#e7912214d40237b6366dc02ddda304db5db64b9d" + integrity sha512-Rkt6iRBp6PGqtxqlCpejw2A0Rzo5aUdrb+pEY08rYDN5CVzj8gkfQeQr53OIpy7u7060En0tntM733epsaRPdw== -"@depay/web3-constants@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@depay/web3-constants/-/web3-constants-5.0.0.tgz#89a8392586a619d63ab73f483b341ba17f03dd51" - integrity sha512-P7GnRdykODAJUH9EC1d6/ZektPmL42hVcklUsub8oGmngDCa+AFz+Pyf1TcL3jaVaznlUTcRZt0fu+r+5MJBew== - -"@depay/web3-exchanges@^8.2.1": - version "8.2.1" - resolved "https://registry.yarnpkg.com/@depay/web3-exchanges/-/web3-exchanges-8.2.1.tgz#0eb9d9337cd05776bfd41ef884ebf6229415002e" - integrity sha512-nMXrfcenpgMEUf+4+uxVF+c0riRciRDe66bt1ADwOgv3VCraseEuYLTERiII0Mnwm5RKiuY7NoOVkbGlt4qB8A== - -"@depay/web3-payments@^10.1.3": - version "10.1.3" - resolved "https://registry.yarnpkg.com/@depay/web3-payments/-/web3-payments-10.1.3.tgz#251a219c5a70d5d9efe5a926f261e25b15a6dd31" - integrity sha512-gWHeW6YFIKZ/no4pNNoCgMQBLKiZfHwXjW5qf7h+a4LXEQnItS76hyNqKLwxy4lXh83oZoA+fJMSD/MprMre5g== - -"@depay/web3-tokens@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@depay/web3-tokens/-/web3-tokens-8.0.1.tgz#7967bd642e6eefbad1af670666a3e912ab11df31" - integrity sha512-1vs5NmbS0p7CH+ey0aLvl7ZZMFfbi4GLNEtHtuXjQU5MpItvEHuh7VXE+XkABc4FeBqElWDvP7zRNvtyvD6n7A== - -"@depay/web3-wallets@^10.0.3": - version "10.0.3" - resolved "https://registry.yarnpkg.com/@depay/web3-wallets/-/web3-wallets-10.0.3.tgz#28bd498d4ecf2b23d06070f2c56d28fec14e1cd3" - integrity sha512-CpM6X94LTAJzpewL8jq3jEQhjq/CazlyMQkmDUh9tdU21xt+zLtS4gH5mAlwqtwy3RzISTGLKtWM7EZEl9JtTA== - -"@depay/widgets@^6.29.0": - version "6.29.0" - resolved "https://registry.yarnpkg.com/@depay/widgets/-/widgets-6.29.0.tgz#d26fbd90d9468b57fae81695c8eff5110b323aef" - integrity sha512-ENSRaz9Gax1sycrGzFmno7xGXeXxCLR1nY6yXUkJeaFz+w10Yv47KQ45j6Rd3BGIU/VgIH+gwIQKLlYZfihvZg== +"@depay/web3-constants@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@depay/web3-constants/-/web3-constants-5.2.0.tgz#99ef70cf453dfbb7f41358eefa85172b97b3d32a" + integrity sha512-CCeiL5Ixe6ZFPNI+/D52TtAstZcAyt+u97iEU2aH+kbRMGc9UjQ2Lc/iBCUARIE8T3W1wAPgNpJV95ebtTZUBg== + +"@depay/web3-exchanges@^8.4.0": + version "8.4.0" + resolved "https://registry.yarnpkg.com/@depay/web3-exchanges/-/web3-exchanges-8.4.0.tgz#60607fcfcb4ab73acd2aecbbc9b377e3e3b4c470" + integrity sha512-9+Xj3oGEAhOUPN2SceySQw2pNFPFPA4M0AFFKXvTwTgGfXK0vYPXBo9+TvpZQakZCzbjtdBvOq2hIlIFDaHdYw== + +"@depay/web3-payments@^10.2.0": + version "10.2.0" + resolved "https://registry.yarnpkg.com/@depay/web3-payments/-/web3-payments-10.2.0.tgz#f7fe03d94bcc61a621725fdebe0a33da15cc4869" + integrity sha512-AoR2G/cKUMoeRwDYek87hX/s2TDoH/hD1ZQvVNr0Zbds89AfiDPcMom0MlzlbL4IvLljb68NaZ8Gtc9ZtbfXoQ== + +"@depay/web3-tokens@^8.1.0": + version "8.1.0" + resolved "https://registry.yarnpkg.com/@depay/web3-tokens/-/web3-tokens-8.1.0.tgz#084e7c40b336810121ecfe20098c538ee84c0a84" + integrity sha512-RUS+L6RSc7g7khncPeCY+JCVQ/IOZQU/ZiHwiR0HI9+n+OyjlAdLshhm6B/rxKLIWUPwExW2m7vo5uh8+9zqkA== + +"@depay/web3-wallets@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@depay/web3-wallets/-/web3-wallets-11.0.0.tgz#cadcc40c2113f387cdc1a9da461e6e0a3d001b1a" + integrity sha512-q3BIS8dTA3QfCd1pcgNU3cA2ljjnXemq0y5wcrMSSY2dCPg22V8fu6fGUjLmOoLap1+nyzMePNgCnSTKooC1/Q== + +"@depay/widgets@^6.30.0": + version "6.30.0" + resolved "https://registry.yarnpkg.com/@depay/widgets/-/widgets-6.30.0.tgz#24a1db55530fdca40fb8c827afb7bc770101f8cb" + integrity sha512-Su430ATJQ2hi85LxeMOGdC9CjOA0nLZFmh8pLRzUi3dM/xytsid7+EOenBlkcnmn4yChFbZ9oRAwPDWdLuZH8w== dependencies: "@depay/coinbase-wallet-sdk" "^1.0.5" "@depay/local-currency" "^3.2.2" @@ -1307,13 +1307,13 @@ "@depay/react-token-image" "^3.0.0" "@depay/walletconnect-v1" "^1.1.0" "@depay/web3-assets" "^6.2.1" - "@depay/web3-blockchains" "^4.3.0" - "@depay/web3-client" "^8.0.0" - "@depay/web3-constants" "^5.0.0" - "@depay/web3-exchanges" "^8.2.1" - "@depay/web3-payments" "^10.1.3" - "@depay/web3-tokens" "^8.0.1" - "@depay/web3-wallets" "^10.0.3" + "@depay/web3-blockchains" "^4.5.0" + "@depay/web3-client" "^8.2.0" + "@depay/web3-constants" "^5.2.0" + "@depay/web3-exchanges" "^8.4.0" + "@depay/web3-payments" "^10.2.0" + "@depay/web3-tokens" "^8.1.0" + "@depay/web3-wallets" "^11.0.0" decimal.js "^10.3.1" react-rangeslider "^2.2.0" @@ -1333,345 +1333,345 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@ethersproject/abi@5.5.0", "@ethersproject/abi@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.5.0.tgz#fb52820e22e50b854ff15ce1647cc508d6660613" - integrity sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w== - dependencies: - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/abstract-provider@5.5.1", "@ethersproject/abstract-provider@^5.5.0": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz#2f1f6e8a3ab7d378d8ad0b5718460f85649710c5" - integrity sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/networks" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/web" "^5.5.0" - -"@ethersproject/abstract-signer@5.5.0", "@ethersproject/abstract-signer@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz#590ff6693370c60ae376bf1c7ada59eb2a8dd08d" - integrity sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA== - dependencies: - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - -"@ethersproject/address@5.5.0", "@ethersproject/address@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.5.0.tgz#bcc6f576a553f21f3dd7ba17248f81b473c9c78f" - integrity sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw== +"@ethersproject/abi@5.6.2", "@ethersproject/abi@^5.6.0": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.2.tgz#f2956f2ac724cd720e581759d9e3840cd9744818" + integrity sha512-40Ixjhy+YzFtnvzIqFU13FW9hd1gMoLa3cJfSDnfnL4o8EnEG1qLiV8sNJo3sHYi9UYMfFeRuZ7kv5+vhzU7gQ== + dependencies: + "@ethersproject/address" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/constants" "^5.6.0" + "@ethersproject/hash" "^5.6.0" + "@ethersproject/keccak256" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.0" + +"@ethersproject/abstract-provider@5.6.0", "@ethersproject/abstract-provider@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz#0c4ac7054650dbd9c476cf5907f588bbb6ef3061" + integrity sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw== + dependencies: + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.0" + "@ethersproject/web" "^5.6.0" + +"@ethersproject/abstract-signer@5.6.1", "@ethersproject/abstract-signer@^5.6.0": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.6.1.tgz#54df786bdf1aabe20d0ed508ec05e0aa2d06674f" + integrity sha512-xhSLo6y0nGJS7NxfvOSzCaWKvWb1TLT7dQ0nnpHZrDnC67xfnWm9NXflTMFPUXXMtjr33CdV0kWDEmnbrQZ74Q== + dependencies: + "@ethersproject/abstract-provider" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + +"@ethersproject/address@5.6.0", "@ethersproject/address@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.0.tgz#13c49836d73e7885fc148ad633afad729da25012" + integrity sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ== dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/rlp" "^5.5.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/keccak256" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/rlp" "^5.6.0" -"@ethersproject/base64@5.5.0", "@ethersproject/base64@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.5.0.tgz#881e8544e47ed976930836986e5eb8fab259c090" - integrity sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA== +"@ethersproject/base64@5.6.0", "@ethersproject/base64@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.6.0.tgz#a12c4da2a6fb86d88563216b0282308fc15907c9" + integrity sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw== dependencies: - "@ethersproject/bytes" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" -"@ethersproject/basex@5.5.0", "@ethersproject/basex@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.5.0.tgz#e40a53ae6d6b09ab4d977bd037010d4bed21b4d3" - integrity sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ== +"@ethersproject/basex@5.6.0", "@ethersproject/basex@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.6.0.tgz#9ea7209bf0a1c3ddc2a90f180c3a7f0d7d2e8a69" + integrity sha512-qN4T+hQd/Md32MoJpc69rOwLYRUXwjTlhHDIeUkUmiN/JyWkkLLMoG0TqvSQKNqZOMgN5stbUYN6ILC+eD7MEQ== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/properties" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/properties" "^5.6.0" -"@ethersproject/bignumber@5.5.0", "@ethersproject/bignumber@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.5.0.tgz#875b143f04a216f4f8b96245bde942d42d279527" - integrity sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg== +"@ethersproject/bignumber@5.6.1", "@ethersproject/bignumber@^5.6.0": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.6.1.tgz#d5e0da518eb82ab8d08ca9db501888bbf5f0c8fb" + integrity sha512-UtMeZ3GaUuF9sx2u9nPZiPP3ULcAFmXyvynR7oHl/tPrM+vldZh7ocMsoa1PqKYGnQnqUZJoqxZnGN6J0qdipA== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" bn.js "^4.11.9" -"@ethersproject/bytes@5.5.0", "@ethersproject/bytes@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.5.0.tgz#cb11c526de657e7b45d2e0f0246fb3b9d29a601c" - integrity sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog== +"@ethersproject/bytes@5.6.1", "@ethersproject/bytes@^5.6.0": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7" + integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g== dependencies: - "@ethersproject/logger" "^5.5.0" + "@ethersproject/logger" "^5.6.0" -"@ethersproject/constants@5.5.0", "@ethersproject/constants@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.5.0.tgz#d2a2cd7d94bd1d58377d1d66c4f53c9be4d0a45e" - integrity sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - -"@ethersproject/contracts@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.5.0.tgz#b735260d4bd61283a670a82d5275e2a38892c197" - integrity sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg== - dependencies: - "@ethersproject/abi" "^5.5.0" - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - -"@ethersproject/hash@5.5.0", "@ethersproject/hash@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.5.0.tgz#7cee76d08f88d1873574c849e0207dcb32380cc9" - integrity sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/hdnode@5.5.0", "@ethersproject/hdnode@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.5.0.tgz#4a04e28f41c546f7c978528ea1575206a200ddf6" - integrity sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/basex" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/pbkdf2" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/wordlists" "^5.5.0" - -"@ethersproject/json-wallets@5.5.0", "@ethersproject/json-wallets@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz#dd522d4297e15bccc8e1427d247ec8376b60e325" - integrity sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hdnode" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/pbkdf2" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" +"@ethersproject/constants@5.6.0", "@ethersproject/constants@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.6.0.tgz#55e3eb0918584d3acc0688e9958b0cedef297088" + integrity sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA== + dependencies: + "@ethersproject/bignumber" "^5.6.0" + +"@ethersproject/contracts@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.6.1.tgz#c0eba3f8a2226456f92251a547344fd0593281d2" + integrity sha512-0fpBBDoPqJMsutE6sNjg6pvCJaIcl7tliMQTMRcoUWDACfjO68CpKOJBlsEhEhmzdnu/41KbrfAeg+sB3y35MQ== + dependencies: + "@ethersproject/abi" "^5.6.0" + "@ethersproject/abstract-provider" "^5.6.0" + "@ethersproject/abstract-signer" "^5.6.0" + "@ethersproject/address" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/constants" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/transactions" "^5.6.0" + +"@ethersproject/hash@5.6.0", "@ethersproject/hash@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.6.0.tgz#d24446a5263e02492f9808baa99b6e2b4c3429a2" + integrity sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA== + dependencies: + "@ethersproject/abstract-signer" "^5.6.0" + "@ethersproject/address" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/keccak256" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.0" + +"@ethersproject/hdnode@5.6.1", "@ethersproject/hdnode@^5.6.0": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.6.1.tgz#37fa1eb91f6e20ca39cc5fcb7acd3da263d85dab" + integrity sha512-6IuYDmbH5Bv/WH/A2cUd0FjNr4qTLAvyHAECiFZhNZp69pPvU7qIDwJ7CU7VAkwm4IVBzqdYy9mpMAGhQdwCDA== + dependencies: + "@ethersproject/abstract-signer" "^5.6.0" + "@ethersproject/basex" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/sha2" "^5.6.0" + "@ethersproject/signing-key" "^5.6.0" + "@ethersproject/strings" "^5.6.0" + "@ethersproject/transactions" "^5.6.0" + "@ethersproject/wordlists" "^5.6.0" + +"@ethersproject/json-wallets@5.6.0", "@ethersproject/json-wallets@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.6.0.tgz#4c2fc27f17e36c583e7a252fb938bc46f98891e5" + integrity sha512-fmh86jViB9r0ibWXTQipxpAGMiuxoqUf78oqJDlCAJXgnJF024hOOX7qVgqsjtbeoxmcLwpPsXNU0WEe/16qPQ== + dependencies: + "@ethersproject/abstract-signer" "^5.6.0" + "@ethersproject/address" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/hdnode" "^5.6.0" + "@ethersproject/keccak256" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/pbkdf2" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.0" + "@ethersproject/strings" "^5.6.0" + "@ethersproject/transactions" "^5.6.0" aes-js "3.0.0" scrypt-js "3.0.1" -"@ethersproject/keccak256@5.5.0", "@ethersproject/keccak256@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.5.0.tgz#e4b1f9d7701da87c564ffe336f86dcee82983492" - integrity sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg== +"@ethersproject/keccak256@5.6.0", "@ethersproject/keccak256@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.6.0.tgz#fea4bb47dbf8f131c2e1774a1cecbfeb9d606459" + integrity sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w== dependencies: - "@ethersproject/bytes" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" js-sha3 "0.8.0" -"@ethersproject/logger@5.5.0", "@ethersproject/logger@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.5.0.tgz#0c2caebeff98e10aefa5aef27d7441c7fd18cf5d" - integrity sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg== - -"@ethersproject/networks@5.5.0", "@ethersproject/networks@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.5.0.tgz#babec47cab892c51f8dd652ce7f2e3e14283981a" - integrity sha512-KWfP3xOnJeF89Uf/FCJdV1a2aDJe5XTN2N52p4fcQ34QhDqQFkgQKZ39VGtiqUgHcLI8DfT0l9azC3KFTunqtA== - dependencies: - "@ethersproject/logger" "^5.5.0" +"@ethersproject/logger@5.6.0", "@ethersproject/logger@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a" + integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== -"@ethersproject/pbkdf2@5.5.0", "@ethersproject/pbkdf2@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz#e25032cdf02f31505d47afbf9c3e000d95c4a050" - integrity sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg== +"@ethersproject/networks@5.6.2", "@ethersproject/networks@^5.6.0": + version "5.6.2" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.2.tgz#2bacda62102c0b1fcee408315f2bed4f6fbdf336" + integrity sha512-9uEzaJY7j5wpYGTojGp8U89mSsgQLc40PCMJLMCnFXTs7nhBveZ0t7dbqWUNrepWTszDbFkYD6WlL8DKx5huHA== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" + "@ethersproject/logger" "^5.6.0" -"@ethersproject/properties@5.5.0", "@ethersproject/properties@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.5.0.tgz#61f00f2bb83376d2071baab02245f92070c59995" - integrity sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA== +"@ethersproject/pbkdf2@5.6.0", "@ethersproject/pbkdf2@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.6.0.tgz#04fcc2d7c6bff88393f5b4237d906a192426685a" + integrity sha512-Wu1AxTgJo3T3H6MIu/eejLFok9TYoSdgwRr5oGY1LTLfmGesDoSx05pemsbrPT2gG4cQME+baTSCp5sEo2erZQ== dependencies: - "@ethersproject/logger" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/sha2" "^5.6.0" -"@ethersproject/providers@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.5.0.tgz#bc2876a8fe5e0053ed9828b1f3767ae46e43758b" - integrity sha512-xqMbDnS/FPy+J/9mBLKddzyLLAQFjrVff5g00efqxPzcAwXiR+SiCGVy6eJ5iAIirBOATjx7QLhDNPGV+AEQsw== - dependencies: - "@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" +"@ethersproject/properties@5.6.0", "@ethersproject/properties@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.6.0.tgz#38904651713bc6bdd5bdd1b0a4287ecda920fa04" + integrity sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg== + dependencies: + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/providers@5.6.6": + version "5.6.6" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.6.6.tgz#1967149cb4557d253f8c176a44aabda155f228cd" + integrity sha512-6X6agj3NeQ4tgnvBMCjHK+CjQbz+Qmn20JTxCYZ/uymrgCEOpJtY9zeRxJIDsSi0DPw8xNAxypj95JMCsapUfA== + dependencies: + "@ethersproject/abstract-provider" "^5.6.0" + "@ethersproject/abstract-signer" "^5.6.0" + "@ethersproject/address" "^5.6.0" + "@ethersproject/basex" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/constants" "^5.6.0" + "@ethersproject/hash" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/networks" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.0" + "@ethersproject/rlp" "^5.6.0" + "@ethersproject/sha2" "^5.6.0" + "@ethersproject/strings" "^5.6.0" + "@ethersproject/transactions" "^5.6.0" + "@ethersproject/web" "^5.6.0" bech32 "1.1.4" ws "7.4.6" -"@ethersproject/random@5.5.0", "@ethersproject/random@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.5.0.tgz#305ed9e033ca537735365ac12eed88580b0f81f9" - integrity sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ== +"@ethersproject/random@5.6.0", "@ethersproject/random@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.6.0.tgz#1505d1ab6a250e0ee92f436850fa3314b2cb5ae6" + integrity sha512-si0PLcLjq+NG/XHSZz90asNf+YfKEqJGVdxoEkSukzbnBgC8rydbgbUgBbBGLeHN4kAJwUFEKsu3sCXT93YMsw== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" -"@ethersproject/rlp@5.5.0", "@ethersproject/rlp@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.5.0.tgz#530f4f608f9ca9d4f89c24ab95db58ab56ab99a0" - integrity sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA== +"@ethersproject/rlp@5.6.0", "@ethersproject/rlp@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.6.0.tgz#55a7be01c6f5e64d6e6e7edb6061aa120962a717" + integrity sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" -"@ethersproject/sha2@5.5.0", "@ethersproject/sha2@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.5.0.tgz#a40a054c61f98fd9eee99af2c3cc6ff57ec24db7" - integrity sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA== +"@ethersproject/sha2@5.6.0", "@ethersproject/sha2@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.6.0.tgz#364c4c11cc753bda36f31f001628706ebadb64d9" + integrity sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" hash.js "1.1.7" -"@ethersproject/signing-key@5.5.0", "@ethersproject/signing-key@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.5.0.tgz#2aa37169ce7e01e3e80f2c14325f624c29cedbe0" - integrity sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng== +"@ethersproject/signing-key@5.6.1", "@ethersproject/signing-key@^5.6.0": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.6.1.tgz#31b0a531520616254eb0465b9443e49515c4d457" + integrity sha512-XvqQ20DH0D+bS3qlrrgh+axRMth5kD1xuvqUQUTeezxUTXBOeR6hWz2/C6FBEu39FRytyybIWrYf7YLSAKr1LQ== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" bn.js "^4.11.9" elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/solidity@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.5.0.tgz#2662eb3e5da471b85a20531e420054278362f93f" - integrity sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/strings@5.5.0", "@ethersproject/strings@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.5.0.tgz#e6784d00ec6c57710755699003bc747e98c5d549" - integrity sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ== +"@ethersproject/solidity@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.6.0.tgz#64657362a596bf7f5630bdc921c07dd78df06dc3" + integrity sha512-YwF52vTNd50kjDzqKaoNNbC/r9kMDPq3YzDWmsjFTRBcIF1y4JCQJ8gB30wsTfHbaxgxelI5BfxQSxD/PbJOww== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/keccak256" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/sha2" "^5.6.0" + "@ethersproject/strings" "^5.6.0" -"@ethersproject/transactions@5.5.0", "@ethersproject/transactions@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.5.0.tgz#7e9bf72e97bcdf69db34fe0d59e2f4203c7a2908" - integrity sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA== - dependencies: - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/rlp" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - -"@ethersproject/units@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.5.0.tgz#104d02db5b5dc42cc672cc4587bafb87a95ee45e" - integrity sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag== +"@ethersproject/strings@5.6.0", "@ethersproject/strings@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.6.0.tgz#9891b26709153d996bf1303d39a7f4bc047878fd" + integrity sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg== dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/constants" "^5.6.0" + "@ethersproject/logger" "^5.6.0" -"@ethersproject/wallet@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.5.0.tgz#322a10527a440ece593980dca6182f17d54eae75" - integrity sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q== - dependencies: - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/hdnode" "^5.5.0" - "@ethersproject/json-wallets" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/wordlists" "^5.5.0" - -"@ethersproject/web@5.5.0", "@ethersproject/web@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.5.0.tgz#0e5bb21a2b58fb4960a705bfc6522a6acf461e28" - integrity sha512-BEgY0eL5oH4mAo37TNYVrFeHsIXLRxggCRG/ksRIxI2X5uj5IsjGmcNiRN/VirQOlBxcUhCgHhaDLG4m6XAVoA== +"@ethersproject/transactions@5.6.0", "@ethersproject/transactions@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.6.0.tgz#4b594d73a868ef6e1529a2f8f94a785e6791ae4e" + integrity sha512-4HX+VOhNjXHZyGzER6E/LVI2i6lf9ejYeWD6l4g50AdmimyuStKc39kvKf1bXWQMg7QNVh+uC7dYwtaZ02IXeg== + dependencies: + "@ethersproject/address" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/constants" "^5.6.0" + "@ethersproject/keccak256" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/rlp" "^5.6.0" + "@ethersproject/signing-key" "^5.6.0" + +"@ethersproject/units@5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.6.0.tgz#e5cbb1906988f5740254a21b9ded6bd51e826d9c" + integrity sha512-tig9x0Qmh8qbo1w8/6tmtyrm/QQRviBh389EQ+d8fP4wDsBrJBf08oZfoiz1/uenKK9M78yAP4PoR7SsVoTjsw== + dependencies: + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/constants" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + +"@ethersproject/wallet@5.6.1": + version "5.6.1" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.6.1.tgz#5df4f75f848ed84ca30fd6ca75d2c66b19c5552b" + integrity sha512-oXWoOslEWtwZiViIMlGVjeKDQz/tI7JF9UkyzN9jaGj8z7sXt2SyFMb0Ev6vSAqjIzrCrNrJ/+MkAhtKnGOfZw== + dependencies: + "@ethersproject/abstract-provider" "^5.6.0" + "@ethersproject/abstract-signer" "^5.6.0" + "@ethersproject/address" "^5.6.0" + "@ethersproject/bignumber" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/hash" "^5.6.0" + "@ethersproject/hdnode" "^5.6.0" + "@ethersproject/json-wallets" "^5.6.0" + "@ethersproject/keccak256" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/random" "^5.6.0" + "@ethersproject/signing-key" "^5.6.0" + "@ethersproject/transactions" "^5.6.0" + "@ethersproject/wordlists" "^5.6.0" + +"@ethersproject/web@5.6.0", "@ethersproject/web@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.6.0.tgz#4bf8b3cbc17055027e1a5dd3c357e37474eaaeb8" + integrity sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg== dependencies: - "@ethersproject/base64" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" + "@ethersproject/base64" "^5.6.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.0" -"@ethersproject/wordlists@5.5.0", "@ethersproject/wordlists@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.5.0.tgz#aac74963aa43e643638e5172353d931b347d584f" - integrity sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q== +"@ethersproject/wordlists@5.6.0", "@ethersproject/wordlists@^5.6.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.6.0.tgz#79e62c5276e091d8575f6930ba01a29218ded032" + integrity sha512-q0bxNBfIX3fUuAo9OmjlEYxP40IB8ABgb7HjEZCL5IKubzV3j30CWi2rqQbjTS2HfoyQbfINoKcTVWP4ejwR7Q== dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" + "@ethersproject/bytes" "^5.6.0" + "@ethersproject/hash" "^5.6.0" + "@ethersproject/logger" "^5.6.0" + "@ethersproject/properties" "^5.6.0" + "@ethersproject/strings" "^5.6.0" "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -4612,41 +4612,41 @@ ethereumjs-util@^6.0.0: ethjs-util "0.1.6" rlp "^2.2.3" -ethers@^5.4.6: - version "5.5.1" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.5.1.tgz#d3259a95a42557844aa543906c537106c0406fbf" - integrity sha512-RodEvUFZI+EmFcE6bwkuJqpCYHazdzeR1nMzg+YWQSmQEsNtfl1KHGfp/FWZYl48bI/g7cgBeP2IlPthjiVngw== - dependencies: - "@ethersproject/abi" "5.5.0" - "@ethersproject/abstract-provider" "5.5.1" - "@ethersproject/abstract-signer" "5.5.0" - "@ethersproject/address" "5.5.0" - "@ethersproject/base64" "5.5.0" - "@ethersproject/basex" "5.5.0" - "@ethersproject/bignumber" "5.5.0" - "@ethersproject/bytes" "5.5.0" - "@ethersproject/constants" "5.5.0" - "@ethersproject/contracts" "5.5.0" - "@ethersproject/hash" "5.5.0" - "@ethersproject/hdnode" "5.5.0" - "@ethersproject/json-wallets" "5.5.0" - "@ethersproject/keccak256" "5.5.0" - "@ethersproject/logger" "5.5.0" - "@ethersproject/networks" "5.5.0" - "@ethersproject/pbkdf2" "5.5.0" - "@ethersproject/properties" "5.5.0" - "@ethersproject/providers" "5.5.0" - "@ethersproject/random" "5.5.0" - "@ethersproject/rlp" "5.5.0" - "@ethersproject/sha2" "5.5.0" - "@ethersproject/signing-key" "5.5.0" - "@ethersproject/solidity" "5.5.0" - "@ethersproject/strings" "5.5.0" - "@ethersproject/transactions" "5.5.0" - "@ethersproject/units" "5.5.0" - "@ethersproject/wallet" "5.5.0" - "@ethersproject/web" "5.5.0" - "@ethersproject/wordlists" "5.5.0" +ethers@^5.6.5: + version "5.6.6" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.6.tgz#a37aa7e265a484a1b4d2ef91d4d89d6b43808a57" + integrity sha512-2B2ZmSGvRcJpHnFMBk58mkXP50njFipUBCgLK8jUTFbomhVs501cLzyMU6+Vx8YnUDQxywC3qkZvd33xWS+2FA== + dependencies: + "@ethersproject/abi" "5.6.2" + "@ethersproject/abstract-provider" "5.6.0" + "@ethersproject/abstract-signer" "5.6.1" + "@ethersproject/address" "5.6.0" + "@ethersproject/base64" "5.6.0" + "@ethersproject/basex" "5.6.0" + "@ethersproject/bignumber" "5.6.1" + "@ethersproject/bytes" "5.6.1" + "@ethersproject/constants" "5.6.0" + "@ethersproject/contracts" "5.6.1" + "@ethersproject/hash" "5.6.0" + "@ethersproject/hdnode" "5.6.1" + "@ethersproject/json-wallets" "5.6.0" + "@ethersproject/keccak256" "5.6.0" + "@ethersproject/logger" "5.6.0" + "@ethersproject/networks" "5.6.2" + "@ethersproject/pbkdf2" "5.6.0" + "@ethersproject/properties" "5.6.0" + "@ethersproject/providers" "5.6.6" + "@ethersproject/random" "5.6.0" + "@ethersproject/rlp" "5.6.0" + "@ethersproject/sha2" "5.6.0" + "@ethersproject/signing-key" "5.6.1" + "@ethersproject/solidity" "5.6.0" + "@ethersproject/strings" "5.6.0" + "@ethersproject/transactions" "5.6.0" + "@ethersproject/units" "5.6.0" + "@ethersproject/wallet" "5.6.1" + "@ethersproject/web" "5.6.0" + "@ethersproject/wordlists" "5.6.0" ethjs-util@0.1.6, ethjs-util@^0.1.3: version "0.1.6"