diff --git a/dist/multicall.cjs.js b/dist/multicall.cjs.js new file mode 100644 index 0000000..ea6a3bf --- /dev/null +++ b/dist/multicall.cjs.js @@ -0,0 +1,700 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var hash = require('ethers/utils/hash'); +var invariant = _interopDefault(require('invariant')); +var fetch = _interopDefault(require('cross-fetch')); +var abiCoder = require('ethers/utils/abi-coder'); +var debug = _interopDefault(require('debug')); +var memoize = _interopDefault(require('lodash/memoize')); +var _extends = _interopDefault(require('@babel/runtime/helpers/extends')); +var WebSocket = _interopDefault(require('isomorphic-ws')); + +var log = debug('multicall'); // Function signature for: aggregate((address,bytes)[]) + +var AGGREGATE_SELECTOR = '0x252dba42'; +function strip0x(str) { + return str.replace(/^0x/, ''); +} +function encodeParameters(types, vals) { + return abiCoder.defaultAbiCoder.encode(types, vals); +} +function decodeParameters(types, vals) { + return abiCoder.defaultAbiCoder.decode(types, '0x' + vals.replace(/0x/i, '')); +} +function isEmpty(obj) { + if (Array.isArray(obj)) return obj.length === 0; + return !obj || Object.keys(obj).length === 0; +} +async function ethCall(rawData, _ref) { + var id = _ref.id, + web3 = _ref.web3, + ethers = _ref.ethers, + provider = _ref.provider, + rpcUrl = _ref.rpcUrl, + block = _ref.block, + multicallAddress = _ref.multicallAddress, + ws = _ref.ws, + wsResponseTimeout = _ref.wsResponseTimeout; + var abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData); + + if (ws) { + log('Sending via WebSocket'); + return new Promise(function (resolve, reject) { + ws.send(JSON.stringify({ + jsonrpc: '2.0', + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'], + id: id + })); + + function onMessage(data) { + if (typeof data !== 'string') data = data.data; + var json = JSON.parse(data); + if (!json.id || json.id !== id) return; + log('Got WebSocket response id #%d', json.id); + clearTimeout(timeoutHandle); + ws.onmessage = null; + resolve(json.result); + } + + var timeoutHandle = setTimeout(function () { + if (ws.onmessage !== onMessage) return; + ws.onmessage = null; + reject(new Error('WebSocket response timeout')); + }, wsResponseTimeout); + ws.onmessage = onMessage; + }); + } else if (ethers) { + log('Sending via ethers provider'); + return ethers.send({ + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'] + }); + } else if (provider) { + log('Sending via EIP-1193 provider'); + return provider.request({ + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'] + }); + } else if (web3) { + log('Sending via web3 provider'); + return web3.eth.call({ + to: multicallAddress, + data: abiEncodedData + }); + } else { + log('Sending via XHR fetch'); + var rawResponse = await fetch(rpcUrl, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + jsonrpc: '2.0', + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'], + id: 1 + }) + }); + var content = await rawResponse.json(); + + if (!content || !content.result) { + throw new Error('Multicall received an empty response. Check your call configuration for errors.'); + } + + return content.result; + } +} + +var INSIDE_EVERY_PARENTHESES = /\(.*?\)/g; +var FIRST_CLOSING_PARENTHESES = /^[^)]*\)/; +function _makeMulticallData(calls) { + var values = [calls.map(function (_ref) { + var target = _ref.target, + method = _ref.method, + args = _ref.args, + returnTypes = _ref.returnTypes; + return [target, hash.id(method).substr(0, 10) + (args && args.length > 0 ? strip0x(encodeParameters(args.map(function (a) { + return a[1]; + }), args.map(function (a) { + return a[0]; + }))) : '')]; + })]; + var calldata = encodeParameters([{ + components: [{ + type: 'address' + }, { + type: 'bytes' + }], + name: 'data', + type: 'tuple[]' + }], values); + return calldata; +} +var makeMulticallData = memoize(_makeMulticallData, function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return JSON.stringify(args); +}); +async function aggregate(calls, config) { + calls = Array.isArray(calls) ? calls : [calls]; + var keyToArgMap = calls.reduce(function (acc, _ref2) { + var call = _ref2.call, + returns = _ref2.returns; + var args = call.slice(1); + + if (args.length > 0) { + for (var _iterator = returns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var returnMeta = _ref3; + var key = returnMeta[0]; + acc[key] = args; + } + } + + return acc; + }, {}); + calls = calls.map(function (_ref4) { + var call = _ref4.call, + target = _ref4.target, + returns = _ref4.returns; + if (!target) target = config.multicallAddress; + var method = call[0], + argValues = call.slice(1); + + var _method$match$map = method.match(INSIDE_EVERY_PARENTHESES).map(function (match) { + return match.slice(1, -1); + }), + argTypesString = _method$match$map[0], + returnTypesString = _method$match$map[1]; + + var argTypes = argTypesString.split(',').filter(function (e) { + return !!e; + }); + invariant(argTypes.length === argValues.length, "Every method argument must have exactly one type.\n Comparing argument types " + JSON.stringify(argTypes) + "\n to argument values " + JSON.stringify(argValues) + ".\n "); + var args = argValues.map(function (argValue, idx) { + return [argValue, argTypes[idx]]; + }); + var returnTypes = !!returnTypesString ? returnTypesString.split(',') : []; + return { + method: method.match(FIRST_CLOSING_PARENTHESES)[0], + args: args, + returnTypes: returnTypes, + target: target, + returns: returns + }; + }); + var callDataBytes = makeMulticallData(calls, false); + var outerResults = await ethCall(callDataBytes, config); + var returnTypeArray = calls.map(function (_ref5) { + var returnTypes = _ref5.returnTypes; + return returnTypes; + }).reduce(function (acc, ele) { + return acc.concat(ele); + }, []); + var returnDataMeta = calls.map(function (_ref6) { + var returns = _ref6.returns; + return returns; + }).reduce(function (acc, ele) { + return acc.concat(ele); + }, []); + invariant(returnTypeArray.length === returnDataMeta.length, 'Missing data needed to parse results'); + var outerResultsDecoded = decodeParameters(['uint256', 'bytes[]'], outerResults); + var blockNumber = outerResultsDecoded.shift(); + var parsedVals = outerResultsDecoded.reduce(function (acc, r) { + r.forEach(function (results, idx) { + var types = calls[idx].returnTypes; + var resultsDecoded = decodeParameters(types, results); + acc.push.apply(acc, resultsDecoded.map(function (r, idx) { + if (types[idx] === 'bool') return r.toString() === 'true'; + return r; + })); + }); + return acc; + }, []); + var retObj = { + blockNumber: blockNumber, + original: {}, + transformed: {} + }; + + for (var i = 0; i < parsedVals.length; i++) { + var _returnDataMeta$i = returnDataMeta[i], + name = _returnDataMeta$i[0], + transform = _returnDataMeta$i[1]; + retObj.original[name] = parsedVals[i]; + retObj.transformed[name] = transform !== undefined ? transform(parsedVals[i]) : parsedVals[i]; + } + + return { + results: retObj, + keyToArgMap: keyToArgMap + }; +} + +var mainnet = { + multicall: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441", + rpcUrl: "https://mainnet.infura.io" +}; +var kovan = { + multicall: "0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a", + rpcUrl: "https://kovan.infura.io" +}; +var rinkeby = { + multicall: "0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821", + rpcUrl: "https://rinkeby.infura.io" +}; +var goerli = { + multicall: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e", + rpcUrl: "https://rpc.slock.it/goerli" +}; +var xdai = { + multicall: "0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a", + rpcUrl: "https://dai.poa.network" +}; +var addresses = { + mainnet: mainnet, + kovan: kovan, + rinkeby: rinkeby, + goerli: goerli, + xdai: xdai +}; + +var log$1 = debug('multicall'); +var reWsEndpoint = /^wss?:\/\//i; + +function isNewState(type, value, store) { + return store[type] === undefined || (value !== null && store[type] !== null && typeof value === 'object' && typeof value.toString === 'function' && typeof store[type] === 'object' && typeof store[type].toString === 'function' ? value.toString() !== store[type].toString() : value !== store[type]); +} + +function prepareConfig(config) { + config = _extends({ + interval: 1000, + staleBlockRetryWait: 3000, + errorRetryWait: 5000, + wsResponseTimeout: 5000, + wsReconnectTimeout: 5000 + }, config); + + if (config.preset !== undefined) { + if (addresses[config.preset] !== undefined) { + config.multicallAddress = addresses[config.preset].multicall; + config.rpcUrl = addresses[config.preset].rpcUrl; + } else throw new Error("Unknown preset " + config.preset); + } + + return config; +} + +function createWatcher(model, config) { + var state = { + model: [].concat(model), + store: {}, + storeTransformed: {}, + keyToArgMap: {}, + latestPromiseId: 0, + latestBlockNumber: null, + id: 0, + listeners: { + subscribe: [], + block: [], + poll: [], + error: [] + }, + handler: null, + wsReconnectHandler: null, + watching: false, + config: prepareConfig(config), + ws: null + }; + + function reconnectWebSocket(timeout) { + clearTimeout(state.handler); + state.handler = null; + clearTimeout(state.wsReconnectHandler); + state.wsReconnectHandler = setTimeout(function () { + destroyWebSocket(); + setupWebSocket(); + }, timeout); + } + + function setupWebSocket() { + if (reWsEndpoint.test(state.config.rpcUrl)) { + log$1("Connecting to WebSocket " + state.config.rpcUrl + "..."); + state.ws = new WebSocket(state.config.rpcUrl); + + state.ws.onopen = function () { + log$1('WebSocket connected'); + if (state.handler) throw new Error('Existing poll setTimeout handler set'); + + if (state.watching) { + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: state.initialFetchResolver + }); + } + }; + + state.ws.onclose = function (err) { + log$1('WebSocket closed: %s', JSON.stringify(err)); + log$1("Reconnecting in " + state.config.wsReconnectTimeout / 1000 + " seconds."); + reconnectWebSocket(state.config.wsReconnectTimeout); + }; + + state.ws.onerror = function (err) { + log$1('WebSocket error: %s', JSON.stringify(err)); + log$1("Reconnecting in " + state.config.wsReconnectTimeout / 1000 + " seconds."); + reconnectWebSocket(state.config.wsReconnectTimeout); + }; + } + } + + function destroyWebSocket() { + log$1('destroyWebSocket()'); + state.ws.onopen = null; + state.ws.onclose = null; + state.ws.onerror = null; + state.ws.onmessage = null; + state.ws.close(); + } + + setupWebSocket(); + state.initialFetchPromise = new Promise(function (resolve) { + state.initialFetchResolver = resolve; + }); + + function _subscribe(listener, id, batch) { + if (batch === void 0) { + batch = false; + } + + if (!isEmpty(state.storeTransformed)) { + var events = Object.entries(state.storeTransformed).map(function (_ref) { + var type = _ref[0], + value = _ref[1]; + return { + type: type, + value: value, + args: state.keyToArgMap[type] || [] + }; + }); + batch ? listener(events) : events.forEach(listener); + } + + state.listeners.subscribe.push({ + listener: listener, + id: id, + batch: batch + }); + } + + function alertListeners(events) { + if (!isEmpty(events)) state.listeners.subscribe.forEach(function (_ref2) { + var listener = _ref2.listener, + batch = _ref2.batch; + return batch ? listener(events) : events.forEach(listener); + }); + } + + function _poll() { + var _this = this; + + var interval = this.interval !== undefined ? this.interval : this.state.config.interval; + log$1('poll() called, %s%s', 'interval: ' + interval, this.retry ? ', retry: ' + this.retry : ''); + this.state.handler = setTimeout(async function () { + try { + if (!_this.state.handler) return; + _this.state.latestPromiseId++; + var promiseId = _this.state.latestPromiseId; + state.listeners.poll.forEach(function (_ref3) { + var listener = _ref3.listener; + return listener(_extends({ + id: promiseId, + latestBlockNumber: _this.state.latestBlockNumber + }, _this.retry ? { + retry: _this.retry + } : {})); + }); + + var _ref4 = await aggregate(_this.state.model, _extends({}, _this.state.config, { + ws: _this.state.ws, + id: _this.state.latestPromiseId + })), + _ref4$results = _ref4.results, + blockNumber = _ref4$results.blockNumber, + data = _extends({}, _ref4$results.original), + dataTransformed = _extends({}, _ref4$results.transformed), + keyToArgMap = _ref4.keyToArgMap; + + if (_this.state.cancelPromiseId === promiseId) return; + if (typeof _this.resolveFetchPromise === 'function') _this.resolveFetchPromise(); + + if (_this.state.latestBlockNumber !== null && blockNumber < _this.state.latestBlockNumber) { + // Retry if blockNumber is lower than latestBlockNumber + log$1("Stale block returned, retrying in " + _this.state.config.staleBlockRetryWait / 1000 + " seconds"); + + _poll.call({ + state: _this.state, + interval: _this.state.config.staleBlockRetryWait, + retry: _this.retry ? _this.retry + 1 : 1 + }); + } else { + if (_this.state.latestBlockNumber === null || _this.state.latestBlockNumber !== null && blockNumber > _this.state.latestBlockNumber) { + _this.state.latestBlockNumber = parseInt(blockNumber); + state.listeners.block.forEach(function (_ref5) { + var listener = _ref5.listener; + return listener(_this.state.latestBlockNumber); + }); + } + + var events = Object.entries(data).filter(function (_ref6) { + var type = _ref6[0], + value = _ref6[1]; + return isNewState(type, value, _this.state.store); + }).map(function (_ref7) { + var type = _ref7[0]; + return { + type: type, + value: dataTransformed[type], + args: keyToArgMap[type] || [] + }; + }); + _this.state.store = _extends({}, data); + _this.state.storeTransformed = _extends({}, dataTransformed); + _this.state.keyToArgMap = _extends({}, keyToArgMap); + alertListeners(events); + + _poll.call({ + state: _this.state + }); + } + } catch (err) { + log$1('Error: %s', err.message); + state.listeners.error.forEach(function (_ref8) { + var listener = _ref8.listener; + return listener(err, _this.state); + }); + if (!_this.state.handler) return; // Retry on error + + log$1("Error occured, retrying in " + _this.state.config.errorRetryWait / 1000 + " seconds"); + + _poll.call({ + state: _this.state, + interval: _this.state.config.errorRetryWait, + retry: _this.retry ? _this.retry + 1 : 1 + }); + } + }, interval); + } + + var watcher = { + tap: function tap(transform) { + log$1('watcher.tap() called'); + var nextModel = transform([].concat(state.model)); + state.model = [].concat(nextModel); + return this.poll(); + }, + poll: function poll() { + log$1('watcher.poll() called'); + var resolveFetchPromise; + var fetchPromise = new Promise(function (resolve) { + resolveFetchPromise = resolve; + }); + + if (state.watching && (!state.ws || state.ws.readyState === WebSocket.OPEN)) { + clearTimeout(state.handler); + state.handler = null; + + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: resolveFetchPromise + }); + + return fetchPromise; + } + + return Promise.resolve(); + }, + subscribe: function subscribe(listener) { + var id = state.id++; + + _subscribe(listener, id, false); + + return { + unsub: function unsub() { + state.listeners.subscribe = state.listeners.subscribe.filter(function (_ref9) { + var _id = _ref9.id; + return _id !== id; + }); + } + }; + }, + batch: function batch() { + return { + subscribe: function subscribe(listener) { + var id = state.id++; + + _subscribe(listener, id, true); + + return { + unsub: function unsub() { + state.listeners.subscribe = state.listeners.subscribe.filter(function (_ref10) { + var _id = _ref10.id; + return _id !== id; + }); + } + }; + } + }; + }, + onNewBlock: function onNewBlock(listener) { + var id = state.id++; + state.latestBlockNumber && listener(state.latestBlockNumber); + state.listeners.block.push({ + listener: listener, + id: id + }); + return { + unsub: function unsub() { + state.listeners.block = state.listeners.block.filter(function (_ref11) { + var _id = _ref11.id; + return _id !== id; + }); + } + }; + }, + onPoll: function onPoll(listener) { + var id = state.id++; + state.listeners.poll.push({ + listener: listener, + id: id + }); + return { + unsub: function unsub() { + state.listeners.poll = state.listeners.poll.filter(function (_ref12) { + var _id = _ref12.id; + return _id !== id; + }); + } + }; + }, + onError: function onError(listener) { + var id = state.id++; + state.listeners.error.push({ + listener: listener, + id: id + }); + return { + unsub: function unsub() { + state.listeners.error = state.listeners.error.filter(function (_ref13) { + var _id = _ref13.id; + return _id !== id; + }); + } + }; + }, + start: function start() { + log$1('watcher.start() called'); + state.watching = true; + + if (!state.ws || state.ws.readyState === WebSocket.OPEN) { + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: state.initialFetchResolver + }); + } + + return state.initialFetchPromise; + }, + stop: function stop() { + log$1('watcher.stop() called'); + clearTimeout(state.handler); + state.handler = null; + clearTimeout(state.wsReconnectHandler); + state.wsReconnectHandler = null; + state.watching = false; + }, + recreate: function recreate(model, config) { + log$1('watcher.recreate() called'); + clearTimeout(state.handler); + state.handler = null; + clearTimeout(state.wsReconnectHandler); + state.wsReconnectHandler = null; + if (state.ws) destroyWebSocket(); + state.ws = null; + state.config = prepareConfig(config); + state.model = [].concat(model); + state.store = {}; + state.storeTransformed = {}; + state.latestBlockNumber = null; + state.cancelPromiseId = state.latestPromiseId; + setupWebSocket(); + + if (state.watching && !state.ws) { + var resolveFetchPromise; + var fetchPromise = new Promise(function (resolve) { + resolveFetchPromise = resolve; + }); + + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: resolveFetchPromise + }); + + return fetchPromise; + } + + return Promise.resolve(); + }, + awaitInitialFetch: function awaitInitialFetch() { + return state.initialFetchPromise; + }, + + get initialFetch() { + return state.initialFetchPromise; + }, + + get schemas() { + return state.model; + } + + }; + return watcher; +} + +exports.aggregate = aggregate; +exports.createWatcher = createWatcher; +//# sourceMappingURL=multicall.cjs.js.map diff --git a/dist/multicall.cjs.js.map b/dist/multicall.cjs.js.map new file mode 100644 index 0000000..a34dca1 --- /dev/null +++ b/dist/multicall.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multicall.cjs.js","sources":["../src/helpers.js","../src/aggregate.js","../src/watcher.js"],"sourcesContent":["import fetch from 'cross-fetch';\nimport { defaultAbiCoder } from 'ethers/utils/abi-coder';\nimport debug from 'debug';\nconst log = debug('multicall');\n\n// Function signature for: aggregate((address,bytes)[])\nexport const AGGREGATE_SELECTOR = '0x252dba42';\n\nexport function strip0x(str) {\n return str.replace(/^0x/, '');\n}\n\nexport function typesLength(types) {\n return types.length;\n}\n\nexport function encodeParameter(type, val) {\n return encodeParameters([type], [val]);\n}\n\nexport function encodeParameters(types, vals) {\n return defaultAbiCoder.encode(types, vals);\n}\n\nexport function decodeParameter(type, val) {\n return decodeParameters([type], val);\n}\n\nexport function decodeParameters(types, vals) {\n return defaultAbiCoder.decode(types, '0x' + vals.replace(/0x/i, ''));\n}\n\nexport function padLeft(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n new Array(padding).join(sign ? sign : '0') +\n string\n );\n}\n\nexport function padRight(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n string +\n new Array(padding).join(sign ? sign : '0')\n );\n}\n\nexport function isEmpty(obj) {\n if (Array.isArray(obj)) return obj.length === 0;\n return !obj || Object.keys(obj).length === 0;\n}\n\nexport async function ethCall(rawData, { id, web3, ethers, provider, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) {\n const abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData);\n if (ws) {\n log('Sending via WebSocket');\n return new Promise((resolve, reject) => {\n ws.send(JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id\n }));\n function onMessage(data) {\n if (typeof data !== 'string') data = data.data;\n const json = JSON.parse(data);\n if (!json.id || json.id !== id) return;\n log('Got WebSocket response id #%d', json.id);\n clearTimeout(timeoutHandle);\n ws.onmessage = null;\n resolve(json.result);\n }\n const timeoutHandle = setTimeout(() => {\n if (ws.onmessage !== onMessage) return;\n ws.onmessage = null;\n reject(new Error('WebSocket response timeout'));\n }, wsResponseTimeout);\n\n ws.onmessage = onMessage;\n });\n }\n else if (ethers) {\n log('Sending via ethers provider');\n return ethers.send({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (provider) {\n log('Sending via EIP-1193 provider');\n return provider.request({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (web3) {\n log('Sending via web3 provider');\n return web3.eth.call({\n to: multicallAddress,\n data: abiEncodedData\n });\n } else {\n log('Sending via XHR fetch');\n const rawResponse = await fetch(rpcUrl, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id: 1\n })\n });\n const content = await rawResponse.json();\n if (!content || !content.result) {\n throw new Error('Multicall received an empty response. Check your call configuration for errors.');\n }\n return content.result;\n }\n}\n","import { id as keccak256 } from 'ethers/utils/hash';\nimport invariant from 'invariant';\nimport { strip0x, ethCall, encodeParameters, decodeParameters } from './helpers.js';\nimport memoize from 'lodash/memoize';\n\nconst INSIDE_EVERY_PARENTHESES = /\\(.*?\\)/g;\nconst FIRST_CLOSING_PARENTHESES = /^[^)]*\\)/;\n\nexport function _makeMulticallData(calls) {\n const values = [\n calls.map(({ target, method, args, returnTypes }) => [\n target,\n keccak256(method).substr(0, 10) +\n (args && args.length > 0\n ? strip0x(encodeParameters(args.map(a => a[1]), args.map(a => a[0])))\n : '')\n ])\n ];\n const calldata = encodeParameters(\n [\n {\n components: [{ type: 'address' }, { type: 'bytes' }],\n name: 'data',\n type: 'tuple[]'\n }\n ],\n values\n );\n return calldata;\n}\n\nconst makeMulticallData = memoize(_makeMulticallData, (...args) => JSON.stringify(args));\n\nexport default async function aggregate(calls, config) {\n calls = Array.isArray(calls) ? calls : [calls];\n\n const keyToArgMap = calls.reduce((acc, { call, returns }) => {\n const [, ...args] = call;\n if (args.length > 0) {\n for (let returnMeta of returns) {\n const [key] = returnMeta;\n acc[key] = args;\n }\n }\n return acc;\n }, {});\n\n calls = calls.map(({ call, target, returns }) => {\n if (!target) target = config.multicallAddress;\n const [method, ...argValues] = call;\n const [argTypesString, returnTypesString] = method\n .match(INSIDE_EVERY_PARENTHESES)\n .map(match => match.slice(1, -1));\n const argTypes = argTypesString.split(',').filter(e => !!e);\n invariant(\n argTypes.length === argValues.length,\n `Every method argument must have exactly one type.\n Comparing argument types ${JSON.stringify(argTypes)}\n to argument values ${JSON.stringify(argValues)}.\n `\n );\n const args = argValues.map((argValue, idx) => [argValue, argTypes[idx]]);\n const returnTypes = !!returnTypesString ? returnTypesString.split(',') : [];\n return {\n method: method.match(FIRST_CLOSING_PARENTHESES)[0],\n args,\n returnTypes,\n target,\n returns\n };\n });\n\n const callDataBytes = makeMulticallData(calls, false);\n const outerResults = await ethCall(callDataBytes, config);\n const returnTypeArray = calls\n .map(({ returnTypes }) => returnTypes)\n .reduce((acc, ele) => acc.concat(ele), []);\n const returnDataMeta = calls\n .map(({ returns }) => returns)\n .reduce((acc, ele) => acc.concat(ele), []);\n\n invariant(\n returnTypeArray.length === returnDataMeta.length,\n 'Missing data needed to parse results'\n );\n\n const outerResultsDecoded = decodeParameters(['uint256', 'bytes[]'], outerResults);\n const blockNumber = outerResultsDecoded.shift();\n const parsedVals = outerResultsDecoded.reduce((acc, r) => {\n r.forEach((results, idx) => {\n const types = calls[idx].returnTypes;\n const resultsDecoded = decodeParameters(types, results);\n acc.push(\n ...resultsDecoded.map((r, idx) => {\n if (types[idx] === 'bool') return r.toString() === 'true';\n return r;\n })\n );\n });\n return acc;\n }, []);\n\n const retObj = { blockNumber, original: {}, transformed: {} };\n\n for (let i = 0; i < parsedVals.length; i++) {\n const [name, transform] = returnDataMeta[i];\n retObj.original[name] = parsedVals[i];\n retObj.transformed[name] = transform !== undefined ? transform(parsedVals[i]) : parsedVals[i];\n }\n\n return { results: retObj, keyToArgMap };\n}\n","import WebSocket from 'isomorphic-ws';\nimport aggregate from './aggregate';\nimport { isEmpty } from './helpers';\nimport addresses from './addresses.json';\nimport debug from 'debug';\nconst log = debug('multicall');\n\nconst reWsEndpoint = /^wss?:\\/\\//i;\n\nfunction isNewState(type, value, store) {\n return (\n store[type] === undefined ||\n (value !== null &&\n store[type] !== null &&\n typeof value === 'object' &&\n typeof value.toString === 'function' &&\n typeof store[type] === 'object' &&\n typeof store[type].toString === 'function'\n ? value.toString() !== store[type].toString()\n : value !== store[type])\n );\n}\n\nfunction prepareConfig(config) {\n config = {\n interval: 1000,\n staleBlockRetryWait: 3000,\n errorRetryWait: 5000,\n wsResponseTimeout: 5000,\n wsReconnectTimeout: 5000,\n ...config\n };\n if (config.preset !== undefined) {\n if (addresses[config.preset] !== undefined) {\n config.multicallAddress = addresses[config.preset].multicall;\n config.rpcUrl = addresses[config.preset].rpcUrl;\n } else throw new Error(`Unknown preset ${config.preset}`);\n }\n return config;\n}\n\nexport default function createWatcher(model, config) {\n const state = {\n model: [...model],\n store: {},\n storeTransformed: {},\n keyToArgMap: {},\n latestPromiseId: 0,\n latestBlockNumber: null,\n id: 0,\n listeners: {\n subscribe: [],\n block: [],\n poll: [],\n error: []\n },\n handler: null,\n wsReconnectHandler: null,\n watching: false,\n config: prepareConfig(config),\n ws: null\n };\n\n function reconnectWebSocket(timeout) {\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = setTimeout(() => {\n destroyWebSocket();\n setupWebSocket();\n }, timeout);\n }\n\n function setupWebSocket() {\n if (reWsEndpoint.test(state.config.rpcUrl)) {\n log(`Connecting to WebSocket ${state.config.rpcUrl}...`);\n state.ws = new WebSocket(state.config.rpcUrl);\n state.ws.onopen = () => {\n log('WebSocket connected');\n if (state.handler) throw new Error('Existing poll setTimeout handler set');\n if (state.watching) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n };\n state.ws.onclose = err => {\n log('WebSocket closed: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n state.ws.onerror = err => {\n log('WebSocket error: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n }\n }\n\n function destroyWebSocket() {\n log('destroyWebSocket()');\n state.ws.onopen = null;\n state.ws.onclose = null;\n state.ws.onerror = null;\n state.ws.onmessage = null;\n state.ws.close();\n }\n\n setupWebSocket();\n\n state.initialFetchPromise = new Promise(resolve => {\n state.initialFetchResolver = resolve;\n });\n\n function subscribe(listener, id, batch = false) {\n if (!isEmpty(state.storeTransformed)) {\n const events = Object.entries(state.storeTransformed).map(([type, value]) => ({\n type,\n value,\n args: state.keyToArgMap[type] || []\n }));\n batch ? listener(events) : events.forEach(listener);\n }\n state.listeners.subscribe.push({ listener, id, batch });\n }\n\n function alertListeners(events) {\n if (!isEmpty(events))\n state.listeners.subscribe.forEach(({ listener, batch }) =>\n batch ? listener(events) : events.forEach(listener)\n );\n }\n\n function poll() {\n const interval = this.interval !== undefined ? this.interval : this.state.config.interval;\n log('poll() called, %s%s', 'interval: ' + interval, this.retry ? ', retry: ' + this.retry : '');\n this.state.handler = setTimeout(async () => {\n try {\n if (!this.state.handler) return;\n\n this.state.latestPromiseId++;\n const promiseId = this.state.latestPromiseId;\n\n state.listeners.poll.forEach(({ listener }) =>\n listener({\n id: promiseId,\n latestBlockNumber: this.state.latestBlockNumber,\n ...(this.retry ? { retry: this.retry } : {})\n })\n );\n\n const {\n results: {\n blockNumber,\n original: { ...data },\n transformed: { ...dataTransformed }\n },\n keyToArgMap\n } = await aggregate(this.state.model, {\n ...this.state.config,\n ws: this.state.ws,\n id: this.state.latestPromiseId\n });\n\n if (this.state.cancelPromiseId === promiseId) return;\n\n if (typeof this.resolveFetchPromise === 'function') this.resolveFetchPromise();\n\n if (this.state.latestBlockNumber !== null && blockNumber < this.state.latestBlockNumber) {\n // Retry if blockNumber is lower than latestBlockNumber\n log(\n `Stale block returned, retrying in ${this.state.config.staleBlockRetryWait /\n 1000} seconds`\n );\n poll.call({\n state: this.state,\n interval: this.state.config.staleBlockRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n } else {\n if (\n this.state.latestBlockNumber === null ||\n (this.state.latestBlockNumber !== null && blockNumber > this.state.latestBlockNumber)\n ) {\n this.state.latestBlockNumber = parseInt(blockNumber);\n state.listeners.block.forEach(({ listener }) => listener(this.state.latestBlockNumber));\n }\n const events = Object.entries(data)\n .filter(([type, value]) => isNewState(type, value, this.state.store))\n .map(([type]) => ({\n type,\n value: dataTransformed[type],\n args: keyToArgMap[type] || []\n }));\n this.state.store = { ...data };\n this.state.storeTransformed = { ...dataTransformed };\n this.state.keyToArgMap = { ...keyToArgMap };\n alertListeners(events);\n poll.call({ state: this.state });\n }\n } catch (err) {\n log('Error: %s', err.message);\n state.listeners.error.forEach(({ listener }) => listener(err, this.state));\n if (!this.state.handler) return;\n // Retry on error\n log(`Error occured, retrying in ${this.state.config.errorRetryWait / 1000} seconds`);\n poll.call({\n state: this.state,\n interval: this.state.config.errorRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n }\n }, interval);\n }\n\n const watcher = {\n tap(transform) {\n log('watcher.tap() called');\n const nextModel = transform([...state.model]);\n state.model = [...nextModel];\n return this.poll();\n },\n poll() {\n log('watcher.poll() called');\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n if (state.watching && (!state.ws || state.ws.readyState === WebSocket.OPEN)) {\n clearTimeout(state.handler);\n state.handler = null;\n poll.call({ state, interval: 0, resolveFetchPromise });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, false);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n batch() {\n return {\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, true);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n }\n };\n },\n onNewBlock(listener) {\n const id = state.id++;\n state.latestBlockNumber && listener(state.latestBlockNumber);\n state.listeners.block.push({ listener, id });\n return {\n unsub() {\n state.listeners.block = state.listeners.block.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onPoll(listener) {\n const id = state.id++;\n state.listeners.poll.push({ listener, id });\n return {\n unsub() {\n state.listeners.poll = state.listeners.poll.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onError(listener) {\n const id = state.id++;\n state.listeners.error.push({ listener, id });\n return {\n unsub() {\n state.listeners.error = state.listeners.error.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n start() {\n log('watcher.start() called');\n state.watching = true;\n if (!state.ws || state.ws.readyState === WebSocket.OPEN) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n return state.initialFetchPromise;\n },\n stop() {\n log('watcher.stop() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n state.watching = false;\n },\n recreate(model, config) {\n log('watcher.recreate() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n if (state.ws) destroyWebSocket();\n state.ws = null;\n state.config = prepareConfig(config);\n state.model = [...model];\n state.store = {};\n state.storeTransformed = {};\n state.latestBlockNumber = null;\n state.cancelPromiseId = state.latestPromiseId;\n setupWebSocket();\n if (state.watching && !state.ws) {\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise\n });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n awaitInitialFetch() {\n return state.initialFetchPromise;\n },\n get initialFetch() {\n return state.initialFetchPromise;\n },\n get schemas() {\n return state.model;\n }\n };\n\n return watcher;\n}\n"],"names":["log","debug","AGGREGATE_SELECTOR","strip0x","str","replace","encodeParameters","types","vals","defaultAbiCoder","encode","decodeParameters","decode","isEmpty","obj","Array","isArray","length","Object","keys","ethCall","rawData","id","web3","ethers","provider","rpcUrl","block","multicallAddress","ws","wsResponseTimeout","abiEncodedData","Promise","resolve","reject","send","JSON","stringify","jsonrpc","method","params","to","data","onMessage","json","parse","clearTimeout","timeoutHandle","onmessage","result","setTimeout","Error","request","eth","call","rawResponse","fetch","headers","body","content","INSIDE_EVERY_PARENTHESES","FIRST_CLOSING_PARENTHESES","_makeMulticallData","calls","values","map","target","args","returnTypes","keccak256","substr","a","calldata","components","type","name","makeMulticallData","memoize","aggregate","config","keyToArgMap","reduce","acc","returns","returnMeta","key","argValues","match","slice","argTypesString","returnTypesString","argTypes","split","filter","e","invariant","argValue","idx","callDataBytes","outerResults","returnTypeArray","ele","concat","returnDataMeta","outerResultsDecoded","blockNumber","shift","parsedVals","r","forEach","results","resultsDecoded","push","toString","retObj","original","transformed","i","transform","undefined","reWsEndpoint","isNewState","value","store","prepareConfig","interval","staleBlockRetryWait","errorRetryWait","wsReconnectTimeout","preset","addresses","multicall","createWatcher","model","state","storeTransformed","latestPromiseId","latestBlockNumber","listeners","subscribe","poll","error","handler","wsReconnectHandler","watching","reconnectWebSocket","timeout","destroyWebSocket","setupWebSocket","test","WebSocket","onopen","resolveFetchPromise","initialFetchResolver","onclose","err","onerror","close","initialFetchPromise","listener","batch","events","entries","alertListeners","retry","promiseId","dataTransformed","cancelPromiseId","parseInt","message","watcher","tap","nextModel","fetchPromise","readyState","OPEN","unsub","_id","onNewBlock","onPoll","onError","start","stop","recreate","awaitInitialFetch","initialFetch","schemas"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAMA,GAAG,GAAGC,KAAK,CAAC,WAAD,CAAjB;;AAGO,IAAMC,kBAAkB,GAAG,YAA3B;AAEA,SAASC,OAAT,CAAiBC,GAAjB,EAAsB;AAC3B,SAAOA,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAP;AACD;AAUM,SAASC,gBAAT,CAA0BC,KAA1B,EAAiCC,IAAjC,EAAuC;AAC5C,SAAOC,wBAAe,CAACC,MAAhB,CAAuBH,KAAvB,EAA8BC,IAA9B,CAAP;AACD;AAMM,SAASG,gBAAT,CAA0BJ,KAA1B,EAAiCC,IAAjC,EAAuC;AAC5C,SAAOC,wBAAe,CAACG,MAAhB,CAAuBL,KAAvB,EAA8B,OAAOC,IAAI,CAACH,OAAL,CAAa,KAAb,EAAoB,EAApB,CAArC,CAAP;AACD;AAwBM,SAASQ,OAAT,CAAiBC,GAAjB,EAAsB;AAC3B,MAAIC,KAAK,CAACC,OAAN,CAAcF,GAAd,CAAJ,EAAwB,OAAOA,GAAG,CAACG,MAAJ,KAAe,CAAtB;AACxB,SAAO,CAACH,GAAD,IAAQI,MAAM,CAACC,IAAP,CAAYL,GAAZ,EAAiBG,MAAjB,KAA4B,CAA3C;AACD;AAEM,eAAeG,OAAf,CAAuBC,OAAvB,QAAw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AI7I,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC1CuH,UAAAA,mBAAmB,GAAGvH,OAAtB;AACD,SAFoB,CAArB;;AAGA2G,QAAAA,KAAI,CAACtF,IAAL,CAAU;AACRgF,UAAAA,KAAK,EAALA,KADQ;AAERT,UAAAA,QAAQ,EAAE,CAFF;AAGR2B,UAAAA,mBAAmB,EAAnBA;AAHQ,SAAV;;AAKA,eAAOqB,YAAP;AACD;;AACD,aAAO7I,OAAO,CAACC,OAAR,EAAP;AACD,KAvHa;AAwHduJ,IAAAA,iBAxHc,+BAwHM;AAClB,aAAOlD,KAAK,CAACwB,mBAAb;AACD,KA1Ha;;AA2Hd,QAAI2B,YAAJ,GAAmB;AACjB,aAAOnD,KAAK,CAACwB,mBAAb;AACD,KA7Ha;;AA8Hd,QAAI4B,OAAJ,GAAc;AACZ,aAAOpD,KAAK,CAACD,KAAb;AACD;;AAhIa,GAAhB;AAmIA,SAAOqC,OAAP;AACD;;;;;"} \ No newline at end of file diff --git a/dist/multicall.esm.js b/dist/multicall.esm.js new file mode 100644 index 0000000..36cf324 --- /dev/null +++ b/dist/multicall.esm.js @@ -0,0 +1,693 @@ +import { id } from 'ethers/utils/hash'; +import invariant from 'invariant'; +import fetch from 'cross-fetch'; +import { defaultAbiCoder } from 'ethers/utils/abi-coder'; +import debug from 'debug'; +import memoize from 'lodash/memoize'; +import _extends from '@babel/runtime/helpers/esm/extends'; +import WebSocket from 'isomorphic-ws'; + +var log = debug('multicall'); // Function signature for: aggregate((address,bytes)[]) + +var AGGREGATE_SELECTOR = '0x252dba42'; +function strip0x(str) { + return str.replace(/^0x/, ''); +} +function encodeParameters(types, vals) { + return defaultAbiCoder.encode(types, vals); +} +function decodeParameters(types, vals) { + return defaultAbiCoder.decode(types, '0x' + vals.replace(/0x/i, '')); +} +function isEmpty(obj) { + if (Array.isArray(obj)) return obj.length === 0; + return !obj || Object.keys(obj).length === 0; +} +async function ethCall(rawData, _ref) { + var id = _ref.id, + web3 = _ref.web3, + ethers = _ref.ethers, + provider = _ref.provider, + rpcUrl = _ref.rpcUrl, + block = _ref.block, + multicallAddress = _ref.multicallAddress, + ws = _ref.ws, + wsResponseTimeout = _ref.wsResponseTimeout; + var abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData); + + if (ws) { + log('Sending via WebSocket'); + return new Promise(function (resolve, reject) { + ws.send(JSON.stringify({ + jsonrpc: '2.0', + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'], + id: id + })); + + function onMessage(data) { + if (typeof data !== 'string') data = data.data; + var json = JSON.parse(data); + if (!json.id || json.id !== id) return; + log('Got WebSocket response id #%d', json.id); + clearTimeout(timeoutHandle); + ws.onmessage = null; + resolve(json.result); + } + + var timeoutHandle = setTimeout(function () { + if (ws.onmessage !== onMessage) return; + ws.onmessage = null; + reject(new Error('WebSocket response timeout')); + }, wsResponseTimeout); + ws.onmessage = onMessage; + }); + } else if (ethers) { + log('Sending via ethers provider'); + return ethers.send({ + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'] + }); + } else if (provider) { + log('Sending via EIP-1193 provider'); + return provider.request({ + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'] + }); + } else if (web3) { + log('Sending via web3 provider'); + return web3.eth.call({ + to: multicallAddress, + data: abiEncodedData + }); + } else { + log('Sending via XHR fetch'); + var rawResponse = await fetch(rpcUrl, { + method: 'POST', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + jsonrpc: '2.0', + method: 'eth_call', + params: [{ + to: multicallAddress, + data: abiEncodedData + }, block || 'latest'], + id: 1 + }) + }); + var content = await rawResponse.json(); + + if (!content || !content.result) { + throw new Error('Multicall received an empty response. Check your call configuration for errors.'); + } + + return content.result; + } +} + +var INSIDE_EVERY_PARENTHESES = /\(.*?\)/g; +var FIRST_CLOSING_PARENTHESES = /^[^)]*\)/; +function _makeMulticallData(calls) { + var values = [calls.map(function (_ref) { + var target = _ref.target, + method = _ref.method, + args = _ref.args, + returnTypes = _ref.returnTypes; + return [target, id(method).substr(0, 10) + (args && args.length > 0 ? strip0x(encodeParameters(args.map(function (a) { + return a[1]; + }), args.map(function (a) { + return a[0]; + }))) : '')]; + })]; + var calldata = encodeParameters([{ + components: [{ + type: 'address' + }, { + type: 'bytes' + }], + name: 'data', + type: 'tuple[]' + }], values); + return calldata; +} +var makeMulticallData = memoize(_makeMulticallData, function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return JSON.stringify(args); +}); +async function aggregate(calls, config) { + calls = Array.isArray(calls) ? calls : [calls]; + var keyToArgMap = calls.reduce(function (acc, _ref2) { + var call = _ref2.call, + returns = _ref2.returns; + var args = call.slice(1); + + if (args.length > 0) { + for (var _iterator = returns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + var returnMeta = _ref3; + var key = returnMeta[0]; + acc[key] = args; + } + } + + return acc; + }, {}); + calls = calls.map(function (_ref4) { + var call = _ref4.call, + target = _ref4.target, + returns = _ref4.returns; + if (!target) target = config.multicallAddress; + var method = call[0], + argValues = call.slice(1); + + var _method$match$map = method.match(INSIDE_EVERY_PARENTHESES).map(function (match) { + return match.slice(1, -1); + }), + argTypesString = _method$match$map[0], + returnTypesString = _method$match$map[1]; + + var argTypes = argTypesString.split(',').filter(function (e) { + return !!e; + }); + invariant(argTypes.length === argValues.length, "Every method argument must have exactly one type.\n Comparing argument types " + JSON.stringify(argTypes) + "\n to argument values " + JSON.stringify(argValues) + ".\n "); + var args = argValues.map(function (argValue, idx) { + return [argValue, argTypes[idx]]; + }); + var returnTypes = !!returnTypesString ? returnTypesString.split(',') : []; + return { + method: method.match(FIRST_CLOSING_PARENTHESES)[0], + args: args, + returnTypes: returnTypes, + target: target, + returns: returns + }; + }); + var callDataBytes = makeMulticallData(calls, false); + var outerResults = await ethCall(callDataBytes, config); + var returnTypeArray = calls.map(function (_ref5) { + var returnTypes = _ref5.returnTypes; + return returnTypes; + }).reduce(function (acc, ele) { + return acc.concat(ele); + }, []); + var returnDataMeta = calls.map(function (_ref6) { + var returns = _ref6.returns; + return returns; + }).reduce(function (acc, ele) { + return acc.concat(ele); + }, []); + invariant(returnTypeArray.length === returnDataMeta.length, 'Missing data needed to parse results'); + var outerResultsDecoded = decodeParameters(['uint256', 'bytes[]'], outerResults); + var blockNumber = outerResultsDecoded.shift(); + var parsedVals = outerResultsDecoded.reduce(function (acc, r) { + r.forEach(function (results, idx) { + var types = calls[idx].returnTypes; + var resultsDecoded = decodeParameters(types, results); + acc.push.apply(acc, resultsDecoded.map(function (r, idx) { + if (types[idx] === 'bool') return r.toString() === 'true'; + return r; + })); + }); + return acc; + }, []); + var retObj = { + blockNumber: blockNumber, + original: {}, + transformed: {} + }; + + for (var i = 0; i < parsedVals.length; i++) { + var _returnDataMeta$i = returnDataMeta[i], + name = _returnDataMeta$i[0], + transform = _returnDataMeta$i[1]; + retObj.original[name] = parsedVals[i]; + retObj.transformed[name] = transform !== undefined ? transform(parsedVals[i]) : parsedVals[i]; + } + + return { + results: retObj, + keyToArgMap: keyToArgMap + }; +} + +var mainnet = { + multicall: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441", + rpcUrl: "https://mainnet.infura.io" +}; +var kovan = { + multicall: "0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a", + rpcUrl: "https://kovan.infura.io" +}; +var rinkeby = { + multicall: "0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821", + rpcUrl: "https://rinkeby.infura.io" +}; +var goerli = { + multicall: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e", + rpcUrl: "https://rpc.slock.it/goerli" +}; +var xdai = { + multicall: "0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a", + rpcUrl: "https://dai.poa.network" +}; +var addresses = { + mainnet: mainnet, + kovan: kovan, + rinkeby: rinkeby, + goerli: goerli, + xdai: xdai +}; + +var log$1 = debug('multicall'); +var reWsEndpoint = /^wss?:\/\//i; + +function isNewState(type, value, store) { + return store[type] === undefined || (value !== null && store[type] !== null && typeof value === 'object' && typeof value.toString === 'function' && typeof store[type] === 'object' && typeof store[type].toString === 'function' ? value.toString() !== store[type].toString() : value !== store[type]); +} + +function prepareConfig(config) { + config = _extends({ + interval: 1000, + staleBlockRetryWait: 3000, + errorRetryWait: 5000, + wsResponseTimeout: 5000, + wsReconnectTimeout: 5000 + }, config); + + if (config.preset !== undefined) { + if (addresses[config.preset] !== undefined) { + config.multicallAddress = addresses[config.preset].multicall; + config.rpcUrl = addresses[config.preset].rpcUrl; + } else throw new Error("Unknown preset " + config.preset); + } + + return config; +} + +function createWatcher(model, config) { + var state = { + model: [].concat(model), + store: {}, + storeTransformed: {}, + keyToArgMap: {}, + latestPromiseId: 0, + latestBlockNumber: null, + id: 0, + listeners: { + subscribe: [], + block: [], + poll: [], + error: [] + }, + handler: null, + wsReconnectHandler: null, + watching: false, + config: prepareConfig(config), + ws: null + }; + + function reconnectWebSocket(timeout) { + clearTimeout(state.handler); + state.handler = null; + clearTimeout(state.wsReconnectHandler); + state.wsReconnectHandler = setTimeout(function () { + destroyWebSocket(); + setupWebSocket(); + }, timeout); + } + + function setupWebSocket() { + if (reWsEndpoint.test(state.config.rpcUrl)) { + log$1("Connecting to WebSocket " + state.config.rpcUrl + "..."); + state.ws = new WebSocket(state.config.rpcUrl); + + state.ws.onopen = function () { + log$1('WebSocket connected'); + if (state.handler) throw new Error('Existing poll setTimeout handler set'); + + if (state.watching) { + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: state.initialFetchResolver + }); + } + }; + + state.ws.onclose = function (err) { + log$1('WebSocket closed: %s', JSON.stringify(err)); + log$1("Reconnecting in " + state.config.wsReconnectTimeout / 1000 + " seconds."); + reconnectWebSocket(state.config.wsReconnectTimeout); + }; + + state.ws.onerror = function (err) { + log$1('WebSocket error: %s', JSON.stringify(err)); + log$1("Reconnecting in " + state.config.wsReconnectTimeout / 1000 + " seconds."); + reconnectWebSocket(state.config.wsReconnectTimeout); + }; + } + } + + function destroyWebSocket() { + log$1('destroyWebSocket()'); + state.ws.onopen = null; + state.ws.onclose = null; + state.ws.onerror = null; + state.ws.onmessage = null; + state.ws.close(); + } + + setupWebSocket(); + state.initialFetchPromise = new Promise(function (resolve) { + state.initialFetchResolver = resolve; + }); + + function _subscribe(listener, id, batch) { + if (batch === void 0) { + batch = false; + } + + if (!isEmpty(state.storeTransformed)) { + var events = Object.entries(state.storeTransformed).map(function (_ref) { + var type = _ref[0], + value = _ref[1]; + return { + type: type, + value: value, + args: state.keyToArgMap[type] || [] + }; + }); + batch ? listener(events) : events.forEach(listener); + } + + state.listeners.subscribe.push({ + listener: listener, + id: id, + batch: batch + }); + } + + function alertListeners(events) { + if (!isEmpty(events)) state.listeners.subscribe.forEach(function (_ref2) { + var listener = _ref2.listener, + batch = _ref2.batch; + return batch ? listener(events) : events.forEach(listener); + }); + } + + function _poll() { + var _this = this; + + var interval = this.interval !== undefined ? this.interval : this.state.config.interval; + log$1('poll() called, %s%s', 'interval: ' + interval, this.retry ? ', retry: ' + this.retry : ''); + this.state.handler = setTimeout(async function () { + try { + if (!_this.state.handler) return; + _this.state.latestPromiseId++; + var promiseId = _this.state.latestPromiseId; + state.listeners.poll.forEach(function (_ref3) { + var listener = _ref3.listener; + return listener(_extends({ + id: promiseId, + latestBlockNumber: _this.state.latestBlockNumber + }, _this.retry ? { + retry: _this.retry + } : {})); + }); + + var _ref4 = await aggregate(_this.state.model, _extends({}, _this.state.config, { + ws: _this.state.ws, + id: _this.state.latestPromiseId + })), + _ref4$results = _ref4.results, + blockNumber = _ref4$results.blockNumber, + data = _extends({}, _ref4$results.original), + dataTransformed = _extends({}, _ref4$results.transformed), + keyToArgMap = _ref4.keyToArgMap; + + if (_this.state.cancelPromiseId === promiseId) return; + if (typeof _this.resolveFetchPromise === 'function') _this.resolveFetchPromise(); + + if (_this.state.latestBlockNumber !== null && blockNumber < _this.state.latestBlockNumber) { + // Retry if blockNumber is lower than latestBlockNumber + log$1("Stale block returned, retrying in " + _this.state.config.staleBlockRetryWait / 1000 + " seconds"); + + _poll.call({ + state: _this.state, + interval: _this.state.config.staleBlockRetryWait, + retry: _this.retry ? _this.retry + 1 : 1 + }); + } else { + if (_this.state.latestBlockNumber === null || _this.state.latestBlockNumber !== null && blockNumber > _this.state.latestBlockNumber) { + _this.state.latestBlockNumber = parseInt(blockNumber); + state.listeners.block.forEach(function (_ref5) { + var listener = _ref5.listener; + return listener(_this.state.latestBlockNumber); + }); + } + + var events = Object.entries(data).filter(function (_ref6) { + var type = _ref6[0], + value = _ref6[1]; + return isNewState(type, value, _this.state.store); + }).map(function (_ref7) { + var type = _ref7[0]; + return { + type: type, + value: dataTransformed[type], + args: keyToArgMap[type] || [] + }; + }); + _this.state.store = _extends({}, data); + _this.state.storeTransformed = _extends({}, dataTransformed); + _this.state.keyToArgMap = _extends({}, keyToArgMap); + alertListeners(events); + + _poll.call({ + state: _this.state + }); + } + } catch (err) { + log$1('Error: %s', err.message); + state.listeners.error.forEach(function (_ref8) { + var listener = _ref8.listener; + return listener(err, _this.state); + }); + if (!_this.state.handler) return; // Retry on error + + log$1("Error occured, retrying in " + _this.state.config.errorRetryWait / 1000 + " seconds"); + + _poll.call({ + state: _this.state, + interval: _this.state.config.errorRetryWait, + retry: _this.retry ? _this.retry + 1 : 1 + }); + } + }, interval); + } + + var watcher = { + tap: function tap(transform) { + log$1('watcher.tap() called'); + var nextModel = transform([].concat(state.model)); + state.model = [].concat(nextModel); + return this.poll(); + }, + poll: function poll() { + log$1('watcher.poll() called'); + var resolveFetchPromise; + var fetchPromise = new Promise(function (resolve) { + resolveFetchPromise = resolve; + }); + + if (state.watching && (!state.ws || state.ws.readyState === WebSocket.OPEN)) { + clearTimeout(state.handler); + state.handler = null; + + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: resolveFetchPromise + }); + + return fetchPromise; + } + + return Promise.resolve(); + }, + subscribe: function subscribe(listener) { + var id = state.id++; + + _subscribe(listener, id, false); + + return { + unsub: function unsub() { + state.listeners.subscribe = state.listeners.subscribe.filter(function (_ref9) { + var _id = _ref9.id; + return _id !== id; + }); + } + }; + }, + batch: function batch() { + return { + subscribe: function subscribe(listener) { + var id = state.id++; + + _subscribe(listener, id, true); + + return { + unsub: function unsub() { + state.listeners.subscribe = state.listeners.subscribe.filter(function (_ref10) { + var _id = _ref10.id; + return _id !== id; + }); + } + }; + } + }; + }, + onNewBlock: function onNewBlock(listener) { + var id = state.id++; + state.latestBlockNumber && listener(state.latestBlockNumber); + state.listeners.block.push({ + listener: listener, + id: id + }); + return { + unsub: function unsub() { + state.listeners.block = state.listeners.block.filter(function (_ref11) { + var _id = _ref11.id; + return _id !== id; + }); + } + }; + }, + onPoll: function onPoll(listener) { + var id = state.id++; + state.listeners.poll.push({ + listener: listener, + id: id + }); + return { + unsub: function unsub() { + state.listeners.poll = state.listeners.poll.filter(function (_ref12) { + var _id = _ref12.id; + return _id !== id; + }); + } + }; + }, + onError: function onError(listener) { + var id = state.id++; + state.listeners.error.push({ + listener: listener, + id: id + }); + return { + unsub: function unsub() { + state.listeners.error = state.listeners.error.filter(function (_ref13) { + var _id = _ref13.id; + return _id !== id; + }); + } + }; + }, + start: function start() { + log$1('watcher.start() called'); + state.watching = true; + + if (!state.ws || state.ws.readyState === WebSocket.OPEN) { + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: state.initialFetchResolver + }); + } + + return state.initialFetchPromise; + }, + stop: function stop() { + log$1('watcher.stop() called'); + clearTimeout(state.handler); + state.handler = null; + clearTimeout(state.wsReconnectHandler); + state.wsReconnectHandler = null; + state.watching = false; + }, + recreate: function recreate(model, config) { + log$1('watcher.recreate() called'); + clearTimeout(state.handler); + state.handler = null; + clearTimeout(state.wsReconnectHandler); + state.wsReconnectHandler = null; + if (state.ws) destroyWebSocket(); + state.ws = null; + state.config = prepareConfig(config); + state.model = [].concat(model); + state.store = {}; + state.storeTransformed = {}; + state.latestBlockNumber = null; + state.cancelPromiseId = state.latestPromiseId; + setupWebSocket(); + + if (state.watching && !state.ws) { + var resolveFetchPromise; + var fetchPromise = new Promise(function (resolve) { + resolveFetchPromise = resolve; + }); + + _poll.call({ + state: state, + interval: 0, + resolveFetchPromise: resolveFetchPromise + }); + + return fetchPromise; + } + + return Promise.resolve(); + }, + awaitInitialFetch: function awaitInitialFetch() { + return state.initialFetchPromise; + }, + + get initialFetch() { + return state.initialFetchPromise; + }, + + get schemas() { + return state.model; + } + + }; + return watcher; +} + +export { aggregate, createWatcher }; +//# sourceMappingURL=multicall.esm.js.map diff --git a/dist/multicall.esm.js.map b/dist/multicall.esm.js.map new file mode 100644 index 0000000..3de041a --- /dev/null +++ b/dist/multicall.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multicall.esm.js","sources":["../src/helpers.js","../src/aggregate.js","../src/watcher.js"],"sourcesContent":["import fetch from 'cross-fetch';\nimport { defaultAbiCoder } from 'ethers/utils/abi-coder';\nimport debug from 'debug';\nconst log = debug('multicall');\n\n// Function signature for: aggregate((address,bytes)[])\nexport const AGGREGATE_SELECTOR = '0x252dba42';\n\nexport function strip0x(str) {\n return str.replace(/^0x/, '');\n}\n\nexport function typesLength(types) {\n return types.length;\n}\n\nexport function encodeParameter(type, val) {\n return encodeParameters([type], [val]);\n}\n\nexport function encodeParameters(types, vals) {\n return defaultAbiCoder.encode(types, vals);\n}\n\nexport function decodeParameter(type, val) {\n return decodeParameters([type], val);\n}\n\nexport function decodeParameters(types, vals) {\n return defaultAbiCoder.decode(types, '0x' + vals.replace(/0x/i, ''));\n}\n\nexport function padLeft(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n new Array(padding).join(sign ? sign : '0') +\n string\n );\n}\n\nexport function padRight(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n string +\n new Array(padding).join(sign ? sign : '0')\n );\n}\n\nexport function isEmpty(obj) {\n if (Array.isArray(obj)) return obj.length === 0;\n return !obj || Object.keys(obj).length === 0;\n}\n\nexport async function ethCall(rawData, { id, web3, ethers, provider, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) {\n const abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData);\n if (ws) {\n log('Sending via WebSocket');\n return new Promise((resolve, reject) => {\n ws.send(JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id\n }));\n function onMessage(data) {\n if (typeof data !== 'string') data = data.data;\n const json = JSON.parse(data);\n if (!json.id || json.id !== id) return;\n log('Got WebSocket response id #%d', json.id);\n clearTimeout(timeoutHandle);\n ws.onmessage = null;\n resolve(json.result);\n }\n const timeoutHandle = setTimeout(() => {\n if (ws.onmessage !== onMessage) return;\n ws.onmessage = null;\n reject(new Error('WebSocket response timeout'));\n }, wsResponseTimeout);\n\n ws.onmessage = onMessage;\n });\n }\n else if (ethers) {\n log('Sending via ethers provider');\n return ethers.send({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (provider) {\n log('Sending via EIP-1193 provider');\n return provider.request({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (web3) {\n log('Sending via web3 provider');\n return web3.eth.call({\n to: multicallAddress,\n data: abiEncodedData\n });\n } else {\n log('Sending via XHR fetch');\n const rawResponse = await fetch(rpcUrl, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id: 1\n })\n });\n const content = await rawResponse.json();\n if (!content || !content.result) {\n throw new Error('Multicall received an empty response. Check your call configuration for errors.');\n }\n return content.result;\n }\n}\n","import { id as keccak256 } from 'ethers/utils/hash';\nimport invariant from 'invariant';\nimport { strip0x, ethCall, encodeParameters, decodeParameters } from './helpers.js';\nimport memoize from 'lodash/memoize';\n\nconst INSIDE_EVERY_PARENTHESES = /\\(.*?\\)/g;\nconst FIRST_CLOSING_PARENTHESES = /^[^)]*\\)/;\n\nexport function _makeMulticallData(calls) {\n const values = [\n calls.map(({ target, method, args, returnTypes }) => [\n target,\n keccak256(method).substr(0, 10) +\n (args && args.length > 0\n ? strip0x(encodeParameters(args.map(a => a[1]), args.map(a => a[0])))\n : '')\n ])\n ];\n const calldata = encodeParameters(\n [\n {\n components: [{ type: 'address' }, { type: 'bytes' }],\n name: 'data',\n type: 'tuple[]'\n }\n ],\n values\n );\n return calldata;\n}\n\nconst makeMulticallData = memoize(_makeMulticallData, (...args) => JSON.stringify(args));\n\nexport default async function aggregate(calls, config) {\n calls = Array.isArray(calls) ? calls : [calls];\n\n const keyToArgMap = calls.reduce((acc, { call, returns }) => {\n const [, ...args] = call;\n if (args.length > 0) {\n for (let returnMeta of returns) {\n const [key] = returnMeta;\n acc[key] = args;\n }\n }\n return acc;\n }, {});\n\n calls = calls.map(({ call, target, returns }) => {\n if (!target) target = config.multicallAddress;\n const [method, ...argValues] = call;\n const [argTypesString, returnTypesString] = method\n .match(INSIDE_EVERY_PARENTHESES)\n .map(match => match.slice(1, -1));\n const argTypes = argTypesString.split(',').filter(e => !!e);\n invariant(\n argTypes.length === argValues.length,\n `Every method argument must have exactly one type.\n Comparing argument types ${JSON.stringify(argTypes)}\n to argument values ${JSON.stringify(argValues)}.\n `\n );\n const args = argValues.map((argValue, idx) => [argValue, argTypes[idx]]);\n const returnTypes = !!returnTypesString ? returnTypesString.split(',') : [];\n return {\n method: method.match(FIRST_CLOSING_PARENTHESES)[0],\n args,\n returnTypes,\n target,\n returns\n };\n });\n\n const callDataBytes = makeMulticallData(calls, false);\n const outerResults = await ethCall(callDataBytes, config);\n const returnTypeArray = calls\n .map(({ returnTypes }) => returnTypes)\n .reduce((acc, ele) => acc.concat(ele), []);\n const returnDataMeta = calls\n .map(({ returns }) => returns)\n .reduce((acc, ele) => acc.concat(ele), []);\n\n invariant(\n returnTypeArray.length === returnDataMeta.length,\n 'Missing data needed to parse results'\n );\n\n const outerResultsDecoded = decodeParameters(['uint256', 'bytes[]'], outerResults);\n const blockNumber = outerResultsDecoded.shift();\n const parsedVals = outerResultsDecoded.reduce((acc, r) => {\n r.forEach((results, idx) => {\n const types = calls[idx].returnTypes;\n const resultsDecoded = decodeParameters(types, results);\n acc.push(\n ...resultsDecoded.map((r, idx) => {\n if (types[idx] === 'bool') return r.toString() === 'true';\n return r;\n })\n );\n });\n return acc;\n }, []);\n\n const retObj = { blockNumber, original: {}, transformed: {} };\n\n for (let i = 0; i < parsedVals.length; i++) {\n const [name, transform] = returnDataMeta[i];\n retObj.original[name] = parsedVals[i];\n retObj.transformed[name] = transform !== undefined ? transform(parsedVals[i]) : parsedVals[i];\n }\n\n return { results: retObj, keyToArgMap };\n}\n","import WebSocket from 'isomorphic-ws';\nimport aggregate from './aggregate';\nimport { isEmpty } from './helpers';\nimport addresses from './addresses.json';\nimport debug from 'debug';\nconst log = debug('multicall');\n\nconst reWsEndpoint = /^wss?:\\/\\//i;\n\nfunction isNewState(type, value, store) {\n return (\n store[type] === undefined ||\n (value !== null &&\n store[type] !== null &&\n typeof value === 'object' &&\n typeof value.toString === 'function' &&\n typeof store[type] === 'object' &&\n typeof store[type].toString === 'function'\n ? value.toString() !== store[type].toString()\n : value !== store[type])\n );\n}\n\nfunction prepareConfig(config) {\n config = {\n interval: 1000,\n staleBlockRetryWait: 3000,\n errorRetryWait: 5000,\n wsResponseTimeout: 5000,\n wsReconnectTimeout: 5000,\n ...config\n };\n if (config.preset !== undefined) {\n if (addresses[config.preset] !== undefined) {\n config.multicallAddress = addresses[config.preset].multicall;\n config.rpcUrl = addresses[config.preset].rpcUrl;\n } else throw new Error(`Unknown preset ${config.preset}`);\n }\n return config;\n}\n\nexport default function createWatcher(model, config) {\n const state = {\n model: [...model],\n store: {},\n storeTransformed: {},\n keyToArgMap: {},\n latestPromiseId: 0,\n latestBlockNumber: null,\n id: 0,\n listeners: {\n subscribe: [],\n block: [],\n poll: [],\n error: []\n },\n handler: null,\n wsReconnectHandler: null,\n watching: false,\n config: prepareConfig(config),\n ws: null\n };\n\n function reconnectWebSocket(timeout) {\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = setTimeout(() => {\n destroyWebSocket();\n setupWebSocket();\n }, timeout);\n }\n\n function setupWebSocket() {\n if (reWsEndpoint.test(state.config.rpcUrl)) {\n log(`Connecting to WebSocket ${state.config.rpcUrl}...`);\n state.ws = new WebSocket(state.config.rpcUrl);\n state.ws.onopen = () => {\n log('WebSocket connected');\n if (state.handler) throw new Error('Existing poll setTimeout handler set');\n if (state.watching) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n };\n state.ws.onclose = err => {\n log('WebSocket closed: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n state.ws.onerror = err => {\n log('WebSocket error: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n }\n }\n\n function destroyWebSocket() {\n log('destroyWebSocket()');\n state.ws.onopen = null;\n state.ws.onclose = null;\n state.ws.onerror = null;\n state.ws.onmessage = null;\n state.ws.close();\n }\n\n setupWebSocket();\n\n state.initialFetchPromise = new Promise(resolve => {\n state.initialFetchResolver = resolve;\n });\n\n function subscribe(listener, id, batch = false) {\n if (!isEmpty(state.storeTransformed)) {\n const events = Object.entries(state.storeTransformed).map(([type, value]) => ({\n type,\n value,\n args: state.keyToArgMap[type] || []\n }));\n batch ? listener(events) : events.forEach(listener);\n }\n state.listeners.subscribe.push({ listener, id, batch });\n }\n\n function alertListeners(events) {\n if (!isEmpty(events))\n state.listeners.subscribe.forEach(({ listener, batch }) =>\n batch ? listener(events) : events.forEach(listener)\n );\n }\n\n function poll() {\n const interval = this.interval !== undefined ? this.interval : this.state.config.interval;\n log('poll() called, %s%s', 'interval: ' + interval, this.retry ? ', retry: ' + this.retry : '');\n this.state.handler = setTimeout(async () => {\n try {\n if (!this.state.handler) return;\n\n this.state.latestPromiseId++;\n const promiseId = this.state.latestPromiseId;\n\n state.listeners.poll.forEach(({ listener }) =>\n listener({\n id: promiseId,\n latestBlockNumber: this.state.latestBlockNumber,\n ...(this.retry ? { retry: this.retry } : {})\n })\n );\n\n const {\n results: {\n blockNumber,\n original: { ...data },\n transformed: { ...dataTransformed }\n },\n keyToArgMap\n } = await aggregate(this.state.model, {\n ...this.state.config,\n ws: this.state.ws,\n id: this.state.latestPromiseId\n });\n\n if (this.state.cancelPromiseId === promiseId) return;\n\n if (typeof this.resolveFetchPromise === 'function') this.resolveFetchPromise();\n\n if (this.state.latestBlockNumber !== null && blockNumber < this.state.latestBlockNumber) {\n // Retry if blockNumber is lower than latestBlockNumber\n log(\n `Stale block returned, retrying in ${this.state.config.staleBlockRetryWait /\n 1000} seconds`\n );\n poll.call({\n state: this.state,\n interval: this.state.config.staleBlockRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n } else {\n if (\n this.state.latestBlockNumber === null ||\n (this.state.latestBlockNumber !== null && blockNumber > this.state.latestBlockNumber)\n ) {\n this.state.latestBlockNumber = parseInt(blockNumber);\n state.listeners.block.forEach(({ listener }) => listener(this.state.latestBlockNumber));\n }\n const events = Object.entries(data)\n .filter(([type, value]) => isNewState(type, value, this.state.store))\n .map(([type]) => ({\n type,\n value: dataTransformed[type],\n args: keyToArgMap[type] || []\n }));\n this.state.store = { ...data };\n this.state.storeTransformed = { ...dataTransformed };\n this.state.keyToArgMap = { ...keyToArgMap };\n alertListeners(events);\n poll.call({ state: this.state });\n }\n } catch (err) {\n log('Error: %s', err.message);\n state.listeners.error.forEach(({ listener }) => listener(err, this.state));\n if (!this.state.handler) return;\n // Retry on error\n log(`Error occured, retrying in ${this.state.config.errorRetryWait / 1000} seconds`);\n poll.call({\n state: this.state,\n interval: this.state.config.errorRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n }\n }, interval);\n }\n\n const watcher = {\n tap(transform) {\n log('watcher.tap() called');\n const nextModel = transform([...state.model]);\n state.model = [...nextModel];\n return this.poll();\n },\n poll() {\n log('watcher.poll() called');\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n if (state.watching && (!state.ws || state.ws.readyState === WebSocket.OPEN)) {\n clearTimeout(state.handler);\n state.handler = null;\n poll.call({ state, interval: 0, resolveFetchPromise });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, false);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n batch() {\n return {\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, true);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n }\n };\n },\n onNewBlock(listener) {\n const id = state.id++;\n state.latestBlockNumber && listener(state.latestBlockNumber);\n state.listeners.block.push({ listener, id });\n return {\n unsub() {\n state.listeners.block = state.listeners.block.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onPoll(listener) {\n const id = state.id++;\n state.listeners.poll.push({ listener, id });\n return {\n unsub() {\n state.listeners.poll = state.listeners.poll.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onError(listener) {\n const id = state.id++;\n state.listeners.error.push({ listener, id });\n return {\n unsub() {\n state.listeners.error = state.listeners.error.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n start() {\n log('watcher.start() called');\n state.watching = true;\n if (!state.ws || state.ws.readyState === WebSocket.OPEN) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n return state.initialFetchPromise;\n },\n stop() {\n log('watcher.stop() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n state.watching = false;\n },\n recreate(model, config) {\n log('watcher.recreate() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n if (state.ws) destroyWebSocket();\n state.ws = null;\n state.config = prepareConfig(config);\n state.model = [...model];\n state.store = {};\n state.storeTransformed = {};\n state.latestBlockNumber = null;\n state.cancelPromiseId = state.latestPromiseId;\n setupWebSocket();\n if (state.watching && !state.ws) {\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise\n });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n awaitInitialFetch() {\n return state.initialFetchPromise;\n },\n get initialFetch() {\n return state.initialFetchPromise;\n },\n get schemas() {\n return state.model;\n }\n };\n\n return watcher;\n}\n"],"names":["log","debug","AGGREGATE_SELECTOR","strip0x","str","replace","encodeParameters","types","vals","defaultAbiCoder","encode","decodeParameters","decode","isEmpty","obj","Array","isArray","length","Object","keys","ethCall","rawData","id","web3","ethers","provider","rpcUrl","block","multicallAddress","ws","wsResponseTimeout","abiEncodedData","Promise","resolve","reject","send","JSON","stringify","jsonrpc","method","params","to","data","onMessage","json","parse","clearTimeout","timeoutHandle","onmessage","result","setTimeout","Error","request","eth","call","rawResponse","fetch","headers","body","content","INSIDE_EVERY_PARENTHESES","FIRST_CLOSING_PARENTHESES","_makeMulticallData","calls","values","map","target","args","returnTypes","keccak256","substr","a","calldata","components","type","name","makeMulticallData","memoize","aggregate","config","keyToArgMap","reduce","acc","returns","returnMeta","key","argValues","match","slice","argTypesString","returnTypesString","argTypes","split","filter","e","invariant","argValue","idx","callDataBytes","outerResults","returnTypeArray","ele","concat","returnDataMeta","outerResultsDecoded","blockNumber","shift","parsedVals","r","forEach","results","resultsDecoded","push","toString","retObj","original","transformed","i","transform","undefined","reWsEndpoint","isNewState","value","store","prepareConfig","interval","staleBlockRetryWait","errorRetryWait","wsReconnectTimeout","preset","addresses","multicall","createWatcher","model","state","storeTransformed","latestPromiseId","latestBlockNumber","listeners","subscribe","poll","error","handler","wsReconnectHandler","watching","reconnectWebSocket","timeout","destroyWebSocket","setupWebSocket","test","WebSocket","onopen","resolveFetchPromise","initialFetchResolver","onclose","err","onerror","close","initialFetchPromise","listener","batch","events","entries","alertListeners","retry","promiseId","dataTransformed","cancelPromiseId","parseInt","message","watcher","tap","nextModel","fetchPromise","readyState","OPEN","unsub","_id","onNewBlock","onPoll","onError","start","stop","recreate","awaitInitialFetch","initialFetch","schemas"],"mappings":";;;;;;;;;AAGA,IAAMA,GAAG,GAAGC,KAAK,CAAC,WAAD,CAAjB;;AAGO,IAAMC,kBAAkB,GAAG,YAA3B;AAEA,SAASC,OAAT,CAAiBC,GAAjB,EAAsB;AAC3B,SAAOA,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAP;AACD;AAUM,SAASC,gBAAT,CAA0BC,KAA1B,EAAiCC,IAAjC,EAAuC;AAC5C,SAAOC,eAAe,CAACC,MAAhB,CAAuBH,KAAvB,EAA8BC,IAA9B,CAAP;AACD;AAMM,SAASG,gBAAT,CAA0BJ,KAA1B,EAAiCC,IAAj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AAa,CAAC7C,MAAD,CAA5B;AACAuD,MAAAA,KAAK,CAACD,KAAN,aAAkBA,KAAlB;AACAC,MAAAA,KAAK,CAACX,KAAN,GAAc,EAAd;AACAW,MAAAA,KAAK,CAACC,gBAAN,GAAyB,EAAzB;AACAD,MAAAA,KAAK,CAACG,iBAAN,GAA0B,IAA1B;AACAH,MAAAA,KAAK,CAACiC,eAAN,GAAwBjC,KAAK,CAACE,eAA9B;AACAY,MAAAA,cAAc;;AACd,UAAId,KAAK,CAACU,QAAN,IAAkB,CAACV,KAAK,CAACzG,EAA7B,EAAiC;AAC/B,YAAI2H,mBAAJ;AACA,YAAMqB,YAAY,GAAG,IAAI7I,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC1CuH,UAAAA,mBAAmB,GAAGvH,OAAtB;AACD,SAFoB,CAArB;;AAGA2G,QAAAA,KAAI,CAACtF,IAAL,CAAU;AACRgF,UAAAA,KAAK,EAALA,KADQ;AAERT,UAAAA,QAAQ,EAAE,CAFF;AAGR2B,UAAAA,mBAAmB,EAAnBA;AAHQ,SAAV;;AAKA,eAAOqB,YAAP;AACD;;AACD,aAAO7I,OAAO,CAACC,OAAR,EAAP;AACD,KAvHa;AAwHduJ,IAAAA,iBAxHc,+BAwHM;AAClB,aAAOlD,KAAK,CAACwB,mBAAb;AACD,KA1Ha;;AA2Hd,QAAI2B,YAAJ,GAAmB;AACjB,aAAOnD,KAAK,CAACwB,mBAAb;AACD,KA7Ha;;AA8Hd,QAAI4B,OAAJ,GAAc;AACZ,aAAOpD,KAAK,CAACD,KAAb;AACD;;AAhIa,GAAhB;AAmIA,SAAOqC,OAAP;AACD;;;;"} \ No newline at end of file diff --git a/dist/multicall.esm.mjs b/dist/multicall.esm.mjs new file mode 100644 index 0000000..d383a48 --- /dev/null +++ b/dist/multicall.esm.mjs @@ -0,0 +1,11 @@ +var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t,e){return t(e={exports:{}},e.exports),e.exports}var n=r((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.version="4.0.27"}));e(n);var i=r((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.MISSING_NEW="MISSING_NEW",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.NUMERIC_FAULT="NUMERIC_FAULT",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION";var r=!1,i=!1;function o(t,r,o){if(i)throw Error("unknown error");r||(r=e.UNKNOWN_ERROR),o||(o={});var a=[];Object.keys(o).forEach((function(t){try{a.push(t+"="+JSON.stringify(o[t]))}catch(e){a.push(t+"="+JSON.stringify(""+o[t]))}})),a.push("version="+n.version);var s=t;a.length&&(t+=" ("+a.join(", ")+")");var u=Error(t);throw u.reason=s,u.code=r,Object.keys(o).forEach((function(t){u[t]=o[t]})),u}e.throwError=o,e.checkNew=function(t,r){t instanceof r||o("missing new",e.MISSING_NEW,{name:r.name})},e.checkArgumentCount=function(t,r,n){n||(n=""),r>t&&o("missing argument"+n,e.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&o("too many arguments"+n,e.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})},e.setCensorship=function(t,n){r&&o("error censorship permanent",e.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),i=!!t,r=!!n},e.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{"test".normalize(t)}catch(e){throw Error("missing "+t)}})),"é"!=="é".normalize("NFD"))throw Error("broken implementation")}catch(t){o("platform missing String.prototype.normalize",e.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:t.message})}};var a={debug:1,default:2,info:2,warn:3,error:4,off:5},s=a.default;function u(t,e){s>a[t]||console.log.apply(console,e)}function h(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];u("warn",t)}e.setLogLevel=function(t){var e=a[t];null!=e?s=e:h("invliad log level - "+t)},e.warn=h,e.info=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];u("info",t)}}));e(i);var o=r((function(e,r){var n=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(i);function a(t){return!!t.toHexString}function s(t){return t.slice?t:(t.slice=function(){var e=Array.prototype.slice.call(arguments);return s(new Uint8Array(Array.prototype.slice.apply(t,e)))},t)}function u(t){if(!t||parseInt(t.length+"")!=t.length||"string"==typeof t)return!1;for(var e=0;t.length>e;e++){var r=t[e];if(0>r||r>=256||parseInt(r+"")!=r)return!1}return!0}function h(t){if(null==t&&o.throwError("cannot convert null value to array",o.INVALID_ARGUMENT,{arg:"value",value:t}),a(t)&&(t=t.toHexString()),"string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);e||o.throwError("invalid hexidecimal string",o.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==e[1]&&o.throwError("hex string must have 0x prefix",o.INVALID_ARGUMENT,{arg:"value",value:t}),(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;t.length>n;n+=2)r.push(parseInt(t.substr(n,2),16));return s(new Uint8Array(r))}return u(t)?s(new Uint8Array(t)):(o.throwError("invalid arrayify value",null,{arg:"value",value:t,type:typeof t}),null)}function l(t){for(var e=[],r=0,n=0;t.length>n;n++){var i=h(t[n]);e.push(i),r+=i.length}var o=new Uint8Array(r),a=0;for(n=0;e.length>n;n++)o.set(e[n],a),a+=e[n].length;return s(o)}function f(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}r.isHexable=a,r.isArrayish=u,r.arrayify=h,r.concat=l,r.stripZeros=function(t){var e=h(t);if(0===e.length)return e;for(var r=0;0===e[r];)r++;return r&&(e=e.slice(r)),e},r.padZeros=function(t,e){if((t=h(t)).length>e)throw Error("cannot pad");var r=new Uint8Array(e);return r.set(t,e-t.length),s(r)},r.isHexString=f;function c(t){if(a(t))return t.toHexString();if("number"==typeof t){0>t&&o.throwError("cannot hexlify negative value",o.INVALID_ARGUMENT,{arg:"value",value:t}),9007199254740991>t||o.throwError("out-of-range",o.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var e="";t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("string"==typeof t){var r=t.match(/^(0x)?[0-9a-fA-F]*$/);return r||o.throwError("invalid hexidecimal string",o.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==r[1]&&o.throwError("hex string must have 0x prefix",o.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2&&(t="0x0"+t.substring(2)),t}if(u(t)){for(var n=[],i=0;t.length>i;i++){var s=t[i];n.push("0123456789abcdef"[(240&s)>>4]+"0123456789abcdef"[15&s])}return"0x"+n.join("")}return o.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function d(t,e){for(f(t)||o.throwError("invalid hex string",o.INVALID_ARGUMENT,{arg:"value",value:t});2*e+2>t.length;)t="0x0"+t.substring(2);return t}function p(t){var e,r=0,n="0x",i="0x";if((e=t)&&null!=e.r&&null!=e.s){null==t.v&&null==t.recoveryParam&&o.throwError("at least on of recoveryParam or v must be specified",o.INVALID_ARGUMENT,{argument:"signature",value:t}),n=d(t.r,32),i=d(t.s,32),"string"==typeof(r=t.v)&&(r=parseInt(r,16));var a=t.recoveryParam;null==a&&null!=t.v&&(a=1-r%2),r=27+a}else{var s=h(t);if(65!==s.length)throw Error("invalid signature");n=c(s.slice(0,32)),i=c(s.slice(32,64)),27!==(r=s[64])&&28!==r&&(r=27+r%2)}return{r:n,s:i,recoveryParam:r-27,v:r}}r.hexlify=c,r.hexDataLength=function(t){return f(t)&&t.length%2==0?(t.length-2)/2:null},r.hexDataSlice=function(t,e,r){return f(t)||o.throwError("invalid hex data",o.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&o.throwError("hex data length must be even",o.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)},r.hexStripZeros=function(t){for(f(t)||o.throwError("invalid hex string",o.INVALID_ARGUMENT,{arg:"value",value:t});t.length>3&&"0x0"===t.substring(0,3);)t="0x"+t.substring(3);return t},r.hexZeroPad=d,r.splitSignature=p,r.joinSignature=function(t){return c(l([(t=p(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}}));e(o);var a,s=(a=Object.freeze({__proto__:null,default:{}}))&&a.default||a,u=r((function(e){!function(t,e){function r(t,e){if(!t)throw Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=s.Buffer}catch(t){}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;i>o;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=49>a||a>54?17>a||a>22?15&a:a-17+10:a-49+10}return n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;o>a;a++){var s=t.charCodeAt(a)-48;i*=n,i+=49>s?17>s?s:s-17+10:s-49+10}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return 0>t.cmp(e)?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e);var i=0;"-"===(t=(""+t).replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){0>t&&(this.negative=1,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),0>=t.length)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var i=0;this.length>i;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)this.words[o]|=(a=t[i]|t[i-1]<<8|t[i-2]<<16)<>>26-s&67108863,26>(s+=24)||(s-=26,o++);else if("le"===n)for(i=0,o=0;t.length>i;i+=3)this.words[o]|=(a=t[i]|t[i+1]<<8|t[i+2]<<16)<>>26-s&67108863,26>(s+=24)||(s-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var r=0;this.length>r;r++)this.words[r]=0;var n,i,o=0;for(r=t.length-6,n=0;r>=e;r-=6)i=a(t,r,r+6),this.words[n]|=i<>>26-o&4194303,26>(o+=24)||(o-=26,n++);r+6!==e&&(i=a(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,h=0,l=r;s>l;l+=n)h=u(t,l,l+n,e),this.imuln(i),67108864>this.words[0]+h?this.words[0]+=h:this._iaddn(h);if(0!==a){var f=1;for(h=u(t,l,t.length,e),l=0;a>l;l++)f*=e;this.imuln(f),67108864>this.words[0]+h?this.words[0]+=h:this._iaddn(h)}},i.prototype.copy=function(t){t.words=Array(this.length);for(var e=0;this.length>e;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;t>this.length;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=a/67108864|0;r.words[0]=67108863&a;for(var u=1;n>u;u++){for(var h=s>>>26,l=67108863&s,f=Math.min(u,e.length-1),c=Math.max(0,u-t.length+1);f>=c;c++){h+=(a=(i=0|t.words[u-c|0])*(o=0|e.words[c])+l)/67108864|0,l=67108863&a}r.words[u]=0|l,s=0|h}return 0!==s?r.words[u]=0|s:r.length--,r.strip()}i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;this.length>a;a++){var s=this.words[a],u=(16777215&(s<>>24-i&16777215)||a!==this.length-1?h[6-u.length]+u+n:u+n,26>(i+=2)||(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var c=l[t],d=f[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:h[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(o>=i,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,h=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),h[s]=a;for(;o>s;s++)h[s]=0}else{for(s=0;o-i>s;s++)h[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),h[o-s-1]=a}return h},i.prototype._countBits=Math.clz32?function(t){return 32-Math.clz32(t)}:function(t){var e=t,r=0;return 4096>e||(r+=13,e>>>=13),64>e||(r+=7,e>>>=7),8>e||(r+=4,e>>>=4),2>e||(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;this.length>e;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;t.length>this.length;)this.words[this.length++]=0;for(var e=0;t.length>e;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;e.length>r;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;r.length>n;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;e.length>n;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;e>i;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;n.length>o;o++)this.words[o]=67108863&(e=(0|r.words[o])+(0|n.words[o])+i),i=e>>>26;for(;0!==i&&r.length>o;o++)this.words[o]=67108863&(e=(0|r.words[o])+i),i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;r.length>o;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;n.length>a;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&r.length>a;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&r.length>a&&r!==this)for(;r.length>a;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,h=0,l=0|a[0],f=8191&l,c=l>>>13,d=0|a[1],p=8191&d,m=d>>>13,v=0|a[2],y=8191&v,g=v>>>13,w=0|a[3],b=8191&w,M=w>>>13,_=0|a[4],E=8191&_,N=_>>>13,A=0|a[5],x=8191&A,C=A>>>13,T=0|a[6],k=8191&T,I=T>>>13,R=0|a[7],F=8191&R,O=R>>>13,S=0|a[8],U=8191&S,P=S>>>13,B=0|a[9],j=8191&B,D=B>>>13,L=0|s[0],G=8191&L,z=L>>>13,V=0|s[1],Z=8191&V,q=V>>>13,H=0|s[2],W=8191&H,$=H>>>13,J=0|s[3],K=8191&J,X=J>>>13,Q=0|s[4],Y=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,lt=0|s[8],ft=8191<,ct=lt>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(n=Math.imul(f,G))|0)+((8191&(i=(i=Math.imul(f,z))+Math.imul(c,G)|0))<<13)|0;h=((o=Math.imul(c,z))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,G),i=(i=Math.imul(p,z))+Math.imul(m,G)|0,o=Math.imul(m,z);var yt=(h+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,q)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,G),i=(i=Math.imul(y,z))+Math.imul(g,G)|0,o=Math.imul(g,z),n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,q)|0;var gt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(c,W)|0))<<13)|0;h=((o=o+Math.imul(c,$)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(b,G),i=(i=Math.imul(b,z))+Math.imul(M,G)|0,o=Math.imul(M,z),n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,q)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,q)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,$)|0;var wt=(h+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(c,K)|0))<<13)|0;h=((o=o+Math.imul(c,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,G),i=(i=Math.imul(E,z))+Math.imul(N,G)|0,o=Math.imul(N,z),n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,q)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,$)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,X)|0;var bt=(h+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,G),i=(i=Math.imul(x,z))+Math.imul(C,G)|0,o=Math.imul(C,z),n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,q)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(k,G),i=(i=Math.imul(k,z))+Math.imul(I,G)|0,o=Math.imul(I,z),n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,q)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(N,W)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var _t=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(F,G),i=(i=Math.imul(F,z))+Math.imul(O,G)|0,o=Math.imul(O,z),n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,q)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,q)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,z))+Math.imul(P,G)|0,o=Math.imul(P,z),n=n+Math.imul(F,Z)|0,i=(i=i+Math.imul(F,q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Nt=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(j,G),i=(i=Math.imul(j,z))+Math.imul(D,G)|0,o=Math.imul(D,z),n=n+Math.imul(U,Z)|0,i=(i=i+Math.imul(U,q)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(F,W)|0,i=(i=i+Math.imul(F,$)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ct)|0;var At=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,Z),i=(i=Math.imul(j,q))+Math.imul(D,Z)|0,o=Math.imul(D,q),n=n+Math.imul(U,W)|0,i=(i=i+Math.imul(U,$)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(F,K)|0,i=(i=i+Math.imul(F,X)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,ct)|0;var xt=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,W),i=(i=Math.imul(j,$))+Math.imul(D,W)|0,o=Math.imul(D,$),n=n+Math.imul(U,K)|0,i=(i=i+Math.imul(U,X)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,X)|0,n=n+Math.imul(F,Y)|0,i=(i=i+Math.imul(F,tt)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ct)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,K),i=(i=Math.imul(j,X))+Math.imul(D,K)|0,o=Math.imul(D,X),n=n+Math.imul(U,Y)|0,i=(i=i+Math.imul(U,tt)|0)+Math.imul(P,Y)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(F,rt)|0,i=(i=i+Math.imul(F,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var Tt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,Y),i=(i=Math.imul(j,tt))+Math.imul(D,Y)|0,o=Math.imul(D,tt),n=n+Math.imul(U,rt)|0,i=(i=i+Math.imul(U,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(F,ot)|0,i=(i=i+Math.imul(F,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(C,ft)|0,o=o+Math.imul(C,ct)|0;var kt=(h+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(U,ot)|0,i=(i=i+Math.imul(U,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(F,ut)|0,i=(i=i+Math.imul(F,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,ct)|0;var It=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),n=n+Math.imul(U,ut)|0,i=(i=i+Math.imul(U,ht)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ht)|0,n=n+Math.imul(F,ft)|0,i=(i=i+Math.imul(F,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var Rt=(h+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),n=n+Math.imul(U,ft)|0,i=(i=i+Math.imul(U,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Ft=(h+(n=n+Math.imul(F,pt)|0)|0)+((8191&(i=(i=i+Math.imul(F,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,n=Math.imul(j,ft),i=(i=Math.imul(j,ct))+Math.imul(D,ft)|0,o=Math.imul(D,ct);var Ot=(h+(n=n+Math.imul(U,pt)|0)|0)+((8191&(i=(i=i+Math.imul(U,mt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var St=(h+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((o=Math.imul(D,mt))+(i>>>13)|0)+(St>>>26)|0,St&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=At,u[10]=xt,u[11]=Ct,u[12]=Tt,u[13]=kt,u[14]=It,u[15]=Rt,u[16]=Ft,u[17]=Ot,u[18]=St,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):63>r?c(this,t,e):1024>r?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;r.length-1>o;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);u>=h;h++){var l=(0|t.words[o-h])*(0|e.words[h]),f=67108863&l;s=67108863&(f=f+s|0),i+=(a=(a=a+(l/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=Array(t),r=i.prototype._countBits(t)-1,n=0;t>n;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;e>i;i++)n|=(1&t)<>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var a=0;o>a;a++)n[a]=e[t[a]],i[a]=r[t[a]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;i>a;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),h=Math.sin(2*Math.PI/s),l=0;i>l;l+=s)for(var f=u,c=h,d=0;a>d;d++){var p=r[l+d],m=n[l+d],v=r[l+d+a],y=n[l+d+a],g=f*v-c*y;y=f*y+c*v,r[l+d]=p+(v=g),n[l+d]=m+y,r[l+d+a]=p-v,n[l+d+a]=m-y,d!==s&&(g=u*f-h*c,c=u*c+h*f,f=g)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<1)for(var n=0;r/2>n;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;e/2>n;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=67108864>i?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;e>a;a++)n[2*a]=8191&(o+=0|t[a]),n[2*a+1]=8191&(o>>>=13),o>>>=13;for(a=2*e;i>a;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=Array(t),r=0;t>r;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=Array(n),s=Array(n),u=Array(n),h=Array(n),l=Array(n),f=Array(n),c=r.words;c.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,h,n),this.transform(a,o,s,u,n,i),this.transform(h,o,l,f,n,i);for(var d=0;n>d;d++){var p=s[d]*l[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){r("number"==typeof t),r(67108864>t);for(var e=0,n=0;this.length>n;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;e.length>r;r++){var n=r%26;e[r]=(t.words[r/26|0]&1<>>n}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;e.length>n&&0===e[n];n++,r=r.sqr());if(++nn;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;this.length>e;e++){var s=this.words[e]&o;this.words[e]=(0|this.words[e])-s<>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;i>e;e++)this.words[e]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<h;h++)u.words[h]=this.words[h];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,h=0;this.length>h;h++)this.words[h]=this.words[h+a];else this.words[0]=0,this.length=1;var l=0;for(h=this.length-1;!(0>h||0===l&&i>h);h--){var f=0|this.words[h];this.words[h]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;return this.length>n&&!!(this.words[n]&1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),n>=this.length)return this;(0!==e&&n++,this.length=Math.min(n,this.length),0!==e)&&(this.words[this.length-1]&=67108863^67108863>>>e<t),0>t?this.isubn(-t):0!==this.negative?1===this.length&&t>(0|this.words[0])?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;this.length>e&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(67108864>t),0>t)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var e=0;this.length>e&&0>this.words[e];e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o;this._expand(t.length+n);var a=0;for(i=0;t.length>i;i++){o=(0|this.words[i+n])+a;var s=(0|t.words[i])*e;a=((o-=67108863&s)>>26)-(s/67108864|0),this.words[i+n]=67108863&o}for(;this.length-n>i;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;this.length>i;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r,n=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=Array(s.length);for(var h=0;s.length>h;h++)s.words[h]=0}var l=n.clone()._ishlnsubmul(o,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(n._ishlnsubmul(o,c=Math.min(c/a|0,67108863),f);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=c)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||0>this.cmp(t)?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return 0>o||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),h=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++h;for(var l=n.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&26>c;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);0>e.cmp(n)?(n.isub(e),s.isub(o),u.isub(a)):(e.isub(n),o.isub(s),a.isub(u))}return{a:s,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,l=1;0==(e.words[0]&l)&&26>h;++h,l<<=1);if(h>0)for(e.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,c=1;0==(n.words[0]&c)&&26>f;++f,c<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);0>e.cmp(n)?(n.isub(e),s.isub(a)):(e.isub(n),a.isub(s))}return 0>(o=0===e.cmpn(1)?a:s).cmpn(0)&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(0>i){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<=this.length)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&this.length>a;a++){var s=0|this.words[a];o=(s+=o)>>>26,this.words[a]=s&=67108863}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=0>t;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(67108863>=t,"Number is too big");var i=0|this.words[0];e=i===t?0:t>i?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(t.length>this.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return 0>=this.cmpn(t)},i.prototype.lte=function(t){return 0>=this.cmp(t)},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new _(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new i(null);return t.words=Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=this.n>e?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;r>n;n++)e.words[n]=t.words[n];if(e.length=r,9>=t.length)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;t.length>n;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}t.words[n-10]=i>>>=22,t.length-=0===i&&t.length>10?10:9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;t.length>r;r++){var n=0|t.words[r];t.words[r]=67108863&(e+=977*n),e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,y),n(b,y),n(M,y),M.prototype.imulK=function(t){for(var e=0,r=0;t.length>r;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new w;else if("p192"===t)e=new b;else{if("p25519"!==t)throw Error("Unknown prime "+t);e=new M}return v[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return 0>r.cmp(this.m)||r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return 0>r.cmp(this.m)||r.isub(this.m),r},_.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,h).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=a;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(p>v);var y=this.pow(f,new i(1).iushln(p-v-1));c=c.redMul(y),f=y.redSqr(),d=d.redMul(f),p=v}return c},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;r.length>n;n++)r[n]=this.mul(r[n-1],t);var o=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],l=u-1;l>=0;l--){var f=h>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},n(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0>i.cmp(this.m)?0>i.cmpn(0)&&(o=i.iadd(this.m)):o=i.isub(this.m),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return 0>o.cmp(this.m)?0>o.cmpn(0)&&(a=o.iadd(this.m)):a=o.isub(this.m),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,t)})),h=r((function(e,r){var n=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var o=n(i);function a(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function s(t,e){return t&&t._ethersType===e}r.defineReadOnly=a,r.setType=function(t,e){Object.defineProperty(t,"_ethersType",{configurable:!1,value:e,writable:!1})},r.isType=s,r.resolveProperties=function(t){var e={},r=[];return Object.keys(t).forEach((function(n){var i=t[n];i instanceof Promise?r.push(i.then((function(t){return e[n]=t,null}))):e[n]=i})),Promise.all(r).then((function(){return e}))},r.checkProperties=function(t,e){t&&"object"==typeof t||o.throwError("invalid object",o.INVALID_ARGUMENT,{argument:"object",value:t}),Object.keys(t).forEach((function(r){e[r]||o.throwError("invalid object key - "+r,o.INVALID_ARGUMENT,{argument:"transaction",value:t,key:r})}))},r.shallowCopy=function(t){var e={};for(var r in t)e[r]=t[r];return e};var u={boolean:!0,number:!0,string:!0};r.deepCopy=function t(e,r){if(null==e||u[typeof e])return e;if(Array.isArray(e)){var n=e.map((function(e){return t(e,r)}));return r&&Object.freeze(n),n}if("object"==typeof e){if(s(e,"BigNumber"))return e;if(s(e,"Description"))return e;if(s(e,"Indexed"))return e;n={};for(var i in e){var o=e[i];void 0!==o&&a(n,i,t(o,r))}return r&&Object.freeze(n),n}if("function"==typeof e)return e;throw Error("Cannot deepCopy "+typeof e)},r.inheritable=function t(e){return function(r){var n,i;(n=r).super_=i=e,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(r,"inherits",t(r))}}}));e(h);var l=r((function(e,r){var n=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},a=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s=n(u),l=a(i),f=new s.default.BN(-1);function c(t){var e=t.toString(16);return"-"===e[0]?e.length%2==0?"-0x0"+e.substring(1):"-0x"+e.substring(1):e.length%2==1?"0x0"+e:"0x"+e}function d(t){return m(y(t))}function p(t){return new v(c(t))}function m(t){var e=t._hex;return"-"===e[0]?new s.default.BN(e.substring(3),16).mul(f):new s.default.BN(e.substring(2),16)}var v=function(){function t(e){if(l.checkNew(this,t),h.setType(this,"BigNumber"),"string"==typeof e)o.isHexString(e)?("0x"==e&&(e="0x0"),h.defineReadOnly(this,"_hex",e)):"-"===e[0]&&o.isHexString(e.substring(1))?h.defineReadOnly(this,"_hex",e):e.match(/^-?[0-9]*$/)?(""==e&&(e="0"),h.defineReadOnly(this,"_hex",c(new s.default.BN(e)))):l.throwError("invalid BigNumber string value",l.INVALID_ARGUMENT,{arg:"value",value:e});else if("number"==typeof e){parseInt(e+"")!==e&&l.throwError("underflow",l.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:e,outputValue:parseInt(e+"")});try{h.defineReadOnly(this,"_hex",c(new s.default.BN(e)))}catch(t){l.throwError("overflow",l.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}}else e instanceof t?h.defineReadOnly(this,"_hex",e._hex):e.toHexString?h.defineReadOnly(this,"_hex",c(d(e.toHexString()))):e._hex&&o.isHexString(e._hex)?h.defineReadOnly(this,"_hex",e._hex):o.isArrayish(e)?h.defineReadOnly(this,"_hex",c(new s.default.BN(o.hexlify(e).substring(2),16))):l.throwError("invalid BigNumber value",l.INVALID_ARGUMENT,{arg:"value",value:e})}return t.prototype.fromTwos=function(t){return p(m(this).fromTwos(t))},t.prototype.toTwos=function(t){return p(m(this).toTwos(t))},t.prototype.abs=function(){return"-"===this._hex[0]?p(m(this).mul(f)):this},t.prototype.add=function(t){return p(m(this).add(d(t)))},t.prototype.sub=function(t){return p(m(this).sub(d(t)))},t.prototype.div=function(t){return y(t).isZero()&&l.throwError("division by zero",l.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),p(m(this).div(d(t)))},t.prototype.mul=function(t){return p(m(this).mul(d(t)))},t.prototype.mod=function(t){return p(m(this).mod(d(t)))},t.prototype.pow=function(t){return p(m(this).pow(d(t)))},t.prototype.maskn=function(t){return p(m(this).maskn(t))},t.prototype.eq=function(t){return m(this).eq(d(t))},t.prototype.lt=function(t){return m(this).lt(d(t))},t.prototype.lte=function(t){return m(this).lte(d(t))},t.prototype.gt=function(t){return m(this).gt(d(t))},t.prototype.gte=function(t){return m(this).gte(d(t))},t.prototype.isZero=function(){return m(this).isZero()},t.prototype.toNumber=function(){try{return m(this).toNumber()}catch(t){l.throwError("overflow",l.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},t.prototype.toString=function(){return m(this).toString(10)},t.prototype.toHexString=function(){return this._hex},t.isBigNumber=function(t){return h.isType(t,"BigNumber")},t}();function y(t){return v.isBigNumber(t)?t:new v(t)}r.BigNumber=v,r.bigNumberify=y}));e(l);var f=r((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.AddressZero="0x0000000000000000000000000000000000000000";e.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000";e.EtherSymbol="Ξ";var r=l.bigNumberify(-1);e.NegativeOne=r;var n=l.bigNumberify(0);e.Zero=n;var i=l.bigNumberify(1);e.One=i;var o=l.bigNumberify(2);e.Two=o;var a=l.bigNumberify("1000000000000000000");e.WeiPerEther=a;var s=l.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");e.MaxUint256=s}));e(f);var c=r((function(t,e){var r;function n(t,e){void 0===e&&(e=r.current),e!=r.current&&(i.checkNormalize(),t=t.normalize(e));for(var n=[],a=0;t.length>a;a++){var s=t.charCodeAt(a);if(128>s)n.push(s);else if(2048>s)n.push(s>>6|192),n.push(63&s|128);else if(55296==(64512&s)){a++;var u=t.charCodeAt(a);if(a>=t.length||56320!=(64512&u))throw Error("invalid utf-8 string");n.push((s=65536+((1023&s)<<10)+(1023&u))>>18|240),n.push(s>>12&63|128),n.push(s>>6&63|128),n.push(63&s|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(63&s|128)}return o.arrayify(n)}function a(t,e){t=o.arrayify(t);for(var r="",n=0;t.length>n;){var i=t[n++];if(i>>7!=0){var a=null,s=null;if(192==(224&i))a=1,s=127;else if(224==(240&i))a=2,s=2047;else{if(240!=(248&i)){if(!e){if(128==(192&i))throw Error("invalid utf8 byte sequence; unexpected continuation byte");throw Error("invalid utf8 byte sequence; invalid prefix")}continue}a=3,s=65535}if(t.lengthn&&t[n]>>6==2;n++);}else{for(var u=i&(1<<8-a-1)-1,h=0;a>h;h++){var l=t[n];if(128!=(192&l)){u=null;break}u=u<<6|63&l,n++}if(null!==u){if(u>s){if(1114111u||u>57343)r+=u>65535?String.fromCharCode(55296+((u-=65536)>>10&1023),56320+(1023&u)):String.fromCharCode(u);else if(!e)throw Error("invalid utf8 byte sequence; utf-16 surrogate")}else if(!e)throw Error("invalid utf8 byte sequence; overlong")}else if(!e)throw Error("invalid utf8 byte sequence; invalid continuation byte")}}else r+=String.fromCharCode(i)}return r}Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(r=e.UnicodeNormalizationForm||(e.UnicodeNormalizationForm={})),e.toUtf8Bytes=n,e.toUtf8String=a,e.formatBytes32String=function(t){var e=n(t);if(e.length>31)throw Error("bytes32 string must be less than 32 bytes");return o.hexlify(o.concat([e,f.HashZero]).slice(0,32))},e.parseBytes32String=function(t){var e=o.arrayify(t);if(32!==e.length)throw Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw Error("invalid bytes32 sdtring - no null terminator");for(var r=31;0===e[r-1];)r--;return a(e.slice(0,r))}}));e(c);var d=r((function(e){ +/** + * [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(){var r="object"==typeof window?window:{};!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node&&(r=t);for(var n=!r.JS_SHA3_NO_COMMON_JS&&e.exports,i="0123456789abcdef".split(""),o=[0,8,16,24],a=[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],s=[224,256,384,512],u=["hex","buffer","arrayBuffer","array"],h=function(t,e,r){return function(n){return new b(t,e,t).update(n)[r]()}},l=function(t,e,r){return function(n,i){return new b(t,e,i).update(n)[r]()}},f=function(t,e){var r=h(t,e,"hex");r.create=function(){return new b(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;u.length>n;++n){var i=u[n];r[i]=h(t,e,i)}return r},c=[{name:"keccak",padding:[1,256,65536,16777216],bits:s,createMethod:f},{name:"sha3",padding:[6,1536,393216,100663296],bits:s,createMethod:f},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,e){var r=l(t,e,"hex");r.create=function(r){return new b(t,e,r)},r.update=function(t,e){return r.create(e).update(t)};for(var n=0;u.length>n;++n){var i=u[n];r[i]=l(t,e,i)}return r}}],d={},p=[],m=0;c.length>m;++m)for(var v=c[m],y=v.bits,g=0;y.length>g;++g){var w=v.name+"_"+y[g];p.push(w),d[w]=v.createMethod(y[g],v.padding)}function b(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;50>n;++n)this.s[n]=0}b.prototype.update=function(t){var e="string"!=typeof t;e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));for(var r,n,i=t.length,a=this.blocks,s=this.byteCount,u=this.blockCount,h=0,l=this.s;i>h;){if(this.reset)for(this.reset=!1,a[0]=this.block,r=1;u+1>r;++r)a[r]=0;if(e)for(r=this.start;i>h&&s>r;++h)a[r>>2]|=t[h]<h&&s>r;++h)128>(n=t.charCodeAt(h))?a[r>>2]|=n<n?(a[r>>2]|=(192|n>>6)<>2]|=(128|63&n)<n||n>=57344?(a[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<r)this.start=r;else{for(this.start=r-s,this.block=a[u],r=0;u>r;++r)l[r]^=a[r];M(l),this.reset=!0}}return this},b.prototype.finalize=function(){var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;r+1>e;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;r>e;++e)n[e]^=t[e];M(n)},b.prototype.toString=b.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,o=this.extraBytes,a=0,s=0,u="";n>s;){for(a=0;e>a&&n>s;++a,++s)u+=i[(t=r[a])>>4&15]+i[15&t]+i[t>>12&15]+i[t>>8&15]+i[t>>20&15]+i[t>>16&15]+i[t>>28&15]+i[t>>24&15];s%e==0&&(M(r),a=0)}return o&&(t=r[a],o>0&&(u+=i[t>>4&15]+i[15&t]),o>1&&(u+=i[t>>12&15]+i[t>>8&15]),o>2&&(u+=i[t>>20&15]+i[t>>16&15])),u},b.prototype.buffer=b.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);n>a;){for(o=0;e>o&&n>a;++o,++a)u[a]=r[o];a%e==0&&M(r)}return i&&(u[o]=r[o],t=t.slice(0,s)),t},b.prototype.digest=b.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];i>s;){for(a=0;r>a&&i>s;++a,++s)u[t=s<<2]=255&(e=n[a]),u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&M(n)}return o&&(t=s<<2,e=n[a],o>0&&(u[t]=255&e),o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u};var M=function(t){var e,r,n,i,o,s,u,h,l,f,c,d,p,m,v,y,g,w,b,M,_,E,N,A,x,C,T,k,I,R,F,O,S,U,P,B,j,D,L,G,z,V,Z,q,H,W,$,J,K,X,Q,Y,tt,et,rt,nt,it,ot,at,st,ut,ht,lt;for(n=0;48>n;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],h=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^((u=t[3]^t[13]^t[23]^t[33]^t[43])<<1|(s=t[2]^t[12]^t[22]^t[32]^t[42])>>>31),t[0]^=e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|u>>>31),t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,r=o^(l<<1|h>>>31),t[2]^=e=i^(h<<1|l>>>31),t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,r=u^(c<<1|f>>>31),t[4]^=e=s^(f<<1|c>>>31),t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,r=l^(p<<1|d>>>31),t[6]^=e=h^(d<<1|p>>>31),t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,r=c^(o<<1|i>>>31),t[8]^=e=f^(i<<1|o>>>31),t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,v=t[1],W=t[11]<<4|t[10]>>>28,$=t[10]<<4|t[11]>>>28,k=t[20]<<3|t[21]>>>29,I=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,V=t[40]<<18|t[41]>>>14,Z=t[41]<<18|t[40]>>>14,U=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,K=t[23]<<10|t[22]>>>22,R=t[33]<<13|t[32]>>>19,F=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,B=t[14]<<6|t[15]>>>26,j=t[15]<<6|t[14]>>>26,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Q=t[35]<<15|t[34]>>>17,O=t[45]<<29|t[44]>>>3,S=t[44]<<29|t[45]>>>3,A=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,L=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,Y=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,q=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,C=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,G=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,N=t[49]<<14|t[48]>>>18,t[0]=(m=t[0])^~(y=t[13]<<12|t[12]>>>20)&(w=t[25]<<11|t[24]>>>21),t[1]=v^~g&b,t[10]=A^~C&k,t[11]=x^~T&I,t[20]=U^~B&D,t[21]=P^~j&L,t[30]=q^~W&J,t[31]=H^~$&K,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=y^~w&M,t[3]=g^~b&_,t[12]=C^~k&R,t[13]=T^~I&F,t[22]=B^~D&G,t[23]=j^~L&z,t[32]=W^~J&X,t[33]=$^~K&Q,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&E,t[5]=b^~_&N,t[14]=k^~R&O,t[15]=I^~F&S,t[24]=D^~G&V,t[25]=L^~z&Z,t[34]=J^~X&Y,t[35]=K^~Q&tt,t[44]=ot^~st&ht,t[45]=at^~ut<,t[6]=M^~E&m,t[7]=_^~N&v,t[16]=R^~O&A,t[17]=F^~S&x,t[26]=G^~V&U,t[27]=z^~Z&P,t[36]=X^~Y&q,t[37]=Q^~tt&H,t[46]=st^~ht&et,t[47]=ut^~lt&rt,t[8]=E^~m&y,t[9]=N^~v&g,t[18]=O^~A&C,t[19]=S^~x&T,t[28]=V^~U&B,t[29]=Z^~P&j,t[38]=Y^~q&W,t[39]=tt^~H&$,t[48]=ht^~et&nt,t[49]=lt^~rt&it,t[0]^=a[n],t[1]^=a[n+1]};if(n)e.exports=d;else for(m=0;p.length>m;++m)r[p[m]]=d[p[m]]}()})),p=r((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.keccak256=function(t){return"0x"+d.keccak_256(o.arrayify(t))}}));e(p);var m=r((function(e,r){var n=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var a=n(i),s=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),u=/^((.*)\.)?([^.]+)$/,h=/^[a-z0-9.-]*$/;r.namehash=function(t){"string"!=typeof t&&a.throwError("invalid address - "+t,a.INVALID_ARGUMENT,{argument:"name",value:t}),(t=t.toLowerCase()).match(h)||a.throwError("contains invalid UseSTD3ASCIIRules characters",a.INVALID_ARGUMENT,{argument:"name",value:t});for(var e=s;t.length;){var r=t.match(u),n=c.toUtf8Bytes(r[3]);e=p.keccak256(o.concat([e,p.keccak256(n)])),t=r[2]||""}return o.hexlify(e)},r.id=function(t){return p.keccak256(c.toUtf8Bytes(t))},r.hashMessage=function(t){return p.keccak256(o.concat([c.toUtf8Bytes("Ethereum Signed Message:\n"),c.toUtf8Bytes(t.length+""),"string"==typeof t?c.toUtf8Bytes(t):t]))}}));e(m);var v=m.id,y=function(t,e,r,n,i,o,a,s){if(!t){var u;if(void 0===e)u=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[r,n,i,o,a,s],l=0;(u=Error(e.replace(/%s/g,(function(){return h[l++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}},g=r((function(e,r){var n=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:t);!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t+=""),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t+=""),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function c(t){this.map={},t instanceof c?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function m(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=""+t:a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=Array(e.length),n=0;e.length>n;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,e){t=h(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},c.prototype.delete=function(t){delete this.map[h(t)]},c.prototype.get=function(t){return t=h(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(h(t))},c.prototype.set=function(t,e){this.map[h(t)]=l(e)},c.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),f(t)},c.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(t)},n&&(c.prototype[Symbol.iterator]=c.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,n,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=t+"";if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function M(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&300>this.status,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},M.error=function(){var t=new M(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];M.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new M(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e,this.stack=Error(t).stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,o){var a=new w(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL"),n(new M("response"in s?s.response:s.responseText,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=c,t.Request=w,t.Response=M),e.Headers=c,e.Request=w,e.Response=M,e.fetch=E}({})}(n),delete n.fetch.polyfill,(r=n.fetch).default=n.fetch,r.fetch=n.fetch,r.Headers=n.Headers,r.Request=n.Request,r.Response=n.Response,e.exports=r})),w=r((function(t,e){function r(t){for(var e=[];t;)e.unshift(255&t),t>>=8;return e}function n(t,e,r){for(var n=0,i=0;r>i;i++)n=256*n+t[e+i];return n}function i(t,e,r,n){for(var i=[];e+1+n>r;){var o=a(t,r);if(i.push(o.result),(r+=o.consumed)>e+1+n)throw Error("invalid rlp")}return{consumed:1+n,result:i}}function a(t,e){if(0===t.length)throw Error("invalid rlp data");if(t[e]>=248){if(e+1+(r=t[e]-247)>t.length)throw Error("too short");if(e+1+r+(a=n(t,e+1,r))>t.length)throw Error("to short");return i(t,e,e+1+r,r+a)}if(t[e]>=192){if(e+1+(a=t[e]-192)>t.length)throw Error("invalid rlp data");return i(t,e,e+1,a)}if(t[e]>=184){var r;if(e+1+(r=t[e]-183)>t.length)throw Error("invalid rlp data");if(e+1+r+(a=n(t,e+1,r))>t.length)throw Error("invalid rlp data");return{consumed:1+r+a,result:o.hexlify(t.slice(e+1+r,e+1+r+a))}}if(t[e]>=128){var a;if(e+1+(a=t[e]-128)>t.length)throw Error("invlaid rlp data");return{consumed:1+a,result:o.hexlify(t.slice(e+1,e+1+a))}}return{consumed:1,result:o.hexlify(t[e])}}Object.defineProperty(e,"__esModule",{value:!0}),e.encode=function(t){return o.hexlify(function t(e){if(Array.isArray(e)){var n=[];return e.forEach((function(e){n=n.concat(t(e))})),n.length>55?((i=r(n.length)).unshift(247+i.length),i.concat(n)):(n.unshift(192+n.length),n)}var i,a=Array.prototype.slice.call(o.arrayify(e));return 1!==a.length||a[0]>127?a.length>55?((i=r(a.length)).unshift(183+i.length),i.concat(a)):(a.unshift(128+a.length),a):a}(t))},e.decode=function(t){var e=o.arrayify(t),r=a(e,0);if(r.consumed!==e.length)throw Error("invalid rlp data");return r.result}}));e(w);var b=r((function(e,r){var n=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var a=n(u);function s(t){"string"==typeof t&&t.match(/^0x[0-9A-Fa-f]{40}$/)||i.throwError("invalid address",i.INVALID_ARGUMENT,{arg:"address",value:t});for(var e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;40>n;n++)r[n]=e[n].charCodeAt(0);r=o.arrayify(p.keccak256(r));for(var a=0;40>a;a+=2)8>r[a>>1]>>4||(e[a]=e[a].toUpperCase()),8>(15&r[a>>1])||(e[a+1]=e[a+1].toUpperCase());return"0x"+e.join("")}for(var h={},l=0;10>l;l++)h[l+""]=l+"";for(l=0;26>l;l++)h[String.fromCharCode(65+l)]=10+l+"";var f,c=Math.floor((f=9007199254740991,Math.log10?Math.log10(f):Math.log(f)/Math.LN10));function d(t){t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00";var e="";for(t.split("").forEach((function(t){e+=h[t]}));e.length>=c;){var r=e.substring(0,c);e=parseInt(r,10)%97+e.substring(r.length)}for(var n=98-parseInt(e,10)%97+"";2>n.length;)n="0"+n;return n}function m(t){var e=null;if("string"!=typeof t&&i.throwError("invalid address",i.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=s(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&i.throwError("bad address checksum",i.INVALID_ARGUMENT,{arg:"address",value:t});else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==d(t)&&i.throwError("bad icap checksum",i.INVALID_ARGUMENT,{arg:"address",value:t}),e=new a.default.BN(t.substring(4),36).toString(16);40>e.length;)e="0"+e;e=s("0x"+e)}else i.throwError("invalid address",i.INVALID_ARGUMENT,{arg:"address",value:t});return e}r.getAddress=m,r.getIcapAddress=function(t){for(var e=new a.default.BN(m(t).substring(2),16).toString(36).toUpperCase();30>e.length;)e="0"+e;return"XE"+d("XE00"+e)+e},r.getContractAddress=function(t){if(!t.from)throw Error("missing from address");var e=t.nonce;return m("0x"+p.keccak256(w.encode([m(t.from),o.stripZeros(o.hexlify(e))])).substring(26))}}));e(b);var M=r((function(e,r){var n,a=t&&t.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var u=s(i),d=RegExp(/^bytes([0-9]*)$/),p=RegExp(/^(u?int)([0-9]*)$/),m=RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(t,e){var r=t.match(p);return r&&48>=parseInt(r[2])?e.toNumber():e};var v=/^([^)(]*)\((.*)\)([^)(]*)$/,y=/^[A-Za-z_][A-Za-z0-9_]*$/;function g(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}function w(t,e){var r=t;function n(t){throw Error('unexpected character "'+r[t]+'" at position '+t+' in "'+r+'"')}t=t.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,a=0;t.length>a;a++){var s=t[a];switch(s){case"(":o.state.allowParams||n(a),o.state.allowType=!1,o.type=g(o.type),o.components=[{type:"",name:"",parent:o,state:{allowType:!0}}],o=o.components[0];break;case")":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=g(o.type);var u=o;(o=o.parent)||n(a),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=g(o.type);var h={type:"",name:"",parent:o.parent,state:{allowType:!0}};o.parent.components.push(h),delete o.parent,o=h;break;case" ":o.state.allowType&&""!==o.type&&(o.type=g(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&(e&&"indexed"===o.name?(o.indexed=!0,o.name=""):o.state.allowName=!1);break;case"[":o.state.allowArray||n(a),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(a),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(a)}}if(o.parent)throw Error("unexpected eof");return delete i.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),i.type=g(i.type),i}function M(t){return G(r.defaultCoerceFunc,t).type}r.parseParamType=function(t){return w(t,!0)},r.formatParamType=M,r.formatSignature=function(t){return t.name+"("+t.inputs.map((function(t){return M(t)})).join(",")+")"},r.parseSignature=function(t){if("string"==typeof t)return"event "===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).substring(0,6)?function(t){var e={anonymous:!1,inputs:[],name:"",type:"event"},r=t.match(v);if(!r)throw Error("invalid event: "+t);if(e.name=r[1].trim(),D(r[2]).forEach((function(t){(t=w(t,!0)).indexed=!!t.indexed,e.inputs.push(t)})),r[3].split(" ").forEach((function(t){switch(t){case"anonymous":e.anonymous=!0;break;case"":break;default:u.info("unknown modifier: "+t)}})),e.name&&!e.name.match(y))throw Error('invalid identifier: "'+e.name+'"');return e}(t.substring(6).trim()):("function "===t.substring(0,9)&&(t=t.substring(9)),function(t){var e={constant:!1,gas:null,inputs:[],name:"",outputs:[],payable:!1,stateMutability:null,type:"function"},r=t.split("@");if(1!==r.length){if(r.length>2)throw Error("invalid signature");if(!r[1].match(/^[0-9]+$/))throw Error("invalid signature gas");e.gas=l.bigNumberify(r[1]),t=r[0]}var n=(r=t.split(" returns "))[0].match(v);if(!n)throw Error("invalid signature");if(e.name=n[1].trim(),!e.name.match(y))throw Error('invalid identifier: "'+n[1]+'"');if(D(n[2]).forEach((function(t){e.inputs.push(w(t))})),n[3].split(" ").forEach((function(t){switch(t){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:u.info("unknown modifier: "+t)}})),r.length>1){var i=r[1].match(v);if(""!=i[1].trim()||""!=i[3].trim())throw Error("unexpected tokens");D(i[2]).forEach((function(t){e.outputs.push(w(t))}))}if("constructor"===e.name){if(e.type="constructor",e.outputs.length)throw Error("constructor may not have outputs");delete e.name,delete e.outputs}return e}(t.trim()));throw Error("unknown signature")};var _=function(t,e,r,n,i){this.coerceFunc=t,this.name=e,this.type=r,this.localName=n,this.dynamic=i},E=function(t){function e(e){var r=t.call(this,e.coerceFunc,e.name,e.type,void 0,e.dynamic)||this;return h.defineReadOnly(r,"coder",e),r}return a(e,t),e.prototype.encode=function(t){return this.coder.encode(t)},e.prototype.decode=function(t,e){return this.coder.decode(t,e)},e}(_),N=function(t){function e(e,r){return t.call(this,e,"null","",r,!1)||this}return a(e,t),e.prototype.encode=function(t){return o.arrayify([])},e.prototype.decode=function(t,e){if(e>t.length)throw Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},e}(_),A=function(t){function e(e,r,n,i){var o=this,a=(n?"int":"uint")+8*r;return(o=t.call(this,e,a,a,i,!1)||this).size=r,o.signed=n,o}return a(e,t),e.prototype.encode=function(t){try{var e=l.bigNumberify(t);if(this.signed){var r=f.MaxUint256.maskn(8*this.size-1);if(e.gt(r))throw Error("out-of-bounds");if(r=r.add(f.One).mul(f.NegativeOne),e.lt(r))throw Error("out-of-bounds")}else if(e.lt(f.Zero)||e.gt(f.MaxUint256.maskn(8*this.size)))throw Error("out-of-bounds");return e=e.toTwos(8*this.size).maskn(8*this.size),this.signed&&(e=e.fromTwos(8*this.size).toTwos(256)),o.padZeros(o.arrayify(e),32)}catch(e){u.throwError("invalid number value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t})}return null},e.prototype.decode=function(t,e){e+32>t.length&&u.throwError("insufficient data for "+this.name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:o.hexlify(t.slice(e,e+32))});var r=l.bigNumberify(t.slice(e+(32-this.size),e+32));return r=this.signed?r.fromTwos(8*this.size):r.maskn(8*this.size),{consumed:32,value:this.coerceFunc(this.name,r)}},e}(_),x=new A((function(t,e){return e}),32,!1,"none"),C=function(t){function e(e,r){return t.call(this,e,"bool","bool",r,!1)||this}return a(e,t),e.prototype.encode=function(t){return x.encode(t?1:0)},e.prototype.decode=function(t,e){try{var r=x.decode(t,e)}catch(t){throw"insufficient data for uint256 type"===t.reason&&u.throwError("insufficient data for boolean type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"boolean",value:t.value}),t}return{consumed:r.consumed,value:this.coerceFunc("bool",!r.value.isZero())}},e}(_),T=function(t){function e(e,r,n){var i=this,o="bytes"+r;return(i=t.call(this,e,o,o,n,!1)||this).length=r,i}return a(e,t),e.prototype.encode=function(t){var e=new Uint8Array(32);try{var r=o.arrayify(t);if(r.length!==this.length)throw Error("incorrect data length");e.set(r)}catch(e){u.throwError("invalid "+this.name+" value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e.value||t})}return e},e.prototype.decode=function(t,e){return e+32>t.length&&u.throwError("insufficient data for "+name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:o.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc(this.name,o.hexlify(t.slice(e,e+this.length)))}},e}(_),k=function(t){function e(e,r){return t.call(this,e,"address","address",r,!1)||this}return a(e,t),e.prototype.encode=function(t){var e=new Uint8Array(32);try{e.set(o.arrayify(b.getAddress(t)),12)}catch(e){u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:t})}return e},e.prototype.decode=function(t,e){return e+32>t.length&&u.throwError("insufficuent data for address type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:o.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc("address",b.getAddress(o.hexlify(t.slice(e+12,e+32))))}},e}(_);function I(t){var e=new Uint8Array(32*Math.ceil(t.length/32)-t.length);return o.concat([x.encode(t.length),t,e])}function R(t,e,r){e+32>t.length&&u.throwError("insufficient data for dynamicBytes length",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:o.hexlify(t.slice(e,e+32))});var n=x.decode(t,e).value;try{n=n.toNumber()}catch(t){u.throwError("dynamic bytes count too large",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:""+n})}return e+32+n>t.length&&u.throwError("insufficient data for dynamicBytes type",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:o.hexlify(t.slice(e,e+32+n))}),{consumed:32+32*Math.ceil(n/32),value:t.slice(e+32,e+32+n)}}var F=function(t){function e(e,r){return t.call(this,e,"bytes","bytes",r,!0)||this}return a(e,t),e.prototype.encode=function(t){try{return I(o.arrayify(t))}catch(t){u.throwError("invalid bytes value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"bytes",value:t.value})}return null},e.prototype.decode=function(t,e){var r=R(t,e,this.localName);return r.value=this.coerceFunc("bytes",o.hexlify(r.value)),r},e}(_),O=function(t){function e(e,r){return t.call(this,e,"string","string",r,!0)||this}return a(e,t),e.prototype.encode=function(t){return"string"!=typeof t&&u.throwError("invalid string value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"string",value:t}),I(c.toUtf8Bytes(t))},e.prototype.decode=function(t,e){var r=R(t,e,this.localName);return r.value=this.coerceFunc("string",c.toUtf8String(r.value)),r},e}(_);function S(t){return 32*Math.ceil(t/32)}function U(t,e){if(Array.isArray(e));else if(e&&"object"==typeof e){var r=[];t.forEach((function(t){r.push(e[t.localName])})),e=r}else u.throwError("invalid tuple value",u.INVALID_ARGUMENT,{coderType:"tuple",value:e});t.length!==e.length&&u.throwError("types/value length mismatch",u.INVALID_ARGUMENT,{coderType:"tuple",value:e});var n=[];t.forEach((function(t,r){n.push({dynamic:t.dynamic,value:t.encode(e[r])})}));var i=0,o=0;n.forEach((function(t){t.dynamic?(i+=32,o+=S(t.value.length)):i+=S(t.value.length)}));var a=0,s=i,h=new Uint8Array(i+o);return n.forEach((function(t){t.dynamic?(h.set(x.encode(s),a),a+=32,h.set(t.value,s),s+=S(t.value.length)):(h.set(t.value,a),a+=S(t.value.length))})),h}function P(t,e,r){var n=r,i=0,o=[];return t.forEach((function(t){if(t.dynamic){var a=x.decode(e,r);(s=t.decode(e,n+a.value.toNumber())).consumed=a.consumed}else var s=t.decode(e,r);null!=s.value&&o.push(s.value),r+=s.consumed,i+=s.consumed})),t.forEach((function(t,e){var r=t.localName;r&&("length"===r&&(r="_length"),null==o[r]&&(o[r]=o[e]))})),{value:o,consumed:i}}var B=function(t){function e(e,r,n,i){var o=this;return(o=t.call(this,e,"array",r.type+"["+(0>n?"":n)+"]",i,-1===n||r.dynamic)||this).coder=r,o.length=n,o}return a(e,t),e.prototype.encode=function(t){Array.isArray(t)||u.throwError("expected array value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t});var e=this.length,r=new Uint8Array(0);-1===e&&(r=x.encode(e=t.length)),u.checkArgumentCount(e,t.length," in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;t.length>i;i++)n.push(this.coder);return o.concat([r,U(n,t)])},e.prototype.decode=function(t,e){var r=0,n=this.length;if(-1===n){try{var i=x.decode(t,e)}catch(t){u.throwError("insufficient data for dynamic array length",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t.value})}try{n=i.value.toNumber()}catch(t){u.throwError("array count too large",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:""+i.value})}r+=i.consumed,e+=i.consumed}for(var o=[],a=0;n>a;a++)o.push(new E(this.coder));var s=P(o,t,e);return s.consumed+=r,s.value=this.coerceFunc(this.type,s.value),s},e}(_),j=function(t){function e(e,r,n){var i=this,o=!1,a=[];r.forEach((function(t){t.dynamic&&(o=!0),a.push(t.type)}));var s="tuple("+a.join(",")+")";return(i=t.call(this,e,"tuple",s,n,o)||this).coders=r,i}return a(e,t),e.prototype.encode=function(t){return U(this.coders,t)},e.prototype.decode=function(t,e){var r=P(this.coders,t,e);return r.value=this.coerceFunc(this.type,r.value),r},e}(_);function D(t){t=t.trim();for(var e=[],r="",n=0,i=0;t.length>i;i++){var o=t[i];if(","===o&&0===n)e.push(r),r="";else if(r+=o,"("===o)n++;else if(")"===o&&-1===--n)throw Error("unbalanced parenthsis")}return r&&e.push(r),e}var L={address:k,bool:C,string:O,bytes:F};function G(t,e){var r,n=L[e.type];if(n)return new n(t,e.name);if(r=e.type.match(p))return(0===(i=parseInt(r[2]||"256"))||i>256||i%8!=0)&&u.throwError("invalid "+r[1]+" bit length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new A(t,i/8,"int"===r[1],e.name);if(r=e.type.match(d))return(0===(i=parseInt(r[1]))||i>32)&&u.throwError("invalid bytes length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new T(t,i,e.name);if(r=e.type.match(m)){var i=parseInt(r[2]||"-1");return(e=h.shallowCopy(e)).type=r[1],e=h.deepCopy(e),new B(t,G(t,e),i,e.name)}return"tuple"===e.type.substring(0,5)?function(t,e,r){e||(e=[]);var n=[];return e.forEach((function(e){n.push(G(t,e))})),new j(t,n,r)}(t,e.components,e.name):""===e.type?new N(t,e.name):(u.throwError("invalid type",u.INVALID_ARGUMENT,{arg:"type",value:e.type}),null)}var z=function(){function t(e){u.checkNew(this,t),e||(e=r.defaultCoerceFunc),h.defineReadOnly(this,"coerceFunc",e)}return t.prototype.encode=function(t,e){t.length!==e.length&&u.throwError("types/values length mismatch",u.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});var r=[];return t.forEach((function(t){var e=null;e="string"==typeof t?w(t):t,r.push(G(this.coerceFunc,e))}),this),o.hexlify(new j(this.coerceFunc,r,"_").encode(e))},t.prototype.decode=function(t,e){var r=[];return t.forEach((function(t){var e=null;e="string"==typeof t?w(t):h.deepCopy(t),r.push(G(this.coerceFunc,e))}),this),new j(this.coerceFunc,r,"_").decode(o.arrayify(e),0).value},t}();r.AbiCoder=z,r.defaultAbiCoder=new z}));e(M);var _=M.defaultAbiCoder,E=1e3,N=6e4,A=36e5,x=24*A,C=function(t,e){e=e||{};var r=typeof t;if("string"===r&&t.length>0)return function(t){if((t+="").length>100)return;var e=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*x;case"hours":case"hour":case"hrs":case"hr":case"h":return r*A;case"minutes":case"minute":case"mins":case"min":case"m":return r*N;case"seconds":case"second":case"secs":case"sec":case"s":return r*E;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(t);if("number"===r&&!1===isNaN(t))return e.long?function(t){var e=Math.abs(t);if(e>=x)return T(t,e,x,"day");if(e>=A)return T(t,e,A,"hour");if(e>=N)return T(t,e,N,"minute");if(e>=E)return T(t,e,E,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=x)return Math.round(t/x)+"d";if(e>=A)return Math.round(t/A)+"h";if(e>=N)return Math.round(t/N)+"m";if(e>=E)return Math.round(t/E)+"s";return t+"ms"}(t);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function T(t,e,r,n){var i=e>=1.5*r;return Math.round(t/r)+" "+n+(i?"s":"")}var k=function(t){function e(t){let e=0;for(let r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return r.colors[Math.abs(e)%r.colors.length]}function r(t){let o;function a(...t){if(!a.enabled)return;const e=a,n=Number(new Date);e.diff=n-(o||n),e.prev=o,e.curr=n,o=n,t[0]=r.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let i=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return n;i++;const a=r.formatters[o];if("function"==typeof a){n=a.call(e,t[i]),t.splice(i,1),i--}return n}),r.formatArgs.call(e,t),(e.log||r.log).apply(e,t)}return a.namespace=t,a.enabled=r.enabled(t),a.useColors=r.useColors(),a.color=e(t),a.destroy=n,a.extend=i,"function"==typeof r.init&&r.init(a),r.instances.push(a),a}function n(){const t=r.instances.indexOf(this);return-1!==t&&(r.instances.splice(t,1),!0)}function i(t,e){const n=r(this.namespace+(void 0===e?":":e)+t);return n.log=this.log,n}function o(t){return(""+t).substring(2,(""+t).length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},r.disable=function(){const t=[...r.names.map(o),...r.skips.map(o).map(t=>"-"+t)].join(",");return r.enable(""),t},r.enable=function(t){let e;r.save(t),r.names=[],r.skips=[];const n=("string"==typeof t?t:"").split(/[\s,]+/),i=n.length;for(e=0;i>e;e++)n[e]&&("-"===(t=n[e].replace(/\*/g,".*?"))[0]?r.skips.push(RegExp("^"+t.substr(1)+"$")):r.names.push(RegExp("^"+t+"$")));for(e=0;r.instances.length>e;e++){const t=r.instances[e];t.enabled=r.enabled(t.namespace)}},r.enabled=function(t){if("*"===t[t.length-1])return!0;let e,n;for(e=0,n=r.skips.length;n>e;e++)if(r.skips[e].test(t))return!1;for(e=0,n=r.names.length;n>e;e++)if(r.names[e].test(t))return!0;return!1},r.humanize=C,Object.keys(t).forEach(e=>{r[e]=t[e]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=e,r.enable(r.load()),r},I=r((function(t,e){e.log=function(...t){return"object"==typeof console&&console.log&&console.log(...t)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(n++,"%c"===t&&(i=n))}),e.splice(i,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=k(e);const{formatters:r}=t.exports;r.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}})),R=I("multicall");function F(t){return t.replace(/^0x/,"")}function O(t,e){return _.encode(t,e)}function S(t,e){return _.decode(t,"0x"+e.replace(/0x/i,""))}function U(t){return Array.isArray(t)?0===t.length:!t||0===Object.keys(t).length}var P="object"==typeof self&&self&&self.Object===Object&&self,B="object"==typeof t&&t&&t.Object===Object&&t||P||Function("return this")(),j=B.Symbol,D=Object.prototype,L=D.hasOwnProperty,G=D.toString,z=j?j.toStringTag:void 0;var V=function(t){var e=L.call(t,z),r=t[z];try{t[z]=void 0;var n=!0}catch(t){}var i=G.call(t);return n&&(e?t[z]=r:delete t[z]),i},Z=Object.prototype.toString;var q=function(t){return Z.call(t)},H=j?j.toStringTag:void 0;var W=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":H&&H in Object(t)?V(t):q(t)};var $=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var J,K=function(t){if(!$(t))return!1;var e=W(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},X=B["__core-js_shared__"],Q=(J=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+J:"";var Y=function(t){return!!Q&&Q in t},tt=Function.prototype.toString;var et=function(t){if(null!=t){try{return tt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},rt=/^\[object .+?Constructor\]$/,nt=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var it=function(t){return!(!$(t)||Y(t))&&(K(t)?nt:rt).test(et(t))};var ot=function(t,e){return null==t?void 0:t[e]};var at=function(t,e){var r=ot(t,e);return it(r)?r:void 0},st=at(Object,"create");var ut=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ht=Object.prototype.hasOwnProperty;var lt=function(t){var e=this.__data__;if(st){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return ht.call(e,t)?e[t]:void 0},ft=Object.prototype.hasOwnProperty;var ct=function(t){var e=this.__data__;return st?void 0!==e[t]:ft.call(e,t)};var dt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=st&&void 0===e?"__lodash_hash_undefined__":e,this};function pt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=0&&(r==e.length-1?e.pop():gt.call(e,r,1),--this.size,!0)};var bt=function(t){var e=this.__data__,r=yt(e,t);return 0>r?void 0:e[r][1]};var Mt=function(t){return yt(this.__data__,t)>-1};var _t=function(t,e){var r=this.__data__,n=yt(r,t);return 0>n?(++this.size,r.push([t,e])):r[n][1]=e,this};function Et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e0?F(O(e.map((function(t){return t[1]})),e.map((function(t){return t[0]})))):"")]}))];return O([{components:[{type:"address"},{type:"bytes"}],name:"data",type:"tuple[]"}],e)}),(function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return JSON.stringify(e)}));async function jt(t,e){var r=(t=Array.isArray(t)?t:[t]).reduce((function(t,e){var r=e.returns,n=e.call.slice(1);if(n.length>0)for(var i=Array.isArray(a=r),o=0,a=i?a:a[Symbol.iterator]();;){var s;if(i){if(o>=a.length)break;s=a[o++]}else{if((o=a.next()).done)break;s=o.value}t[s[0]]=n}return t}),{});t=t.map((function(t){var r=t.call,n=t.target,i=t.returns;n||(n=e.multicallAddress);var o=r[0],a=r.slice(1),s=o.match(Ut).map((function(t){return t.slice(1,-1)})),u=s[1],h=s[0].split(",").filter((function(t){return!!t}));y(h.length===a.length,"Every method argument must have exactly one type.\n Comparing argument types "+JSON.stringify(h)+"\n to argument values "+JSON.stringify(a)+".\n ");var l=a.map((function(t,e){return[t,h[e]]})),f=u?u.split(","):[];return{method:o.match(Pt)[0],args:l,returnTypes:f,target:n,returns:i}}));var n=Bt(t,!1),i=await async function(t,e){var r=e.id,n=e.web3,i=e.ethers,o=e.provider,a=e.rpcUrl,s=e.block,u=e.multicallAddress,h=e.ws,l=e.wsResponseTimeout,f="0x252dba42"+F(t);if(h)return R("Sending via WebSocket"),new Promise((function(t,e){function n(e){"string"!=typeof e&&(e=e.data);var n=JSON.parse(e);n.id&&n.id===r&&(R("Got WebSocket response id #%d",n.id),clearTimeout(i),h.onmessage=null,t(n.result))}h.send(JSON.stringify({jsonrpc:"2.0",method:"eth_call",params:[{to:u,data:f},s||"latest"],id:r}));var i=setTimeout((function(){h.onmessage===n&&(h.onmessage=null,e(Error("WebSocket response timeout")))}),l);h.onmessage=n}));if(i)return R("Sending via ethers provider"),i.send({method:"eth_call",params:[{to:u,data:f},s||"latest"]});if(o)return R("Sending via EIP-1193 provider"),o.request({method:"eth_call",params:[{to:u,data:f},s||"latest"]});if(n)return R("Sending via web3 provider"),n.eth.call({to:u,data:f});R("Sending via XHR fetch");var c=await g(a,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"eth_call",params:[{to:u,data:f},s||"latest"],id:1})}),d=await c.json();if(!d||!d.result)throw Error("Multicall received an empty response. Check your call configuration for errors.");return d.result}(n,e),o=t.map((function(t){return t.returnTypes})).reduce((function(t,e){return t.concat(e)}),[]),a=t.map((function(t){return t.returns})).reduce((function(t,e){return t.concat(e)}),[]);y(o.length===a.length,"Missing data needed to parse results");for(var s=S(["uint256","bytes[]"],i),u=s.shift(),h=s.reduce((function(e,r){return r.forEach((function(r,n){var i=t[n].returnTypes,o=S(i,r);e.push.apply(e,o.map((function(t,e){return"bool"===i[e]?""+t=="true":t})))})),e}),[]),l={blockNumber:u,original:{},transformed:{}},f=0;h.length>f;f++){var c=a[f],d=c[0],p=c[1];l.original[d]=h[f],l.transformed[d]=void 0!==p?p(h[f]):h[f]}return{results:l,keyToArgMap:r}}function Dt(){return(Dt=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var Lt=null;"undefined"!=typeof WebSocket?Lt=WebSocket:"undefined"!=typeof MozWebSocket?Lt=MozWebSocket:void 0!==t?Lt=t.WebSocket||t.MozWebSocket:"undefined"!=typeof window?Lt=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(Lt=self.WebSocket||self.MozWebSocket);var Gt=Lt,zt={mainnet:{multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",rpcUrl:"https://mainnet.infura.io"},kovan:{multicall:"0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a",rpcUrl:"https://kovan.infura.io"},rinkeby:{multicall:"0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821",rpcUrl:"https://rinkeby.infura.io"},goerli:{multicall:"0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",rpcUrl:"https://rpc.slock.it/goerli"},xdai:{multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpcUrl:"https://dai.poa.network"}},Vt=I("multicall"),Zt=/^wss?:\/\//i;function qt(t){if(void 0!==(t=Dt({interval:1e3,staleBlockRetryWait:3e3,errorRetryWait:5e3,wsResponseTimeout:5e3,wsReconnectTimeout:5e3},t)).preset){if(void 0===zt[t.preset])throw Error("Unknown preset "+t.preset);t.multicallAddress=zt[t.preset].multicall,t.rpcUrl=zt[t.preset].rpcUrl}return t}function Ht(t,e){var r={model:[].concat(t),store:{},storeTransformed:{},keyToArgMap:{},latestPromiseId:0,latestBlockNumber:null,id:0,listeners:{subscribe:[],block:[],poll:[],error:[]},handler:null,wsReconnectHandler:null,watching:!1,config:qt(e),ws:null};function n(t){clearTimeout(r.handler),r.handler=null,clearTimeout(r.wsReconnectHandler),r.wsReconnectHandler=setTimeout((function(){o(),i()}),t)}function i(){Zt.test(r.config.rpcUrl)&&(Vt("Connecting to WebSocket "+r.config.rpcUrl+"..."),r.ws=new Gt(r.config.rpcUrl),r.ws.onopen=function(){if(Vt("WebSocket connected"),r.handler)throw Error("Existing poll setTimeout handler set");r.watching&&s.call({state:r,interval:0,resolveFetchPromise:r.initialFetchResolver})},r.ws.onclose=function(t){Vt("WebSocket closed: %s",JSON.stringify(t)),Vt("Reconnecting in "+r.config.wsReconnectTimeout/1e3+" seconds."),n(r.config.wsReconnectTimeout)},r.ws.onerror=function(t){Vt("WebSocket error: %s",JSON.stringify(t)),Vt("Reconnecting in "+r.config.wsReconnectTimeout/1e3+" seconds."),n(r.config.wsReconnectTimeout)})}function o(){Vt("destroyWebSocket()"),r.ws.onopen=null,r.ws.onclose=null,r.ws.onerror=null,r.ws.onmessage=null,r.ws.close()}function a(t,e,n){if(void 0===n&&(n=!1),!U(r.storeTransformed)){var i=Object.entries(r.storeTransformed).map((function(t){var e=t[0];return{type:e,value:t[1],args:r.keyToArgMap[e]||[]}}));n?t(i):i.forEach(t)}r.listeners.subscribe.push({listener:t,id:e,batch:n})}function s(){var t=this,e=void 0!==this.interval?this.interval:this.state.config.interval;Vt("poll() called, %s%s","interval: "+e,this.retry?", retry: "+this.retry:""),this.state.handler=setTimeout((async function(){try{if(!t.state.handler)return;t.state.latestPromiseId++;var e=t.state.latestPromiseId;r.listeners.poll.forEach((function(r){return(0,r.listener)(Dt({id:e,latestBlockNumber:t.state.latestBlockNumber},t.retry?{retry:t.retry}:{}))}));var n=await jt(t.state.model,Dt({},t.state.config,{ws:t.state.ws,id:t.state.latestPromiseId})),i=n.results,o=i.blockNumber,a=Dt({},i.original),u=Dt({},i.transformed),h=n.keyToArgMap;if(t.state.cancelPromiseId===e)return;if("function"==typeof t.resolveFetchPromise&&t.resolveFetchPromise(),null!==t.state.latestBlockNumber&&t.state.latestBlockNumber>o)Vt("Stale block returned, retrying in "+t.state.config.staleBlockRetryWait/1e3+" seconds"),s.call({state:t.state,interval:t.state.config.staleBlockRetryWait,retry:t.retry?t.retry+1:1});else{(null===t.state.latestBlockNumber||null!==t.state.latestBlockNumber&&o>t.state.latestBlockNumber)&&(t.state.latestBlockNumber=parseInt(o),r.listeners.block.forEach((function(e){return(0,e.listener)(t.state.latestBlockNumber)})));var l=Object.entries(a).filter((function(e){return function(t,e,r){return void 0===r[t]||(null!==e&&null!==r[t]&&"object"==typeof e&&"function"==typeof e.toString&&"object"==typeof r[t]&&"function"==typeof r[t].toString?""+e!=""+r[t]:e!==r[t])}(e[0],e[1],t.state.store)})).map((function(t){var e=t[0];return{type:e,value:u[e],args:h[e]||[]}}));t.state.store=Dt({},a),t.state.storeTransformed=Dt({},u),t.state.keyToArgMap=Dt({},h),function(t){U(t)||r.listeners.subscribe.forEach((function(e){var r=e.listener;return e.batch?r(t):t.forEach(r)}))}(l),s.call({state:t.state})}}catch(e){if(Vt("Error: %s",e.message),r.listeners.error.forEach((function(r){return(0,r.listener)(e,t.state)})),!t.state.handler)return;Vt("Error occured, retrying in "+t.state.config.errorRetryWait/1e3+" seconds"),s.call({state:t.state,interval:t.state.config.errorRetryWait,retry:t.retry?t.retry+1:1})}}),e)}return i(),r.initialFetchPromise=new Promise((function(t){r.initialFetchResolver=t})),{tap:function(t){Vt("watcher.tap() called");var e=t([].concat(r.model));return r.model=[].concat(e),this.poll()},poll:function(){var t;Vt("watcher.poll() called");var e=new Promise((function(e){t=e}));return!r.watching||r.ws&&r.ws.readyState!==Gt.OPEN?Promise.resolve():(clearTimeout(r.handler),r.handler=null,s.call({state:r,interval:0,resolveFetchPromise:t}),e)},subscribe:function(t){var e=r.id++;return a(t,e,!1),{unsub:function(){r.listeners.subscribe=r.listeners.subscribe.filter((function(t){return t.id!==e}))}}},batch:function(){return{subscribe:function(t){var e=r.id++;return a(t,e,!0),{unsub:function(){r.listeners.subscribe=r.listeners.subscribe.filter((function(t){return t.id!==e}))}}}}},onNewBlock:function(t){var e=r.id++;return r.latestBlockNumber&&t(r.latestBlockNumber),r.listeners.block.push({listener:t,id:e}),{unsub:function(){r.listeners.block=r.listeners.block.filter((function(t){return t.id!==e}))}}},onPoll:function(t){var e=r.id++;return r.listeners.poll.push({listener:t,id:e}),{unsub:function(){r.listeners.poll=r.listeners.poll.filter((function(t){return t.id!==e}))}}},onError:function(t){var e=r.id++;return r.listeners.error.push({listener:t,id:e}),{unsub:function(){r.listeners.error=r.listeners.error.filter((function(t){return t.id!==e}))}}},start:function(){return Vt("watcher.start() called"),r.watching=!0,r.ws&&r.ws.readyState!==Gt.OPEN||s.call({state:r,interval:0,resolveFetchPromise:r.initialFetchResolver}),r.initialFetchPromise},stop:function(){Vt("watcher.stop() called"),clearTimeout(r.handler),r.handler=null,clearTimeout(r.wsReconnectHandler),r.wsReconnectHandler=null,r.watching=!1},recreate:function(t,e){if(Vt("watcher.recreate() called"),clearTimeout(r.handler),r.handler=null,clearTimeout(r.wsReconnectHandler),r.wsReconnectHandler=null,r.ws&&o(),r.ws=null,r.config=qt(e),r.model=[].concat(t),r.store={},r.storeTransformed={},r.latestBlockNumber=null,r.cancelPromiseId=r.latestPromiseId,i(),r.watching&&!r.ws){var n,a=new Promise((function(t){n=t}));return s.call({state:r,interval:0,resolveFetchPromise:n}),a}return Promise.resolve()},awaitInitialFetch:function(){return r.initialFetchPromise},get initialFetch(){return r.initialFetchPromise},get schemas(){return r.model}}}export{jt as aggregate,Ht as createWatcher}; +//# sourceMappingURL=multicall.esm.mjs.map diff --git a/dist/multicall.esm.mjs.map b/dist/multicall.esm.mjs.map new file mode 100644 index 0000000..0d7c0d6 --- /dev/null +++ b/dist/multicall.esm.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"multicall.esm.mjs","sources":["../node_modules/ethers/_version.js","../node_modules/ethers/errors.js","../node_modules/ethers/utils/bytes.js","../node_modules/bn.js/lib/bn.js","../node_modules/ethers/utils/properties.js","../node_modules/ethers/utils/bignumber.js","../node_modules/ethers/constants.js","../node_modules/ethers/utils/utf8.js","../node_modules/js-sha3/src/sha3.js","../node_modules/ethers/utils/keccak256.js","../node_modules/ethers/utils/hash.js","../node_modules/invariant/browser.js","../node_modules/cross-fetch/dist/browser-ponyfill.js","../node_modules/ethers/utils/rlp.js","../node_modules/ethers/utils/address.js","../node_modules/ethers/utils/abi-coder.js","../node_modules/ms/index.js","../node_modules/debug/src/common.js","../node_modules/debug/src/browser.js","../src/helpers.js","../node_modules/lodash/_freeGlobal.js","../node_modules/lodash/_root.js","../node_modules/lodash/_Symbol.js","../node_modules/lodash/_getRawTag.js","../node_modules/lodash/_objectToString.js","../node_modules/lodash/_baseGetTag.js","../node_modules/lodash/isObject.js","../node_modules/lodash/isFunction.js","../node_modules/lodash/_isMasked.js","../node_modules/lodash/_coreJsData.js","../node_modules/lodash/_toSource.js","../node_modules/lodash/_baseIsNative.js","../node_modules/lodash/_getValue.js","../node_modules/lodash/_getNative.js","../node_modules/lodash/_nativeCreate.js","../node_modules/lodash/_hashDelete.js","../node_modules/lodash/_hashGet.js","../node_modules/lodash/_hashHas.js","../node_modules/lodash/_hashSet.js","../node_modules/lodash/_Hash.js","../node_modules/lodash/_hashClear.js","../node_modules/lodash/eq.js","../node_modules/lodash/_assocIndexOf.js","../node_modules/lodash/_listCacheDelete.js","../node_modules/lodash/_listCacheGet.js","../node_modules/lodash/_listCacheHas.js","../node_modules/lodash/_listCacheSet.js","../node_modules/lodash/_ListCache.js","../node_modules/lodash/_listCacheClear.js","../node_modules/lodash/_Map.js","../node_modules/lodash/_isKeyable.js","../node_modules/lodash/_getMapData.js","../node_modules/lodash/_mapCacheDelete.js","../node_modules/lodash/_mapCacheGet.js","../node_modules/lodash/_mapCacheHas.js","../node_modules/lodash/_mapCacheSet.js","../node_modules/lodash/_MapCache.js","../node_modules/lodash/_mapCacheClear.js","../node_modules/lodash/memoize.js","../src/aggregate.js","../node_modules/isomorphic-ws/browser.js","../src/watcher.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = \"4.0.27\";\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar _version_1 = require(\"./_version\");\n// Unknown Error\nexports.UNKNOWN_ERROR = 'UNKNOWN_ERROR';\n// Not implemented\nexports.NOT_IMPLEMENTED = 'NOT_IMPLEMENTED';\n// Missing new operator to an object\n// - name: The name of the class\nexports.MISSING_NEW = 'MISSING_NEW';\n// Call exception\n// - transaction: the transaction\n// - address?: the contract address\n// - args?: The arguments passed into the function\n// - method?: The Solidity method signature\n// - errorSignature?: The EIP848 error signature\n// - errorArgs?: The EIP848 error parameters\n// - reason: The reason (only for EIP848 \"Error(string)\")\nexports.CALL_EXCEPTION = 'CALL_EXCEPTION';\n// Invalid argument (e.g. value is incompatible with type) to a function:\n// - argument: The argument name that was invalid\n// - value: The value of the argument\nexports.INVALID_ARGUMENT = 'INVALID_ARGUMENT';\n// Missing argument to a function:\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexports.MISSING_ARGUMENT = 'MISSING_ARGUMENT';\n// Too many arguments\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexports.UNEXPECTED_ARGUMENT = 'UNEXPECTED_ARGUMENT';\n// Numeric Fault\n// - operation: the operation being executed\n// - fault: the reason this faulted\nexports.NUMERIC_FAULT = 'NUMERIC_FAULT';\n// Insufficien funds (< value + gasLimit * gasPrice)\n// - transaction: the transaction attempted\nexports.INSUFFICIENT_FUNDS = 'INSUFFICIENT_FUNDS';\n// Nonce has already been used\n// - transaction: the transaction attempted\nexports.NONCE_EXPIRED = 'NONCE_EXPIRED';\n// The replacement fee for the transaction is too low\n// - transaction: the transaction attempted\nexports.REPLACEMENT_UNDERPRICED = 'REPLACEMENT_UNDERPRICED';\n// Unsupported operation\n// - operation\nexports.UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION';\nvar _permanentCensorErrors = false;\nvar _censorErrors = false;\n// @TODO: Enum\nfunction throwError(message, code, params) {\n if (_censorErrors) {\n throw new Error('unknown error');\n }\n if (!code) {\n code = exports.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n var messageDetails = [];\n Object.keys(params).forEach(function (key) {\n try {\n messageDetails.push(key + '=' + JSON.stringify(params[key]));\n }\n catch (error) {\n messageDetails.push(key + '=' + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(\"version=\" + _version_1.version);\n var reason = message;\n if (messageDetails.length) {\n message += ' (' + messageDetails.join(', ') + ')';\n }\n // @TODO: Any??\n var error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n throw error;\n}\nexports.throwError = throwError;\nfunction checkNew(self, kind) {\n if (!(self instanceof kind)) {\n throwError('missing new', exports.MISSING_NEW, { name: kind.name });\n }\n}\nexports.checkNew = checkNew;\nfunction checkArgumentCount(count, expectedCount, suffix) {\n if (!suffix) {\n suffix = '';\n }\n if (count < expectedCount) {\n throwError('missing argument' + suffix, exports.MISSING_ARGUMENT, { count: count, expectedCount: expectedCount });\n }\n if (count > expectedCount) {\n throwError('too many arguments' + suffix, exports.UNEXPECTED_ARGUMENT, { count: count, expectedCount: expectedCount });\n }\n}\nexports.checkArgumentCount = checkArgumentCount;\nfunction setCensorship(censorship, permanent) {\n if (_permanentCensorErrors) {\n throwError('error censorship permanent', exports.UNSUPPORTED_OPERATION, { operation: 'setCensorship' });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n}\nexports.setCensorship = setCensorship;\nfunction checkNormalize() {\n try {\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach(function (form) {\n try {\n \"test\".normalize(form);\n }\n catch (error) {\n throw new Error('missing ' + form);\n }\n });\n if (String.fromCharCode(0xe9).normalize('NFD') !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error('broken implementation');\n }\n }\n catch (error) {\n throwError('platform missing String.prototype.normalize', exports.UNSUPPORTED_OPERATION, { operation: 'String.prototype.normalize', form: error.message });\n }\n}\nexports.checkNormalize = checkNormalize;\nvar LogLevels = { debug: 1, \"default\": 2, info: 2, warn: 3, error: 4, off: 5 };\nvar LogLevel = LogLevels[\"default\"];\nfunction setLogLevel(logLevel) {\n var level = LogLevels[logLevel];\n if (level == null) {\n warn(\"invliad log level - \" + logLevel);\n return;\n }\n LogLevel = level;\n}\nexports.setLogLevel = setLogLevel;\nfunction log(logLevel, args) {\n if (LogLevel > LogLevels[logLevel]) {\n return;\n }\n console.log.apply(console, args);\n}\nfunction warn() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n log(\"warn\", args);\n}\nexports.warn = warn;\nfunction info() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n log(\"info\", args);\n}\nexports.info = info;\n","\"use strict\";\n/**\n * Conversion Utilities\n *\n */\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = __importStar(require(\"../errors\"));\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nexports.isHexable = isHexable;\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n var args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isArrayish(value) {\n if (!value || parseInt(String(value.length)) != value.length || typeof (value) === 'string') {\n return false;\n }\n for (var i = 0; i < value.length; i++) {\n var v = value[i];\n if (v < 0 || v >= 256 || parseInt(String(v)) != v) {\n return false;\n }\n }\n return true;\n}\nexports.isArrayish = isArrayish;\nfunction arrayify(value) {\n if (value == null) {\n errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (typeof (value) === 'string') {\n var match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n value = value.substring(2);\n if (value.length % 2) {\n value = '0' + value;\n }\n var result = [];\n for (var i = 0; i < value.length; i += 2) {\n result.push(parseInt(value.substr(i, 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isArrayish(value)) {\n return addSlice(new Uint8Array(value));\n }\n errors.throwError('invalid arrayify value', null, { arg: 'value', value: value, type: typeof (value) });\n return null;\n}\nexports.arrayify = arrayify;\nfunction concat(objects) {\n var arrays = [];\n var length = 0;\n for (var i = 0; i < objects.length; i++) {\n var object = arrayify(objects[i]);\n arrays.push(object);\n length += object.length;\n }\n var result = new Uint8Array(length);\n var offset = 0;\n for (var i = 0; i < arrays.length; i++) {\n result.set(arrays[i], offset);\n offset += arrays[i].length;\n }\n return addSlice(result);\n}\nexports.concat = concat;\nfunction stripZeros(value) {\n var result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n var start = 0;\n while (result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nexports.stripZeros = stripZeros;\nfunction padZeros(value, length) {\n value = arrayify(value);\n if (length < value.length) {\n throw new Error('cannot pad');\n }\n var result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nexports.padZeros = padZeros;\nfunction isHexString(value, length) {\n if (typeof (value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nexports.isHexString = isHexString;\nvar HexCharacters = '0123456789abcdef';\nfunction hexlify(value) {\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (typeof (value) === 'number') {\n if (value < 0) {\n errors.throwError('cannot hexlify negative value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n // @TODO: Roll this into the above error as a numeric fault (overflow); next version, not backward compatible\n // We can about (value == MAX_INT) to as well, since that may indicate we underflowed already\n if (value >= 9007199254740991) {\n errors.throwError(\"out-of-range\", errors.NUMERIC_FAULT, {\n operartion: \"hexlify\",\n fault: \"out-of-safe-range\"\n });\n }\n var hex = '';\n while (value) {\n hex = HexCharacters[value & 0x0f] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = '0' + hex;\n }\n return '0x' + hex;\n }\n return '0x00';\n }\n if (typeof (value) === 'string') {\n var match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (value.length % 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n }\n if (isArrayish(value)) {\n var result = [];\n for (var i = 0; i < value.length; i++) {\n var v = value[i];\n result.push(HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]);\n }\n return '0x' + result.join('');\n }\n errors.throwError('invalid hexlify value', null, { arg: 'value', value: value });\n return 'never';\n}\nexports.hexlify = hexlify;\nfunction hexDataLength(data) {\n if (!isHexString(data) || (data.length % 2) !== 0) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nexports.hexDataLength = hexDataLength;\nfunction hexDataSlice(data, offset, endOffset) {\n if (!isHexString(data)) {\n errors.throwError('invalid hex data', errors.INVALID_ARGUMENT, { arg: 'value', value: data });\n }\n if ((data.length % 2) !== 0) {\n errors.throwError('hex data length must be even', errors.INVALID_ARGUMENT, { arg: 'value', value: data });\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return '0x' + data.substring(offset, 2 + 2 * endOffset);\n }\n return '0x' + data.substring(offset);\n}\nexports.hexDataSlice = hexDataSlice;\nfunction hexStripZeros(value) {\n if (!isHexString(value)) {\n errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n while (value.length > 3 && value.substring(0, 3) === '0x0') {\n value = '0x' + value.substring(3);\n }\n return value;\n}\nexports.hexStripZeros = hexStripZeros;\nfunction hexZeroPad(value, length) {\n if (!isHexString(value)) {\n errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n while (value.length < 2 * length + 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n}\nexports.hexZeroPad = hexZeroPad;\nfunction isSignature(value) {\n return (value && value.r != null && value.s != null);\n}\nfunction splitSignature(signature) {\n var v = 0;\n var r = '0x', s = '0x';\n if (isSignature(signature)) {\n if (signature.v == null && signature.recoveryParam == null) {\n errors.throwError('at least on of recoveryParam or v must be specified', errors.INVALID_ARGUMENT, { argument: 'signature', value: signature });\n }\n r = hexZeroPad(signature.r, 32);\n s = hexZeroPad(signature.s, 32);\n v = signature.v;\n if (typeof (v) === 'string') {\n v = parseInt(v, 16);\n }\n var recoveryParam = signature.recoveryParam;\n if (recoveryParam == null && signature.v != null) {\n recoveryParam = 1 - (v % 2);\n }\n v = 27 + recoveryParam;\n }\n else {\n var bytes = arrayify(signature);\n if (bytes.length !== 65) {\n throw new Error('invalid signature');\n }\n r = hexlify(bytes.slice(0, 32));\n s = hexlify(bytes.slice(32, 64));\n v = bytes[64];\n if (v !== 27 && v !== 28) {\n v = 27 + (v % 2);\n }\n }\n return {\n r: r,\n s: s,\n recoveryParam: (v - 27),\n v: v\n };\n}\nexports.splitSignature = splitSignature;\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? '0x1c' : '0x1b')\n ]));\n}\nexports.joinSignature = joinSignature;\n","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n Buffer = require('buffer').Buffer;\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n }\n\n if (base === 16) {\n this._parseHex(number, start);\n } else {\n this._parseBase(number, base, start);\n }\n\n if (number[0] === '-') {\n this.negative = 1;\n }\n\n this.strip();\n\n if (endian !== 'le') return;\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [ number & 0x3ffffff ];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [ 0 ];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n };\n\n function parseHex (str, start, end) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r <<= 4;\n\n // 'a' - 'f'\n if (c >= 49 && c <= 54) {\n r |= c - 49 + 0xa;\n\n // 'A' - 'F'\n } else if (c >= 17 && c <= 22) {\n r |= c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n r |= c & 0xf;\n }\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n // Scan 24-bit chunks and add them to the number\n var off = 0;\n for (i = number.length - 6, j = 0; i >= start; i -= 6) {\n w = parseHex(number, i, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n if (i + 6 !== start) {\n w = parseHex(number, start, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n }\n this.strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n r += c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n r += c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n r += c;\n }\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [ 0 ];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype.strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n BN.prototype.inspect = function inspect () {\n return (this.red ? '';\n };\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16);\n };\n\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n assert(typeof Buffer !== 'undefined');\n return this.toArrayLike(Buffer, endian, length);\n };\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n this.strip();\n var littleEndian = endian === 'le';\n var res = new ArrayType(reqLength);\n\n var b, i;\n var q = this.clone();\n if (!littleEndian) {\n // Assume big-endian\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[i] = b;\n }\n\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n\n return res;\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this.strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this.strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this.strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this.strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this.strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this.strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n function jumboMulTo (self, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this.strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this.strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this.strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q.strip();\n }\n a.strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modn = function modn (num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return acc;\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n return this.strip();\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this.strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n r.strip();\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","'use strict';\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = __importStar(require(\"../errors\"));\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\nexports.defineReadOnly = defineReadOnly;\n// There are some issues with instanceof with npm link, so we use this\n// to ensure types are what we expect.\nfunction setType(object, type) {\n Object.defineProperty(object, '_ethersType', { configurable: false, value: type, writable: false });\n}\nexports.setType = setType;\nfunction isType(object, type) {\n return (object && object._ethersType === type);\n}\nexports.isType = isType;\nfunction resolveProperties(object) {\n var result = {};\n var promises = [];\n Object.keys(object).forEach(function (key) {\n var value = object[key];\n if (value instanceof Promise) {\n promises.push(value.then(function (value) {\n result[key] = value;\n return null;\n }));\n }\n else {\n result[key] = value;\n }\n });\n return Promise.all(promises).then(function () {\n return result;\n });\n}\nexports.resolveProperties = resolveProperties;\nfunction checkProperties(object, properties) {\n if (!object || typeof (object) !== 'object') {\n errors.throwError('invalid object', errors.INVALID_ARGUMENT, {\n argument: 'object',\n value: object\n });\n }\n Object.keys(object).forEach(function (key) {\n if (!properties[key]) {\n errors.throwError('invalid object key - ' + key, errors.INVALID_ARGUMENT, {\n argument: 'transaction',\n value: object,\n key: key\n });\n }\n });\n}\nexports.checkProperties = checkProperties;\nfunction shallowCopy(object) {\n var result = {};\n for (var key in object) {\n result[key] = object[key];\n }\n return result;\n}\nexports.shallowCopy = shallowCopy;\nvar opaque = { boolean: true, number: true, string: true };\nfunction deepCopy(object, frozen) {\n // Opaque objects are not mutable, so safe to copy by assignment\n if (object === undefined || object === null || opaque[typeof (object)]) {\n return object;\n }\n // Arrays are mutable, so we need to create a copy\n if (Array.isArray(object)) {\n var result = object.map(function (item) { return deepCopy(item, frozen); });\n if (frozen) {\n Object.freeze(result);\n }\n return result;\n }\n if (typeof (object) === 'object') {\n // Some internal objects, which are already immutable\n if (isType(object, 'BigNumber')) {\n return object;\n }\n if (isType(object, 'Description')) {\n return object;\n }\n if (isType(object, 'Indexed')) {\n return object;\n }\n var result = {};\n for (var key in object) {\n var value = object[key];\n if (value === undefined) {\n continue;\n }\n defineReadOnly(result, key, deepCopy(value, frozen));\n }\n if (frozen) {\n Object.freeze(result);\n }\n return result;\n }\n // The function type is also immutable, so safe to copy by assignment\n if (typeof (object) === 'function') {\n return object;\n }\n throw new Error('Cannot deepCopy ' + typeof (object));\n}\nexports.deepCopy = deepCopy;\n// See: https://github.com/isaacs/inherits/blob/master/inherits_browser.js\nfunction inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n}\nfunction inheritable(parent) {\n return function (child) {\n inherits(child, parent);\n defineReadOnly(child, 'inherits', inheritable(child));\n };\n}\nexports.inheritable = inheritable;\n","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardles.\n *\n */\nvar bn_js_1 = __importDefault(require(\"bn.js\"));\nvar bytes_1 = require(\"./bytes\");\nvar properties_1 = require(\"./properties\");\nvar errors = __importStar(require(\"../errors\"));\nvar BN_1 = new bn_js_1.default.BN(-1);\nfunction toHex(bn) {\n var value = bn.toString(16);\n if (value[0] === '-') {\n if ((value.length % 2) === 0) {\n return '-0x0' + value.substring(1);\n }\n return \"-0x\" + value.substring(1);\n }\n if ((value.length % 2) === 1) {\n return '0x0' + value;\n }\n return '0x' + value;\n}\nfunction toBN(value) {\n return _bnify(bigNumberify(value));\n}\nfunction toBigNumber(bn) {\n return new BigNumber(toHex(bn));\n}\nfunction _bnify(value) {\n var hex = value._hex;\n if (hex[0] === '-') {\n return (new bn_js_1.default.BN(hex.substring(3), 16)).mul(BN_1);\n }\n return new bn_js_1.default.BN(hex.substring(2), 16);\n}\nvar BigNumber = /** @class */ (function () {\n function BigNumber(value) {\n errors.checkNew(this, BigNumber);\n properties_1.setType(this, 'BigNumber');\n if (typeof (value) === 'string') {\n if (bytes_1.isHexString(value)) {\n if (value == '0x') {\n value = '0x0';\n }\n properties_1.defineReadOnly(this, '_hex', value);\n }\n else if (value[0] === '-' && bytes_1.isHexString(value.substring(1))) {\n properties_1.defineReadOnly(this, '_hex', value);\n }\n else if (value.match(/^-?[0-9]*$/)) {\n if (value == '') {\n value = '0';\n }\n properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));\n }\n else {\n errors.throwError('invalid BigNumber string value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n }\n else if (typeof (value) === 'number') {\n if (parseInt(String(value)) !== value) {\n errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: parseInt(String(value)) });\n }\n try {\n properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));\n }\n catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n }\n else if (value instanceof BigNumber) {\n properties_1.defineReadOnly(this, '_hex', value._hex);\n }\n else if (value.toHexString) {\n properties_1.defineReadOnly(this, '_hex', toHex(toBN(value.toHexString())));\n }\n else if (value._hex && bytes_1.isHexString(value._hex)) {\n properties_1.defineReadOnly(this, '_hex', value._hex);\n }\n else if (bytes_1.isArrayish(value)) {\n properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(bytes_1.hexlify(value).substring(2), 16)));\n }\n else {\n errors.throwError('invalid BigNumber value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n }\n BigNumber.prototype.fromTwos = function (value) {\n return toBigNumber(_bnify(this).fromTwos(value));\n };\n BigNumber.prototype.toTwos = function (value) {\n return toBigNumber(_bnify(this).toTwos(value));\n };\n BigNumber.prototype.abs = function () {\n if (this._hex[0] === '-') {\n return toBigNumber(_bnify(this).mul(BN_1));\n }\n return this;\n };\n BigNumber.prototype.add = function (other) {\n return toBigNumber(_bnify(this).add(toBN(other)));\n };\n BigNumber.prototype.sub = function (other) {\n return toBigNumber(_bnify(this).sub(toBN(other)));\n };\n BigNumber.prototype.div = function (other) {\n var o = bigNumberify(other);\n if (o.isZero()) {\n errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });\n }\n return toBigNumber(_bnify(this).div(toBN(other)));\n };\n BigNumber.prototype.mul = function (other) {\n return toBigNumber(_bnify(this).mul(toBN(other)));\n };\n BigNumber.prototype.mod = function (other) {\n return toBigNumber(_bnify(this).mod(toBN(other)));\n };\n BigNumber.prototype.pow = function (other) {\n return toBigNumber(_bnify(this).pow(toBN(other)));\n };\n BigNumber.prototype.maskn = function (value) {\n return toBigNumber(_bnify(this).maskn(value));\n };\n BigNumber.prototype.eq = function (other) {\n return _bnify(this).eq(toBN(other));\n };\n BigNumber.prototype.lt = function (other) {\n return _bnify(this).lt(toBN(other));\n };\n BigNumber.prototype.lte = function (other) {\n return _bnify(this).lte(toBN(other));\n };\n BigNumber.prototype.gt = function (other) {\n return _bnify(this).gt(toBN(other));\n };\n BigNumber.prototype.gte = function (other) {\n return _bnify(this).gte(toBN(other));\n };\n BigNumber.prototype.isZero = function () {\n return _bnify(this).isZero();\n };\n BigNumber.prototype.toNumber = function () {\n try {\n return _bnify(this).toNumber();\n }\n catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n return null;\n };\n BigNumber.prototype.toString = function () {\n return _bnify(this).toString(10);\n };\n BigNumber.prototype.toHexString = function () {\n return this._hex;\n };\n BigNumber.isBigNumber = function (value) {\n return properties_1.isType(value, 'BigNumber');\n };\n return BigNumber;\n}());\nexports.BigNumber = BigNumber;\nfunction bigNumberify(value) {\n if (BigNumber.isBigNumber(value)) {\n return value;\n }\n return new BigNumber(value);\n}\nexports.bigNumberify = bigNumberify;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bignumber_1 = require(\"./utils/bignumber\");\nvar AddressZero = '0x0000000000000000000000000000000000000000';\nexports.AddressZero = AddressZero;\nvar HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';\nexports.HashZero = HashZero;\n// NFKD (decomposed)\n//const EtherSymbol = '\\uD835\\uDF63';\n// NFKC (composed)\nvar EtherSymbol = '\\u039e';\nexports.EtherSymbol = EtherSymbol;\nvar NegativeOne = bignumber_1.bigNumberify(-1);\nexports.NegativeOne = NegativeOne;\nvar Zero = bignumber_1.bigNumberify(0);\nexports.Zero = Zero;\nvar One = bignumber_1.bigNumberify(1);\nexports.One = One;\nvar Two = bignumber_1.bigNumberify(2);\nexports.Two = Two;\nvar WeiPerEther = bignumber_1.bigNumberify('1000000000000000000');\nexports.WeiPerEther = WeiPerEther;\nvar MaxUint256 = bignumber_1.bigNumberify('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');\nexports.MaxUint256 = MaxUint256;\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar constants_1 = require(\"../constants\");\nvar errors_1 = require(\"../errors\");\nvar bytes_1 = require(\"./bytes\");\n///////////////////////////////\nvar UnicodeNormalizationForm;\n(function (UnicodeNormalizationForm) {\n UnicodeNormalizationForm[\"current\"] = \"\";\n UnicodeNormalizationForm[\"NFC\"] = \"NFC\";\n UnicodeNormalizationForm[\"NFD\"] = \"NFD\";\n UnicodeNormalizationForm[\"NFKC\"] = \"NFKC\";\n UnicodeNormalizationForm[\"NFKD\"] = \"NFKD\";\n})(UnicodeNormalizationForm = exports.UnicodeNormalizationForm || (exports.UnicodeNormalizationForm = {}));\n;\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nfunction toUtf8Bytes(str, form) {\n if (form === void 0) { form = UnicodeNormalizationForm.current; }\n if (form != UnicodeNormalizationForm.current) {\n errors_1.checkNormalize();\n str = str.normalize(form);\n }\n var result = [];\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n var c2 = str.charCodeAt(i);\n if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) {\n throw new Error('invalid utf-8 string');\n }\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((c >> 18) | 0xf0);\n result.push(((c >> 12) & 0x3f) | 0x80);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return bytes_1.arrayify(result);\n}\nexports.toUtf8Bytes = toUtf8Bytes;\n;\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction toUtf8String(bytes, ignoreErrors) {\n bytes = bytes_1.arrayify(bytes);\n var result = '';\n var i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n var c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result += String.fromCharCode(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n var extraLength = null;\n var overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if (!ignoreErrors) {\n if ((c & 0xc0) === 0x80) {\n throw new Error('invalid utf8 byte sequence; unexpected continuation byte');\n }\n throw new Error('invalid utf8 byte sequence; invalid prefix');\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i + extraLength > bytes.length) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; too short');\n }\n // If there is an invalid unprocessed byte, skip continuation bytes\n for (; i < bytes.length; i++) {\n if (bytes[i] >> 6 !== 0x02) {\n break;\n }\n }\n continue;\n }\n // Remove the length prefix from the char\n var res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (var j = 0; j < extraLength; j++) {\n var nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n if (res === null) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; invalid continuation byte');\n }\n continue;\n }\n // Check for overlong seuences (more bytes than needed)\n if (res <= overlongMask) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; overlong');\n }\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; out-of-range');\n }\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; utf-16 surrogate');\n }\n continue;\n }\n if (res <= 0xffff) {\n result += String.fromCharCode(res);\n continue;\n }\n res -= 0x10000;\n result += String.fromCharCode(((res >> 10) & 0x3ff) + 0xd800, (res & 0x3ff) + 0xdc00);\n }\n return result;\n}\nexports.toUtf8String = toUtf8String;\nfunction formatBytes32String(text) {\n // Get the bytes\n var bytes = toUtf8Bytes(text);\n // Check we have room for null-termination\n if (bytes.length > 31) {\n throw new Error('bytes32 string must be less than 32 bytes');\n }\n // Zero-pad (implicitly null-terminates)\n return bytes_1.hexlify(bytes_1.concat([bytes, constants_1.HashZero]).slice(0, 32));\n}\nexports.formatBytes32String = formatBytes32String;\nfunction parseBytes32String(bytes) {\n var data = bytes_1.arrayify(bytes);\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) {\n throw new Error('invalid bytes32 - not 32 bytes long');\n }\n if (data[31] !== 0) {\n throw new Error('invalid bytes32 sdtring - no null terminator');\n }\n // Find the null termination\n var length = 31;\n while (data[length - 1] === 0) {\n length--;\n }\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\nexports.parseBytes32String = parseBytes32String;\n","/**\r\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\r\n *\r\n * @version 0.5.7\r\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\r\n * @copyright Chen, Yi-Cyuan 2015-2016\r\n * @license MIT\r\n */\r\n/*jslint bitwise: true */\r\n(function () {\r\n 'use strict';\r\n\r\n var root = typeof window === 'object' ? window : {};\r\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\r\n if (NODE_JS) {\r\n root = global;\r\n }\r\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module === 'object' && module.exports;\r\n var HEX_CHARS = '0123456789abcdef'.split('');\r\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\r\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\r\n var PADDING = [6, 1536, 393216, 100663296];\r\n var SHIFT = [0, 8, 16, 24];\r\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\r\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\r\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\r\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\r\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\r\n var BITS = [224, 256, 384, 512];\r\n var SHAKE_BITS = [128, 256];\r\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array'];\r\n\r\n var createOutputMethod = function (bits, padding, outputType) {\r\n return function (message) {\r\n return new Keccak(bits, padding, bits).update(message)[outputType]();\r\n };\r\n };\r\n\r\n var createShakeOutputMethod = function (bits, padding, outputType) {\r\n return function (message, outputBits) {\r\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\r\n };\r\n };\r\n\r\n var createMethod = function (bits, padding) {\r\n var method = createOutputMethod(bits, padding, 'hex');\r\n method.create = function () {\r\n return new Keccak(bits, padding, bits);\r\n };\r\n method.update = function (message) {\r\n return method.create().update(message);\r\n };\r\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\r\n var type = OUTPUT_TYPES[i];\r\n method[type] = createOutputMethod(bits, padding, type);\r\n }\r\n return method;\r\n };\r\n\r\n var createShakeMethod = function (bits, padding) {\r\n var method = createShakeOutputMethod(bits, padding, 'hex');\r\n method.create = function (outputBits) {\r\n return new Keccak(bits, padding, outputBits);\r\n };\r\n method.update = function (message, outputBits) {\r\n return method.create(outputBits).update(message);\r\n };\r\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\r\n var type = OUTPUT_TYPES[i];\r\n method[type] = createShakeOutputMethod(bits, padding, type);\r\n }\r\n return method;\r\n };\r\n\r\n var algorithms = [\r\n {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod},\r\n {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod},\r\n {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod}\r\n ];\r\n\r\n var methods = {}, methodNames = [];\r\n\r\n for (var i = 0; i < algorithms.length; ++i) {\r\n var algorithm = algorithms[i];\r\n var bits = algorithm.bits;\r\n for (var j = 0; j < bits.length; ++j) {\r\n var methodName = algorithm.name +'_' + bits[j];\r\n methodNames.push(methodName);\r\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\r\n }\r\n }\r\n\r\n function Keccak(bits, padding, outputBits) {\r\n this.blocks = [];\r\n this.s = [];\r\n this.padding = padding;\r\n this.outputBits = outputBits;\r\n this.reset = true;\r\n this.block = 0;\r\n this.start = 0;\r\n this.blockCount = (1600 - (bits << 1)) >> 5;\r\n this.byteCount = this.blockCount << 2;\r\n this.outputBlocks = outputBits >> 5;\r\n this.extraBytes = (outputBits & 31) >> 3;\r\n\r\n for (var i = 0; i < 50; ++i) {\r\n this.s[i] = 0;\r\n }\r\n }\r\n\r\n Keccak.prototype.update = function (message) {\r\n var notString = typeof message !== 'string';\r\n if (notString && message.constructor === ArrayBuffer) {\r\n message = new Uint8Array(message);\r\n }\r\n var length = message.length, blocks = this.blocks, byteCount = this.byteCount,\r\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\r\n\r\n while (index < length) {\r\n if (this.reset) {\r\n this.reset = false;\r\n blocks[0] = this.block;\r\n for (i = 1; i < blockCount + 1; ++i) {\r\n blocks[i] = 0;\r\n }\r\n }\r\n if (notString) {\r\n for (i = this.start; index < length && i < byteCount; ++index) {\r\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\r\n }\r\n } else {\r\n for (i = this.start; index < length && i < byteCount; ++index) {\r\n code = message.charCodeAt(index);\r\n if (code < 0x80) {\r\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\r\n } else if (code < 0x800) {\r\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n } else if (code < 0xd800 || code >= 0xe000) {\r\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n } else {\r\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\r\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n }\r\n }\r\n }\r\n this.lastByteIndex = i;\r\n if (i >= byteCount) {\r\n this.start = i - byteCount;\r\n this.block = blocks[blockCount];\r\n for (i = 0; i < blockCount; ++i) {\r\n s[i] ^= blocks[i];\r\n }\r\n f(s);\r\n this.reset = true;\r\n } else {\r\n this.start = i;\r\n }\r\n }\r\n return this;\r\n };\r\n\r\n Keccak.prototype.finalize = function () {\r\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\r\n blocks[i >> 2] |= this.padding[i & 3];\r\n if (this.lastByteIndex === this.byteCount) {\r\n blocks[0] = blocks[blockCount];\r\n for (i = 1; i < blockCount + 1; ++i) {\r\n blocks[i] = 0;\r\n }\r\n }\r\n blocks[blockCount - 1] |= 0x80000000;\r\n for (i = 0; i < blockCount; ++i) {\r\n s[i] ^= blocks[i];\r\n }\r\n f(s);\r\n };\r\n\r\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var hex = '', block;\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n block = s[i];\r\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\r\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\r\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\r\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n i = 0;\r\n }\r\n }\r\n if (extraBytes) {\r\n block = s[i];\r\n if (extraBytes > 0) {\r\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\r\n }\r\n if (extraBytes > 1) {\r\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\r\n }\r\n if (extraBytes > 2) {\r\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\r\n }\r\n }\r\n return hex;\r\n };\r\n\r\n Keccak.prototype.arrayBuffer = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var bytes = this.outputBits >> 3;\r\n var buffer;\r\n if (extraBytes) {\r\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\r\n } else {\r\n buffer = new ArrayBuffer(bytes);\r\n }\r\n var array = new Uint32Array(buffer);\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n array[j] = s[i];\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n }\r\n }\r\n if (extraBytes) {\r\n array[i] = s[i];\r\n buffer = buffer.slice(0, bytes);\r\n }\r\n return buffer;\r\n };\r\n\r\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\r\n\r\n Keccak.prototype.digest = Keccak.prototype.array = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var array = [], offset, block;\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n offset = j << 2;\r\n block = s[i];\r\n array[offset] = block & 0xFF;\r\n array[offset + 1] = (block >> 8) & 0xFF;\r\n array[offset + 2] = (block >> 16) & 0xFF;\r\n array[offset + 3] = (block >> 24) & 0xFF;\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n }\r\n }\r\n if (extraBytes) {\r\n offset = j << 2;\r\n block = s[i];\r\n if (extraBytes > 0) {\r\n array[offset] = block & 0xFF;\r\n }\r\n if (extraBytes > 1) {\r\n array[offset + 1] = (block >> 8) & 0xFF;\r\n }\r\n if (extraBytes > 2) {\r\n array[offset + 2] = (block >> 16) & 0xFF;\r\n }\r\n }\r\n return array;\r\n };\r\n\r\n var f = function (s) {\r\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\r\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\r\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\r\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\r\n for (n = 0; n < 48; n += 2) {\r\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\r\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\r\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\r\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\r\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\r\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\r\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\r\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\r\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\r\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\r\n\r\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\r\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\r\n s[0] ^= h;\r\n s[1] ^= l;\r\n s[10] ^= h;\r\n s[11] ^= l;\r\n s[20] ^= h;\r\n s[21] ^= l;\r\n s[30] ^= h;\r\n s[31] ^= l;\r\n s[40] ^= h;\r\n s[41] ^= l;\r\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\r\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\r\n s[2] ^= h;\r\n s[3] ^= l;\r\n s[12] ^= h;\r\n s[13] ^= l;\r\n s[22] ^= h;\r\n s[23] ^= l;\r\n s[32] ^= h;\r\n s[33] ^= l;\r\n s[42] ^= h;\r\n s[43] ^= l;\r\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\r\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\r\n s[4] ^= h;\r\n s[5] ^= l;\r\n s[14] ^= h;\r\n s[15] ^= l;\r\n s[24] ^= h;\r\n s[25] ^= l;\r\n s[34] ^= h;\r\n s[35] ^= l;\r\n s[44] ^= h;\r\n s[45] ^= l;\r\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\r\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\r\n s[6] ^= h;\r\n s[7] ^= l;\r\n s[16] ^= h;\r\n s[17] ^= l;\r\n s[26] ^= h;\r\n s[27] ^= l;\r\n s[36] ^= h;\r\n s[37] ^= l;\r\n s[46] ^= h;\r\n s[47] ^= l;\r\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\r\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\r\n s[8] ^= h;\r\n s[9] ^= l;\r\n s[18] ^= h;\r\n s[19] ^= l;\r\n s[28] ^= h;\r\n s[29] ^= l;\r\n s[38] ^= h;\r\n s[39] ^= l;\r\n s[48] ^= h;\r\n s[49] ^= l;\r\n\r\n b0 = s[0];\r\n b1 = s[1];\r\n b32 = (s[11] << 4) | (s[10] >>> 28);\r\n b33 = (s[10] << 4) | (s[11] >>> 28);\r\n b14 = (s[20] << 3) | (s[21] >>> 29);\r\n b15 = (s[21] << 3) | (s[20] >>> 29);\r\n b46 = (s[31] << 9) | (s[30] >>> 23);\r\n b47 = (s[30] << 9) | (s[31] >>> 23);\r\n b28 = (s[40] << 18) | (s[41] >>> 14);\r\n b29 = (s[41] << 18) | (s[40] >>> 14);\r\n b20 = (s[2] << 1) | (s[3] >>> 31);\r\n b21 = (s[3] << 1) | (s[2] >>> 31);\r\n b2 = (s[13] << 12) | (s[12] >>> 20);\r\n b3 = (s[12] << 12) | (s[13] >>> 20);\r\n b34 = (s[22] << 10) | (s[23] >>> 22);\r\n b35 = (s[23] << 10) | (s[22] >>> 22);\r\n b16 = (s[33] << 13) | (s[32] >>> 19);\r\n b17 = (s[32] << 13) | (s[33] >>> 19);\r\n b48 = (s[42] << 2) | (s[43] >>> 30);\r\n b49 = (s[43] << 2) | (s[42] >>> 30);\r\n b40 = (s[5] << 30) | (s[4] >>> 2);\r\n b41 = (s[4] << 30) | (s[5] >>> 2);\r\n b22 = (s[14] << 6) | (s[15] >>> 26);\r\n b23 = (s[15] << 6) | (s[14] >>> 26);\r\n b4 = (s[25] << 11) | (s[24] >>> 21);\r\n b5 = (s[24] << 11) | (s[25] >>> 21);\r\n b36 = (s[34] << 15) | (s[35] >>> 17);\r\n b37 = (s[35] << 15) | (s[34] >>> 17);\r\n b18 = (s[45] << 29) | (s[44] >>> 3);\r\n b19 = (s[44] << 29) | (s[45] >>> 3);\r\n b10 = (s[6] << 28) | (s[7] >>> 4);\r\n b11 = (s[7] << 28) | (s[6] >>> 4);\r\n b42 = (s[17] << 23) | (s[16] >>> 9);\r\n b43 = (s[16] << 23) | (s[17] >>> 9);\r\n b24 = (s[26] << 25) | (s[27] >>> 7);\r\n b25 = (s[27] << 25) | (s[26] >>> 7);\r\n b6 = (s[36] << 21) | (s[37] >>> 11);\r\n b7 = (s[37] << 21) | (s[36] >>> 11);\r\n b38 = (s[47] << 24) | (s[46] >>> 8);\r\n b39 = (s[46] << 24) | (s[47] >>> 8);\r\n b30 = (s[8] << 27) | (s[9] >>> 5);\r\n b31 = (s[9] << 27) | (s[8] >>> 5);\r\n b12 = (s[18] << 20) | (s[19] >>> 12);\r\n b13 = (s[19] << 20) | (s[18] >>> 12);\r\n b44 = (s[29] << 7) | (s[28] >>> 25);\r\n b45 = (s[28] << 7) | (s[29] >>> 25);\r\n b26 = (s[38] << 8) | (s[39] >>> 24);\r\n b27 = (s[39] << 8) | (s[38] >>> 24);\r\n b8 = (s[48] << 14) | (s[49] >>> 18);\r\n b9 = (s[49] << 14) | (s[48] >>> 18);\r\n\r\n s[0] = b0 ^ (~b2 & b4);\r\n s[1] = b1 ^ (~b3 & b5);\r\n s[10] = b10 ^ (~b12 & b14);\r\n s[11] = b11 ^ (~b13 & b15);\r\n s[20] = b20 ^ (~b22 & b24);\r\n s[21] = b21 ^ (~b23 & b25);\r\n s[30] = b30 ^ (~b32 & b34);\r\n s[31] = b31 ^ (~b33 & b35);\r\n s[40] = b40 ^ (~b42 & b44);\r\n s[41] = b41 ^ (~b43 & b45);\r\n s[2] = b2 ^ (~b4 & b6);\r\n s[3] = b3 ^ (~b5 & b7);\r\n s[12] = b12 ^ (~b14 & b16);\r\n s[13] = b13 ^ (~b15 & b17);\r\n s[22] = b22 ^ (~b24 & b26);\r\n s[23] = b23 ^ (~b25 & b27);\r\n s[32] = b32 ^ (~b34 & b36);\r\n s[33] = b33 ^ (~b35 & b37);\r\n s[42] = b42 ^ (~b44 & b46);\r\n s[43] = b43 ^ (~b45 & b47);\r\n s[4] = b4 ^ (~b6 & b8);\r\n s[5] = b5 ^ (~b7 & b9);\r\n s[14] = b14 ^ (~b16 & b18);\r\n s[15] = b15 ^ (~b17 & b19);\r\n s[24] = b24 ^ (~b26 & b28);\r\n s[25] = b25 ^ (~b27 & b29);\r\n s[34] = b34 ^ (~b36 & b38);\r\n s[35] = b35 ^ (~b37 & b39);\r\n s[44] = b44 ^ (~b46 & b48);\r\n s[45] = b45 ^ (~b47 & b49);\r\n s[6] = b6 ^ (~b8 & b0);\r\n s[7] = b7 ^ (~b9 & b1);\r\n s[16] = b16 ^ (~b18 & b10);\r\n s[17] = b17 ^ (~b19 & b11);\r\n s[26] = b26 ^ (~b28 & b20);\r\n s[27] = b27 ^ (~b29 & b21);\r\n s[36] = b36 ^ (~b38 & b30);\r\n s[37] = b37 ^ (~b39 & b31);\r\n s[46] = b46 ^ (~b48 & b40);\r\n s[47] = b47 ^ (~b49 & b41);\r\n s[8] = b8 ^ (~b0 & b2);\r\n s[9] = b9 ^ (~b1 & b3);\r\n s[18] = b18 ^ (~b10 & b12);\r\n s[19] = b19 ^ (~b11 & b13);\r\n s[28] = b28 ^ (~b20 & b22);\r\n s[29] = b29 ^ (~b21 & b23);\r\n s[38] = b38 ^ (~b30 & b32);\r\n s[39] = b39 ^ (~b31 & b33);\r\n s[48] = b48 ^ (~b40 & b42);\r\n s[49] = b49 ^ (~b41 & b43);\r\n\r\n s[0] ^= RC[n];\r\n s[1] ^= RC[n + 1];\r\n }\r\n };\r\n\r\n if (COMMON_JS) {\r\n module.exports = methods;\r\n } else {\r\n for (var i = 0; i < methodNames.length; ++i) {\r\n root[methodNames[i]] = methods[methodNames[i]];\r\n }\r\n }\r\n})();\r\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar sha3 = require(\"js-sha3\");\nvar bytes_1 = require(\"./bytes\");\nfunction keccak256(data) {\n return '0x' + sha3.keccak_256(bytes_1.arrayify(data));\n}\nexports.keccak256 = keccak256;\n","'use strict';\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = __importStar(require(\"../errors\"));\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar keccak256_1 = require(\"./keccak256\");\n///////////////////////////////\nvar Zeros = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\nvar Partition = new RegExp(\"^((.*)\\\\.)?([^.]+)$\");\nvar UseSTD3ASCIIRules = new RegExp(\"^[a-z0-9.-]*$\");\nfunction namehash(name) {\n if (typeof (name) !== 'string') {\n errors.throwError('invalid address - ' + String(name), errors.INVALID_ARGUMENT, {\n argument: 'name',\n value: name\n });\n }\n name = name.toLowerCase();\n // Supporting the full UTF-8 space requires additional (and large)\n // libraries, so for now we simply do not support them.\n // It should be fairly easy in the future to support systems with\n // String.normalize, but that is future work.\n if (!name.match(UseSTD3ASCIIRules)) {\n errors.throwError('contains invalid UseSTD3ASCIIRules characters', errors.INVALID_ARGUMENT, {\n argument: 'name',\n value: name\n });\n }\n var result = Zeros;\n while (name.length) {\n var partition = name.match(Partition);\n var label = utf8_1.toUtf8Bytes(partition[3]);\n result = keccak256_1.keccak256(bytes_1.concat([result, keccak256_1.keccak256(label)]));\n name = partition[2] || '';\n }\n return bytes_1.hexlify(result);\n}\nexports.namehash = namehash;\nfunction id(text) {\n return keccak256_1.keccak256(utf8_1.toUtf8Bytes(text));\n}\nexports.id = id;\nfunction hashMessage(message) {\n return keccak256_1.keccak256(bytes_1.concat([\n utf8_1.toUtf8Bytes('\\x19Ethereum Signed Message:\\n'),\n utf8_1.toUtf8Bytes(String(message.length)),\n ((typeof (message) === 'string') ? utf8_1.toUtf8Bytes(message) : message)\n ]));\n}\nexports.hashMessage = hashMessage;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","var __self__ = (function (root) {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = root.DOMException\n}\nF.prototype = root;\nreturn new F();\n})(typeof self !== 'undefined' ? self : this);\n(function(self) {\n\nvar irrelevant = (function (exports) {\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n return exports;\n\n}({}));\n})(__self__);\ndelete __self__.fetch.polyfill\nexports = __self__.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = __self__.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = __self__.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = __self__.Headers\nexports.Request = __self__.Request\nexports.Response = __self__.Response\nmodule.exports = exports\n","\"use strict\";\n//See: https://github.com/ethereum/wiki/wiki/RLP\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"./bytes\");\nfunction arrayifyInteger(value) {\n var result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n var result = 0;\n for (var i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n var payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n var length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n var data = Array.prototype.slice.call(bytes_1.arrayify(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n var length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nfunction encode(object) {\n return bytes_1.hexlify(_encode(object));\n}\nexports.encode = encode;\nfunction _decodeChildren(data, offset, childOffset, length) {\n var result = [];\n while (childOffset < offset + 1 + length) {\n var decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n throw new Error('invalid rlp');\n }\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n throw new Error('invalid rlp data');\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n var lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n throw new Error('too short');\n }\n var length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n throw new Error('to short');\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n var length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n throw new Error('invalid rlp data');\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n var lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n throw new Error('invalid rlp data');\n }\n var length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n throw new Error('invalid rlp data');\n }\n var result = bytes_1.hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n var length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n throw new Error('invlaid rlp data');\n }\n var result = bytes_1.hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: bytes_1.hexlify(data[offset]) };\n}\nfunction decode(data) {\n var bytes = bytes_1.arrayify(data);\n var decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n throw new Error('invalid rlp data');\n }\n return decoded.result;\n}\nexports.decode = decode;\n","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use this for base 36 maths\nvar bn_js_1 = __importDefault(require(\"bn.js\"));\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar rlp_1 = require(\"./rlp\");\nvar errors = require(\"../errors\");\n///////////////////////////////\nfunction getChecksumAddress(address) {\n if (typeof (address) !== 'string' || !address.match(/^0x[0-9A-Fa-f]{40}$/)) {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n address = address.toLowerCase();\n var chars = address.substring(2).split('');\n var hashed = new Uint8Array(40);\n for (var i_1 = 0; i_1 < 40; i_1++) {\n hashed[i_1] = chars[i_1].charCodeAt(0);\n }\n hashed = bytes_1.arrayify(keccak256_1.keccak256(hashed));\n for (var i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return '0x' + chars.join('');\n}\n// Shims for environments that are missing some required constants and functions\nvar MAX_SAFE_INTEGER = 0x1fffffffffffff;\nfunction log10(x) {\n if (Math.log10) {\n return Math.log10(x);\n }\n return Math.log(x) / Math.LN10;\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nvar ibanLookup = {};\nfor (var i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (var i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\nvar safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + '00';\n var expanded = '';\n address.split('').forEach(function (c) {\n expanded += ibanLookup[c];\n });\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n var block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n var checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = '0' + checksum;\n }\n return checksum;\n}\n;\nfunction getAddress(address) {\n var result = null;\n if (typeof (address) !== 'string') {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (address.substring(0, 2) !== '0x') {\n address = '0x' + address;\n }\n result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {\n errors.throwError('bad address checksum', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n // Maybe ICAP? (we only support direct mode)\n }\n else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n if (address.substring(2, 4) !== ibanChecksum(address)) {\n errors.throwError('bad icap checksum', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n result = (new bn_js_1.default.BN(address.substring(4), 36)).toString(16);\n while (result.length < 40) {\n result = '0' + result;\n }\n result = getChecksumAddress('0x' + result);\n }\n else {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n return result;\n}\nexports.getAddress = getAddress;\nfunction getIcapAddress(address) {\n var base36 = (new bn_js_1.default.BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();\n while (base36.length < 30) {\n base36 = '0' + base36;\n }\n return 'XE' + ibanChecksum('XE00' + base36) + base36;\n}\nexports.getIcapAddress = getIcapAddress;\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\nfunction getContractAddress(transaction) {\n if (!transaction.from) {\n throw new Error('missing from address');\n }\n var nonce = transaction.nonce;\n return getAddress('0x' + keccak256_1.keccak256(rlp_1.encode([\n getAddress(transaction.from),\n bytes_1.stripZeros(bytes_1.hexlify(nonce))\n ])).substring(26));\n}\nexports.getContractAddress = getContractAddress;\n","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\nvar constants_1 = require(\"../constants\");\nvar errors = __importStar(require(\"../errors\"));\nvar address_1 = require(\"./address\");\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar properties_1 = require(\"./properties\");\n///////////////////////////////\nvar paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nvar paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nvar paramTypeArray = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\nexports.defaultCoerceFunc = function (type, value) {\n var match = type.match(paramTypeNumber);\n if (match && parseInt(match[2]) <= 48) {\n return value.toNumber();\n }\n return value;\n};\n///////////////////////////////////\n// Parsing for Solidity Signatures\nvar regexParen = new RegExp(\"^([^)(]*)\\\\((.*)\\\\)([^)(]*)$\");\nvar regexIdentifier = new RegExp(\"^[A-Za-z_][A-Za-z0-9_]*$\");\nfunction verifyType(type) {\n // These need to be transformed to their full description\n if (type.match(/^uint($|[^1-9])/)) {\n type = 'uint256' + type.substring(4);\n }\n else if (type.match(/^int($|[^1-9])/)) {\n type = 'int256' + type.substring(3);\n }\n return type;\n}\nfunction parseParam(param, allowIndexed) {\n var originalParam = param;\n function throwError(i) {\n throw new Error('unexpected character \"' + originalParam[i] + '\" at position ' + i + ' in \"' + originalParam + '\"');\n }\n param = param.replace(/\\s/g, ' ');\n var parent = { type: '', name: '', state: { allowType: true } };\n var node = parent;\n for (var i = 0; i < param.length; i++) {\n var c = param[i];\n switch (c) {\n case '(':\n if (!node.state.allowParams) {\n throwError(i);\n }\n node.state.allowType = false;\n node.type = verifyType(node.type);\n node.components = [{ type: '', name: '', parent: node, state: { allowType: true } }];\n node = node.components[0];\n break;\n case ')':\n delete node.state;\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n node.type = verifyType(node.type);\n var child = node;\n node = node.parent;\n if (!node) {\n throwError(i);\n }\n delete child.parent;\n node.state.allowParams = false;\n node.state.allowName = true;\n node.state.allowArray = true;\n break;\n case ',':\n delete node.state;\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n node.type = verifyType(node.type);\n var sibling = { type: '', name: '', parent: node.parent, state: { allowType: true } };\n node.parent.components.push(sibling);\n delete node.parent;\n node = sibling;\n break;\n // Hit a space...\n case ' ':\n // If reading type, the type is done and may read a param or name\n if (node.state.allowType) {\n if (node.type !== '') {\n node.type = verifyType(node.type);\n delete node.state.allowType;\n node.state.allowName = true;\n node.state.allowParams = true;\n }\n }\n // If reading name, the name is done\n if (node.state.allowName) {\n if (node.name !== '') {\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n else {\n node.state.allowName = false;\n }\n }\n }\n break;\n case '[':\n if (!node.state.allowArray) {\n throwError(i);\n }\n node.type += c;\n node.state.allowArray = false;\n node.state.allowName = false;\n node.state.readArray = true;\n break;\n case ']':\n if (!node.state.readArray) {\n throwError(i);\n }\n node.type += c;\n node.state.readArray = false;\n node.state.allowArray = true;\n node.state.allowName = true;\n break;\n default:\n if (node.state.allowType) {\n node.type += c;\n node.state.allowParams = true;\n node.state.allowArray = true;\n }\n else if (node.state.allowName) {\n node.name += c;\n delete node.state.allowArray;\n }\n else if (node.state.readArray) {\n node.type += c;\n }\n else {\n throwError(i);\n }\n }\n }\n if (node.parent) {\n throw new Error(\"unexpected eof\");\n }\n delete parent.state;\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n parent.type = verifyType(parent.type);\n return parent;\n}\n// @TODO: Better return type\nfunction parseSignatureEvent(fragment) {\n var abi = {\n anonymous: false,\n inputs: [],\n name: '',\n type: 'event'\n };\n var match = fragment.match(regexParen);\n if (!match) {\n throw new Error('invalid event: ' + fragment);\n }\n abi.name = match[1].trim();\n splitNesting(match[2]).forEach(function (param) {\n param = parseParam(param, true);\n param.indexed = !!param.indexed;\n abi.inputs.push(param);\n });\n match[3].split(' ').forEach(function (modifier) {\n switch (modifier) {\n case 'anonymous':\n abi.anonymous = true;\n break;\n case '':\n break;\n default:\n errors.info('unknown modifier: ' + modifier);\n }\n });\n if (abi.name && !abi.name.match(regexIdentifier)) {\n throw new Error('invalid identifier: \"' + abi.name + '\"');\n }\n return abi;\n}\nfunction parseSignatureFunction(fragment) {\n var abi = {\n constant: false,\n gas: null,\n inputs: [],\n name: '',\n outputs: [],\n payable: false,\n stateMutability: null,\n type: 'function'\n };\n var comps = fragment.split('@');\n if (comps.length !== 1) {\n if (comps.length > 2) {\n throw new Error('invalid signature');\n }\n if (!comps[1].match(/^[0-9]+$/)) {\n throw new Error('invalid signature gas');\n }\n abi.gas = bignumber_1.bigNumberify(comps[1]);\n fragment = comps[0];\n }\n comps = fragment.split(' returns ');\n var left = comps[0].match(regexParen);\n if (!left) {\n throw new Error('invalid signature');\n }\n abi.name = left[1].trim();\n if (!abi.name.match(regexIdentifier)) {\n throw new Error('invalid identifier: \"' + left[1] + '\"');\n }\n splitNesting(left[2]).forEach(function (param) {\n abi.inputs.push(parseParam(param));\n });\n left[3].split(' ').forEach(function (modifier) {\n switch (modifier) {\n case 'constant':\n abi.constant = true;\n break;\n case 'payable':\n abi.payable = true;\n abi.stateMutability = 'payable';\n break;\n case 'pure':\n abi.constant = true;\n abi.stateMutability = 'pure';\n break;\n case 'view':\n abi.constant = true;\n abi.stateMutability = 'view';\n break;\n case 'external':\n case 'public':\n case '':\n break;\n default:\n errors.info('unknown modifier: ' + modifier);\n }\n });\n // We have outputs\n if (comps.length > 1) {\n var right = comps[1].match(regexParen);\n if (right[1].trim() != '' || right[3].trim() != '') {\n throw new Error('unexpected tokens');\n }\n splitNesting(right[2]).forEach(function (param) {\n abi.outputs.push(parseParam(param));\n });\n }\n if (abi.name === 'constructor') {\n abi.type = \"constructor\";\n if (abi.outputs.length) {\n throw new Error('constructor may not have outputs');\n }\n delete abi.name;\n delete abi.outputs;\n }\n return abi;\n}\nfunction parseParamType(type) {\n return parseParam(type, true);\n}\nexports.parseParamType = parseParamType;\n// @TODO: Allow a second boolean to expose names\nfunction formatParamType(paramType) {\n return getParamCoder(exports.defaultCoerceFunc, paramType).type;\n}\nexports.formatParamType = formatParamType;\n// @TODO: Allow a second boolean to expose names and modifiers\nfunction formatSignature(fragment) {\n return fragment.name + '(' + fragment.inputs.map(function (i) { return formatParamType(i); }).join(',') + ')';\n}\nexports.formatSignature = formatSignature;\nfunction parseSignature(fragment) {\n if (typeof (fragment) === 'string') {\n // Make sure the \"returns\" is surrounded by a space and all whitespace is exactly one space\n fragment = fragment.replace(/\\s/g, ' ');\n fragment = fragment.replace(/\\(/g, ' (').replace(/\\)/g, ') ').replace(/\\s+/g, ' ');\n fragment = fragment.trim();\n if (fragment.substring(0, 6) === 'event ') {\n return parseSignatureEvent(fragment.substring(6).trim());\n }\n else {\n if (fragment.substring(0, 9) === 'function ') {\n fragment = fragment.substring(9);\n }\n return parseSignatureFunction(fragment.trim());\n }\n }\n throw new Error('unknown signature');\n}\nexports.parseSignature = parseSignature;\nvar Coder = /** @class */ (function () {\n function Coder(coerceFunc, name, type, localName, dynamic) {\n this.coerceFunc = coerceFunc;\n this.name = name;\n this.type = type;\n this.localName = localName;\n this.dynamic = dynamic;\n }\n return Coder;\n}());\n// Clones the functionality of an existing Coder, but without a localName\nvar CoderAnonymous = /** @class */ (function (_super) {\n __extends(CoderAnonymous, _super);\n function CoderAnonymous(coder) {\n var _this = _super.call(this, coder.coerceFunc, coder.name, coder.type, undefined, coder.dynamic) || this;\n properties_1.defineReadOnly(_this, 'coder', coder);\n return _this;\n }\n CoderAnonymous.prototype.encode = function (value) { return this.coder.encode(value); };\n CoderAnonymous.prototype.decode = function (data, offset) { return this.coder.decode(data, offset); };\n return CoderAnonymous;\n}(Coder));\nvar CoderNull = /** @class */ (function (_super) {\n __extends(CoderNull, _super);\n function CoderNull(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'null', '', localName, false) || this;\n }\n CoderNull.prototype.encode = function (value) {\n return bytes_1.arrayify([]);\n };\n CoderNull.prototype.decode = function (data, offset) {\n if (offset > data.length) {\n throw new Error('invalid null');\n }\n return {\n consumed: 0,\n value: this.coerceFunc('null', undefined)\n };\n };\n return CoderNull;\n}(Coder));\nvar CoderNumber = /** @class */ (function (_super) {\n __extends(CoderNumber, _super);\n function CoderNumber(coerceFunc, size, signed, localName) {\n var _this = this;\n var name = ((signed ? 'int' : 'uint') + (size * 8));\n _this = _super.call(this, coerceFunc, name, name, localName, false) || this;\n _this.size = size;\n _this.signed = signed;\n return _this;\n }\n CoderNumber.prototype.encode = function (value) {\n try {\n var v = bignumber_1.bigNumberify(value);\n if (this.signed) {\n var bounds = constants_1.MaxUint256.maskn(this.size * 8 - 1);\n if (v.gt(bounds)) {\n throw new Error('out-of-bounds');\n }\n bounds = bounds.add(constants_1.One).mul(constants_1.NegativeOne);\n if (v.lt(bounds)) {\n throw new Error('out-of-bounds');\n }\n }\n else if (v.lt(constants_1.Zero) || v.gt(constants_1.MaxUint256.maskn(this.size * 8))) {\n throw new Error('out-of-bounds');\n }\n v = v.toTwos(this.size * 8).maskn(this.size * 8);\n if (this.signed) {\n v = v.fromTwos(this.size * 8).toTwos(256);\n }\n return bytes_1.padZeros(bytes_1.arrayify(v), 32);\n }\n catch (error) {\n errors.throwError('invalid number value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: value\n });\n }\n return null;\n };\n CoderNumber.prototype.decode = function (data, offset) {\n if (data.length < offset + 32) {\n errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n var junkLength = 32 - this.size;\n var value = bignumber_1.bigNumberify(data.slice(offset + junkLength, offset + 32));\n if (this.signed) {\n value = value.fromTwos(this.size * 8);\n }\n else {\n value = value.maskn(this.size * 8);\n }\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, value),\n };\n };\n return CoderNumber;\n}(Coder));\nvar uint256Coder = new CoderNumber(function (type, value) { return value; }, 32, false, 'none');\nvar CoderBoolean = /** @class */ (function (_super) {\n __extends(CoderBoolean, _super);\n function CoderBoolean(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'bool', 'bool', localName, false) || this;\n }\n CoderBoolean.prototype.encode = function (value) {\n return uint256Coder.encode(!!value ? 1 : 0);\n };\n CoderBoolean.prototype.decode = function (data, offset) {\n try {\n var result = uint256Coder.decode(data, offset);\n }\n catch (error) {\n if (error.reason === 'insufficient data for uint256 type') {\n errors.throwError('insufficient data for boolean type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'boolean',\n value: error.value\n });\n }\n throw error;\n }\n return {\n consumed: result.consumed,\n value: this.coerceFunc('bool', !result.value.isZero())\n };\n };\n return CoderBoolean;\n}(Coder));\nvar CoderFixedBytes = /** @class */ (function (_super) {\n __extends(CoderFixedBytes, _super);\n function CoderFixedBytes(coerceFunc, length, localName) {\n var _this = this;\n var name = ('bytes' + length);\n _this = _super.call(this, coerceFunc, name, name, localName, false) || this;\n _this.length = length;\n return _this;\n }\n CoderFixedBytes.prototype.encode = function (value) {\n var result = new Uint8Array(32);\n try {\n var data = bytes_1.arrayify(value);\n if (data.length !== this.length) {\n throw new Error('incorrect data length');\n }\n result.set(data);\n }\n catch (error) {\n errors.throwError('invalid ' + this.name + ' value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: (error.value || value)\n });\n }\n return result;\n };\n CoderFixedBytes.prototype.decode = function (data, offset) {\n if (data.length < offset + 32) {\n errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, bytes_1.hexlify(data.slice(offset, offset + this.length)))\n };\n };\n return CoderFixedBytes;\n}(Coder));\nvar CoderAddress = /** @class */ (function (_super) {\n __extends(CoderAddress, _super);\n function CoderAddress(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'address', 'address', localName, false) || this;\n }\n CoderAddress.prototype.encode = function (value) {\n var result = new Uint8Array(32);\n try {\n result.set(bytes_1.arrayify(address_1.getAddress(value)), 12);\n }\n catch (error) {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'address',\n value: value\n });\n }\n return result;\n };\n CoderAddress.prototype.decode = function (data, offset) {\n if (data.length < offset + 32) {\n errors.throwError('insufficuent data for address type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'address',\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n return {\n consumed: 32,\n value: this.coerceFunc('address', address_1.getAddress(bytes_1.hexlify(data.slice(offset + 12, offset + 32))))\n };\n };\n return CoderAddress;\n}(Coder));\nfunction _encodeDynamicBytes(value) {\n var dataLength = 32 * Math.ceil(value.length / 32);\n var padding = new Uint8Array(dataLength - value.length);\n return bytes_1.concat([\n uint256Coder.encode(value.length),\n value,\n padding\n ]);\n}\nfunction _decodeDynamicBytes(data, offset, localName) {\n if (data.length < offset + 32) {\n errors.throwError('insufficient data for dynamicBytes length', errors.INVALID_ARGUMENT, {\n arg: localName,\n coderType: 'dynamicBytes',\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n var length = uint256Coder.decode(data, offset).value;\n try {\n length = length.toNumber();\n }\n catch (error) {\n errors.throwError('dynamic bytes count too large', errors.INVALID_ARGUMENT, {\n arg: localName,\n coderType: 'dynamicBytes',\n value: length.toString()\n });\n }\n if (data.length < offset + 32 + length) {\n errors.throwError('insufficient data for dynamicBytes type', errors.INVALID_ARGUMENT, {\n arg: localName,\n coderType: 'dynamicBytes',\n value: bytes_1.hexlify(data.slice(offset, offset + 32 + length))\n });\n }\n return {\n consumed: 32 + 32 * Math.ceil(length / 32),\n value: data.slice(offset + 32, offset + 32 + length),\n };\n}\nvar CoderDynamicBytes = /** @class */ (function (_super) {\n __extends(CoderDynamicBytes, _super);\n function CoderDynamicBytes(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'bytes', 'bytes', localName, true) || this;\n }\n CoderDynamicBytes.prototype.encode = function (value) {\n try {\n return _encodeDynamicBytes(bytes_1.arrayify(value));\n }\n catch (error) {\n errors.throwError('invalid bytes value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'bytes',\n value: error.value\n });\n }\n return null;\n };\n CoderDynamicBytes.prototype.decode = function (data, offset) {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('bytes', bytes_1.hexlify(result.value));\n return result;\n };\n return CoderDynamicBytes;\n}(Coder));\nvar CoderString = /** @class */ (function (_super) {\n __extends(CoderString, _super);\n function CoderString(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'string', 'string', localName, true) || this;\n }\n CoderString.prototype.encode = function (value) {\n if (typeof (value) !== 'string') {\n errors.throwError('invalid string value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'string',\n value: value\n });\n }\n return _encodeDynamicBytes(utf8_1.toUtf8Bytes(value));\n };\n CoderString.prototype.decode = function (data, offset) {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('string', utf8_1.toUtf8String(result.value));\n return result;\n };\n return CoderString;\n}(Coder));\nfunction alignSize(size) {\n return 32 * Math.ceil(size / 32);\n}\nfunction pack(coders, values) {\n if (Array.isArray(values)) {\n // do nothing\n }\n else if (values && typeof (values) === 'object') {\n var arrayValues = [];\n coders.forEach(function (coder) {\n arrayValues.push(values[coder.localName]);\n });\n values = arrayValues;\n }\n else {\n errors.throwError('invalid tuple value', errors.INVALID_ARGUMENT, {\n coderType: 'tuple',\n value: values\n });\n }\n if (coders.length !== values.length) {\n errors.throwError('types/value length mismatch', errors.INVALID_ARGUMENT, {\n coderType: 'tuple',\n value: values\n });\n }\n var parts = [];\n coders.forEach(function (coder, index) {\n parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });\n });\n var staticSize = 0, dynamicSize = 0;\n parts.forEach(function (part) {\n if (part.dynamic) {\n staticSize += 32;\n dynamicSize += alignSize(part.value.length);\n }\n else {\n staticSize += alignSize(part.value.length);\n }\n });\n var offset = 0, dynamicOffset = staticSize;\n var data = new Uint8Array(staticSize + dynamicSize);\n parts.forEach(function (part) {\n if (part.dynamic) {\n //uint256Coder.encode(dynamicOffset).copy(data, offset);\n data.set(uint256Coder.encode(dynamicOffset), offset);\n offset += 32;\n //part.value.copy(data, dynamicOffset); @TODO\n data.set(part.value, dynamicOffset);\n dynamicOffset += alignSize(part.value.length);\n }\n else {\n //part.value.copy(data, offset); @TODO\n data.set(part.value, offset);\n offset += alignSize(part.value.length);\n }\n });\n return data;\n}\nfunction unpack(coders, data, offset) {\n var baseOffset = offset;\n var consumed = 0;\n var value = [];\n coders.forEach(function (coder) {\n if (coder.dynamic) {\n var dynamicOffset = uint256Coder.decode(data, offset);\n var result = coder.decode(data, baseOffset + dynamicOffset.value.toNumber());\n // The dynamic part is leap-frogged somewhere else; doesn't count towards size\n result.consumed = dynamicOffset.consumed;\n }\n else {\n var result = coder.decode(data, offset);\n }\n if (result.value != undefined) {\n value.push(result.value);\n }\n offset += result.consumed;\n consumed += result.consumed;\n });\n coders.forEach(function (coder, index) {\n var name = coder.localName;\n if (!name) {\n return;\n }\n if (name === 'length') {\n name = '_length';\n }\n if (value[name] != null) {\n return;\n }\n value[name] = value[index];\n });\n return {\n value: value,\n consumed: consumed\n };\n}\nvar CoderArray = /** @class */ (function (_super) {\n __extends(CoderArray, _super);\n function CoderArray(coerceFunc, coder, length, localName) {\n var _this = this;\n var type = (coder.type + '[' + (length >= 0 ? length : '') + ']');\n var dynamic = (length === -1 || coder.dynamic);\n _this = _super.call(this, coerceFunc, 'array', type, localName, dynamic) || this;\n _this.coder = coder;\n _this.length = length;\n return _this;\n }\n CoderArray.prototype.encode = function (value) {\n if (!Array.isArray(value)) {\n errors.throwError('expected array value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n value: value\n });\n }\n var count = this.length;\n var result = new Uint8Array(0);\n if (count === -1) {\n count = value.length;\n result = uint256Coder.encode(count);\n }\n errors.checkArgumentCount(count, value.length, ' in coder array' + (this.localName ? (\" \" + this.localName) : \"\"));\n var coders = [];\n for (var i = 0; i < value.length; i++) {\n coders.push(this.coder);\n }\n return bytes_1.concat([result, pack(coders, value)]);\n };\n CoderArray.prototype.decode = function (data, offset) {\n // @TODO:\n //if (data.length < offset + length * 32) { throw new Error('invalid array'); }\n var consumed = 0;\n var count = this.length;\n if (count === -1) {\n try {\n var decodedLength = uint256Coder.decode(data, offset);\n }\n catch (error) {\n errors.throwError('insufficient data for dynamic array length', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n value: error.value\n });\n }\n try {\n count = decodedLength.value.toNumber();\n }\n catch (error) {\n errors.throwError('array count too large', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n value: decodedLength.value.toString()\n });\n }\n consumed += decodedLength.consumed;\n offset += decodedLength.consumed;\n }\n var coders = [];\n for (var i = 0; i < count; i++) {\n coders.push(new CoderAnonymous(this.coder));\n }\n var result = unpack(coders, data, offset);\n result.consumed += consumed;\n result.value = this.coerceFunc(this.type, result.value);\n return result;\n };\n return CoderArray;\n}(Coder));\nvar CoderTuple = /** @class */ (function (_super) {\n __extends(CoderTuple, _super);\n function CoderTuple(coerceFunc, coders, localName) {\n var _this = this;\n var dynamic = false;\n var types = [];\n coders.forEach(function (coder) {\n if (coder.dynamic) {\n dynamic = true;\n }\n types.push(coder.type);\n });\n var type = ('tuple(' + types.join(',') + ')');\n _this = _super.call(this, coerceFunc, 'tuple', type, localName, dynamic) || this;\n _this.coders = coders;\n return _this;\n }\n CoderTuple.prototype.encode = function (value) {\n return pack(this.coders, value);\n };\n CoderTuple.prototype.decode = function (data, offset) {\n var result = unpack(this.coders, data, offset);\n result.value = this.coerceFunc(this.type, result.value);\n return result;\n };\n return CoderTuple;\n}(Coder));\n/*\nfunction getTypes(coders) {\n var type = coderTuple(coders).type;\n return type.substring(6, type.length - 1);\n}\n*/\nfunction splitNesting(value) {\n value = value.trim();\n var result = [];\n var accum = '';\n var depth = 0;\n for (var offset = 0; offset < value.length; offset++) {\n var c = value[offset];\n if (c === ',' && depth === 0) {\n result.push(accum);\n accum = '';\n }\n else {\n accum += c;\n if (c === '(') {\n depth++;\n }\n else if (c === ')') {\n depth--;\n if (depth === -1) {\n throw new Error('unbalanced parenthsis');\n }\n }\n }\n }\n if (accum) {\n result.push(accum);\n }\n return result;\n}\n// @TODO: Is there a way to return \"class\"?\nvar paramTypeSimple = {\n address: CoderAddress,\n bool: CoderBoolean,\n string: CoderString,\n bytes: CoderDynamicBytes,\n};\nfunction getTupleParamCoder(coerceFunc, components, localName) {\n if (!components) {\n components = [];\n }\n var coders = [];\n components.forEach(function (component) {\n coders.push(getParamCoder(coerceFunc, component));\n });\n return new CoderTuple(coerceFunc, coders, localName);\n}\nfunction getParamCoder(coerceFunc, param) {\n var coder = paramTypeSimple[param.type];\n if (coder) {\n return new coder(coerceFunc, param.name);\n }\n var match = param.type.match(paramTypeNumber);\n if (match) {\n var size = parseInt(match[2] || \"256\");\n if (size === 0 || size > 256 || (size % 8) !== 0) {\n errors.throwError('invalid ' + match[1] + ' bit length', errors.INVALID_ARGUMENT, {\n arg: 'param',\n value: param\n });\n }\n return new CoderNumber(coerceFunc, size / 8, (match[1] === 'int'), param.name);\n }\n var match = param.type.match(paramTypeBytes);\n if (match) {\n var size = parseInt(match[1]);\n if (size === 0 || size > 32) {\n errors.throwError('invalid bytes length', errors.INVALID_ARGUMENT, {\n arg: 'param',\n value: param\n });\n }\n return new CoderFixedBytes(coerceFunc, size, param.name);\n }\n var match = param.type.match(paramTypeArray);\n if (match) {\n var size = parseInt(match[2] || \"-1\");\n param = properties_1.shallowCopy(param);\n param.type = match[1];\n param = properties_1.deepCopy(param);\n return new CoderArray(coerceFunc, getParamCoder(coerceFunc, param), size, param.name);\n }\n if (param.type.substring(0, 5) === 'tuple') {\n return getTupleParamCoder(coerceFunc, param.components, param.name);\n }\n if (param.type === '') {\n return new CoderNull(coerceFunc, param.name);\n }\n errors.throwError('invalid type', errors.INVALID_ARGUMENT, {\n arg: 'type',\n value: param.type\n });\n return null;\n}\nvar AbiCoder = /** @class */ (function () {\n function AbiCoder(coerceFunc) {\n errors.checkNew(this, AbiCoder);\n if (!coerceFunc) {\n coerceFunc = exports.defaultCoerceFunc;\n }\n properties_1.defineReadOnly(this, 'coerceFunc', coerceFunc);\n }\n AbiCoder.prototype.encode = function (types, values) {\n if (types.length !== values.length) {\n errors.throwError('types/values length mismatch', errors.INVALID_ARGUMENT, {\n count: { types: types.length, values: values.length },\n value: { types: types, values: values }\n });\n }\n var coders = [];\n types.forEach(function (type) {\n // Convert types to type objects\n // - \"uint foo\" => { type: \"uint\", name: \"foo\" }\n // - \"tuple(uint, uint)\" => { type: \"tuple\", components: [ { type: \"uint\" }, { type: \"uint\" }, ] }\n var typeObject = null;\n if (typeof (type) === 'string') {\n typeObject = parseParam(type);\n }\n else {\n typeObject = type;\n }\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n }, this);\n return bytes_1.hexlify(new CoderTuple(this.coerceFunc, coders, '_').encode(values));\n };\n AbiCoder.prototype.decode = function (types, data) {\n var coders = [];\n types.forEach(function (type) {\n // See encode for details\n var typeObject = null;\n if (typeof (type) === 'string') {\n typeObject = parseParam(type);\n }\n else {\n typeObject = properties_1.deepCopy(type);\n }\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n }, this);\n return new CoderTuple(this.coerceFunc, coders, '_').decode(bytes_1.arrayify(data), 0).value;\n };\n return AbiCoder;\n}());\nexports.AbiCoder = AbiCoder;\nexports.defaultAbiCoder = new AbiCoder();\n","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isNaN(val) === false) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^((?:\\d+)?\\-?\\d?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* Active `debug` instances.\n\t*/\n\tcreateDebug.instances = [];\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn match;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.enabled = createDebug.enabled(namespace);\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = selectColor(namespace);\n\t\tdebug.destroy = destroy;\n\t\tdebug.extend = extend;\n\t\t// Debug.formatArgs = formatArgs;\n\t\t// debug.rawLog = rawLog;\n\n\t\t// env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\tcreateDebug.instances.push(debug);\n\n\t\treturn debug;\n\t}\n\n\tfunction destroy() {\n\t\tconst index = createDebug.instances.indexOf(this);\n\t\tif (index !== -1) {\n\t\t\tcreateDebug.instances.splice(index, 1);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0; i < createDebug.instances.length; i++) {\n\t\t\tconst instance = createDebug.instances[i];\n\t\t\tinstance.enabled = createDebug.enabled(instance.namespace);\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\nfunction log(...args) {\n\t// This hackery is required for IE8/9, where\n\t// the `console.log` function doesn't have 'apply'\n\treturn typeof console === 'object' &&\n\t\tconsole.log &&\n\t\tconsole.log(...args);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","import fetch from 'cross-fetch';\nimport { defaultAbiCoder } from 'ethers/utils/abi-coder';\nimport debug from 'debug';\nconst log = debug('multicall');\n\n// Function signature for: aggregate((address,bytes)[])\nexport const AGGREGATE_SELECTOR = '0x252dba42';\n\nexport function strip0x(str) {\n return str.replace(/^0x/, '');\n}\n\nexport function typesLength(types) {\n return types.length;\n}\n\nexport function encodeParameter(type, val) {\n return encodeParameters([type], [val]);\n}\n\nexport function encodeParameters(types, vals) {\n return defaultAbiCoder.encode(types, vals);\n}\n\nexport function decodeParameter(type, val) {\n return decodeParameters([type], val);\n}\n\nexport function decodeParameters(types, vals) {\n return defaultAbiCoder.decode(types, '0x' + vals.replace(/0x/i, ''));\n}\n\nexport function padLeft(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n new Array(padding).join(sign ? sign : '0') +\n string\n );\n}\n\nexport function padRight(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n string +\n new Array(padding).join(sign ? sign : '0')\n );\n}\n\nexport function isEmpty(obj) {\n if (Array.isArray(obj)) return obj.length === 0;\n return !obj || Object.keys(obj).length === 0;\n}\n\nexport async function ethCall(rawData, { id, web3, ethers, provider, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) {\n const abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData);\n if (ws) {\n log('Sending via WebSocket');\n return new Promise((resolve, reject) => {\n ws.send(JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id\n }));\n function onMessage(data) {\n if (typeof data !== 'string') data = data.data;\n const json = JSON.parse(data);\n if (!json.id || json.id !== id) return;\n log('Got WebSocket response id #%d', json.id);\n clearTimeout(timeoutHandle);\n ws.onmessage = null;\n resolve(json.result);\n }\n const timeoutHandle = setTimeout(() => {\n if (ws.onmessage !== onMessage) return;\n ws.onmessage = null;\n reject(new Error('WebSocket response timeout'));\n }, wsResponseTimeout);\n\n ws.onmessage = onMessage;\n });\n }\n else if (ethers) {\n log('Sending via ethers provider');\n return ethers.send({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (provider) {\n log('Sending via EIP-1193 provider');\n return provider.request({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (web3) {\n log('Sending via web3 provider');\n return web3.eth.call({\n to: multicallAddress,\n data: abiEncodedData\n });\n } else {\n log('Sending via XHR fetch');\n const rawResponse = await fetch(rpcUrl, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id: 1\n })\n });\n const content = await rawResponse.json();\n if (!content || !content.result) {\n throw new Error('Multicall received an empty response. Check your call configuration for errors.');\n }\n return content.result;\n }\n}\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","import { id as keccak256 } from 'ethers/utils/hash';\nimport invariant from 'invariant';\nimport { strip0x, ethCall, encodeParameters, decodeParameters } from './helpers.js';\nimport memoize from 'lodash/memoize';\n\nconst INSIDE_EVERY_PARENTHESES = /\\(.*?\\)/g;\nconst FIRST_CLOSING_PARENTHESES = /^[^)]*\\)/;\n\nexport function _makeMulticallData(calls) {\n const values = [\n calls.map(({ target, method, args, returnTypes }) => [\n target,\n keccak256(method).substr(0, 10) +\n (args && args.length > 0\n ? strip0x(encodeParameters(args.map(a => a[1]), args.map(a => a[0])))\n : '')\n ])\n ];\n const calldata = encodeParameters(\n [\n {\n components: [{ type: 'address' }, { type: 'bytes' }],\n name: 'data',\n type: 'tuple[]'\n }\n ],\n values\n );\n return calldata;\n}\n\nconst makeMulticallData = memoize(_makeMulticallData, (...args) => JSON.stringify(args));\n\nexport default async function aggregate(calls, config) {\n calls = Array.isArray(calls) ? calls : [calls];\n\n const keyToArgMap = calls.reduce((acc, { call, returns }) => {\n const [, ...args] = call;\n if (args.length > 0) {\n for (let returnMeta of returns) {\n const [key] = returnMeta;\n acc[key] = args;\n }\n }\n return acc;\n }, {});\n\n calls = calls.map(({ call, target, returns }) => {\n if (!target) target = config.multicallAddress;\n const [method, ...argValues] = call;\n const [argTypesString, returnTypesString] = method\n .match(INSIDE_EVERY_PARENTHESES)\n .map(match => match.slice(1, -1));\n const argTypes = argTypesString.split(',').filter(e => !!e);\n invariant(\n argTypes.length === argValues.length,\n `Every method argument must have exactly one type.\n Comparing argument types ${JSON.stringify(argTypes)}\n to argument values ${JSON.stringify(argValues)}.\n `\n );\n const args = argValues.map((argValue, idx) => [argValue, argTypes[idx]]);\n const returnTypes = !!returnTypesString ? returnTypesString.split(',') : [];\n return {\n method: method.match(FIRST_CLOSING_PARENTHESES)[0],\n args,\n returnTypes,\n target,\n returns\n };\n });\n\n const callDataBytes = makeMulticallData(calls, false);\n const outerResults = await ethCall(callDataBytes, config);\n const returnTypeArray = calls\n .map(({ returnTypes }) => returnTypes)\n .reduce((acc, ele) => acc.concat(ele), []);\n const returnDataMeta = calls\n .map(({ returns }) => returns)\n .reduce((acc, ele) => acc.concat(ele), []);\n\n invariant(\n returnTypeArray.length === returnDataMeta.length,\n 'Missing data needed to parse results'\n );\n\n const outerResultsDecoded = decodeParameters(['uint256', 'bytes[]'], outerResults);\n const blockNumber = outerResultsDecoded.shift();\n const parsedVals = outerResultsDecoded.reduce((acc, r) => {\n r.forEach((results, idx) => {\n const types = calls[idx].returnTypes;\n const resultsDecoded = decodeParameters(types, results);\n acc.push(\n ...resultsDecoded.map((r, idx) => {\n if (types[idx] === 'bool') return r.toString() === 'true';\n return r;\n })\n );\n });\n return acc;\n }, []);\n\n const retObj = { blockNumber, original: {}, transformed: {} };\n\n for (let i = 0; i < parsedVals.length; i++) {\n const [name, transform] = returnDataMeta[i];\n retObj.original[name] = parsedVals[i];\n retObj.transformed[name] = transform !== undefined ? transform(parsedVals[i]) : parsedVals[i];\n }\n\n return { results: retObj, keyToArgMap };\n}\n","// https://github.com/maxogden/websocket-stream/blob/48dc3ddf943e5ada668c31ccd94e9186f02fafbd/ws-fallback.js\n\nvar ws = null\n\nif (typeof WebSocket !== 'undefined') {\n ws = WebSocket\n} else if (typeof MozWebSocket !== 'undefined') {\n ws = MozWebSocket\n} else if (typeof global !== 'undefined') {\n ws = global.WebSocket || global.MozWebSocket\n} else if (typeof window !== 'undefined') {\n ws = window.WebSocket || window.MozWebSocket\n} else if (typeof self !== 'undefined') {\n ws = self.WebSocket || self.MozWebSocket\n}\n\nmodule.exports = ws\n","import WebSocket from 'isomorphic-ws';\nimport aggregate from './aggregate';\nimport { isEmpty } from './helpers';\nimport addresses from './addresses.json';\nimport debug from 'debug';\nconst log = debug('multicall');\n\nconst reWsEndpoint = /^wss?:\\/\\//i;\n\nfunction isNewState(type, value, store) {\n return (\n store[type] === undefined ||\n (value !== null &&\n store[type] !== null &&\n typeof value === 'object' &&\n typeof value.toString === 'function' &&\n typeof store[type] === 'object' &&\n typeof store[type].toString === 'function'\n ? value.toString() !== store[type].toString()\n : value !== store[type])\n );\n}\n\nfunction prepareConfig(config) {\n config = {\n interval: 1000,\n staleBlockRetryWait: 3000,\n errorRetryWait: 5000,\n wsResponseTimeout: 5000,\n wsReconnectTimeout: 5000,\n ...config\n };\n if (config.preset !== undefined) {\n if (addresses[config.preset] !== undefined) {\n config.multicallAddress = addresses[config.preset].multicall;\n config.rpcUrl = addresses[config.preset].rpcUrl;\n } else throw new Error(`Unknown preset ${config.preset}`);\n }\n return config;\n}\n\nexport default function createWatcher(model, config) {\n const state = {\n model: [...model],\n store: {},\n storeTransformed: {},\n keyToArgMap: {},\n latestPromiseId: 0,\n latestBlockNumber: null,\n id: 0,\n listeners: {\n subscribe: [],\n block: [],\n poll: [],\n error: []\n },\n handler: null,\n wsReconnectHandler: null,\n watching: false,\n config: prepareConfig(config),\n ws: null\n };\n\n function reconnectWebSocket(timeout) {\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = setTimeout(() => {\n destroyWebSocket();\n setupWebSocket();\n }, timeout);\n }\n\n function setupWebSocket() {\n if (reWsEndpoint.test(state.config.rpcUrl)) {\n log(`Connecting to WebSocket ${state.config.rpcUrl}...`);\n state.ws = new WebSocket(state.config.rpcUrl);\n state.ws.onopen = () => {\n log('WebSocket connected');\n if (state.handler) throw new Error('Existing poll setTimeout handler set');\n if (state.watching) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n };\n state.ws.onclose = err => {\n log('WebSocket closed: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n state.ws.onerror = err => {\n log('WebSocket error: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n }\n }\n\n function destroyWebSocket() {\n log('destroyWebSocket()');\n state.ws.onopen = null;\n state.ws.onclose = null;\n state.ws.onerror = null;\n state.ws.onmessage = null;\n state.ws.close();\n }\n\n setupWebSocket();\n\n state.initialFetchPromise = new Promise(resolve => {\n state.initialFetchResolver = resolve;\n });\n\n function subscribe(listener, id, batch = false) {\n if (!isEmpty(state.storeTransformed)) {\n const events = Object.entries(state.storeTransformed).map(([type, value]) => ({\n type,\n value,\n args: state.keyToArgMap[type] || []\n }));\n batch ? listener(events) : events.forEach(listener);\n }\n state.listeners.subscribe.push({ listener, id, batch });\n }\n\n function alertListeners(events) {\n if (!isEmpty(events))\n state.listeners.subscribe.forEach(({ listener, batch }) =>\n batch ? listener(events) : events.forEach(listener)\n );\n }\n\n function poll() {\n const interval = this.interval !== undefined ? this.interval : this.state.config.interval;\n log('poll() called, %s%s', 'interval: ' + interval, this.retry ? ', retry: ' + this.retry : '');\n this.state.handler = setTimeout(async () => {\n try {\n if (!this.state.handler) return;\n\n this.state.latestPromiseId++;\n const promiseId = this.state.latestPromiseId;\n\n state.listeners.poll.forEach(({ listener }) =>\n listener({\n id: promiseId,\n latestBlockNumber: this.state.latestBlockNumber,\n ...(this.retry ? { retry: this.retry } : {})\n })\n );\n\n const {\n results: {\n blockNumber,\n original: { ...data },\n transformed: { ...dataTransformed }\n },\n keyToArgMap\n } = await aggregate(this.state.model, {\n ...this.state.config,\n ws: this.state.ws,\n id: this.state.latestPromiseId\n });\n\n if (this.state.cancelPromiseId === promiseId) return;\n\n if (typeof this.resolveFetchPromise === 'function') this.resolveFetchPromise();\n\n if (this.state.latestBlockNumber !== null && blockNumber < this.state.latestBlockNumber) {\n // Retry if blockNumber is lower than latestBlockNumber\n log(\n `Stale block returned, retrying in ${this.state.config.staleBlockRetryWait /\n 1000} seconds`\n );\n poll.call({\n state: this.state,\n interval: this.state.config.staleBlockRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n } else {\n if (\n this.state.latestBlockNumber === null ||\n (this.state.latestBlockNumber !== null && blockNumber > this.state.latestBlockNumber)\n ) {\n this.state.latestBlockNumber = parseInt(blockNumber);\n state.listeners.block.forEach(({ listener }) => listener(this.state.latestBlockNumber));\n }\n const events = Object.entries(data)\n .filter(([type, value]) => isNewState(type, value, this.state.store))\n .map(([type]) => ({\n type,\n value: dataTransformed[type],\n args: keyToArgMap[type] || []\n }));\n this.state.store = { ...data };\n this.state.storeTransformed = { ...dataTransformed };\n this.state.keyToArgMap = { ...keyToArgMap };\n alertListeners(events);\n poll.call({ state: this.state });\n }\n } catch (err) {\n log('Error: %s', err.message);\n state.listeners.error.forEach(({ listener }) => listener(err, this.state));\n if (!this.state.handler) return;\n // Retry on error\n log(`Error occured, retrying in ${this.state.config.errorRetryWait / 1000} seconds`);\n poll.call({\n state: this.state,\n interval: this.state.config.errorRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n }\n }, interval);\n }\n\n const watcher = {\n tap(transform) {\n log('watcher.tap() called');\n const nextModel = transform([...state.model]);\n state.model = [...nextModel];\n return this.poll();\n },\n poll() {\n log('watcher.poll() called');\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n if (state.watching && (!state.ws || state.ws.readyState === WebSocket.OPEN)) {\n clearTimeout(state.handler);\n state.handler = null;\n poll.call({ state, interval: 0, resolveFetchPromise });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, false);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n batch() {\n return {\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, true);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n }\n };\n },\n onNewBlock(listener) {\n const id = state.id++;\n state.latestBlockNumber && listener(state.latestBlockNumber);\n state.listeners.block.push({ listener, id });\n return {\n unsub() {\n state.listeners.block = state.listeners.block.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onPoll(listener) {\n const id = state.id++;\n state.listeners.poll.push({ listener, id });\n return {\n unsub() {\n state.listeners.poll = state.listeners.poll.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onError(listener) {\n const id = state.id++;\n state.listeners.error.push({ listener, id });\n return {\n unsub() {\n state.listeners.error = state.listeners.error.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n start() {\n log('watcher.start() called');\n state.watching = true;\n if (!state.ws || state.ws.readyState === WebSocket.OPEN) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n return state.initialFetchPromise;\n },\n stop() {\n log('watcher.stop() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n state.watching = false;\n },\n recreate(model, config) {\n log('watcher.recreate() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n if (state.ws) destroyWebSocket();\n state.ws = null;\n state.config = prepareConfig(config);\n state.model = [...model];\n state.store = {};\n state.storeTransformed = {};\n state.latestBlockNumber = null;\n state.cancelPromiseId = state.latestPromiseId;\n setupWebSocket();\n if (state.watching && !state.ws) {\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise\n });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n awaitInitialFetch() {\n return state.initialFetchPromise;\n },\n get initialFetch() {\n return state.initialFetchPromise;\n },\n get schemas() {\n return state.model;\n }\n };\n\n return watcher;\n}\n"],"names":["Object","defineProperty","exports","value","_permanentCensorErrors","_censorErrors","throwError","message","code","params","Error","UNKNOWN_ERROR","messageDetails","keys","forEach","key","push","JSON","stringify","error","_version_1","version","reason","length","join","self","kind","MISSING_NEW","name","count","expectedCount","suffix","MISSING_ARGUMENT","UNEXPECTED_ARGUMENT","censorship","permanent","UNSUPPORTED_OPERATION","operation","form","normalize","String","LogLevels","debug","default","info","warn","off","LogLevel","log","logLevel","args","console","apply","_i","arguments","level","__importStar","this","mod","__esModule","result","k","hasOwnProperty","call","errors","require$$0","isHexable","addSlice","array","slice","Array","prototype","Uint8Array","isArrayish","parseInt","i","v","arrayify","INVALID_ARGUMENT","arg","toHexString","match","substring","substr","type","concat","objects","arrays","object","offset","set","isHexString","start","hexlify","NUMERIC_FAULT","operartion","fault","hex","Math","floor","hexZeroPad","splitSignature","signature","r","s","recoveryParam","argument","bytes","data","endOffset","module","assert","val","msg","inherits","ctor","superCtor","super_","TempCtor","constructor","BN","number","base","endian","isBN","negative","words","red","_init","Buffer","wordSize","e","parseHex","str","end","len","min","c","charCodeAt","parseBase","mul","num","isArray","max","left","right","cmp","_initNumber","_initArray","replace","_parseHex","_parseBase","strip","toArray","ceil","j","w","limbLen","limbPow","total","word","imuln","_iaddn","pow","copy","dest","clone","_expand","size","_normSign","inspect","toString","zeros","groupSizes","groupBases","smallMulTo","out","a","b","carry","ncarry","rword","maxJ","padding","groupSize","groupBase","isZero","modn","idivn","toNumber","ret","toJSON","toBuffer","toArrayLike","ArrayType","byteLength","reqLength","littleEndian","res","q","andln","iushrn","_countBits","clz32","t","_zeroBits","bitLength","hi","zeroBits","toTwos","width","abs","inotn","iaddn","fromTwos","testn","notn","ineg","isNeg","neg","iuor","ior","or","uor","iuand","iand","and","uand","iuxor","ixor","xor","uxor","bytesNeeded","bitsLeft","setn","bit","wbit","iadd","isub","add","sub","comb10MulTo","lo","mid","o","a0","al0","ah0","a1","al1","ah1","a2","al2","ah2","a3","al3","ah3","a4","al4","ah4","a5","al5","ah5","a6","al6","ah6","a7","al7","ah7","a8","al8","ah8","a9","al9","ah9","b0","bl0","bh0","b1","bl1","bh1","b2","bl2","bh2","b3","bl3","bh3","b4","bl4","bh4","b5","bl5","bh5","b6","bl6","bh6","b7","bl7","bh7","b8","bl8","bh8","b9","bl9","bh9","w0","imul","w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18","jumboMulTo","FFTM","mulp","x","y","mulTo","hncarry","bigMulTo","makeRBT","N","l","revBin","rb","permute","rbt","rws","iws","rtws","itws","transform","rtwdf","cos","PI","itwdf","sin","p","rtwdf_","itwdf_","re","ie","ro","io","rx","guessLen13b","n","m","odd","conjugate","normalize13b","ws","round","convert13b","stub","ph","_","rwst","iwst","nrws","nrwst","niwst","rmws","mulf","muln","sqr","isqr","toBitArray","iushln","bits","carryMask","newCarry","ishln","hint","extended","h","mask","maskedWords","ishrn","shln","ushln","shrn","ushrn","imaskn","maskn","isubn","addn","subn","iabs","_ishlnsubmul","shift","_wordDiv","mode","bhi","diff","qj","div","divmod","positive","divn","umod","divRound","dm","half","r2","acc","egcd","A","B","C","D","g","isEven","yp","xp","im","isOdd","jm","gcd","_invmp","x1","x2","delta","cmpn","invm","bincn","ucmp","gtn","gt","gten","gte","ltn","lt","lten","lte","eqn","eq","Red","toRed","ctx","convertTo","_forceRed","fromRed","convertFrom","forceRed","redAdd","redIAdd","redSub","redISub","redShl","shl","redMul","_verify2","redIMul","redSqr","_verify1","redISqr","redSqrt","sqrt","redInvm","redNeg","redPow","primes","k256","p224","p192","p25519","MPrime","tmp","_tmp","K256","P224","P192","P25519","prime","_prime","Mont","imod","rinv","minv","ireduce","rlen","split","imulK","input","output","outLen","prev","next","mod3","one","nOne","lpow","z","inv","wnd","current","currentLen","mont","u","defineReadOnly","enumerable","writable","isType","_ethersType","configurable","promises","Promise","then","all","properties","opaque","boolean","string","deepCopy","frozen","map","item","freeze","undefined","inheritable","parent","child","create","__importDefault","bn_js_1","require$$1","BN_1","toHex","bn","toBN","_bnify","bigNumberify","toBigNumber","BigNumber","_hex","checkNew","properties_1","setType","bytes_1","outputValue","details","other","isBigNumber","NegativeOne","bignumber_1","Zero","One","Two","WeiPerEther","MaxUint256","UnicodeNormalizationForm","toUtf8Bytes","errors_1","checkNormalize","c2","toUtf8String","ignoreErrors","extraLength","overlongMask","nextChar","fromCharCode","text","constants_1","HashZero","root","window","JS_SHA3_NO_NODE_JS","process","versions","node","global","COMMON_JS","JS_SHA3_NO_COMMON_JS","HEX_CHARS","SHIFT","RC","BITS","OUTPUT_TYPES","createOutputMethod","outputType","Keccak","update","createShakeOutputMethod","outputBits","createMethod","method","algorithms","methods","methodNames","algorithm","methodName","blocks","reset","block","blockCount","byteCount","outputBlocks","extraBytes","notString","ArrayBuffer","index","lastByteIndex","f","finalize","buffer","arrayBuffer","Uint32Array","digest","c0","c1","c3","c4","c5","c6","c7","c8","c9","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","sha3","keccak_256","Zeros","Partition","UseSTD3ASCIIRules","toLowerCase","partition","label","utf8_1","keccak256_1","keccak256","condition","format","d","argIndex","framesToPop","__self__","F","fetch","DOMException","support","Symbol","Blob","viewClasses","isArrayBufferView","isView","obj","indexOf","normalizeName","test","TypeError","normalizeValue","iteratorFor","items","iterator","done","Headers","headers","append","header","getOwnPropertyNames","consumed","body","bodyUsed","reject","fileReaderReady","reader","resolve","onload","onerror","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","view","Body","_initBody","_bodyInit","_bodyText","isPrototypeOf","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","get","rejected","readAsText","chars","readArrayBufferAsText","formData","decode","json","parse","oldValue","has","callback","thisArg","values","entries","Request","options","upcased","url","credentials","signal","toUpperCase","referrer","trim","decodeURIComponent","Response","bodyInit","status","ok","statusText","response","redirectStatuses","redirect","RangeError","location","err","stack","init","request","aborted","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","line","parts","responseURL","responseText","ontimeout","onabort","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","removeEventListener","send","polyfill","arrayifyInteger","unshift","unarrayifyInteger","_decodeChildren","childOffset","decoded","_decode","lengthLength","_encode","payload","getChecksumAddress","address","hashed","i_1","ibanLookup","safeDigits","log10","LN10","ibanChecksum","expanded","checksum","getAddress","base36","transaction","from","nonce","rlp_1","encode","stripZeros","extendStatics","__extends","setPrototypeOf","__proto__","__","paramTypeBytes","RegExp","paramTypeNumber","paramTypeArray","regexParen","regexIdentifier","verifyType","parseParam","param","allowIndexed","originalParam","state","allowType","allowParams","components","indexed","allowName","allowArray","sibling","readArray","formatParamType","paramType","getParamCoder","defaultCoerceFunc","fragment","inputs","abi","anonymous","splitNesting","modifier","parseSignatureEvent","constant","gas","outputs","payable","stateMutability","comps","parseSignatureFunction","Coder","coerceFunc","localName","dynamic","CoderAnonymous","_super","coder","_this","CoderNull","CoderNumber","signed","bounds","padZeros","coderType","uint256Coder","CoderBoolean","CoderFixedBytes","CoderAddress","address_1","_encodeDynamicBytes","_decodeDynamicBytes","CoderDynamicBytes","CoderString","alignSize","pack","coders","arrayValues","staticSize","dynamicSize","part","dynamicOffset","unpack","baseOffset","CoderArray","checkArgumentCount","decodedLength","CoderTuple","types","accum","depth","paramTypeSimple","bool","shallowCopy","component","getTupleParamCoder","AbiCoder","typeObject","exec","parseFloat","isNaN","long","ms","msAbs","plural","fmtLong","fmtShort","isPlural","env","selectColor","namespace","hash","createDebug","colors","prevTime","enabled","curr","Number","Date","coerce","formatter","formatters","splice","formatArgs","useColors","color","destroy","extend","instances","delimiter","newDebug","toNamespace","regexp","disable","namespaces","names","skips","enable","save","instance","humanize","load","lastC","storage","setItem","removeItem","getItem","DEBUG","__nwjs","navigator","userAgent","document","documentElement","style","WebkitAppearance","firebug","exception","table","$1","localStorage","localstorage","strip0x","encodeParameters","vals","defaultAbiCoder","decodeParameters","isEmpty","freeSelf","Function","objectProto","nativeObjectToString","symToStringTag","toStringTag","isOwn","tag","unmasked","getRawTag","objectToString","uid","isObject","baseGetTag","coreJsData","maskSrcKey","IE_PROTO","func","funcToString","reIsHostCtor","reIsNative","isMasked","isFunction","toSource","getValue","baseIsNative","getNative","__data__","nativeCreate","Hash","clear","entry","hashDelete","hashGet","hashHas","hashSet","assocIndexOf","pop","ListCache","listCacheDelete","listCacheGet","listCacheHas","listCacheSet","isKeyable","getMapData","MapCache","Map","mapCacheDelete","mapCacheGet","mapCacheHas","mapCacheSet","memoize","resolver","memoized","cache","Cache","INSIDE_EVERY_PARENTHESES","FIRST_CLOSING_PARENTHESES","makeMulticallData","calls","target","async","aggregate","config","keyToArgMap","reduce","returns","multicallAddress","argValues","returnTypesString","argTypes","filter","invariant","argValue","idx","returnTypes","callDataBytes","outerResults","rawData","id","web3","ethers","provider","rpcUrl","wsResponseTimeout","abiEncodedData","onMessage","clearTimeout","timeoutHandle","onmessage","jsonrpc","to","setTimeout","eth","rawResponse","content","ethCall","returnTypeArray","ele","returnDataMeta","outerResultsDecoded","blockNumber","parsedVals","results","resultsDecoded","retObj","original","transformed","WebSocket","MozWebSocket","reWsEndpoint","prepareConfig","interval","staleBlockRetryWait","errorRetryWait","wsReconnectTimeout","preset","addresses","multicall","createWatcher","model","store","storeTransformed","latestPromiseId","latestBlockNumber","listeners","subscribe","poll","handler","wsReconnectHandler","watching","reconnectWebSocket","timeout","destroyWebSocket","setupWebSocket","onopen","resolveFetchPromise","initialFetchResolver","onclose","close","listener","batch","events","retry","promiseId","dataTransformed","cancelPromiseId","isNewState","alertListeners","initialFetchPromise","tap","nextModel","fetchPromise","OPEN","unsub","onNewBlock","onPoll","onError","stop","recreate","awaitInitialFetch"],"mappings":"6UACAA,OAAOC,eAAeC,EAAS,aAAc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B6B,kBAASvC,EAAOzD,MACd7+B,GAAI,6BACJqgC,aAAatO,EAAM+Q,SACnB/Q,EAAM+Q,QAAU,KAChBzC,aAAatO,EAAMgR,oBACnBhR,EAAMgR,mBAAqB,KACvBhR,EAAMne,IAAIuvB,IACdpR,EAAMne,GAAK,KACXme,EAAM8M,OAASgD,GAAchD,GAC7B9M,EAAMuQ,gBAAYA,GAClBvQ,EAAMwQ,MAAQ,GACdxQ,EAAMyQ,iBAAmB,GACzBzQ,EAAM2Q,kBAAoB,KAC1B3Q,EAAMiS,gBAAkBjS,EAAM0Q,gBAC9BW,IACIrR,EAAMiR,WAAajR,EAAMne,GAAI,KAC3B0vB,EACEgB,EAAe,IAAI9mB,SAAQ,SAAAsM,GAC/BwZ,EAAsBxZ,YAExB+Y,EAAK9hC,KAAK,CACRgxB,MAAAA,EACA+P,SAAU,EACVwB,oBAAAA,IAEKgB,SAEF9mB,QAAQsM,WAEjBgb,oCACS/S,EAAMoS,+CAGNpS,EAAMoS,0CAGNpS,EAAMuQ"} \ No newline at end of file diff --git a/dist/multicall.umd.js b/dist/multicall.umd.js new file mode 100644 index 0000000..0ec5d9f --- /dev/null +++ b/dist/multicall.umd.js @@ -0,0 +1,11 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).Multicall={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var i=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.version="4.0.27"}));r(i);var o=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.MISSING_NEW="MISSING_NEW",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.NUMERIC_FAULT="NUMERIC_FAULT",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION";var r=!1,n=!1;function o(t,r,o){if(n)throw Error("unknown error");r||(r=e.UNKNOWN_ERROR),o||(o={});var a=[];Object.keys(o).forEach((function(t){try{a.push(t+"="+JSON.stringify(o[t]))}catch(e){a.push(t+"="+JSON.stringify(""+o[t]))}})),a.push("version="+i.version);var s=t;a.length&&(t+=" ("+a.join(", ")+")");var u=Error(t);throw u.reason=s,u.code=r,Object.keys(o).forEach((function(t){u[t]=o[t]})),u}e.throwError=o,e.checkNew=function(t,r){t instanceof r||o("missing new",e.MISSING_NEW,{name:r.name})},e.checkArgumentCount=function(t,r,n){n||(n=""),r>t&&o("missing argument"+n,e.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&o("too many arguments"+n,e.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})},e.setCensorship=function(t,i){r&&o("error censorship permanent",e.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n=!!t,r=!!i},e.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{"test".normalize(t)}catch(e){throw Error("missing "+t)}})),"é"!=="é".normalize("NFD"))throw Error("broken implementation")}catch(t){o("platform missing String.prototype.normalize",e.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:t.message})}};var a={debug:1,default:2,info:2,warn:3,error:4,off:5},s=a.default;function u(t,e){s>a[t]||console.log.apply(console,e)}function h(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];u("warn",t)}e.setLogLevel=function(t){var e=a[t];null!=e?s=e:h("invliad log level - "+t)},e.warn=h,e.info=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];u("info",t)}}));r(o);var a=n((function(t,r){var n=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(o);function a(t){return!!t.toHexString}function s(t){return t.slice?t:(t.slice=function(){var e=Array.prototype.slice.call(arguments);return s(new Uint8Array(Array.prototype.slice.apply(t,e)))},t)}function u(t){if(!t||parseInt(t.length+"")!=t.length||"string"==typeof t)return!1;for(var e=0;t.length>e;e++){var r=t[e];if(0>r||r>=256||parseInt(r+"")!=r)return!1}return!0}function h(t){if(null==t&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:t}),a(t)&&(t=t.toHexString()),"string"==typeof t){var e=t.match(/^(0x)?[0-9a-fA-F]*$/);e||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==e[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),(t=t.substring(2)).length%2&&(t="0"+t);for(var r=[],n=0;t.length>n;n+=2)r.push(parseInt(t.substr(n,2),16));return s(new Uint8Array(r))}return u(t)?s(new Uint8Array(t)):(i.throwError("invalid arrayify value",null,{arg:"value",value:t,type:typeof t}),null)}function l(t){for(var e=[],r=0,n=0;t.length>n;n++){var i=h(t[n]);e.push(i),r+=i.length}var o=new Uint8Array(r),a=0;for(n=0;e.length>n;n++)o.set(e[n],a),a+=e[n].length;return s(o)}function f(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}r.isHexable=a,r.isArrayish=u,r.arrayify=h,r.concat=l,r.stripZeros=function(t){var e=h(t);if(0===e.length)return e;for(var r=0;0===e[r];)r++;return r&&(e=e.slice(r)),e},r.padZeros=function(t,e){if((t=h(t)).length>e)throw Error("cannot pad");var r=new Uint8Array(e);return r.set(t,e-t.length),s(r)},r.isHexString=f;function c(t){if(a(t))return t.toHexString();if("number"==typeof t){0>t&&i.throwError("cannot hexlify negative value",i.INVALID_ARGUMENT,{arg:"value",value:t}),9007199254740991>t||i.throwError("out-of-range",i.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var e="";t;)e="0123456789abcdef"[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("string"==typeof t){var r=t.match(/^(0x)?[0-9a-fA-F]*$/);return r||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:t}),"0x"!==r[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2&&(t="0x0"+t.substring(2)),t}if(u(t)){for(var n=[],o=0;t.length>o;o++){var s=t[o];n.push("0123456789abcdef"[(240&s)>>4]+"0123456789abcdef"[15&s])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function d(t,e){for(f(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});2*e+2>t.length;)t="0x0"+t.substring(2);return t}function p(t){var e,r=0,n="0x",o="0x";if((e=t)&&null!=e.r&&null!=e.s){null==t.v&&null==t.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:t}),n=d(t.r,32),o=d(t.s,32),"string"==typeof(r=t.v)&&(r=parseInt(r,16));var a=t.recoveryParam;null==a&&null!=t.v&&(a=1-r%2),r=27+a}else{var s=h(t);if(65!==s.length)throw Error("invalid signature");n=c(s.slice(0,32)),o=c(s.slice(32,64)),27!==(r=s[64])&&28!==r&&(r=27+r%2)}return{r:n,s:o,recoveryParam:r-27,v:r}}r.hexlify=c,r.hexDataLength=function(t){return f(t)&&t.length%2==0?(t.length-2)/2:null},r.hexDataSlice=function(t,e,r){return f(t)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)},r.hexStripZeros=function(t){for(f(t)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:t});t.length>3&&"0x0"===t.substring(0,3);)t="0x"+t.substring(3);return t},r.hexZeroPad=d,r.splitSignature=p,r.joinSignature=function(t){return c(l([(t=p(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}}));r(a);var s,u=(s=Object.freeze({__proto__:null,default:{}}))&&s.default||s,h=n((function(t){!function(t,e){function r(t,e){if(!t)throw Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o=u.Buffer}catch(t){}function a(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;i>o;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=49>a||a>54?17>a||a>22?15&a:a-17+10:a-49+10}return n}function s(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;o>a;a++){var s=t.charCodeAt(a)-48;i*=n,i+=49>s?17>s?s:s-17+10:s-49+10}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return 0>t.cmp(e)?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e);var i=0;"-"===(t=(""+t).replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){0>t&&(this.negative=1,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),0>=t.length)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var i=0;this.length>i;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)this.words[o]|=(a=t[i]|t[i-1]<<8|t[i-2]<<16)<>>26-s&67108863,26>(s+=24)||(s-=26,o++);else if("le"===n)for(i=0,o=0;t.length>i;i+=3)this.words[o]|=(a=t[i]|t[i+1]<<8|t[i+2]<<16)<>>26-s&67108863,26>(s+=24)||(s-=26,o++);return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var r=0;this.length>r;r++)this.words[r]=0;var n,i,o=0;for(r=t.length-6,n=0;r>=e;r-=6)i=a(t,r,r+6),this.words[n]|=i<>>26-o&4194303,26>(o+=24)||(o-=26,n++);r+6!==e&&(i=a(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,u=Math.min(o,o-a)+r,h=0,l=r;u>l;l+=n)h=s(t,l,l+n,e),this.imuln(i),67108864>this.words[0]+h?this.words[0]+=h:this._iaddn(h);if(0!==a){var f=1;for(h=s(t,l,t.length,e),l=0;a>l;l++)f*=e;this.imuln(f),67108864>this.words[0]+h?this.words[0]+=h:this._iaddn(h)}},i.prototype.copy=function(t){t.words=Array(this.length);for(var e=0;this.length>e;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;t>this.length;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=a/67108864|0;r.words[0]=67108863&a;for(var u=1;n>u;u++){for(var h=s>>>26,l=67108863&s,f=Math.min(u,e.length-1),c=Math.max(0,u-t.length+1);f>=c;c++){h+=(a=(i=0|t.words[u-c|0])*(o=0|e.words[c])+l)/67108864|0,l=67108863&a}r.words[u]=0|l,s=0|h}return 0!==s?r.words[u]=0|s:r.length--,r.strip()}i.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;this.length>a;a++){var s=this.words[a],u=(16777215&(s<>>24-i&16777215)||a!==this.length-1?h[6-u.length]+u+n:u+n,26>(i+=2)||(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var c=l[t],d=f[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:h[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(o>=i,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,h=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),h[s]=a;for(;o>s;s++)h[s]=0}else{for(s=0;o-i>s;s++)h[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),h[o-s-1]=a}return h},i.prototype._countBits=Math.clz32?function(t){return 32-Math.clz32(t)}:function(t){var e=t,r=0;return 4096>e||(r+=13,e>>>=13),64>e||(r+=7,e>>>=7),8>e||(r+=4,e>>>=4),2>e||(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;this.length>e;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;t.length>this.length;)this.words[this.length++]=0;for(var e=0;t.length>e;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;e.length>r;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},i.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;r.length>n;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;e.length>n;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},i.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;e>i;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;n.length>o;o++)this.words[o]=67108863&(e=(0|r.words[o])+(0|n.words[o])+i),i=e>>>26;for(;0!==i&&r.length>o;o++)this.words[o]=67108863&(e=(0|r.words[o])+i),i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;r.length>o;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;n.length>a;a++)o=(e=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&r.length>a;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&r.length>a&&r!==this)for(;r.length>a;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var n,i,o,a=t.words,s=e.words,u=r.words,h=0,l=0|a[0],f=8191&l,c=l>>>13,d=0|a[1],p=8191&d,m=d>>>13,v=0|a[2],y=8191&v,g=v>>>13,w=0|a[3],b=8191&w,M=w>>>13,_=0|a[4],E=8191&_,N=_>>>13,A=0|a[5],x=8191&A,C=A>>>13,T=0|a[6],k=8191&T,I=T>>>13,R=0|a[7],F=8191&R,O=R>>>13,S=0|a[8],U=8191&S,P=S>>>13,B=0|a[9],j=8191&B,D=B>>>13,L=0|s[0],G=8191&L,z=L>>>13,V=0|s[1],Z=8191&V,q=V>>>13,H=0|s[2],W=8191&H,$=H>>>13,J=0|s[3],K=8191&J,X=J>>>13,Q=0|s[4],Y=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ht=st>>>13,lt=0|s[8],ft=8191<,ct=lt>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(h+(n=Math.imul(f,G))|0)+((8191&(i=(i=Math.imul(f,z))+Math.imul(c,G)|0))<<13)|0;h=((o=Math.imul(c,z))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,G),i=(i=Math.imul(p,z))+Math.imul(m,G)|0,o=Math.imul(m,z);var yt=(h+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(c,Z)|0))<<13)|0;h=((o=o+Math.imul(c,q)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,G),i=(i=Math.imul(y,z))+Math.imul(g,G)|0,o=Math.imul(g,z),n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,q)|0;var gt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(c,W)|0))<<13)|0;h=((o=o+Math.imul(c,$)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(b,G),i=(i=Math.imul(b,z))+Math.imul(M,G)|0,o=Math.imul(M,z),n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,q)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,q)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,$)|0;var wt=(h+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(c,K)|0))<<13)|0;h=((o=o+Math.imul(c,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,G),i=(i=Math.imul(E,z))+Math.imul(N,G)|0,o=Math.imul(N,z),n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,q)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,$)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,X)|0;var bt=(h+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Y)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(x,G),i=(i=Math.imul(x,z))+Math.imul(C,G)|0,o=Math.imul(C,z),n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,q)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,$)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,$)|0,n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(g,K)|0,o=o+Math.imul(g,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,tt)|0;var Mt=(h+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(c,rt)|0))<<13)|0;h=((o=o+Math.imul(c,nt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(k,G),i=(i=Math.imul(k,z))+Math.imul(I,G)|0,o=Math.imul(I,z),n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,q)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(N,W)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(b,K)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var _t=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,at)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(F,G),i=(i=Math.imul(F,z))+Math.imul(O,G)|0,o=Math.imul(O,z),n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,q)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,q)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,$)|0,n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(h+(n=n+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(c,ut)|0))<<13)|0;h=((o=o+Math.imul(c,ht)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,z))+Math.imul(P,G)|0,o=Math.imul(P,z),n=n+Math.imul(F,Z)|0,i=(i=i+Math.imul(F,q)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Nt=(h+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;h=((o=o+Math.imul(c,ct)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(j,G),i=(i=Math.imul(j,z))+Math.imul(D,G)|0,o=Math.imul(D,z),n=n+Math.imul(U,Z)|0,i=(i=i+Math.imul(U,q)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(F,W)|0,i=(i=i+Math.imul(F,$)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ct)|0;var At=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,Z),i=(i=Math.imul(j,q))+Math.imul(D,Z)|0,o=Math.imul(D,q),n=n+Math.imul(U,W)|0,i=(i=i+Math.imul(U,$)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(F,K)|0,i=(i=i+Math.imul(F,X)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,ct)|0;var xt=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,W),i=(i=Math.imul(j,$))+Math.imul(D,W)|0,o=Math.imul(D,$),n=n+Math.imul(U,K)|0,i=(i=i+Math.imul(U,X)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,X)|0,n=n+Math.imul(F,Y)|0,i=(i=i+Math.imul(F,tt)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ct)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,K),i=(i=Math.imul(j,X))+Math.imul(D,K)|0,o=Math.imul(D,X),n=n+Math.imul(U,Y)|0,i=(i=i+Math.imul(U,tt)|0)+Math.imul(P,Y)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(F,rt)|0,i=(i=i+Math.imul(F,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(k,ot)|0,i=(i=i+Math.imul(k,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var Tt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,Y),i=(i=Math.imul(j,tt))+Math.imul(D,Y)|0,o=Math.imul(D,tt),n=n+Math.imul(U,rt)|0,i=(i=i+Math.imul(U,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(F,ot)|0,i=(i=i+Math.imul(F,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,n=n+Math.imul(k,ut)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(C,ft)|0,o=o+Math.imul(C,ct)|0;var kt=(h+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(D,rt)|0,o=Math.imul(D,nt),n=n+Math.imul(U,ot)|0,i=(i=i+Math.imul(U,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(F,ut)|0,i=(i=i+Math.imul(F,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,ct)|0;var It=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ot),i=(i=Math.imul(j,at))+Math.imul(D,ot)|0,o=Math.imul(D,at),n=n+Math.imul(U,ut)|0,i=(i=i+Math.imul(U,ht)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ht)|0,n=n+Math.imul(F,ft)|0,i=(i=i+Math.imul(F,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var Rt=(h+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,mt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,ut),i=(i=Math.imul(j,ht))+Math.imul(D,ut)|0,o=Math.imul(D,ht),n=n+Math.imul(U,ft)|0,i=(i=i+Math.imul(U,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var Ft=(h+(n=n+Math.imul(F,pt)|0)|0)+((8191&(i=(i=i+Math.imul(F,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,n=Math.imul(j,ft),i=(i=Math.imul(j,ct))+Math.imul(D,ft)|0,o=Math.imul(D,ct);var Ot=(h+(n=n+Math.imul(U,pt)|0)|0)+((8191&(i=(i=i+Math.imul(U,mt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((o=o+Math.imul(P,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var St=(h+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(D,pt)|0))<<13)|0;return h=((o=Math.imul(D,mt))+(i>>>13)|0)+(St>>>26)|0,St&=67108863,u[0]=vt,u[1]=yt,u[2]=gt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=_t,u[7]=Et,u[8]=Nt,u[9]=At,u[10]=xt,u[11]=Ct,u[12]=Tt,u[13]=kt,u[14]=It,u[15]=Rt,u[16]=Ft,u[17]=Ot,u[18]=St,0!==h&&(u[19]=h,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):63>r?c(this,t,e):1024>r?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;r.length-1>o;o++){var a=i;i=0;for(var s=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);u>=h;h++){var l=(0|t.words[o-h])*(0|e.words[h]),f=67108863&l;s=67108863&(f=f+s|0),i+=(a=(a=a+(l/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=Array(t),r=i.prototype._countBits(t)-1,n=0;t>n;n++)e[n]=this.revBin(n,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;e>i;i++)n|=(1&t)<>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var a=0;o>a;a++)n[a]=e[t[a]],i[a]=r[t[a]]},m.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var a=1;i>a;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),h=Math.sin(2*Math.PI/s),l=0;i>l;l+=s)for(var f=u,c=h,d=0;a>d;d++){var p=r[l+d],m=n[l+d],v=r[l+d+a],y=n[l+d+a],g=f*v-c*y;y=f*y+c*v,r[l+d]=p+(v=g),n[l+d]=m+y,r[l+d+a]=p-v,n[l+d+a]=m-y,d!==s&&(g=u*f-h*c,c=u*c+h*f,f=g)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<1)for(var n=0;r/2>n;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},m.prototype.normalize13b=function(t,e){for(var r=0,n=0;e/2>n;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=67108864>i?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;e>a;a++)n[2*a]=8191&(o+=0|t[a]),n[2*a+1]=8191&(o>>>=13),o>>>=13;for(a=2*e;i>a;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=Array(t),r=0;t>r;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),a=Array(n),s=Array(n),u=Array(n),h=Array(n),l=Array(n),f=Array(n),c=r.words;c.length=n,this.convert13b(t.words,t.length,a,n),this.convert13b(e.words,e.length,h,n),this.transform(a,o,s,u,n,i),this.transform(h,o,l,f,n,i);for(var d=0;n>d;d++){var p=s[d]*l[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},i.prototype.mul=function(t){var e=new i(null);return e.words=Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=Array(this.length+t.length),p(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){r("number"==typeof t),r(67108864>t);for(var e=0,n=0;this.length>n;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;e.length>r;r++){var n=r%26;e[r]=(t.words[r/26|0]&1<>>n}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;e.length>n&&0===e[n];n++,r=r.sqr());if(++nn;n++,o=o.sqr())0!==e[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;this.length>e;e++){var s=this.words[e]&o;this.words[e]=(0|this.words[e])-s<>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;i>e;e++)this.words[e]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<h;h++)u.words[h]=this.words[h];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,h=0;this.length>h;h++)this.words[h]=this.words[h+a];else this.words[0]=0,this.length=1;var l=0;for(h=this.length-1;!(0>h||0===l&&i>h);h--){var f=0|this.words[h];this.words[h]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;return this.length>n&&!!(this.words[n]&1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),n>=this.length)return this;(0!==e&&n++,this.length=Math.min(n,this.length),0!==e)&&(this.words[this.length-1]&=67108863^67108863>>>e<t),0>t?this.isubn(-t):0!==this.negative?1===this.length&&t>(0|this.words[0])?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;this.length>e&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(67108864>t),0>t)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var e=0;this.length>e&&0>this.words[e];e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o;this._expand(t.length+n);var a=0;for(i=0;t.length>i;i++){o=(0|this.words[i+n])+a;var s=(0|t.words[i])*e;a=((o-=67108863&s)>>26)-(s/67108864|0),this.words[i+n]=67108863&o}for(;this.length-n>i;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;this.length>i;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r,n=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,u=n.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=Array(s.length);for(var h=0;s.length>h;h++)s.words[h]=0}var l=n.clone()._ishlnsubmul(o,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(n._ishlnsubmul(o,c=Math.min(c/a|0,67108863),f);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=c)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||0>this.cmp(t)?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return 0>o||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),h=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++h;for(var l=n.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&26>c;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&26>p;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);0>e.cmp(n)?(n.isub(e),s.isub(o),u.isub(a)):(e.isub(n),o.isub(s),a.isub(u))}return{a:s,b:u,gcd:n.iushln(h)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var h=0,l=1;0==(e.words[0]&l)&&26>h;++h,l<<=1);if(h>0)for(e.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,c=1;0==(n.words[0]&c)&&26>f;++f,c<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);0>e.cmp(n)?(n.isub(e),s.isub(a)):(e.isub(n),a.isub(s))}return 0>(o=0===e.cmpn(1)?a:s).cmpn(0)&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(0>i){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<=this.length)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&this.length>a;a++){var s=0|this.words[a];o=(s+=o)>>>26,this.words[a]=s&=67108863}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=0>t;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(67108863>=t,"Number is too big");var i=0|this.words[0];e=i===t?0:t>i?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(t.length>this.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return 0>=this.cmpn(t)},i.prototype.lte=function(t){return 0>=this.cmp(t)},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new _(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new i(null);return t.words=Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=this.n>e?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},n(g,y),g.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;r>n;n++)e.words[n]=t.words[n];if(e.length=r,9>=t.length)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;t.length>n;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}t.words[n-10]=i>>>=22,t.length-=0===i&&t.length>10?10:9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;t.length>r;r++){var n=0|t.words[r];t.words[r]=67108863&(e+=977*n),e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,y),n(b,y),n(M,y),M.prototype.imulK=function(t){for(var e=0,r=0;t.length>r;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new w;else if("p192"===t)e=new b;else{if("p25519"!==t)throw Error("Unknown prime "+t);e=new M}return v[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return 0>r.cmp(this.m)||r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return 0>r.cmp(this.m)||r.isub(this.m),r},_.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),h=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,h).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,o),c=this.pow(t,o.addn(1).iushrn(1)),d=this.pow(t,o),p=a;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();r(p>v);var y=this.pow(f,new i(1).iushln(p-v-1));c=c.redMul(y),f=y.redSqr(),d=d.redMul(f),p=v}return c},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=Array(16);r[0]=new i(1).toRed(this),r[1]=t;for(var n=2;r.length>n;n++)r[n]=this.mul(r[n-1],t);var o=r[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],l=u-1;l>=0;l--){var f=h>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},n(E,_),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0>i.cmp(this.m)?0>i.cmpn(0)&&(o=i.iadd(this.m)):o=i.isub(this.m),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return 0>o.cmp(this.m)?0>o.cmpn(0)&&(a=o.iadd(this.m)):a=o.isub(this.m),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,e)})),l=n((function(t,r){var n=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(o);function a(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function s(t,e){return t&&t._ethersType===e}r.defineReadOnly=a,r.setType=function(t,e){Object.defineProperty(t,"_ethersType",{configurable:!1,value:e,writable:!1})},r.isType=s,r.resolveProperties=function(t){var e={},r=[];return Object.keys(t).forEach((function(n){var i=t[n];i instanceof Promise?r.push(i.then((function(t){return e[n]=t,null}))):e[n]=i})),Promise.all(r).then((function(){return e}))},r.checkProperties=function(t,e){t&&"object"==typeof t||i.throwError("invalid object",i.INVALID_ARGUMENT,{argument:"object",value:t}),Object.keys(t).forEach((function(r){e[r]||i.throwError("invalid object key - "+r,i.INVALID_ARGUMENT,{argument:"transaction",value:t,key:r})}))},r.shallowCopy=function(t){var e={};for(var r in t)e[r]=t[r];return e};var u={boolean:!0,number:!0,string:!0};r.deepCopy=function t(e,r){if(null==e||u[typeof e])return e;if(Array.isArray(e)){var n=e.map((function(e){return t(e,r)}));return r&&Object.freeze(n),n}if("object"==typeof e){if(s(e,"BigNumber"))return e;if(s(e,"Description"))return e;if(s(e,"Indexed"))return e;n={};for(var i in e){var o=e[i];void 0!==o&&a(n,i,t(o,r))}return r&&Object.freeze(n),n}if("function"==typeof e)return e;throw Error("Cannot deepCopy "+typeof e)},r.inheritable=function t(e){return function(r){var n,i;(n=r).super_=i=e,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(r,"inherits",t(r))}}}));r(l);var f=n((function(t,r){var n=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var s=n(h),u=i(o),f=new s.default.BN(-1);function c(t){var e=t.toString(16);return"-"===e[0]?e.length%2==0?"-0x0"+e.substring(1):"-0x"+e.substring(1):e.length%2==1?"0x0"+e:"0x"+e}function d(t){return m(y(t))}function p(t){return new v(c(t))}function m(t){var e=t._hex;return"-"===e[0]?new s.default.BN(e.substring(3),16).mul(f):new s.default.BN(e.substring(2),16)}var v=function(){function t(e){if(u.checkNew(this,t),l.setType(this,"BigNumber"),"string"==typeof e)a.isHexString(e)?("0x"==e&&(e="0x0"),l.defineReadOnly(this,"_hex",e)):"-"===e[0]&&a.isHexString(e.substring(1))?l.defineReadOnly(this,"_hex",e):e.match(/^-?[0-9]*$/)?(""==e&&(e="0"),l.defineReadOnly(this,"_hex",c(new s.default.BN(e)))):u.throwError("invalid BigNumber string value",u.INVALID_ARGUMENT,{arg:"value",value:e});else if("number"==typeof e){parseInt(e+"")!==e&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:e,outputValue:parseInt(e+"")});try{l.defineReadOnly(this,"_hex",c(new s.default.BN(e)))}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}}else e instanceof t?l.defineReadOnly(this,"_hex",e._hex):e.toHexString?l.defineReadOnly(this,"_hex",c(d(e.toHexString()))):e._hex&&a.isHexString(e._hex)?l.defineReadOnly(this,"_hex",e._hex):a.isArrayish(e)?l.defineReadOnly(this,"_hex",c(new s.default.BN(a.hexlify(e).substring(2),16))):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:e})}return t.prototype.fromTwos=function(t){return p(m(this).fromTwos(t))},t.prototype.toTwos=function(t){return p(m(this).toTwos(t))},t.prototype.abs=function(){return"-"===this._hex[0]?p(m(this).mul(f)):this},t.prototype.add=function(t){return p(m(this).add(d(t)))},t.prototype.sub=function(t){return p(m(this).sub(d(t)))},t.prototype.div=function(t){return y(t).isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),p(m(this).div(d(t)))},t.prototype.mul=function(t){return p(m(this).mul(d(t)))},t.prototype.mod=function(t){return p(m(this).mod(d(t)))},t.prototype.pow=function(t){return p(m(this).pow(d(t)))},t.prototype.maskn=function(t){return p(m(this).maskn(t))},t.prototype.eq=function(t){return m(this).eq(d(t))},t.prototype.lt=function(t){return m(this).lt(d(t))},t.prototype.lte=function(t){return m(this).lte(d(t))},t.prototype.gt=function(t){return m(this).gt(d(t))},t.prototype.gte=function(t){return m(this).gte(d(t))},t.prototype.isZero=function(){return m(this).isZero()},t.prototype.toNumber=function(){try{return m(this).toNumber()}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},t.prototype.toString=function(){return m(this).toString(10)},t.prototype.toHexString=function(){return this._hex},t.isBigNumber=function(t){return l.isType(t,"BigNumber")},t}();function y(t){return v.isBigNumber(t)?t:new v(t)}r.BigNumber=v,r.bigNumberify=y}));r(f);var c=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.AddressZero="0x0000000000000000000000000000000000000000";e.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000";e.EtherSymbol="Ξ";var r=f.bigNumberify(-1);e.NegativeOne=r;var n=f.bigNumberify(0);e.Zero=n;var i=f.bigNumberify(1);e.One=i;var o=f.bigNumberify(2);e.Two=o;var a=f.bigNumberify("1000000000000000000");e.WeiPerEther=a;var s=f.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");e.MaxUint256=s}));r(c);var d=n((function(t,e){var r;function n(t,e){void 0===e&&(e=r.current),e!=r.current&&(o.checkNormalize(),t=t.normalize(e));for(var n=[],i=0;t.length>i;i++){var s=t.charCodeAt(i);if(128>s)n.push(s);else if(2048>s)n.push(s>>6|192),n.push(63&s|128);else if(55296==(64512&s)){i++;var u=t.charCodeAt(i);if(i>=t.length||56320!=(64512&u))throw Error("invalid utf-8 string");n.push((s=65536+((1023&s)<<10)+(1023&u))>>18|240),n.push(s>>12&63|128),n.push(s>>6&63|128),n.push(63&s|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(63&s|128)}return a.arrayify(n)}function i(t,e){t=a.arrayify(t);for(var r="",n=0;t.length>n;){var i=t[n++];if(i>>7!=0){var o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){if(!e){if(128==(192&i))throw Error("invalid utf8 byte sequence; unexpected continuation byte");throw Error("invalid utf8 byte sequence; invalid prefix")}continue}o=3,s=65535}if(t.lengthn&&t[n]>>6==2;n++);}else{for(var u=i&(1<<8-o-1)-1,h=0;o>h;h++){var l=t[n];if(128!=(192&l)){u=null;break}u=u<<6|63&l,n++}if(null!==u){if(u>s){if(1114111u||u>57343)r+=u>65535?String.fromCharCode(55296+((u-=65536)>>10&1023),56320+(1023&u)):String.fromCharCode(u);else if(!e)throw Error("invalid utf8 byte sequence; utf-16 surrogate")}else if(!e)throw Error("invalid utf8 byte sequence; overlong")}else if(!e)throw Error("invalid utf8 byte sequence; invalid continuation byte")}}else r+=String.fromCharCode(i)}return r}Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(r=e.UnicodeNormalizationForm||(e.UnicodeNormalizationForm={})),e.toUtf8Bytes=n,e.toUtf8String=i,e.formatBytes32String=function(t){var e=n(t);if(e.length>31)throw Error("bytes32 string must be less than 32 bytes");return a.hexlify(a.concat([e,c.HashZero]).slice(0,32))},e.parseBytes32String=function(t){var e=a.arrayify(t);if(32!==e.length)throw Error("invalid bytes32 - not 32 bytes long");if(0!==e[31])throw Error("invalid bytes32 sdtring - no null terminator");for(var r=31;0===e[r-1];)r--;return i(e.slice(0,r))}}));r(d);var p=n((function(t){ +/** + * [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(){var r="object"==typeof window?window:{};!r.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node&&(r=e);for(var n=!r.JS_SHA3_NO_COMMON_JS&&t.exports,i="0123456789abcdef".split(""),o=[0,8,16,24],a=[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],s=[224,256,384,512],u=["hex","buffer","arrayBuffer","array"],h=function(t,e,r){return function(n){return new b(t,e,t).update(n)[r]()}},l=function(t,e,r){return function(n,i){return new b(t,e,i).update(n)[r]()}},f=function(t,e){var r=h(t,e,"hex");r.create=function(){return new b(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;u.length>n;++n){var i=u[n];r[i]=h(t,e,i)}return r},c=[{name:"keccak",padding:[1,256,65536,16777216],bits:s,createMethod:f},{name:"sha3",padding:[6,1536,393216,100663296],bits:s,createMethod:f},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(t,e){var r=l(t,e,"hex");r.create=function(r){return new b(t,e,r)},r.update=function(t,e){return r.create(e).update(t)};for(var n=0;u.length>n;++n){var i=u[n];r[i]=l(t,e,i)}return r}}],d={},p=[],m=0;c.length>m;++m)for(var v=c[m],y=v.bits,g=0;y.length>g;++g){var w=v.name+"_"+y[g];p.push(w),d[w]=v.createMethod(y[g],v.padding)}function b(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;50>n;++n)this.s[n]=0}b.prototype.update=function(t){var e="string"!=typeof t;e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));for(var r,n,i=t.length,a=this.blocks,s=this.byteCount,u=this.blockCount,h=0,l=this.s;i>h;){if(this.reset)for(this.reset=!1,a[0]=this.block,r=1;u+1>r;++r)a[r]=0;if(e)for(r=this.start;i>h&&s>r;++h)a[r>>2]|=t[h]<h&&s>r;++h)128>(n=t.charCodeAt(h))?a[r>>2]|=n<n?(a[r>>2]|=(192|n>>6)<>2]|=(128|63&n)<n||n>=57344?(a[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<r)this.start=r;else{for(this.start=r-s,this.block=a[u],r=0;u>r;++r)l[r]^=a[r];M(l),this.reset=!0}}return this},b.prototype.finalize=function(){var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;r+1>e;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;r>e;++e)n[e]^=t[e];M(n)},b.prototype.toString=b.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,o=this.extraBytes,a=0,s=0,u="";n>s;){for(a=0;e>a&&n>s;++a,++s)u+=i[(t=r[a])>>4&15]+i[15&t]+i[t>>12&15]+i[t>>8&15]+i[t>>20&15]+i[t>>16&15]+i[t>>28&15]+i[t>>24&15];s%e==0&&(M(r),a=0)}return o&&(t=r[a],o>0&&(u+=i[t>>4&15]+i[15&t]),o>1&&(u+=i[t>>12&15]+i[t>>8&15]),o>2&&(u+=i[t>>20&15]+i[t>>16&15])),u},b.prototype.buffer=b.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);n>a;){for(o=0;e>o&&n>a;++o,++a)u[a]=r[o];a%e==0&&M(r)}return i&&(u[o]=r[o],t=t.slice(0,s)),t},b.prototype.digest=b.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];i>s;){for(a=0;r>a&&i>s;++a,++s)u[t=s<<2]=255&(e=n[a]),u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&M(n)}return o&&(t=s<<2,e=n[a],o>0&&(u[t]=255&e),o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u};var M=function(t){var e,r,n,i,o,s,u,h,l,f,c,d,p,m,v,y,g,w,b,M,_,E,N,A,x,C,T,k,I,R,F,O,S,U,P,B,j,D,L,G,z,V,Z,q,H,W,$,J,K,X,Q,Y,tt,et,rt,nt,it,ot,at,st,ut,ht,lt;for(n=0;48>n;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],h=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^((u=t[3]^t[13]^t[23]^t[33]^t[43])<<1|(s=t[2]^t[12]^t[22]^t[32]^t[42])>>>31),t[0]^=e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|u>>>31),t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,r=o^(l<<1|h>>>31),t[2]^=e=i^(h<<1|l>>>31),t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,r=u^(c<<1|f>>>31),t[4]^=e=s^(f<<1|c>>>31),t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,r=l^(p<<1|d>>>31),t[6]^=e=h^(d<<1|p>>>31),t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,r=c^(o<<1|i>>>31),t[8]^=e=f^(i<<1|o>>>31),t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,v=t[1],W=t[11]<<4|t[10]>>>28,$=t[10]<<4|t[11]>>>28,k=t[20]<<3|t[21]>>>29,I=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,V=t[40]<<18|t[41]>>>14,Z=t[41]<<18|t[40]>>>14,U=t[2]<<1|t[3]>>>31,P=t[3]<<1|t[2]>>>31,g=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,K=t[23]<<10|t[22]>>>22,R=t[33]<<13|t[32]>>>19,F=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,B=t[14]<<6|t[15]>>>26,j=t[15]<<6|t[14]>>>26,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Q=t[35]<<15|t[34]>>>17,O=t[45]<<29|t[44]>>>3,S=t[44]<<29|t[45]>>>3,A=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,D=t[26]<<25|t[27]>>>7,L=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,Y=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,q=t[8]<<27|t[9]>>>5,H=t[9]<<27|t[8]>>>5,C=t[18]<<20|t[19]>>>12,T=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,G=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,E=t[48]<<14|t[49]>>>18,N=t[49]<<14|t[48]>>>18,t[0]=(m=t[0])^~(y=t[13]<<12|t[12]>>>20)&(w=t[25]<<11|t[24]>>>21),t[1]=v^~g&b,t[10]=A^~C&k,t[11]=x^~T&I,t[20]=U^~B&D,t[21]=P^~j&L,t[30]=q^~W&J,t[31]=H^~$&K,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=y^~w&M,t[3]=g^~b&_,t[12]=C^~k&R,t[13]=T^~I&F,t[22]=B^~D&G,t[23]=j^~L&z,t[32]=W^~J&X,t[33]=$^~K&Q,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&E,t[5]=b^~_&N,t[14]=k^~R&O,t[15]=I^~F&S,t[24]=D^~G&V,t[25]=L^~z&Z,t[34]=J^~X&Y,t[35]=K^~Q&tt,t[44]=ot^~st&ht,t[45]=at^~ut<,t[6]=M^~E&m,t[7]=_^~N&v,t[16]=R^~O&A,t[17]=F^~S&x,t[26]=G^~V&U,t[27]=z^~Z&P,t[36]=X^~Y&q,t[37]=Q^~tt&H,t[46]=st^~ht&et,t[47]=ut^~lt&rt,t[8]=E^~m&y,t[9]=N^~v&g,t[18]=O^~A&C,t[19]=S^~x&T,t[28]=V^~U&B,t[29]=Z^~P&j,t[38]=Y^~q&W,t[39]=tt^~H&$,t[48]=ht^~et&nt,t[49]=lt^~rt&it,t[0]^=a[n],t[1]^=a[n+1]};if(n)t.exports=d;else for(m=0;p.length>m;++m)r[p[m]]=d[p[m]]}()})),m=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.keccak256=function(t){return"0x"+p.keccak_256(a.arrayify(t))}}));r(m);var v=n((function(t,r){var n=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var i=n(o),s=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),u=/^((.*)\.)?([^.]+)$/,h=/^[a-z0-9.-]*$/;r.namehash=function(t){"string"!=typeof t&&i.throwError("invalid address - "+t,i.INVALID_ARGUMENT,{argument:"name",value:t}),(t=t.toLowerCase()).match(h)||i.throwError("contains invalid UseSTD3ASCIIRules characters",i.INVALID_ARGUMENT,{argument:"name",value:t});for(var e=s;t.length;){var r=t.match(u),n=d.toUtf8Bytes(r[3]);e=m.keccak256(a.concat([e,m.keccak256(n)])),t=r[2]||""}return a.hexlify(e)},r.id=function(t){return m.keccak256(d.toUtf8Bytes(t))},r.hashMessage=function(t){return m.keccak256(a.concat([d.toUtf8Bytes("Ethereum Signed Message:\n"),d.toUtf8Bytes(t.length+""),"string"==typeof t?d.toUtf8Bytes(t):t]))}}));r(v);var y=v.id,g=function(t,e,r,n,i,o,a,s){if(!t){var u;if(void 0===e)u=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[r,n,i,o,a,s],l=0;(u=Error(e.replace(/%s/g,(function(){return h[l++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}},w=n((function(t,r){var n=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:e);!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t+=""),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t+=""),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function c(t){this.map={},t instanceof c?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function m(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=""+t:a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=Array(e.length),n=0;e.length>n;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,e){t=h(t),e=l(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},c.prototype.delete=function(t){delete this.map[h(t)]},c.prototype.get=function(t){return t=h(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(h(t))},c.prototype.set=function(t,e){this.map[h(t)]=l(e)},c.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),f(t)},c.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(t)},n&&(c.prototype[Symbol.iterator]=c.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,n,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=t+"";if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=(n=(r=e.method||this.method||"GET").toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function M(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&300>this.status,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},M.error=function(){var t=new M(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];M.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new M(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e,this.stack=Error(t).stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,o){var a=new w(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL"),n(new M("response"in s?s.response:s.responseText,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=c,t.Request=w,t.Response=M),e.Headers=c,e.Request=w,e.Response=M,e.fetch=E}({})}(n),delete n.fetch.polyfill,(r=n.fetch).default=n.fetch,r.fetch=n.fetch,r.Headers=n.Headers,r.Request=n.Request,r.Response=n.Response,t.exports=r})),b=n((function(t,e){function r(t){for(var e=[];t;)e.unshift(255&t),t>>=8;return e}function n(t,e,r){for(var n=0,i=0;r>i;i++)n=256*n+t[e+i];return n}function i(t,e,r,n){for(var i=[];e+1+n>r;){var a=o(t,r);if(i.push(a.result),(r+=a.consumed)>e+1+n)throw Error("invalid rlp")}return{consumed:1+n,result:i}}function o(t,e){if(0===t.length)throw Error("invalid rlp data");if(t[e]>=248){if(e+1+(r=t[e]-247)>t.length)throw Error("too short");if(e+1+r+(o=n(t,e+1,r))>t.length)throw Error("to short");return i(t,e,e+1+r,r+o)}if(t[e]>=192){if(e+1+(o=t[e]-192)>t.length)throw Error("invalid rlp data");return i(t,e,e+1,o)}if(t[e]>=184){var r;if(e+1+(r=t[e]-183)>t.length)throw Error("invalid rlp data");if(e+1+r+(o=n(t,e+1,r))>t.length)throw Error("invalid rlp data");return{consumed:1+r+o,result:a.hexlify(t.slice(e+1+r,e+1+r+o))}}if(t[e]>=128){var o;if(e+1+(o=t[e]-128)>t.length)throw Error("invlaid rlp data");return{consumed:1+o,result:a.hexlify(t.slice(e+1,e+1+o))}}return{consumed:1,result:a.hexlify(t[e])}}Object.defineProperty(e,"__esModule",{value:!0}),e.encode=function(t){return a.hexlify(function t(e){if(Array.isArray(e)){var n=[];return e.forEach((function(e){n=n.concat(t(e))})),n.length>55?((i=r(n.length)).unshift(247+i.length),i.concat(n)):(n.unshift(192+n.length),n)}var i,o=Array.prototype.slice.call(a.arrayify(e));return 1!==o.length||o[0]>127?o.length>55?((i=r(o.length)).unshift(183+i.length),i.concat(o)):(o.unshift(128+o.length),o):o}(t))},e.decode=function(t){var e=a.arrayify(t),r=o(e,0);if(r.consumed!==e.length)throw Error("invalid rlp data");return r.result}}));r(b);var M=n((function(t,r){var n=e&&e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(h);function s(t){"string"==typeof t&&t.match(/^0x[0-9A-Fa-f]{40}$/)||o.throwError("invalid address",o.INVALID_ARGUMENT,{arg:"address",value:t});for(var e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;40>n;n++)r[n]=e[n].charCodeAt(0);r=a.arrayify(m.keccak256(r));for(var i=0;40>i;i+=2)8>r[i>>1]>>4||(e[i]=e[i].toUpperCase()),8>(15&r[i>>1])||(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}for(var u={},l=0;10>l;l++)u[l+""]=l+"";for(l=0;26>l;l++)u[String.fromCharCode(65+l)]=10+l+"";var f,c=Math.floor((f=9007199254740991,Math.log10?Math.log10(f):Math.log(f)/Math.LN10));function d(t){t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00";var e="";for(t.split("").forEach((function(t){e+=u[t]}));e.length>=c;){var r=e.substring(0,c);e=parseInt(r,10)%97+e.substring(r.length)}for(var n=98-parseInt(e,10)%97+"";2>n.length;)n="0"+n;return n}function p(t){var e=null;if("string"!=typeof t&&o.throwError("invalid address",o.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=s(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&o.throwError("bad address checksum",o.INVALID_ARGUMENT,{arg:"address",value:t});else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==d(t)&&o.throwError("bad icap checksum",o.INVALID_ARGUMENT,{arg:"address",value:t}),e=new i.default.BN(t.substring(4),36).toString(16);40>e.length;)e="0"+e;e=s("0x"+e)}else o.throwError("invalid address",o.INVALID_ARGUMENT,{arg:"address",value:t});return e}r.getAddress=p,r.getIcapAddress=function(t){for(var e=new i.default.BN(p(t).substring(2),16).toString(36).toUpperCase();30>e.length;)e="0"+e;return"XE"+d("XE00"+e)+e},r.getContractAddress=function(t){if(!t.from)throw Error("missing from address");var e=t.nonce;return p("0x"+m.keccak256(b.encode([p(t.from),a.stripZeros(a.hexlify(e))])).substring(26))}}));r(M);var _=n((function(t,r){var n,i=e&&e.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=e&&e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(r,"__esModule",{value:!0});var u=s(o),h=RegExp(/^bytes([0-9]*)$/),p=RegExp(/^(u?int)([0-9]*)$/),m=RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(t,e){var r=t.match(p);return r&&48>=parseInt(r[2])?e.toNumber():e};var v=/^([^)(]*)\((.*)\)([^)(]*)$/,y=/^[A-Za-z_][A-Za-z0-9_]*$/;function g(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}function w(t,e){var r=t;function n(t){throw Error('unexpected character "'+r[t]+'" at position '+t+' in "'+r+'"')}t=t.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,a=0;t.length>a;a++){var s=t[a];switch(s){case"(":o.state.allowParams||n(a),o.state.allowType=!1,o.type=g(o.type),o.components=[{type:"",name:"",parent:o,state:{allowType:!0}}],o=o.components[0];break;case")":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=g(o.type);var u=o;(o=o.parent)||n(a),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=g(o.type);var h={type:"",name:"",parent:o.parent,state:{allowType:!0}};o.parent.components.push(h),delete o.parent,o=h;break;case" ":o.state.allowType&&""!==o.type&&(o.type=g(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&(e&&"indexed"===o.name?(o.indexed=!0,o.name=""):o.state.allowName=!1);break;case"[":o.state.allowArray||n(a),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(a),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(a)}}if(o.parent)throw Error("unexpected eof");return delete i.state,e&&"indexed"===o.name&&(o.indexed=!0,o.name=""),i.type=g(i.type),i}function b(t){return G(r.defaultCoerceFunc,t).type}r.parseParamType=function(t){return w(t,!0)},r.formatParamType=b,r.formatSignature=function(t){return t.name+"("+t.inputs.map((function(t){return b(t)})).join(",")+")"},r.parseSignature=function(t){if("string"==typeof t)return"event "===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).substring(0,6)?function(t){var e={anonymous:!1,inputs:[],name:"",type:"event"},r=t.match(v);if(!r)throw Error("invalid event: "+t);if(e.name=r[1].trim(),D(r[2]).forEach((function(t){(t=w(t,!0)).indexed=!!t.indexed,e.inputs.push(t)})),r[3].split(" ").forEach((function(t){switch(t){case"anonymous":e.anonymous=!0;break;case"":break;default:u.info("unknown modifier: "+t)}})),e.name&&!e.name.match(y))throw Error('invalid identifier: "'+e.name+'"');return e}(t.substring(6).trim()):("function "===t.substring(0,9)&&(t=t.substring(9)),function(t){var e={constant:!1,gas:null,inputs:[],name:"",outputs:[],payable:!1,stateMutability:null,type:"function"},r=t.split("@");if(1!==r.length){if(r.length>2)throw Error("invalid signature");if(!r[1].match(/^[0-9]+$/))throw Error("invalid signature gas");e.gas=f.bigNumberify(r[1]),t=r[0]}var n=(r=t.split(" returns "))[0].match(v);if(!n)throw Error("invalid signature");if(e.name=n[1].trim(),!e.name.match(y))throw Error('invalid identifier: "'+n[1]+'"');if(D(n[2]).forEach((function(t){e.inputs.push(w(t))})),n[3].split(" ").forEach((function(t){switch(t){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:u.info("unknown modifier: "+t)}})),r.length>1){var i=r[1].match(v);if(""!=i[1].trim()||""!=i[3].trim())throw Error("unexpected tokens");D(i[2]).forEach((function(t){e.outputs.push(w(t))}))}if("constructor"===e.name){if(e.type="constructor",e.outputs.length)throw Error("constructor may not have outputs");delete e.name,delete e.outputs}return e}(t.trim()));throw Error("unknown signature")};var _=function(t,e,r,n,i){this.coerceFunc=t,this.name=e,this.type=r,this.localName=n,this.dynamic=i},E=function(t){function e(e){var r=t.call(this,e.coerceFunc,e.name,e.type,void 0,e.dynamic)||this;return l.defineReadOnly(r,"coder",e),r}return i(e,t),e.prototype.encode=function(t){return this.coder.encode(t)},e.prototype.decode=function(t,e){return this.coder.decode(t,e)},e}(_),N=function(t){function e(e,r){return t.call(this,e,"null","",r,!1)||this}return i(e,t),e.prototype.encode=function(t){return a.arrayify([])},e.prototype.decode=function(t,e){if(e>t.length)throw Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},e}(_),A=function(t){function e(e,r,n,i){var o=this,a=(n?"int":"uint")+8*r;return(o=t.call(this,e,a,a,i,!1)||this).size=r,o.signed=n,o}return i(e,t),e.prototype.encode=function(t){try{var e=f.bigNumberify(t);if(this.signed){var r=c.MaxUint256.maskn(8*this.size-1);if(e.gt(r))throw Error("out-of-bounds");if(r=r.add(c.One).mul(c.NegativeOne),e.lt(r))throw Error("out-of-bounds")}else if(e.lt(c.Zero)||e.gt(c.MaxUint256.maskn(8*this.size)))throw Error("out-of-bounds");return e=e.toTwos(8*this.size).maskn(8*this.size),this.signed&&(e=e.fromTwos(8*this.size).toTwos(256)),a.padZeros(a.arrayify(e),32)}catch(e){u.throwError("invalid number value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t})}return null},e.prototype.decode=function(t,e){e+32>t.length&&u.throwError("insufficient data for "+this.name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:a.hexlify(t.slice(e,e+32))});var r=f.bigNumberify(t.slice(e+(32-this.size),e+32));return r=this.signed?r.fromTwos(8*this.size):r.maskn(8*this.size),{consumed:32,value:this.coerceFunc(this.name,r)}},e}(_),x=new A((function(t,e){return e}),32,!1,"none"),C=function(t){function e(e,r){return t.call(this,e,"bool","bool",r,!1)||this}return i(e,t),e.prototype.encode=function(t){return x.encode(t?1:0)},e.prototype.decode=function(t,e){try{var r=x.decode(t,e)}catch(t){throw"insufficient data for uint256 type"===t.reason&&u.throwError("insufficient data for boolean type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"boolean",value:t.value}),t}return{consumed:r.consumed,value:this.coerceFunc("bool",!r.value.isZero())}},e}(_),T=function(t){function e(e,r,n){var i=this,o="bytes"+r;return(i=t.call(this,e,o,o,n,!1)||this).length=r,i}return i(e,t),e.prototype.encode=function(t){var e=new Uint8Array(32);try{var r=a.arrayify(t);if(r.length!==this.length)throw Error("incorrect data length");e.set(r)}catch(e){u.throwError("invalid "+this.name+" value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e.value||t})}return e},e.prototype.decode=function(t,e){return e+32>t.length&&u.throwError("insufficient data for "+name+" type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:a.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc(this.name,a.hexlify(t.slice(e,e+this.length)))}},e}(_),k=function(t){function e(e,r){return t.call(this,e,"address","address",r,!1)||this}return i(e,t),e.prototype.encode=function(t){var e=new Uint8Array(32);try{e.set(a.arrayify(M.getAddress(t)),12)}catch(e){u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:t})}return e},e.prototype.decode=function(t,e){return e+32>t.length&&u.throwError("insufficuent data for address type",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:a.hexlify(t.slice(e,e+32))}),{consumed:32,value:this.coerceFunc("address",M.getAddress(a.hexlify(t.slice(e+12,e+32))))}},e}(_);function I(t){var e=new Uint8Array(32*Math.ceil(t.length/32)-t.length);return a.concat([x.encode(t.length),t,e])}function R(t,e,r){e+32>t.length&&u.throwError("insufficient data for dynamicBytes length",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:a.hexlify(t.slice(e,e+32))});var n=x.decode(t,e).value;try{n=n.toNumber()}catch(t){u.throwError("dynamic bytes count too large",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:""+n})}return e+32+n>t.length&&u.throwError("insufficient data for dynamicBytes type",u.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:a.hexlify(t.slice(e,e+32+n))}),{consumed:32+32*Math.ceil(n/32),value:t.slice(e+32,e+32+n)}}var F=function(t){function e(e,r){return t.call(this,e,"bytes","bytes",r,!0)||this}return i(e,t),e.prototype.encode=function(t){try{return I(a.arrayify(t))}catch(t){u.throwError("invalid bytes value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"bytes",value:t.value})}return null},e.prototype.decode=function(t,e){var r=R(t,e,this.localName);return r.value=this.coerceFunc("bytes",a.hexlify(r.value)),r},e}(_),O=function(t){function e(e,r){return t.call(this,e,"string","string",r,!0)||this}return i(e,t),e.prototype.encode=function(t){return"string"!=typeof t&&u.throwError("invalid string value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"string",value:t}),I(d.toUtf8Bytes(t))},e.prototype.decode=function(t,e){var r=R(t,e,this.localName);return r.value=this.coerceFunc("string",d.toUtf8String(r.value)),r},e}(_);function S(t){return 32*Math.ceil(t/32)}function U(t,e){if(Array.isArray(e));else if(e&&"object"==typeof e){var r=[];t.forEach((function(t){r.push(e[t.localName])})),e=r}else u.throwError("invalid tuple value",u.INVALID_ARGUMENT,{coderType:"tuple",value:e});t.length!==e.length&&u.throwError("types/value length mismatch",u.INVALID_ARGUMENT,{coderType:"tuple",value:e});var n=[];t.forEach((function(t,r){n.push({dynamic:t.dynamic,value:t.encode(e[r])})}));var i=0,o=0;n.forEach((function(t){t.dynamic?(i+=32,o+=S(t.value.length)):i+=S(t.value.length)}));var a=0,s=i,h=new Uint8Array(i+o);return n.forEach((function(t){t.dynamic?(h.set(x.encode(s),a),a+=32,h.set(t.value,s),s+=S(t.value.length)):(h.set(t.value,a),a+=S(t.value.length))})),h}function P(t,e,r){var n=r,i=0,o=[];return t.forEach((function(t){if(t.dynamic){var a=x.decode(e,r);(s=t.decode(e,n+a.value.toNumber())).consumed=a.consumed}else var s=t.decode(e,r);null!=s.value&&o.push(s.value),r+=s.consumed,i+=s.consumed})),t.forEach((function(t,e){var r=t.localName;r&&("length"===r&&(r="_length"),null==o[r]&&(o[r]=o[e]))})),{value:o,consumed:i}}var B=function(t){function e(e,r,n,i){var o=this;return(o=t.call(this,e,"array",r.type+"["+(0>n?"":n)+"]",i,-1===n||r.dynamic)||this).coder=r,o.length=n,o}return i(e,t),e.prototype.encode=function(t){Array.isArray(t)||u.throwError("expected array value",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t});var e=this.length,r=new Uint8Array(0);-1===e&&(r=x.encode(e=t.length)),u.checkArgumentCount(e,t.length," in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;t.length>i;i++)n.push(this.coder);return a.concat([r,U(n,t)])},e.prototype.decode=function(t,e){var r=0,n=this.length;if(-1===n){try{var i=x.decode(t,e)}catch(t){u.throwError("insufficient data for dynamic array length",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:t.value})}try{n=i.value.toNumber()}catch(t){u.throwError("array count too large",u.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:""+i.value})}r+=i.consumed,e+=i.consumed}for(var o=[],a=0;n>a;a++)o.push(new E(this.coder));var s=P(o,t,e);return s.consumed+=r,s.value=this.coerceFunc(this.type,s.value),s},e}(_),j=function(t){function e(e,r,n){var i=this,o=!1,a=[];r.forEach((function(t){t.dynamic&&(o=!0),a.push(t.type)}));var s="tuple("+a.join(",")+")";return(i=t.call(this,e,"tuple",s,n,o)||this).coders=r,i}return i(e,t),e.prototype.encode=function(t){return U(this.coders,t)},e.prototype.decode=function(t,e){var r=P(this.coders,t,e);return r.value=this.coerceFunc(this.type,r.value),r},e}(_);function D(t){t=t.trim();for(var e=[],r="",n=0,i=0;t.length>i;i++){var o=t[i];if(","===o&&0===n)e.push(r),r="";else if(r+=o,"("===o)n++;else if(")"===o&&-1===--n)throw Error("unbalanced parenthsis")}return r&&e.push(r),e}var L={address:k,bool:C,string:O,bytes:F};function G(t,e){var r,n=L[e.type];if(n)return new n(t,e.name);if(r=e.type.match(p))return(0===(i=parseInt(r[2]||"256"))||i>256||i%8!=0)&&u.throwError("invalid "+r[1]+" bit length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new A(t,i/8,"int"===r[1],e.name);if(r=e.type.match(h))return(0===(i=parseInt(r[1]))||i>32)&&u.throwError("invalid bytes length",u.INVALID_ARGUMENT,{arg:"param",value:e}),new T(t,i,e.name);if(r=e.type.match(m)){var i=parseInt(r[2]||"-1");return(e=l.shallowCopy(e)).type=r[1],e=l.deepCopy(e),new B(t,G(t,e),i,e.name)}return"tuple"===e.type.substring(0,5)?function(t,e,r){e||(e=[]);var n=[];return e.forEach((function(e){n.push(G(t,e))})),new j(t,n,r)}(t,e.components,e.name):""===e.type?new N(t,e.name):(u.throwError("invalid type",u.INVALID_ARGUMENT,{arg:"type",value:e.type}),null)}var z=function(){function t(e){u.checkNew(this,t),e||(e=r.defaultCoerceFunc),l.defineReadOnly(this,"coerceFunc",e)}return t.prototype.encode=function(t,e){t.length!==e.length&&u.throwError("types/values length mismatch",u.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});var r=[];return t.forEach((function(t){var e=null;e="string"==typeof t?w(t):t,r.push(G(this.coerceFunc,e))}),this),a.hexlify(new j(this.coerceFunc,r,"_").encode(e))},t.prototype.decode=function(t,e){var r=[];return t.forEach((function(t){var e=null;e="string"==typeof t?w(t):l.deepCopy(t),r.push(G(this.coerceFunc,e))}),this),new j(this.coerceFunc,r,"_").decode(a.arrayify(e),0).value},t}();r.AbiCoder=z,r.defaultAbiCoder=new z}));r(_);var E=_.defaultAbiCoder,N=1e3,A=6e4,x=36e5,C=24*x,T=function(t,e){e=e||{};var r=typeof t;if("string"===r&&t.length>0)return function(t){if((t+="").length>100)return;var e=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*C;case"hours":case"hour":case"hrs":case"hr":case"h":return r*x;case"minutes":case"minute":case"mins":case"min":case"m":return r*A;case"seconds":case"second":case"secs":case"sec":case"s":return r*N;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(t);if("number"===r&&!1===isNaN(t))return e.long?function(t){var e=Math.abs(t);if(e>=C)return k(t,e,C,"day");if(e>=x)return k(t,e,x,"hour");if(e>=A)return k(t,e,A,"minute");if(e>=N)return k(t,e,N,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=C)return Math.round(t/C)+"d";if(e>=x)return Math.round(t/x)+"h";if(e>=A)return Math.round(t/A)+"m";if(e>=N)return Math.round(t/N)+"s";return t+"ms"}(t);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function k(t,e,r,n){var i=e>=1.5*r;return Math.round(t/r)+" "+n+(i?"s":"")}var I=function(t){function e(t){let e=0;for(let r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return r.colors[Math.abs(e)%r.colors.length]}function r(t){let o;function a(...t){if(!a.enabled)return;const e=a,n=Number(new Date);e.diff=n-(o||n),e.prev=o,e.curr=n,o=n,t[0]=r.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let i=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(n,o)=>{if("%%"===n)return n;i++;const a=r.formatters[o];if("function"==typeof a){n=a.call(e,t[i]),t.splice(i,1),i--}return n}),r.formatArgs.call(e,t),(e.log||r.log).apply(e,t)}return a.namespace=t,a.enabled=r.enabled(t),a.useColors=r.useColors(),a.color=e(t),a.destroy=n,a.extend=i,"function"==typeof r.init&&r.init(a),r.instances.push(a),a}function n(){const t=r.instances.indexOf(this);return-1!==t&&(r.instances.splice(t,1),!0)}function i(t,e){const n=r(this.namespace+(void 0===e?":":e)+t);return n.log=this.log,n}function o(t){return(""+t).substring(2,(""+t).length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},r.disable=function(){const t=[...r.names.map(o),...r.skips.map(o).map(t=>"-"+t)].join(",");return r.enable(""),t},r.enable=function(t){let e;r.save(t),r.names=[],r.skips=[];const n=("string"==typeof t?t:"").split(/[\s,]+/),i=n.length;for(e=0;i>e;e++)n[e]&&("-"===(t=n[e].replace(/\*/g,".*?"))[0]?r.skips.push(RegExp("^"+t.substr(1)+"$")):r.names.push(RegExp("^"+t+"$")));for(e=0;r.instances.length>e;e++){const t=r.instances[e];t.enabled=r.enabled(t.namespace)}},r.enabled=function(t){if("*"===t[t.length-1])return!0;let e,n;for(e=0,n=r.skips.length;n>e;e++)if(r.skips[e].test(t))return!1;for(e=0,n=r.names.length;n>e;e++)if(r.names[e].test(t))return!0;return!1},r.humanize=T,Object.keys(t).forEach(e=>{r[e]=t[e]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=e,r.enable(r.load()),r},R=n((function(t,e){e.log=function(...t){return"object"==typeof console&&console.log&&console.log(...t)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(n++,"%c"===t&&(i=n))}),e.splice(i,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=I(e);const{formatters:r}=t.exports;r.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}})),F=R("multicall");function O(t){return t.replace(/^0x/,"")}function S(t,e){return E.encode(t,e)}function U(t,e){return E.decode(t,"0x"+e.replace(/0x/i,""))}function P(t){return Array.isArray(t)?0===t.length:!t||0===Object.keys(t).length}var B="object"==typeof self&&self&&self.Object===Object&&self,j="object"==typeof e&&e&&e.Object===Object&&e||B||Function("return this")(),D=j.Symbol,L=Object.prototype,G=L.hasOwnProperty,z=L.toString,V=D?D.toStringTag:void 0;var Z=function(t){var e=G.call(t,V),r=t[V];try{t[V]=void 0;var n=!0}catch(t){}var i=z.call(t);return n&&(e?t[V]=r:delete t[V]),i},q=Object.prototype.toString;var H=function(t){return q.call(t)},W=D?D.toStringTag:void 0;var $=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":W&&W in Object(t)?Z(t):H(t)};var J=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var K,X=function(t){if(!J(t))return!1;var e=$(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Q=j["__core-js_shared__"],Y=(K=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"";var tt=function(t){return!!Y&&Y in t},et=Function.prototype.toString;var rt=function(t){if(null!=t){try{return et.call(t)}catch(t){}try{return t+""}catch(t){}}return""},nt=/^\[object .+?Constructor\]$/,it=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ot=function(t){return!(!J(t)||tt(t))&&(X(t)?it:nt).test(rt(t))};var at=function(t,e){return null==t?void 0:t[e]};var st=function(t,e){var r=at(t,e);return ot(r)?r:void 0},ut=st(Object,"create");var ht=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},lt=Object.prototype.hasOwnProperty;var ft=function(t){var e=this.__data__;if(ut){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return lt.call(e,t)?e[t]:void 0},ct=Object.prototype.hasOwnProperty;var dt=function(t){var e=this.__data__;return ut?void 0!==e[t]:ct.call(e,t)};var pt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ut&&void 0===e?"__lodash_hash_undefined__":e,this};function mt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=0&&(r==e.length-1?e.pop():wt.call(e,r,1),--this.size,!0)};var Mt=function(t){var e=this.__data__,r=gt(e,t);return 0>r?void 0:e[r][1]};var _t=function(t){return gt(this.__data__,t)>-1};var Et=function(t,e){var r=this.__data__,n=gt(r,t);return 0>n?(++this.size,r.push([t,e])):r[n][1]=e,this};function Nt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e0?O(S(e.map((function(t){return t[1]})),e.map((function(t){return t[0]})))):"")]}))];return S([{components:[{type:"address"},{type:"bytes"}],name:"data",type:"tuple[]"}],e)}),(function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return JSON.stringify(e)}));async function Dt(t,e){var r=(t=Array.isArray(t)?t:[t]).reduce((function(t,e){var r=e.returns,n=e.call.slice(1);if(n.length>0)for(var i=Array.isArray(a=r),o=0,a=i?a:a[Symbol.iterator]();;){var s;if(i){if(o>=a.length)break;s=a[o++]}else{if((o=a.next()).done)break;s=o.value}t[s[0]]=n}return t}),{});t=t.map((function(t){var r=t.call,n=t.target,i=t.returns;n||(n=e.multicallAddress);var o=r[0],a=r.slice(1),s=o.match(Pt).map((function(t){return t.slice(1,-1)})),u=s[1],h=s[0].split(",").filter((function(t){return!!t}));g(h.length===a.length,"Every method argument must have exactly one type.\n Comparing argument types "+JSON.stringify(h)+"\n to argument values "+JSON.stringify(a)+".\n ");var l=a.map((function(t,e){return[t,h[e]]})),f=u?u.split(","):[];return{method:o.match(Bt)[0],args:l,returnTypes:f,target:n,returns:i}}));var n=jt(t,!1),i=await async function(t,e){var r=e.id,n=e.web3,i=e.ethers,o=e.provider,a=e.rpcUrl,s=e.block,u=e.multicallAddress,h=e.ws,l=e.wsResponseTimeout,f="0x252dba42"+O(t);if(h)return F("Sending via WebSocket"),new Promise((function(t,e){function n(e){"string"!=typeof e&&(e=e.data);var n=JSON.parse(e);n.id&&n.id===r&&(F("Got WebSocket response id #%d",n.id),clearTimeout(i),h.onmessage=null,t(n.result))}h.send(JSON.stringify({jsonrpc:"2.0",method:"eth_call",params:[{to:u,data:f},s||"latest"],id:r}));var i=setTimeout((function(){h.onmessage===n&&(h.onmessage=null,e(Error("WebSocket response timeout")))}),l);h.onmessage=n}));if(i)return F("Sending via ethers provider"),i.send({method:"eth_call",params:[{to:u,data:f},s||"latest"]});if(o)return F("Sending via EIP-1193 provider"),o.request({method:"eth_call",params:[{to:u,data:f},s||"latest"]});if(n)return F("Sending via web3 provider"),n.eth.call({to:u,data:f});F("Sending via XHR fetch");var c=await w(a,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"eth_call",params:[{to:u,data:f},s||"latest"],id:1})}),d=await c.json();if(!d||!d.result)throw Error("Multicall received an empty response. Check your call configuration for errors.");return d.result}(n,e),o=t.map((function(t){return t.returnTypes})).reduce((function(t,e){return t.concat(e)}),[]),a=t.map((function(t){return t.returns})).reduce((function(t,e){return t.concat(e)}),[]);g(o.length===a.length,"Missing data needed to parse results");for(var s=U(["uint256","bytes[]"],i),u=s.shift(),h=s.reduce((function(e,r){return r.forEach((function(r,n){var i=t[n].returnTypes,o=U(i,r);e.push.apply(e,o.map((function(t,e){return"bool"===i[e]?""+t=="true":t})))})),e}),[]),l={blockNumber:u,original:{},transformed:{}},f=0;h.length>f;f++){var c=a[f],d=c[0],p=c[1];l.original[d]=h[f],l.transformed[d]=void 0!==p?p(h[f]):h[f]}return{results:l,keyToArgMap:r}}function Lt(){return(Lt=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var Gt=null;"undefined"!=typeof WebSocket?Gt=WebSocket:"undefined"!=typeof MozWebSocket?Gt=MozWebSocket:void 0!==e?Gt=e.WebSocket||e.MozWebSocket:"undefined"!=typeof window?Gt=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(Gt=self.WebSocket||self.MozWebSocket);var zt=Gt,Vt={mainnet:{multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",rpcUrl:"https://mainnet.infura.io"},kovan:{multicall:"0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a",rpcUrl:"https://kovan.infura.io"},rinkeby:{multicall:"0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821",rpcUrl:"https://rinkeby.infura.io"},goerli:{multicall:"0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",rpcUrl:"https://rpc.slock.it/goerli"},xdai:{multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpcUrl:"https://dai.poa.network"}},Zt=R("multicall"),qt=/^wss?:\/\//i;function Ht(t){if(void 0!==(t=Lt({interval:1e3,staleBlockRetryWait:3e3,errorRetryWait:5e3,wsResponseTimeout:5e3,wsReconnectTimeout:5e3},t)).preset){if(void 0===Vt[t.preset])throw Error("Unknown preset "+t.preset);t.multicallAddress=Vt[t.preset].multicall,t.rpcUrl=Vt[t.preset].rpcUrl}return t}t.aggregate=Dt,t.createWatcher=function(t,e){var r={model:[].concat(t),store:{},storeTransformed:{},keyToArgMap:{},latestPromiseId:0,latestBlockNumber:null,id:0,listeners:{subscribe:[],block:[],poll:[],error:[]},handler:null,wsReconnectHandler:null,watching:!1,config:Ht(e),ws:null};function n(t){clearTimeout(r.handler),r.handler=null,clearTimeout(r.wsReconnectHandler),r.wsReconnectHandler=setTimeout((function(){o(),i()}),t)}function i(){qt.test(r.config.rpcUrl)&&(Zt("Connecting to WebSocket "+r.config.rpcUrl+"..."),r.ws=new zt(r.config.rpcUrl),r.ws.onopen=function(){if(Zt("WebSocket connected"),r.handler)throw Error("Existing poll setTimeout handler set");r.watching&&s.call({state:r,interval:0,resolveFetchPromise:r.initialFetchResolver})},r.ws.onclose=function(t){Zt("WebSocket closed: %s",JSON.stringify(t)),Zt("Reconnecting in "+r.config.wsReconnectTimeout/1e3+" seconds."),n(r.config.wsReconnectTimeout)},r.ws.onerror=function(t){Zt("WebSocket error: %s",JSON.stringify(t)),Zt("Reconnecting in "+r.config.wsReconnectTimeout/1e3+" seconds."),n(r.config.wsReconnectTimeout)})}function o(){Zt("destroyWebSocket()"),r.ws.onopen=null,r.ws.onclose=null,r.ws.onerror=null,r.ws.onmessage=null,r.ws.close()}function a(t,e,n){if(void 0===n&&(n=!1),!P(r.storeTransformed)){var i=Object.entries(r.storeTransformed).map((function(t){var e=t[0];return{type:e,value:t[1],args:r.keyToArgMap[e]||[]}}));n?t(i):i.forEach(t)}r.listeners.subscribe.push({listener:t,id:e,batch:n})}function s(){var t=this,e=void 0!==this.interval?this.interval:this.state.config.interval;Zt("poll() called, %s%s","interval: "+e,this.retry?", retry: "+this.retry:""),this.state.handler=setTimeout((async function(){try{if(!t.state.handler)return;t.state.latestPromiseId++;var e=t.state.latestPromiseId;r.listeners.poll.forEach((function(r){return(0,r.listener)(Lt({id:e,latestBlockNumber:t.state.latestBlockNumber},t.retry?{retry:t.retry}:{}))}));var n=await Dt(t.state.model,Lt({},t.state.config,{ws:t.state.ws,id:t.state.latestPromiseId})),i=n.results,o=i.blockNumber,a=Lt({},i.original),u=Lt({},i.transformed),h=n.keyToArgMap;if(t.state.cancelPromiseId===e)return;if("function"==typeof t.resolveFetchPromise&&t.resolveFetchPromise(),null!==t.state.latestBlockNumber&&t.state.latestBlockNumber>o)Zt("Stale block returned, retrying in "+t.state.config.staleBlockRetryWait/1e3+" seconds"),s.call({state:t.state,interval:t.state.config.staleBlockRetryWait,retry:t.retry?t.retry+1:1});else{(null===t.state.latestBlockNumber||null!==t.state.latestBlockNumber&&o>t.state.latestBlockNumber)&&(t.state.latestBlockNumber=parseInt(o),r.listeners.block.forEach((function(e){return(0,e.listener)(t.state.latestBlockNumber)})));var l=Object.entries(a).filter((function(e){return function(t,e,r){return void 0===r[t]||(null!==e&&null!==r[t]&&"object"==typeof e&&"function"==typeof e.toString&&"object"==typeof r[t]&&"function"==typeof r[t].toString?""+e!=""+r[t]:e!==r[t])}(e[0],e[1],t.state.store)})).map((function(t){var e=t[0];return{type:e,value:u[e],args:h[e]||[]}}));t.state.store=Lt({},a),t.state.storeTransformed=Lt({},u),t.state.keyToArgMap=Lt({},h),function(t){P(t)||r.listeners.subscribe.forEach((function(e){var r=e.listener;return e.batch?r(t):t.forEach(r)}))}(l),s.call({state:t.state})}}catch(e){if(Zt("Error: %s",e.message),r.listeners.error.forEach((function(r){return(0,r.listener)(e,t.state)})),!t.state.handler)return;Zt("Error occured, retrying in "+t.state.config.errorRetryWait/1e3+" seconds"),s.call({state:t.state,interval:t.state.config.errorRetryWait,retry:t.retry?t.retry+1:1})}}),e)}return i(),r.initialFetchPromise=new Promise((function(t){r.initialFetchResolver=t})),{tap:function(t){Zt("watcher.tap() called");var e=t([].concat(r.model));return r.model=[].concat(e),this.poll()},poll:function(){var t;Zt("watcher.poll() called");var e=new Promise((function(e){t=e}));return!r.watching||r.ws&&r.ws.readyState!==zt.OPEN?Promise.resolve():(clearTimeout(r.handler),r.handler=null,s.call({state:r,interval:0,resolveFetchPromise:t}),e)},subscribe:function(t){var e=r.id++;return a(t,e,!1),{unsub:function(){r.listeners.subscribe=r.listeners.subscribe.filter((function(t){return t.id!==e}))}}},batch:function(){return{subscribe:function(t){var e=r.id++;return a(t,e,!0),{unsub:function(){r.listeners.subscribe=r.listeners.subscribe.filter((function(t){return t.id!==e}))}}}}},onNewBlock:function(t){var e=r.id++;return r.latestBlockNumber&&t(r.latestBlockNumber),r.listeners.block.push({listener:t,id:e}),{unsub:function(){r.listeners.block=r.listeners.block.filter((function(t){return t.id!==e}))}}},onPoll:function(t){var e=r.id++;return r.listeners.poll.push({listener:t,id:e}),{unsub:function(){r.listeners.poll=r.listeners.poll.filter((function(t){return t.id!==e}))}}},onError:function(t){var e=r.id++;return r.listeners.error.push({listener:t,id:e}),{unsub:function(){r.listeners.error=r.listeners.error.filter((function(t){return t.id!==e}))}}},start:function(){return Zt("watcher.start() called"),r.watching=!0,r.ws&&r.ws.readyState!==zt.OPEN||s.call({state:r,interval:0,resolveFetchPromise:r.initialFetchResolver}),r.initialFetchPromise},stop:function(){Zt("watcher.stop() called"),clearTimeout(r.handler),r.handler=null,clearTimeout(r.wsReconnectHandler),r.wsReconnectHandler=null,r.watching=!1},recreate:function(t,e){if(Zt("watcher.recreate() called"),clearTimeout(r.handler),r.handler=null,clearTimeout(r.wsReconnectHandler),r.wsReconnectHandler=null,r.ws&&o(),r.ws=null,r.config=Ht(e),r.model=[].concat(t),r.store={},r.storeTransformed={},r.latestBlockNumber=null,r.cancelPromiseId=r.latestPromiseId,i(),r.watching&&!r.ws){var n,a=new Promise((function(t){n=t}));return s.call({state:r,interval:0,resolveFetchPromise:n}),a}return Promise.resolve()},awaitInitialFetch:function(){return r.initialFetchPromise},get initialFetch(){return r.initialFetchPromise},get schemas(){return r.model}}},Object.defineProperty(t,"__esModule",{value:!0})})); +//# sourceMappingURL=multicall.umd.js.map diff --git a/dist/multicall.umd.js.map b/dist/multicall.umd.js.map new file mode 100644 index 0000000..e1d3c87 --- /dev/null +++ b/dist/multicall.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multicall.umd.js","sources":["../node_modules/ethers/_version.js","../node_modules/ethers/errors.js","../node_modules/ethers/utils/bytes.js","../node_modules/bn.js/lib/bn.js","../node_modules/ethers/utils/properties.js","../node_modules/ethers/utils/bignumber.js","../node_modules/ethers/constants.js","../node_modules/ethers/utils/utf8.js","../node_modules/js-sha3/src/sha3.js","../node_modules/ethers/utils/keccak256.js","../node_modules/ethers/utils/hash.js","../node_modules/invariant/browser.js","../node_modules/cross-fetch/dist/browser-ponyfill.js","../node_modules/ethers/utils/rlp.js","../node_modules/ethers/utils/address.js","../node_modules/ethers/utils/abi-coder.js","../node_modules/ms/index.js","../node_modules/debug/src/common.js","../node_modules/debug/src/browser.js","../src/helpers.js","../node_modules/lodash/_freeGlobal.js","../node_modules/lodash/_root.js","../node_modules/lodash/_Symbol.js","../node_modules/lodash/_getRawTag.js","../node_modules/lodash/_objectToString.js","../node_modules/lodash/_baseGetTag.js","../node_modules/lodash/isObject.js","../node_modules/lodash/isFunction.js","../node_modules/lodash/_isMasked.js","../node_modules/lodash/_coreJsData.js","../node_modules/lodash/_toSource.js","../node_modules/lodash/_baseIsNative.js","../node_modules/lodash/_getValue.js","../node_modules/lodash/_getNative.js","../node_modules/lodash/_nativeCreate.js","../node_modules/lodash/_hashDelete.js","../node_modules/lodash/_hashGet.js","../node_modules/lodash/_hashHas.js","../node_modules/lodash/_hashSet.js","../node_modules/lodash/_Hash.js","../node_modules/lodash/_hashClear.js","../node_modules/lodash/eq.js","../node_modules/lodash/_assocIndexOf.js","../node_modules/lodash/_listCacheDelete.js","../node_modules/lodash/_listCacheGet.js","../node_modules/lodash/_listCacheHas.js","../node_modules/lodash/_listCacheSet.js","../node_modules/lodash/_ListCache.js","../node_modules/lodash/_listCacheClear.js","../node_modules/lodash/_Map.js","../node_modules/lodash/_isKeyable.js","../node_modules/lodash/_getMapData.js","../node_modules/lodash/_mapCacheDelete.js","../node_modules/lodash/_mapCacheGet.js","../node_modules/lodash/_mapCacheHas.js","../node_modules/lodash/_mapCacheSet.js","../node_modules/lodash/_MapCache.js","../node_modules/lodash/_mapCacheClear.js","../node_modules/lodash/memoize.js","../src/aggregate.js","../node_modules/isomorphic-ws/browser.js","../src/watcher.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = \"4.0.27\";\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar _version_1 = require(\"./_version\");\n// Unknown Error\nexports.UNKNOWN_ERROR = 'UNKNOWN_ERROR';\n// Not implemented\nexports.NOT_IMPLEMENTED = 'NOT_IMPLEMENTED';\n// Missing new operator to an object\n// - name: The name of the class\nexports.MISSING_NEW = 'MISSING_NEW';\n// Call exception\n// - transaction: the transaction\n// - address?: the contract address\n// - args?: The arguments passed into the function\n// - method?: The Solidity method signature\n// - errorSignature?: The EIP848 error signature\n// - errorArgs?: The EIP848 error parameters\n// - reason: The reason (only for EIP848 \"Error(string)\")\nexports.CALL_EXCEPTION = 'CALL_EXCEPTION';\n// Invalid argument (e.g. value is incompatible with type) to a function:\n// - argument: The argument name that was invalid\n// - value: The value of the argument\nexports.INVALID_ARGUMENT = 'INVALID_ARGUMENT';\n// Missing argument to a function:\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexports.MISSING_ARGUMENT = 'MISSING_ARGUMENT';\n// Too many arguments\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexports.UNEXPECTED_ARGUMENT = 'UNEXPECTED_ARGUMENT';\n// Numeric Fault\n// - operation: the operation being executed\n// - fault: the reason this faulted\nexports.NUMERIC_FAULT = 'NUMERIC_FAULT';\n// Insufficien funds (< value + gasLimit * gasPrice)\n// - transaction: the transaction attempted\nexports.INSUFFICIENT_FUNDS = 'INSUFFICIENT_FUNDS';\n// Nonce has already been used\n// - transaction: the transaction attempted\nexports.NONCE_EXPIRED = 'NONCE_EXPIRED';\n// The replacement fee for the transaction is too low\n// - transaction: the transaction attempted\nexports.REPLACEMENT_UNDERPRICED = 'REPLACEMENT_UNDERPRICED';\n// Unsupported operation\n// - operation\nexports.UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION';\nvar _permanentCensorErrors = false;\nvar _censorErrors = false;\n// @TODO: Enum\nfunction throwError(message, code, params) {\n if (_censorErrors) {\n throw new Error('unknown error');\n }\n if (!code) {\n code = exports.UNKNOWN_ERROR;\n }\n if (!params) {\n params = {};\n }\n var messageDetails = [];\n Object.keys(params).forEach(function (key) {\n try {\n messageDetails.push(key + '=' + JSON.stringify(params[key]));\n }\n catch (error) {\n messageDetails.push(key + '=' + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(\"version=\" + _version_1.version);\n var reason = message;\n if (messageDetails.length) {\n message += ' (' + messageDetails.join(', ') + ')';\n }\n // @TODO: Any??\n var error = new Error(message);\n error.reason = reason;\n error.code = code;\n Object.keys(params).forEach(function (key) {\n error[key] = params[key];\n });\n throw error;\n}\nexports.throwError = throwError;\nfunction checkNew(self, kind) {\n if (!(self instanceof kind)) {\n throwError('missing new', exports.MISSING_NEW, { name: kind.name });\n }\n}\nexports.checkNew = checkNew;\nfunction checkArgumentCount(count, expectedCount, suffix) {\n if (!suffix) {\n suffix = '';\n }\n if (count < expectedCount) {\n throwError('missing argument' + suffix, exports.MISSING_ARGUMENT, { count: count, expectedCount: expectedCount });\n }\n if (count > expectedCount) {\n throwError('too many arguments' + suffix, exports.UNEXPECTED_ARGUMENT, { count: count, expectedCount: expectedCount });\n }\n}\nexports.checkArgumentCount = checkArgumentCount;\nfunction setCensorship(censorship, permanent) {\n if (_permanentCensorErrors) {\n throwError('error censorship permanent', exports.UNSUPPORTED_OPERATION, { operation: 'setCensorship' });\n }\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n}\nexports.setCensorship = setCensorship;\nfunction checkNormalize() {\n try {\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach(function (form) {\n try {\n \"test\".normalize(form);\n }\n catch (error) {\n throw new Error('missing ' + form);\n }\n });\n if (String.fromCharCode(0xe9).normalize('NFD') !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error('broken implementation');\n }\n }\n catch (error) {\n throwError('platform missing String.prototype.normalize', exports.UNSUPPORTED_OPERATION, { operation: 'String.prototype.normalize', form: error.message });\n }\n}\nexports.checkNormalize = checkNormalize;\nvar LogLevels = { debug: 1, \"default\": 2, info: 2, warn: 3, error: 4, off: 5 };\nvar LogLevel = LogLevels[\"default\"];\nfunction setLogLevel(logLevel) {\n var level = LogLevels[logLevel];\n if (level == null) {\n warn(\"invliad log level - \" + logLevel);\n return;\n }\n LogLevel = level;\n}\nexports.setLogLevel = setLogLevel;\nfunction log(logLevel, args) {\n if (LogLevel > LogLevels[logLevel]) {\n return;\n }\n console.log.apply(console, args);\n}\nfunction warn() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n log(\"warn\", args);\n}\nexports.warn = warn;\nfunction info() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n log(\"info\", args);\n}\nexports.info = info;\n","\"use strict\";\n/**\n * Conversion Utilities\n *\n */\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = __importStar(require(\"../errors\"));\n///////////////////////////////\nfunction isHexable(value) {\n return !!(value.toHexString);\n}\nexports.isHexable = isHexable;\nfunction addSlice(array) {\n if (array.slice) {\n return array;\n }\n array.slice = function () {\n var args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n };\n return array;\n}\nfunction isArrayish(value) {\n if (!value || parseInt(String(value.length)) != value.length || typeof (value) === 'string') {\n return false;\n }\n for (var i = 0; i < value.length; i++) {\n var v = value[i];\n if (v < 0 || v >= 256 || parseInt(String(v)) != v) {\n return false;\n }\n }\n return true;\n}\nexports.isArrayish = isArrayish;\nfunction arrayify(value) {\n if (value == null) {\n errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (isHexable(value)) {\n value = value.toHexString();\n }\n if (typeof (value) === 'string') {\n var match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n value = value.substring(2);\n if (value.length % 2) {\n value = '0' + value;\n }\n var result = [];\n for (var i = 0; i < value.length; i += 2) {\n result.push(parseInt(value.substr(i, 2), 16));\n }\n return addSlice(new Uint8Array(result));\n }\n if (isArrayish(value)) {\n return addSlice(new Uint8Array(value));\n }\n errors.throwError('invalid arrayify value', null, { arg: 'value', value: value, type: typeof (value) });\n return null;\n}\nexports.arrayify = arrayify;\nfunction concat(objects) {\n var arrays = [];\n var length = 0;\n for (var i = 0; i < objects.length; i++) {\n var object = arrayify(objects[i]);\n arrays.push(object);\n length += object.length;\n }\n var result = new Uint8Array(length);\n var offset = 0;\n for (var i = 0; i < arrays.length; i++) {\n result.set(arrays[i], offset);\n offset += arrays[i].length;\n }\n return addSlice(result);\n}\nexports.concat = concat;\nfunction stripZeros(value) {\n var result = arrayify(value);\n if (result.length === 0) {\n return result;\n }\n // Find the first non-zero entry\n var start = 0;\n while (result[start] === 0) {\n start++;\n }\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n return result;\n}\nexports.stripZeros = stripZeros;\nfunction padZeros(value, length) {\n value = arrayify(value);\n if (length < value.length) {\n throw new Error('cannot pad');\n }\n var result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\nexports.padZeros = padZeros;\nfunction isHexString(value, length) {\n if (typeof (value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (length && value.length !== 2 + 2 * length) {\n return false;\n }\n return true;\n}\nexports.isHexString = isHexString;\nvar HexCharacters = '0123456789abcdef';\nfunction hexlify(value) {\n if (isHexable(value)) {\n return value.toHexString();\n }\n if (typeof (value) === 'number') {\n if (value < 0) {\n errors.throwError('cannot hexlify negative value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n // @TODO: Roll this into the above error as a numeric fault (overflow); next version, not backward compatible\n // We can about (value == MAX_INT) to as well, since that may indicate we underflowed already\n if (value >= 9007199254740991) {\n errors.throwError(\"out-of-range\", errors.NUMERIC_FAULT, {\n operartion: \"hexlify\",\n fault: \"out-of-safe-range\"\n });\n }\n var hex = '';\n while (value) {\n hex = HexCharacters[value & 0x0f] + hex;\n value = Math.floor(value / 16);\n }\n if (hex.length) {\n if (hex.length % 2) {\n hex = '0' + hex;\n }\n return '0x' + hex;\n }\n return '0x00';\n }\n if (typeof (value) === 'string') {\n var match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n if (value.length % 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n }\n if (isArrayish(value)) {\n var result = [];\n for (var i = 0; i < value.length; i++) {\n var v = value[i];\n result.push(HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]);\n }\n return '0x' + result.join('');\n }\n errors.throwError('invalid hexlify value', null, { arg: 'value', value: value });\n return 'never';\n}\nexports.hexlify = hexlify;\nfunction hexDataLength(data) {\n if (!isHexString(data) || (data.length % 2) !== 0) {\n return null;\n }\n return (data.length - 2) / 2;\n}\nexports.hexDataLength = hexDataLength;\nfunction hexDataSlice(data, offset, endOffset) {\n if (!isHexString(data)) {\n errors.throwError('invalid hex data', errors.INVALID_ARGUMENT, { arg: 'value', value: data });\n }\n if ((data.length % 2) !== 0) {\n errors.throwError('hex data length must be even', errors.INVALID_ARGUMENT, { arg: 'value', value: data });\n }\n offset = 2 + 2 * offset;\n if (endOffset != null) {\n return '0x' + data.substring(offset, 2 + 2 * endOffset);\n }\n return '0x' + data.substring(offset);\n}\nexports.hexDataSlice = hexDataSlice;\nfunction hexStripZeros(value) {\n if (!isHexString(value)) {\n errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n while (value.length > 3 && value.substring(0, 3) === '0x0') {\n value = '0x' + value.substring(3);\n }\n return value;\n}\nexports.hexStripZeros = hexStripZeros;\nfunction hexZeroPad(value, length) {\n if (!isHexString(value)) {\n errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n while (value.length < 2 * length + 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n}\nexports.hexZeroPad = hexZeroPad;\nfunction isSignature(value) {\n return (value && value.r != null && value.s != null);\n}\nfunction splitSignature(signature) {\n var v = 0;\n var r = '0x', s = '0x';\n if (isSignature(signature)) {\n if (signature.v == null && signature.recoveryParam == null) {\n errors.throwError('at least on of recoveryParam or v must be specified', errors.INVALID_ARGUMENT, { argument: 'signature', value: signature });\n }\n r = hexZeroPad(signature.r, 32);\n s = hexZeroPad(signature.s, 32);\n v = signature.v;\n if (typeof (v) === 'string') {\n v = parseInt(v, 16);\n }\n var recoveryParam = signature.recoveryParam;\n if (recoveryParam == null && signature.v != null) {\n recoveryParam = 1 - (v % 2);\n }\n v = 27 + recoveryParam;\n }\n else {\n var bytes = arrayify(signature);\n if (bytes.length !== 65) {\n throw new Error('invalid signature');\n }\n r = hexlify(bytes.slice(0, 32));\n s = hexlify(bytes.slice(32, 64));\n v = bytes[64];\n if (v !== 27 && v !== 28) {\n v = 27 + (v % 2);\n }\n }\n return {\n r: r,\n s: s,\n recoveryParam: (v - 27),\n v: v\n };\n}\nexports.splitSignature = splitSignature;\nfunction joinSignature(signature) {\n signature = splitSignature(signature);\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? '0x1c' : '0x1b')\n ]));\n}\nexports.joinSignature = joinSignature;\n","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n Buffer = require('buffer').Buffer;\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n }\n\n if (base === 16) {\n this._parseHex(number, start);\n } else {\n this._parseBase(number, base, start);\n }\n\n if (number[0] === '-') {\n this.negative = 1;\n }\n\n this.strip();\n\n if (endian !== 'le') return;\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [ number & 0x3ffffff ];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [ 0 ];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n };\n\n function parseHex (str, start, end) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r <<= 4;\n\n // 'a' - 'f'\n if (c >= 49 && c <= 54) {\n r |= c - 49 + 0xa;\n\n // 'A' - 'F'\n } else if (c >= 17 && c <= 22) {\n r |= c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n r |= c & 0xf;\n }\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n // Scan 24-bit chunks and add them to the number\n var off = 0;\n for (i = number.length - 6, j = 0; i >= start; i -= 6) {\n w = parseHex(number, i, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n if (i + 6 !== start) {\n w = parseHex(number, start, i + 6);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;\n }\n this.strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n r += c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n r += c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n r += c;\n }\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [ 0 ];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype.strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n BN.prototype.inspect = function inspect () {\n return (this.red ? '';\n };\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16);\n };\n\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n assert(typeof Buffer !== 'undefined');\n return this.toArrayLike(Buffer, endian, length);\n };\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n this.strip();\n var littleEndian = endian === 'le';\n var res = new ArrayType(reqLength);\n\n var b, i;\n var q = this.clone();\n if (!littleEndian) {\n // Assume big-endian\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[i] = b;\n }\n\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n\n return res;\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this.strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this.strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this.strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this.strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this.strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this.strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n function jumboMulTo (self, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this.strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this.strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this.strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q.strip();\n }\n a.strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modn = function modn (num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return acc;\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n return this.strip();\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this.strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n r.strip();\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","'use strict';\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = __importStar(require(\"../errors\"));\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\nexports.defineReadOnly = defineReadOnly;\n// There are some issues with instanceof with npm link, so we use this\n// to ensure types are what we expect.\nfunction setType(object, type) {\n Object.defineProperty(object, '_ethersType', { configurable: false, value: type, writable: false });\n}\nexports.setType = setType;\nfunction isType(object, type) {\n return (object && object._ethersType === type);\n}\nexports.isType = isType;\nfunction resolveProperties(object) {\n var result = {};\n var promises = [];\n Object.keys(object).forEach(function (key) {\n var value = object[key];\n if (value instanceof Promise) {\n promises.push(value.then(function (value) {\n result[key] = value;\n return null;\n }));\n }\n else {\n result[key] = value;\n }\n });\n return Promise.all(promises).then(function () {\n return result;\n });\n}\nexports.resolveProperties = resolveProperties;\nfunction checkProperties(object, properties) {\n if (!object || typeof (object) !== 'object') {\n errors.throwError('invalid object', errors.INVALID_ARGUMENT, {\n argument: 'object',\n value: object\n });\n }\n Object.keys(object).forEach(function (key) {\n if (!properties[key]) {\n errors.throwError('invalid object key - ' + key, errors.INVALID_ARGUMENT, {\n argument: 'transaction',\n value: object,\n key: key\n });\n }\n });\n}\nexports.checkProperties = checkProperties;\nfunction shallowCopy(object) {\n var result = {};\n for (var key in object) {\n result[key] = object[key];\n }\n return result;\n}\nexports.shallowCopy = shallowCopy;\nvar opaque = { boolean: true, number: true, string: true };\nfunction deepCopy(object, frozen) {\n // Opaque objects are not mutable, so safe to copy by assignment\n if (object === undefined || object === null || opaque[typeof (object)]) {\n return object;\n }\n // Arrays are mutable, so we need to create a copy\n if (Array.isArray(object)) {\n var result = object.map(function (item) { return deepCopy(item, frozen); });\n if (frozen) {\n Object.freeze(result);\n }\n return result;\n }\n if (typeof (object) === 'object') {\n // Some internal objects, which are already immutable\n if (isType(object, 'BigNumber')) {\n return object;\n }\n if (isType(object, 'Description')) {\n return object;\n }\n if (isType(object, 'Indexed')) {\n return object;\n }\n var result = {};\n for (var key in object) {\n var value = object[key];\n if (value === undefined) {\n continue;\n }\n defineReadOnly(result, key, deepCopy(value, frozen));\n }\n if (frozen) {\n Object.freeze(result);\n }\n return result;\n }\n // The function type is also immutable, so safe to copy by assignment\n if (typeof (object) === 'function') {\n return object;\n }\n throw new Error('Cannot deepCopy ' + typeof (object));\n}\nexports.deepCopy = deepCopy;\n// See: https://github.com/isaacs/inherits/blob/master/inherits_browser.js\nfunction inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n}\nfunction inheritable(parent) {\n return function (child) {\n inherits(child, parent);\n defineReadOnly(child, 'inherits', inheritable(child));\n };\n}\nexports.inheritable = inheritable;\n","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * BigNumber\n *\n * A wrapper around the BN.js object. We use the BN.js library\n * because it is used by elliptic, so it is required regardles.\n *\n */\nvar bn_js_1 = __importDefault(require(\"bn.js\"));\nvar bytes_1 = require(\"./bytes\");\nvar properties_1 = require(\"./properties\");\nvar errors = __importStar(require(\"../errors\"));\nvar BN_1 = new bn_js_1.default.BN(-1);\nfunction toHex(bn) {\n var value = bn.toString(16);\n if (value[0] === '-') {\n if ((value.length % 2) === 0) {\n return '-0x0' + value.substring(1);\n }\n return \"-0x\" + value.substring(1);\n }\n if ((value.length % 2) === 1) {\n return '0x0' + value;\n }\n return '0x' + value;\n}\nfunction toBN(value) {\n return _bnify(bigNumberify(value));\n}\nfunction toBigNumber(bn) {\n return new BigNumber(toHex(bn));\n}\nfunction _bnify(value) {\n var hex = value._hex;\n if (hex[0] === '-') {\n return (new bn_js_1.default.BN(hex.substring(3), 16)).mul(BN_1);\n }\n return new bn_js_1.default.BN(hex.substring(2), 16);\n}\nvar BigNumber = /** @class */ (function () {\n function BigNumber(value) {\n errors.checkNew(this, BigNumber);\n properties_1.setType(this, 'BigNumber');\n if (typeof (value) === 'string') {\n if (bytes_1.isHexString(value)) {\n if (value == '0x') {\n value = '0x0';\n }\n properties_1.defineReadOnly(this, '_hex', value);\n }\n else if (value[0] === '-' && bytes_1.isHexString(value.substring(1))) {\n properties_1.defineReadOnly(this, '_hex', value);\n }\n else if (value.match(/^-?[0-9]*$/)) {\n if (value == '') {\n value = '0';\n }\n properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));\n }\n else {\n errors.throwError('invalid BigNumber string value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n }\n else if (typeof (value) === 'number') {\n if (parseInt(String(value)) !== value) {\n errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: parseInt(String(value)) });\n }\n try {\n properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));\n }\n catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n }\n else if (value instanceof BigNumber) {\n properties_1.defineReadOnly(this, '_hex', value._hex);\n }\n else if (value.toHexString) {\n properties_1.defineReadOnly(this, '_hex', toHex(toBN(value.toHexString())));\n }\n else if (value._hex && bytes_1.isHexString(value._hex)) {\n properties_1.defineReadOnly(this, '_hex', value._hex);\n }\n else if (bytes_1.isArrayish(value)) {\n properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(bytes_1.hexlify(value).substring(2), 16)));\n }\n else {\n errors.throwError('invalid BigNumber value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n }\n BigNumber.prototype.fromTwos = function (value) {\n return toBigNumber(_bnify(this).fromTwos(value));\n };\n BigNumber.prototype.toTwos = function (value) {\n return toBigNumber(_bnify(this).toTwos(value));\n };\n BigNumber.prototype.abs = function () {\n if (this._hex[0] === '-') {\n return toBigNumber(_bnify(this).mul(BN_1));\n }\n return this;\n };\n BigNumber.prototype.add = function (other) {\n return toBigNumber(_bnify(this).add(toBN(other)));\n };\n BigNumber.prototype.sub = function (other) {\n return toBigNumber(_bnify(this).sub(toBN(other)));\n };\n BigNumber.prototype.div = function (other) {\n var o = bigNumberify(other);\n if (o.isZero()) {\n errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });\n }\n return toBigNumber(_bnify(this).div(toBN(other)));\n };\n BigNumber.prototype.mul = function (other) {\n return toBigNumber(_bnify(this).mul(toBN(other)));\n };\n BigNumber.prototype.mod = function (other) {\n return toBigNumber(_bnify(this).mod(toBN(other)));\n };\n BigNumber.prototype.pow = function (other) {\n return toBigNumber(_bnify(this).pow(toBN(other)));\n };\n BigNumber.prototype.maskn = function (value) {\n return toBigNumber(_bnify(this).maskn(value));\n };\n BigNumber.prototype.eq = function (other) {\n return _bnify(this).eq(toBN(other));\n };\n BigNumber.prototype.lt = function (other) {\n return _bnify(this).lt(toBN(other));\n };\n BigNumber.prototype.lte = function (other) {\n return _bnify(this).lte(toBN(other));\n };\n BigNumber.prototype.gt = function (other) {\n return _bnify(this).gt(toBN(other));\n };\n BigNumber.prototype.gte = function (other) {\n return _bnify(this).gte(toBN(other));\n };\n BigNumber.prototype.isZero = function () {\n return _bnify(this).isZero();\n };\n BigNumber.prototype.toNumber = function () {\n try {\n return _bnify(this).toNumber();\n }\n catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n return null;\n };\n BigNumber.prototype.toString = function () {\n return _bnify(this).toString(10);\n };\n BigNumber.prototype.toHexString = function () {\n return this._hex;\n };\n BigNumber.isBigNumber = function (value) {\n return properties_1.isType(value, 'BigNumber');\n };\n return BigNumber;\n}());\nexports.BigNumber = BigNumber;\nfunction bigNumberify(value) {\n if (BigNumber.isBigNumber(value)) {\n return value;\n }\n return new BigNumber(value);\n}\nexports.bigNumberify = bigNumberify;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bignumber_1 = require(\"./utils/bignumber\");\nvar AddressZero = '0x0000000000000000000000000000000000000000';\nexports.AddressZero = AddressZero;\nvar HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';\nexports.HashZero = HashZero;\n// NFKD (decomposed)\n//const EtherSymbol = '\\uD835\\uDF63';\n// NFKC (composed)\nvar EtherSymbol = '\\u039e';\nexports.EtherSymbol = EtherSymbol;\nvar NegativeOne = bignumber_1.bigNumberify(-1);\nexports.NegativeOne = NegativeOne;\nvar Zero = bignumber_1.bigNumberify(0);\nexports.Zero = Zero;\nvar One = bignumber_1.bigNumberify(1);\nexports.One = One;\nvar Two = bignumber_1.bigNumberify(2);\nexports.Two = Two;\nvar WeiPerEther = bignumber_1.bigNumberify('1000000000000000000');\nexports.WeiPerEther = WeiPerEther;\nvar MaxUint256 = bignumber_1.bigNumberify('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');\nexports.MaxUint256 = MaxUint256;\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar constants_1 = require(\"../constants\");\nvar errors_1 = require(\"../errors\");\nvar bytes_1 = require(\"./bytes\");\n///////////////////////////////\nvar UnicodeNormalizationForm;\n(function (UnicodeNormalizationForm) {\n UnicodeNormalizationForm[\"current\"] = \"\";\n UnicodeNormalizationForm[\"NFC\"] = \"NFC\";\n UnicodeNormalizationForm[\"NFD\"] = \"NFD\";\n UnicodeNormalizationForm[\"NFKC\"] = \"NFKC\";\n UnicodeNormalizationForm[\"NFKD\"] = \"NFKD\";\n})(UnicodeNormalizationForm = exports.UnicodeNormalizationForm || (exports.UnicodeNormalizationForm = {}));\n;\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nfunction toUtf8Bytes(str, form) {\n if (form === void 0) { form = UnicodeNormalizationForm.current; }\n if (form != UnicodeNormalizationForm.current) {\n errors_1.checkNormalize();\n str = str.normalize(form);\n }\n var result = [];\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 0x80) {\n result.push(c);\n }\n else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n }\n else if ((c & 0xfc00) == 0xd800) {\n i++;\n var c2 = str.charCodeAt(i);\n if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) {\n throw new Error('invalid utf-8 string');\n }\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((c >> 18) | 0xf0);\n result.push(((c >> 12) & 0x3f) | 0x80);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n return bytes_1.arrayify(result);\n}\nexports.toUtf8Bytes = toUtf8Bytes;\n;\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction toUtf8String(bytes, ignoreErrors) {\n bytes = bytes_1.arrayify(bytes);\n var result = '';\n var i = 0;\n // Invalid bytes are ignored\n while (i < bytes.length) {\n var c = bytes[i++];\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result += String.fromCharCode(c);\n continue;\n }\n // Multibyte; how many bytes left for this character?\n var extraLength = null;\n var overlongMask = null;\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n // 1110 xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n }\n else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n }\n else {\n if (!ignoreErrors) {\n if ((c & 0xc0) === 0x80) {\n throw new Error('invalid utf8 byte sequence; unexpected continuation byte');\n }\n throw new Error('invalid utf8 byte sequence; invalid prefix');\n }\n continue;\n }\n // Do we have enough bytes in our data?\n if (i + extraLength > bytes.length) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; too short');\n }\n // If there is an invalid unprocessed byte, skip continuation bytes\n for (; i < bytes.length; i++) {\n if (bytes[i] >> 6 !== 0x02) {\n break;\n }\n }\n continue;\n }\n // Remove the length prefix from the char\n var res = c & ((1 << (8 - extraLength - 1)) - 1);\n for (var j = 0; j < extraLength; j++) {\n var nextChar = bytes[i];\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n res = null;\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n if (res === null) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; invalid continuation byte');\n }\n continue;\n }\n // Check for overlong seuences (more bytes than needed)\n if (res <= overlongMask) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; overlong');\n }\n continue;\n }\n // Maximum code point\n if (res > 0x10ffff) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; out-of-range');\n }\n continue;\n }\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n if (!ignoreErrors) {\n throw new Error('invalid utf8 byte sequence; utf-16 surrogate');\n }\n continue;\n }\n if (res <= 0xffff) {\n result += String.fromCharCode(res);\n continue;\n }\n res -= 0x10000;\n result += String.fromCharCode(((res >> 10) & 0x3ff) + 0xd800, (res & 0x3ff) + 0xdc00);\n }\n return result;\n}\nexports.toUtf8String = toUtf8String;\nfunction formatBytes32String(text) {\n // Get the bytes\n var bytes = toUtf8Bytes(text);\n // Check we have room for null-termination\n if (bytes.length > 31) {\n throw new Error('bytes32 string must be less than 32 bytes');\n }\n // Zero-pad (implicitly null-terminates)\n return bytes_1.hexlify(bytes_1.concat([bytes, constants_1.HashZero]).slice(0, 32));\n}\nexports.formatBytes32String = formatBytes32String;\nfunction parseBytes32String(bytes) {\n var data = bytes_1.arrayify(bytes);\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) {\n throw new Error('invalid bytes32 - not 32 bytes long');\n }\n if (data[31] !== 0) {\n throw new Error('invalid bytes32 sdtring - no null terminator');\n }\n // Find the null termination\n var length = 31;\n while (data[length - 1] === 0) {\n length--;\n }\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\nexports.parseBytes32String = parseBytes32String;\n","/**\r\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\r\n *\r\n * @version 0.5.7\r\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\r\n * @copyright Chen, Yi-Cyuan 2015-2016\r\n * @license MIT\r\n */\r\n/*jslint bitwise: true */\r\n(function () {\r\n 'use strict';\r\n\r\n var root = typeof window === 'object' ? window : {};\r\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\r\n if (NODE_JS) {\r\n root = global;\r\n }\r\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module === 'object' && module.exports;\r\n var HEX_CHARS = '0123456789abcdef'.split('');\r\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\r\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\r\n var PADDING = [6, 1536, 393216, 100663296];\r\n var SHIFT = [0, 8, 16, 24];\r\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\r\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\r\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\r\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\r\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\r\n var BITS = [224, 256, 384, 512];\r\n var SHAKE_BITS = [128, 256];\r\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array'];\r\n\r\n var createOutputMethod = function (bits, padding, outputType) {\r\n return function (message) {\r\n return new Keccak(bits, padding, bits).update(message)[outputType]();\r\n };\r\n };\r\n\r\n var createShakeOutputMethod = function (bits, padding, outputType) {\r\n return function (message, outputBits) {\r\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\r\n };\r\n };\r\n\r\n var createMethod = function (bits, padding) {\r\n var method = createOutputMethod(bits, padding, 'hex');\r\n method.create = function () {\r\n return new Keccak(bits, padding, bits);\r\n };\r\n method.update = function (message) {\r\n return method.create().update(message);\r\n };\r\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\r\n var type = OUTPUT_TYPES[i];\r\n method[type] = createOutputMethod(bits, padding, type);\r\n }\r\n return method;\r\n };\r\n\r\n var createShakeMethod = function (bits, padding) {\r\n var method = createShakeOutputMethod(bits, padding, 'hex');\r\n method.create = function (outputBits) {\r\n return new Keccak(bits, padding, outputBits);\r\n };\r\n method.update = function (message, outputBits) {\r\n return method.create(outputBits).update(message);\r\n };\r\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\r\n var type = OUTPUT_TYPES[i];\r\n method[type] = createShakeOutputMethod(bits, padding, type);\r\n }\r\n return method;\r\n };\r\n\r\n var algorithms = [\r\n {name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod},\r\n {name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod},\r\n {name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod}\r\n ];\r\n\r\n var methods = {}, methodNames = [];\r\n\r\n for (var i = 0; i < algorithms.length; ++i) {\r\n var algorithm = algorithms[i];\r\n var bits = algorithm.bits;\r\n for (var j = 0; j < bits.length; ++j) {\r\n var methodName = algorithm.name +'_' + bits[j];\r\n methodNames.push(methodName);\r\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\r\n }\r\n }\r\n\r\n function Keccak(bits, padding, outputBits) {\r\n this.blocks = [];\r\n this.s = [];\r\n this.padding = padding;\r\n this.outputBits = outputBits;\r\n this.reset = true;\r\n this.block = 0;\r\n this.start = 0;\r\n this.blockCount = (1600 - (bits << 1)) >> 5;\r\n this.byteCount = this.blockCount << 2;\r\n this.outputBlocks = outputBits >> 5;\r\n this.extraBytes = (outputBits & 31) >> 3;\r\n\r\n for (var i = 0; i < 50; ++i) {\r\n this.s[i] = 0;\r\n }\r\n }\r\n\r\n Keccak.prototype.update = function (message) {\r\n var notString = typeof message !== 'string';\r\n if (notString && message.constructor === ArrayBuffer) {\r\n message = new Uint8Array(message);\r\n }\r\n var length = message.length, blocks = this.blocks, byteCount = this.byteCount,\r\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\r\n\r\n while (index < length) {\r\n if (this.reset) {\r\n this.reset = false;\r\n blocks[0] = this.block;\r\n for (i = 1; i < blockCount + 1; ++i) {\r\n blocks[i] = 0;\r\n }\r\n }\r\n if (notString) {\r\n for (i = this.start; index < length && i < byteCount; ++index) {\r\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\r\n }\r\n } else {\r\n for (i = this.start; index < length && i < byteCount; ++index) {\r\n code = message.charCodeAt(index);\r\n if (code < 0x80) {\r\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\r\n } else if (code < 0x800) {\r\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n } else if (code < 0xd800 || code >= 0xe000) {\r\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n } else {\r\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\r\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\r\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\r\n }\r\n }\r\n }\r\n this.lastByteIndex = i;\r\n if (i >= byteCount) {\r\n this.start = i - byteCount;\r\n this.block = blocks[blockCount];\r\n for (i = 0; i < blockCount; ++i) {\r\n s[i] ^= blocks[i];\r\n }\r\n f(s);\r\n this.reset = true;\r\n } else {\r\n this.start = i;\r\n }\r\n }\r\n return this;\r\n };\r\n\r\n Keccak.prototype.finalize = function () {\r\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\r\n blocks[i >> 2] |= this.padding[i & 3];\r\n if (this.lastByteIndex === this.byteCount) {\r\n blocks[0] = blocks[blockCount];\r\n for (i = 1; i < blockCount + 1; ++i) {\r\n blocks[i] = 0;\r\n }\r\n }\r\n blocks[blockCount - 1] |= 0x80000000;\r\n for (i = 0; i < blockCount; ++i) {\r\n s[i] ^= blocks[i];\r\n }\r\n f(s);\r\n };\r\n\r\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var hex = '', block;\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n block = s[i];\r\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\r\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\r\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\r\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n i = 0;\r\n }\r\n }\r\n if (extraBytes) {\r\n block = s[i];\r\n if (extraBytes > 0) {\r\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\r\n }\r\n if (extraBytes > 1) {\r\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\r\n }\r\n if (extraBytes > 2) {\r\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\r\n }\r\n }\r\n return hex;\r\n };\r\n\r\n Keccak.prototype.arrayBuffer = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var bytes = this.outputBits >> 3;\r\n var buffer;\r\n if (extraBytes) {\r\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\r\n } else {\r\n buffer = new ArrayBuffer(bytes);\r\n }\r\n var array = new Uint32Array(buffer);\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n array[j] = s[i];\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n }\r\n }\r\n if (extraBytes) {\r\n array[i] = s[i];\r\n buffer = buffer.slice(0, bytes);\r\n }\r\n return buffer;\r\n };\r\n\r\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\r\n\r\n Keccak.prototype.digest = Keccak.prototype.array = function () {\r\n this.finalize();\r\n\r\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\r\n extraBytes = this.extraBytes, i = 0, j = 0;\r\n var array = [], offset, block;\r\n while (j < outputBlocks) {\r\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\r\n offset = j << 2;\r\n block = s[i];\r\n array[offset] = block & 0xFF;\r\n array[offset + 1] = (block >> 8) & 0xFF;\r\n array[offset + 2] = (block >> 16) & 0xFF;\r\n array[offset + 3] = (block >> 24) & 0xFF;\r\n }\r\n if (j % blockCount === 0) {\r\n f(s);\r\n }\r\n }\r\n if (extraBytes) {\r\n offset = j << 2;\r\n block = s[i];\r\n if (extraBytes > 0) {\r\n array[offset] = block & 0xFF;\r\n }\r\n if (extraBytes > 1) {\r\n array[offset + 1] = (block >> 8) & 0xFF;\r\n }\r\n if (extraBytes > 2) {\r\n array[offset + 2] = (block >> 16) & 0xFF;\r\n }\r\n }\r\n return array;\r\n };\r\n\r\n var f = function (s) {\r\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\r\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\r\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\r\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\r\n for (n = 0; n < 48; n += 2) {\r\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\r\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\r\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\r\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\r\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\r\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\r\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\r\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\r\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\r\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\r\n\r\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\r\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\r\n s[0] ^= h;\r\n s[1] ^= l;\r\n s[10] ^= h;\r\n s[11] ^= l;\r\n s[20] ^= h;\r\n s[21] ^= l;\r\n s[30] ^= h;\r\n s[31] ^= l;\r\n s[40] ^= h;\r\n s[41] ^= l;\r\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\r\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\r\n s[2] ^= h;\r\n s[3] ^= l;\r\n s[12] ^= h;\r\n s[13] ^= l;\r\n s[22] ^= h;\r\n s[23] ^= l;\r\n s[32] ^= h;\r\n s[33] ^= l;\r\n s[42] ^= h;\r\n s[43] ^= l;\r\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\r\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\r\n s[4] ^= h;\r\n s[5] ^= l;\r\n s[14] ^= h;\r\n s[15] ^= l;\r\n s[24] ^= h;\r\n s[25] ^= l;\r\n s[34] ^= h;\r\n s[35] ^= l;\r\n s[44] ^= h;\r\n s[45] ^= l;\r\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\r\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\r\n s[6] ^= h;\r\n s[7] ^= l;\r\n s[16] ^= h;\r\n s[17] ^= l;\r\n s[26] ^= h;\r\n s[27] ^= l;\r\n s[36] ^= h;\r\n s[37] ^= l;\r\n s[46] ^= h;\r\n s[47] ^= l;\r\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\r\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\r\n s[8] ^= h;\r\n s[9] ^= l;\r\n s[18] ^= h;\r\n s[19] ^= l;\r\n s[28] ^= h;\r\n s[29] ^= l;\r\n s[38] ^= h;\r\n s[39] ^= l;\r\n s[48] ^= h;\r\n s[49] ^= l;\r\n\r\n b0 = s[0];\r\n b1 = s[1];\r\n b32 = (s[11] << 4) | (s[10] >>> 28);\r\n b33 = (s[10] << 4) | (s[11] >>> 28);\r\n b14 = (s[20] << 3) | (s[21] >>> 29);\r\n b15 = (s[21] << 3) | (s[20] >>> 29);\r\n b46 = (s[31] << 9) | (s[30] >>> 23);\r\n b47 = (s[30] << 9) | (s[31] >>> 23);\r\n b28 = (s[40] << 18) | (s[41] >>> 14);\r\n b29 = (s[41] << 18) | (s[40] >>> 14);\r\n b20 = (s[2] << 1) | (s[3] >>> 31);\r\n b21 = (s[3] << 1) | (s[2] >>> 31);\r\n b2 = (s[13] << 12) | (s[12] >>> 20);\r\n b3 = (s[12] << 12) | (s[13] >>> 20);\r\n b34 = (s[22] << 10) | (s[23] >>> 22);\r\n b35 = (s[23] << 10) | (s[22] >>> 22);\r\n b16 = (s[33] << 13) | (s[32] >>> 19);\r\n b17 = (s[32] << 13) | (s[33] >>> 19);\r\n b48 = (s[42] << 2) | (s[43] >>> 30);\r\n b49 = (s[43] << 2) | (s[42] >>> 30);\r\n b40 = (s[5] << 30) | (s[4] >>> 2);\r\n b41 = (s[4] << 30) | (s[5] >>> 2);\r\n b22 = (s[14] << 6) | (s[15] >>> 26);\r\n b23 = (s[15] << 6) | (s[14] >>> 26);\r\n b4 = (s[25] << 11) | (s[24] >>> 21);\r\n b5 = (s[24] << 11) | (s[25] >>> 21);\r\n b36 = (s[34] << 15) | (s[35] >>> 17);\r\n b37 = (s[35] << 15) | (s[34] >>> 17);\r\n b18 = (s[45] << 29) | (s[44] >>> 3);\r\n b19 = (s[44] << 29) | (s[45] >>> 3);\r\n b10 = (s[6] << 28) | (s[7] >>> 4);\r\n b11 = (s[7] << 28) | (s[6] >>> 4);\r\n b42 = (s[17] << 23) | (s[16] >>> 9);\r\n b43 = (s[16] << 23) | (s[17] >>> 9);\r\n b24 = (s[26] << 25) | (s[27] >>> 7);\r\n b25 = (s[27] << 25) | (s[26] >>> 7);\r\n b6 = (s[36] << 21) | (s[37] >>> 11);\r\n b7 = (s[37] << 21) | (s[36] >>> 11);\r\n b38 = (s[47] << 24) | (s[46] >>> 8);\r\n b39 = (s[46] << 24) | (s[47] >>> 8);\r\n b30 = (s[8] << 27) | (s[9] >>> 5);\r\n b31 = (s[9] << 27) | (s[8] >>> 5);\r\n b12 = (s[18] << 20) | (s[19] >>> 12);\r\n b13 = (s[19] << 20) | (s[18] >>> 12);\r\n b44 = (s[29] << 7) | (s[28] >>> 25);\r\n b45 = (s[28] << 7) | (s[29] >>> 25);\r\n b26 = (s[38] << 8) | (s[39] >>> 24);\r\n b27 = (s[39] << 8) | (s[38] >>> 24);\r\n b8 = (s[48] << 14) | (s[49] >>> 18);\r\n b9 = (s[49] << 14) | (s[48] >>> 18);\r\n\r\n s[0] = b0 ^ (~b2 & b4);\r\n s[1] = b1 ^ (~b3 & b5);\r\n s[10] = b10 ^ (~b12 & b14);\r\n s[11] = b11 ^ (~b13 & b15);\r\n s[20] = b20 ^ (~b22 & b24);\r\n s[21] = b21 ^ (~b23 & b25);\r\n s[30] = b30 ^ (~b32 & b34);\r\n s[31] = b31 ^ (~b33 & b35);\r\n s[40] = b40 ^ (~b42 & b44);\r\n s[41] = b41 ^ (~b43 & b45);\r\n s[2] = b2 ^ (~b4 & b6);\r\n s[3] = b3 ^ (~b5 & b7);\r\n s[12] = b12 ^ (~b14 & b16);\r\n s[13] = b13 ^ (~b15 & b17);\r\n s[22] = b22 ^ (~b24 & b26);\r\n s[23] = b23 ^ (~b25 & b27);\r\n s[32] = b32 ^ (~b34 & b36);\r\n s[33] = b33 ^ (~b35 & b37);\r\n s[42] = b42 ^ (~b44 & b46);\r\n s[43] = b43 ^ (~b45 & b47);\r\n s[4] = b4 ^ (~b6 & b8);\r\n s[5] = b5 ^ (~b7 & b9);\r\n s[14] = b14 ^ (~b16 & b18);\r\n s[15] = b15 ^ (~b17 & b19);\r\n s[24] = b24 ^ (~b26 & b28);\r\n s[25] = b25 ^ (~b27 & b29);\r\n s[34] = b34 ^ (~b36 & b38);\r\n s[35] = b35 ^ (~b37 & b39);\r\n s[44] = b44 ^ (~b46 & b48);\r\n s[45] = b45 ^ (~b47 & b49);\r\n s[6] = b6 ^ (~b8 & b0);\r\n s[7] = b7 ^ (~b9 & b1);\r\n s[16] = b16 ^ (~b18 & b10);\r\n s[17] = b17 ^ (~b19 & b11);\r\n s[26] = b26 ^ (~b28 & b20);\r\n s[27] = b27 ^ (~b29 & b21);\r\n s[36] = b36 ^ (~b38 & b30);\r\n s[37] = b37 ^ (~b39 & b31);\r\n s[46] = b46 ^ (~b48 & b40);\r\n s[47] = b47 ^ (~b49 & b41);\r\n s[8] = b8 ^ (~b0 & b2);\r\n s[9] = b9 ^ (~b1 & b3);\r\n s[18] = b18 ^ (~b10 & b12);\r\n s[19] = b19 ^ (~b11 & b13);\r\n s[28] = b28 ^ (~b20 & b22);\r\n s[29] = b29 ^ (~b21 & b23);\r\n s[38] = b38 ^ (~b30 & b32);\r\n s[39] = b39 ^ (~b31 & b33);\r\n s[48] = b48 ^ (~b40 & b42);\r\n s[49] = b49 ^ (~b41 & b43);\r\n\r\n s[0] ^= RC[n];\r\n s[1] ^= RC[n + 1];\r\n }\r\n };\r\n\r\n if (COMMON_JS) {\r\n module.exports = methods;\r\n } else {\r\n for (var i = 0; i < methodNames.length; ++i) {\r\n root[methodNames[i]] = methods[methodNames[i]];\r\n }\r\n }\r\n})();\r\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar sha3 = require(\"js-sha3\");\nvar bytes_1 = require(\"./bytes\");\nfunction keccak256(data) {\n return '0x' + sha3.keccak_256(bytes_1.arrayify(data));\n}\nexports.keccak256 = keccak256;\n","'use strict';\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = __importStar(require(\"../errors\"));\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar keccak256_1 = require(\"./keccak256\");\n///////////////////////////////\nvar Zeros = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);\nvar Partition = new RegExp(\"^((.*)\\\\.)?([^.]+)$\");\nvar UseSTD3ASCIIRules = new RegExp(\"^[a-z0-9.-]*$\");\nfunction namehash(name) {\n if (typeof (name) !== 'string') {\n errors.throwError('invalid address - ' + String(name), errors.INVALID_ARGUMENT, {\n argument: 'name',\n value: name\n });\n }\n name = name.toLowerCase();\n // Supporting the full UTF-8 space requires additional (and large)\n // libraries, so for now we simply do not support them.\n // It should be fairly easy in the future to support systems with\n // String.normalize, but that is future work.\n if (!name.match(UseSTD3ASCIIRules)) {\n errors.throwError('contains invalid UseSTD3ASCIIRules characters', errors.INVALID_ARGUMENT, {\n argument: 'name',\n value: name\n });\n }\n var result = Zeros;\n while (name.length) {\n var partition = name.match(Partition);\n var label = utf8_1.toUtf8Bytes(partition[3]);\n result = keccak256_1.keccak256(bytes_1.concat([result, keccak256_1.keccak256(label)]));\n name = partition[2] || '';\n }\n return bytes_1.hexlify(result);\n}\nexports.namehash = namehash;\nfunction id(text) {\n return keccak256_1.keccak256(utf8_1.toUtf8Bytes(text));\n}\nexports.id = id;\nfunction hashMessage(message) {\n return keccak256_1.keccak256(bytes_1.concat([\n utf8_1.toUtf8Bytes('\\x19Ethereum Signed Message:\\n'),\n utf8_1.toUtf8Bytes(String(message.length)),\n ((typeof (message) === 'string') ? utf8_1.toUtf8Bytes(message) : message)\n ]));\n}\nexports.hashMessage = hashMessage;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments\n * to provide information about what broke and what you were\n * expecting.\n *\n * The invariant message will be stripped in production, but the invariant\n * will remain to ensure logic does not differ in production.\n */\n\nvar invariant = function(condition, format, a, b, c, d, e, f) {\n if (process.env.NODE_ENV !== 'production') {\n if (format === undefined) {\n throw new Error('invariant requires an error message argument');\n }\n }\n\n if (!condition) {\n var error;\n if (format === undefined) {\n error = new Error(\n 'Minified exception occurred; use the non-minified dev environment ' +\n 'for the full error message and additional helpful warnings.'\n );\n } else {\n var args = [a, b, c, d, e, f];\n var argIndex = 0;\n error = new Error(\n format.replace(/%s/g, function() { return args[argIndex++]; })\n );\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // we don't care about invariant's own frame\n throw error;\n }\n};\n\nmodule.exports = invariant;\n","var __self__ = (function (root) {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = root.DOMException\n}\nF.prototype = root;\nreturn new F();\n})(typeof self !== 'undefined' ? self : this);\n(function(self) {\n\nvar irrelevant = (function (exports) {\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n return exports;\n\n}({}));\n})(__self__);\ndelete __self__.fetch.polyfill\nexports = __self__.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = __self__.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = __self__.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = __self__.Headers\nexports.Request = __self__.Request\nexports.Response = __self__.Response\nmodule.exports = exports\n","\"use strict\";\n//See: https://github.com/ethereum/wiki/wiki/RLP\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"./bytes\");\nfunction arrayifyInteger(value) {\n var result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\nfunction unarrayifyInteger(data, offset, length) {\n var result = 0;\n for (var i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\nfunction _encode(object) {\n if (Array.isArray(object)) {\n var payload = [];\n object.forEach(function (child) {\n payload = payload.concat(_encode(child));\n });\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length);\n return payload;\n }\n var length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n return length.concat(payload);\n }\n var data = Array.prototype.slice.call(bytes_1.arrayify(object));\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n }\n else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n var length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n return length.concat(data);\n}\nfunction encode(object) {\n return bytes_1.hexlify(_encode(object));\n}\nexports.encode = encode;\nfunction _decodeChildren(data, offset, childOffset, length) {\n var result = [];\n while (childOffset < offset + 1 + length) {\n var decoded = _decode(data, childOffset);\n result.push(decoded.result);\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n throw new Error('invalid rlp');\n }\n }\n return { consumed: (1 + length), result: result };\n}\n// returns { consumed: number, result: Object }\nfunction _decode(data, offset) {\n if (data.length === 0) {\n throw new Error('invalid rlp data');\n }\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n var lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n throw new Error('too short');\n }\n var length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n throw new Error('to short');\n }\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n }\n else if (data[offset] >= 0xc0) {\n var length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n throw new Error('invalid rlp data');\n }\n return _decodeChildren(data, offset, offset + 1, length);\n }\n else if (data[offset] >= 0xb8) {\n var lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n throw new Error('invalid rlp data');\n }\n var length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n throw new Error('invalid rlp data');\n }\n var result = bytes_1.hexlify(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length));\n return { consumed: (1 + lengthLength + length), result: result };\n }\n else if (data[offset] >= 0x80) {\n var length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n throw new Error('invlaid rlp data');\n }\n var result = bytes_1.hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result };\n }\n return { consumed: 1, result: bytes_1.hexlify(data[offset]) };\n}\nfunction decode(data) {\n var bytes = bytes_1.arrayify(data);\n var decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n throw new Error('invalid rlp data');\n }\n return decoded.result;\n}\nexports.decode = decode;\n","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use this for base 36 maths\nvar bn_js_1 = __importDefault(require(\"bn.js\"));\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar rlp_1 = require(\"./rlp\");\nvar errors = require(\"../errors\");\n///////////////////////////////\nfunction getChecksumAddress(address) {\n if (typeof (address) !== 'string' || !address.match(/^0x[0-9A-Fa-f]{40}$/)) {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n address = address.toLowerCase();\n var chars = address.substring(2).split('');\n var hashed = new Uint8Array(40);\n for (var i_1 = 0; i_1 < 40; i_1++) {\n hashed[i_1] = chars[i_1].charCodeAt(0);\n }\n hashed = bytes_1.arrayify(keccak256_1.keccak256(hashed));\n for (var i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return '0x' + chars.join('');\n}\n// Shims for environments that are missing some required constants and functions\nvar MAX_SAFE_INTEGER = 0x1fffffffffffff;\nfunction log10(x) {\n if (Math.log10) {\n return Math.log10(x);\n }\n return Math.log(x) / Math.LN10;\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nvar ibanLookup = {};\nfor (var i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (var i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\nvar safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + '00';\n var expanded = '';\n address.split('').forEach(function (c) {\n expanded += ibanLookup[c];\n });\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n var block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n var checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = '0' + checksum;\n }\n return checksum;\n}\n;\nfunction getAddress(address) {\n var result = null;\n if (typeof (address) !== 'string') {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (address.substring(0, 2) !== '0x') {\n address = '0x' + address;\n }\n result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {\n errors.throwError('bad address checksum', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n // Maybe ICAP? (we only support direct mode)\n }\n else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n if (address.substring(2, 4) !== ibanChecksum(address)) {\n errors.throwError('bad icap checksum', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n result = (new bn_js_1.default.BN(address.substring(4), 36)).toString(16);\n while (result.length < 40) {\n result = '0' + result;\n }\n result = getChecksumAddress('0x' + result);\n }\n else {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n return result;\n}\nexports.getAddress = getAddress;\nfunction getIcapAddress(address) {\n var base36 = (new bn_js_1.default.BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();\n while (base36.length < 30) {\n base36 = '0' + base36;\n }\n return 'XE' + ibanChecksum('XE00' + base36) + base36;\n}\nexports.getIcapAddress = getIcapAddress;\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\nfunction getContractAddress(transaction) {\n if (!transaction.from) {\n throw new Error('missing from address');\n }\n var nonce = transaction.nonce;\n return getAddress('0x' + keccak256_1.keccak256(rlp_1.encode([\n getAddress(transaction.from),\n bytes_1.stripZeros(bytes_1.hexlify(nonce))\n ])).substring(26));\n}\nexports.getContractAddress = getContractAddress;\n","'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\nvar constants_1 = require(\"../constants\");\nvar errors = __importStar(require(\"../errors\"));\nvar address_1 = require(\"./address\");\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar properties_1 = require(\"./properties\");\n///////////////////////////////\nvar paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nvar paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nvar paramTypeArray = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\nexports.defaultCoerceFunc = function (type, value) {\n var match = type.match(paramTypeNumber);\n if (match && parseInt(match[2]) <= 48) {\n return value.toNumber();\n }\n return value;\n};\n///////////////////////////////////\n// Parsing for Solidity Signatures\nvar regexParen = new RegExp(\"^([^)(]*)\\\\((.*)\\\\)([^)(]*)$\");\nvar regexIdentifier = new RegExp(\"^[A-Za-z_][A-Za-z0-9_]*$\");\nfunction verifyType(type) {\n // These need to be transformed to their full description\n if (type.match(/^uint($|[^1-9])/)) {\n type = 'uint256' + type.substring(4);\n }\n else if (type.match(/^int($|[^1-9])/)) {\n type = 'int256' + type.substring(3);\n }\n return type;\n}\nfunction parseParam(param, allowIndexed) {\n var originalParam = param;\n function throwError(i) {\n throw new Error('unexpected character \"' + originalParam[i] + '\" at position ' + i + ' in \"' + originalParam + '\"');\n }\n param = param.replace(/\\s/g, ' ');\n var parent = { type: '', name: '', state: { allowType: true } };\n var node = parent;\n for (var i = 0; i < param.length; i++) {\n var c = param[i];\n switch (c) {\n case '(':\n if (!node.state.allowParams) {\n throwError(i);\n }\n node.state.allowType = false;\n node.type = verifyType(node.type);\n node.components = [{ type: '', name: '', parent: node, state: { allowType: true } }];\n node = node.components[0];\n break;\n case ')':\n delete node.state;\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n node.type = verifyType(node.type);\n var child = node;\n node = node.parent;\n if (!node) {\n throwError(i);\n }\n delete child.parent;\n node.state.allowParams = false;\n node.state.allowName = true;\n node.state.allowArray = true;\n break;\n case ',':\n delete node.state;\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n node.type = verifyType(node.type);\n var sibling = { type: '', name: '', parent: node.parent, state: { allowType: true } };\n node.parent.components.push(sibling);\n delete node.parent;\n node = sibling;\n break;\n // Hit a space...\n case ' ':\n // If reading type, the type is done and may read a param or name\n if (node.state.allowType) {\n if (node.type !== '') {\n node.type = verifyType(node.type);\n delete node.state.allowType;\n node.state.allowName = true;\n node.state.allowParams = true;\n }\n }\n // If reading name, the name is done\n if (node.state.allowName) {\n if (node.name !== '') {\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n else {\n node.state.allowName = false;\n }\n }\n }\n break;\n case '[':\n if (!node.state.allowArray) {\n throwError(i);\n }\n node.type += c;\n node.state.allowArray = false;\n node.state.allowName = false;\n node.state.readArray = true;\n break;\n case ']':\n if (!node.state.readArray) {\n throwError(i);\n }\n node.type += c;\n node.state.readArray = false;\n node.state.allowArray = true;\n node.state.allowName = true;\n break;\n default:\n if (node.state.allowType) {\n node.type += c;\n node.state.allowParams = true;\n node.state.allowArray = true;\n }\n else if (node.state.allowName) {\n node.name += c;\n delete node.state.allowArray;\n }\n else if (node.state.readArray) {\n node.type += c;\n }\n else {\n throwError(i);\n }\n }\n }\n if (node.parent) {\n throw new Error(\"unexpected eof\");\n }\n delete parent.state;\n if (allowIndexed && node.name === 'indexed') {\n node.indexed = true;\n node.name = '';\n }\n parent.type = verifyType(parent.type);\n return parent;\n}\n// @TODO: Better return type\nfunction parseSignatureEvent(fragment) {\n var abi = {\n anonymous: false,\n inputs: [],\n name: '',\n type: 'event'\n };\n var match = fragment.match(regexParen);\n if (!match) {\n throw new Error('invalid event: ' + fragment);\n }\n abi.name = match[1].trim();\n splitNesting(match[2]).forEach(function (param) {\n param = parseParam(param, true);\n param.indexed = !!param.indexed;\n abi.inputs.push(param);\n });\n match[3].split(' ').forEach(function (modifier) {\n switch (modifier) {\n case 'anonymous':\n abi.anonymous = true;\n break;\n case '':\n break;\n default:\n errors.info('unknown modifier: ' + modifier);\n }\n });\n if (abi.name && !abi.name.match(regexIdentifier)) {\n throw new Error('invalid identifier: \"' + abi.name + '\"');\n }\n return abi;\n}\nfunction parseSignatureFunction(fragment) {\n var abi = {\n constant: false,\n gas: null,\n inputs: [],\n name: '',\n outputs: [],\n payable: false,\n stateMutability: null,\n type: 'function'\n };\n var comps = fragment.split('@');\n if (comps.length !== 1) {\n if (comps.length > 2) {\n throw new Error('invalid signature');\n }\n if (!comps[1].match(/^[0-9]+$/)) {\n throw new Error('invalid signature gas');\n }\n abi.gas = bignumber_1.bigNumberify(comps[1]);\n fragment = comps[0];\n }\n comps = fragment.split(' returns ');\n var left = comps[0].match(regexParen);\n if (!left) {\n throw new Error('invalid signature');\n }\n abi.name = left[1].trim();\n if (!abi.name.match(regexIdentifier)) {\n throw new Error('invalid identifier: \"' + left[1] + '\"');\n }\n splitNesting(left[2]).forEach(function (param) {\n abi.inputs.push(parseParam(param));\n });\n left[3].split(' ').forEach(function (modifier) {\n switch (modifier) {\n case 'constant':\n abi.constant = true;\n break;\n case 'payable':\n abi.payable = true;\n abi.stateMutability = 'payable';\n break;\n case 'pure':\n abi.constant = true;\n abi.stateMutability = 'pure';\n break;\n case 'view':\n abi.constant = true;\n abi.stateMutability = 'view';\n break;\n case 'external':\n case 'public':\n case '':\n break;\n default:\n errors.info('unknown modifier: ' + modifier);\n }\n });\n // We have outputs\n if (comps.length > 1) {\n var right = comps[1].match(regexParen);\n if (right[1].trim() != '' || right[3].trim() != '') {\n throw new Error('unexpected tokens');\n }\n splitNesting(right[2]).forEach(function (param) {\n abi.outputs.push(parseParam(param));\n });\n }\n if (abi.name === 'constructor') {\n abi.type = \"constructor\";\n if (abi.outputs.length) {\n throw new Error('constructor may not have outputs');\n }\n delete abi.name;\n delete abi.outputs;\n }\n return abi;\n}\nfunction parseParamType(type) {\n return parseParam(type, true);\n}\nexports.parseParamType = parseParamType;\n// @TODO: Allow a second boolean to expose names\nfunction formatParamType(paramType) {\n return getParamCoder(exports.defaultCoerceFunc, paramType).type;\n}\nexports.formatParamType = formatParamType;\n// @TODO: Allow a second boolean to expose names and modifiers\nfunction formatSignature(fragment) {\n return fragment.name + '(' + fragment.inputs.map(function (i) { return formatParamType(i); }).join(',') + ')';\n}\nexports.formatSignature = formatSignature;\nfunction parseSignature(fragment) {\n if (typeof (fragment) === 'string') {\n // Make sure the \"returns\" is surrounded by a space and all whitespace is exactly one space\n fragment = fragment.replace(/\\s/g, ' ');\n fragment = fragment.replace(/\\(/g, ' (').replace(/\\)/g, ') ').replace(/\\s+/g, ' ');\n fragment = fragment.trim();\n if (fragment.substring(0, 6) === 'event ') {\n return parseSignatureEvent(fragment.substring(6).trim());\n }\n else {\n if (fragment.substring(0, 9) === 'function ') {\n fragment = fragment.substring(9);\n }\n return parseSignatureFunction(fragment.trim());\n }\n }\n throw new Error('unknown signature');\n}\nexports.parseSignature = parseSignature;\nvar Coder = /** @class */ (function () {\n function Coder(coerceFunc, name, type, localName, dynamic) {\n this.coerceFunc = coerceFunc;\n this.name = name;\n this.type = type;\n this.localName = localName;\n this.dynamic = dynamic;\n }\n return Coder;\n}());\n// Clones the functionality of an existing Coder, but without a localName\nvar CoderAnonymous = /** @class */ (function (_super) {\n __extends(CoderAnonymous, _super);\n function CoderAnonymous(coder) {\n var _this = _super.call(this, coder.coerceFunc, coder.name, coder.type, undefined, coder.dynamic) || this;\n properties_1.defineReadOnly(_this, 'coder', coder);\n return _this;\n }\n CoderAnonymous.prototype.encode = function (value) { return this.coder.encode(value); };\n CoderAnonymous.prototype.decode = function (data, offset) { return this.coder.decode(data, offset); };\n return CoderAnonymous;\n}(Coder));\nvar CoderNull = /** @class */ (function (_super) {\n __extends(CoderNull, _super);\n function CoderNull(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'null', '', localName, false) || this;\n }\n CoderNull.prototype.encode = function (value) {\n return bytes_1.arrayify([]);\n };\n CoderNull.prototype.decode = function (data, offset) {\n if (offset > data.length) {\n throw new Error('invalid null');\n }\n return {\n consumed: 0,\n value: this.coerceFunc('null', undefined)\n };\n };\n return CoderNull;\n}(Coder));\nvar CoderNumber = /** @class */ (function (_super) {\n __extends(CoderNumber, _super);\n function CoderNumber(coerceFunc, size, signed, localName) {\n var _this = this;\n var name = ((signed ? 'int' : 'uint') + (size * 8));\n _this = _super.call(this, coerceFunc, name, name, localName, false) || this;\n _this.size = size;\n _this.signed = signed;\n return _this;\n }\n CoderNumber.prototype.encode = function (value) {\n try {\n var v = bignumber_1.bigNumberify(value);\n if (this.signed) {\n var bounds = constants_1.MaxUint256.maskn(this.size * 8 - 1);\n if (v.gt(bounds)) {\n throw new Error('out-of-bounds');\n }\n bounds = bounds.add(constants_1.One).mul(constants_1.NegativeOne);\n if (v.lt(bounds)) {\n throw new Error('out-of-bounds');\n }\n }\n else if (v.lt(constants_1.Zero) || v.gt(constants_1.MaxUint256.maskn(this.size * 8))) {\n throw new Error('out-of-bounds');\n }\n v = v.toTwos(this.size * 8).maskn(this.size * 8);\n if (this.signed) {\n v = v.fromTwos(this.size * 8).toTwos(256);\n }\n return bytes_1.padZeros(bytes_1.arrayify(v), 32);\n }\n catch (error) {\n errors.throwError('invalid number value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: value\n });\n }\n return null;\n };\n CoderNumber.prototype.decode = function (data, offset) {\n if (data.length < offset + 32) {\n errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n var junkLength = 32 - this.size;\n var value = bignumber_1.bigNumberify(data.slice(offset + junkLength, offset + 32));\n if (this.signed) {\n value = value.fromTwos(this.size * 8);\n }\n else {\n value = value.maskn(this.size * 8);\n }\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, value),\n };\n };\n return CoderNumber;\n}(Coder));\nvar uint256Coder = new CoderNumber(function (type, value) { return value; }, 32, false, 'none');\nvar CoderBoolean = /** @class */ (function (_super) {\n __extends(CoderBoolean, _super);\n function CoderBoolean(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'bool', 'bool', localName, false) || this;\n }\n CoderBoolean.prototype.encode = function (value) {\n return uint256Coder.encode(!!value ? 1 : 0);\n };\n CoderBoolean.prototype.decode = function (data, offset) {\n try {\n var result = uint256Coder.decode(data, offset);\n }\n catch (error) {\n if (error.reason === 'insufficient data for uint256 type') {\n errors.throwError('insufficient data for boolean type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'boolean',\n value: error.value\n });\n }\n throw error;\n }\n return {\n consumed: result.consumed,\n value: this.coerceFunc('bool', !result.value.isZero())\n };\n };\n return CoderBoolean;\n}(Coder));\nvar CoderFixedBytes = /** @class */ (function (_super) {\n __extends(CoderFixedBytes, _super);\n function CoderFixedBytes(coerceFunc, length, localName) {\n var _this = this;\n var name = ('bytes' + length);\n _this = _super.call(this, coerceFunc, name, name, localName, false) || this;\n _this.length = length;\n return _this;\n }\n CoderFixedBytes.prototype.encode = function (value) {\n var result = new Uint8Array(32);\n try {\n var data = bytes_1.arrayify(value);\n if (data.length !== this.length) {\n throw new Error('incorrect data length');\n }\n result.set(data);\n }\n catch (error) {\n errors.throwError('invalid ' + this.name + ' value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: (error.value || value)\n });\n }\n return result;\n };\n CoderFixedBytes.prototype.decode = function (data, offset) {\n if (data.length < offset + 32) {\n errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: this.name,\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, bytes_1.hexlify(data.slice(offset, offset + this.length)))\n };\n };\n return CoderFixedBytes;\n}(Coder));\nvar CoderAddress = /** @class */ (function (_super) {\n __extends(CoderAddress, _super);\n function CoderAddress(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'address', 'address', localName, false) || this;\n }\n CoderAddress.prototype.encode = function (value) {\n var result = new Uint8Array(32);\n try {\n result.set(bytes_1.arrayify(address_1.getAddress(value)), 12);\n }\n catch (error) {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'address',\n value: value\n });\n }\n return result;\n };\n CoderAddress.prototype.decode = function (data, offset) {\n if (data.length < offset + 32) {\n errors.throwError('insufficuent data for address type', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'address',\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n return {\n consumed: 32,\n value: this.coerceFunc('address', address_1.getAddress(bytes_1.hexlify(data.slice(offset + 12, offset + 32))))\n };\n };\n return CoderAddress;\n}(Coder));\nfunction _encodeDynamicBytes(value) {\n var dataLength = 32 * Math.ceil(value.length / 32);\n var padding = new Uint8Array(dataLength - value.length);\n return bytes_1.concat([\n uint256Coder.encode(value.length),\n value,\n padding\n ]);\n}\nfunction _decodeDynamicBytes(data, offset, localName) {\n if (data.length < offset + 32) {\n errors.throwError('insufficient data for dynamicBytes length', errors.INVALID_ARGUMENT, {\n arg: localName,\n coderType: 'dynamicBytes',\n value: bytes_1.hexlify(data.slice(offset, offset + 32))\n });\n }\n var length = uint256Coder.decode(data, offset).value;\n try {\n length = length.toNumber();\n }\n catch (error) {\n errors.throwError('dynamic bytes count too large', errors.INVALID_ARGUMENT, {\n arg: localName,\n coderType: 'dynamicBytes',\n value: length.toString()\n });\n }\n if (data.length < offset + 32 + length) {\n errors.throwError('insufficient data for dynamicBytes type', errors.INVALID_ARGUMENT, {\n arg: localName,\n coderType: 'dynamicBytes',\n value: bytes_1.hexlify(data.slice(offset, offset + 32 + length))\n });\n }\n return {\n consumed: 32 + 32 * Math.ceil(length / 32),\n value: data.slice(offset + 32, offset + 32 + length),\n };\n}\nvar CoderDynamicBytes = /** @class */ (function (_super) {\n __extends(CoderDynamicBytes, _super);\n function CoderDynamicBytes(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'bytes', 'bytes', localName, true) || this;\n }\n CoderDynamicBytes.prototype.encode = function (value) {\n try {\n return _encodeDynamicBytes(bytes_1.arrayify(value));\n }\n catch (error) {\n errors.throwError('invalid bytes value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'bytes',\n value: error.value\n });\n }\n return null;\n };\n CoderDynamicBytes.prototype.decode = function (data, offset) {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('bytes', bytes_1.hexlify(result.value));\n return result;\n };\n return CoderDynamicBytes;\n}(Coder));\nvar CoderString = /** @class */ (function (_super) {\n __extends(CoderString, _super);\n function CoderString(coerceFunc, localName) {\n return _super.call(this, coerceFunc, 'string', 'string', localName, true) || this;\n }\n CoderString.prototype.encode = function (value) {\n if (typeof (value) !== 'string') {\n errors.throwError('invalid string value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'string',\n value: value\n });\n }\n return _encodeDynamicBytes(utf8_1.toUtf8Bytes(value));\n };\n CoderString.prototype.decode = function (data, offset) {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('string', utf8_1.toUtf8String(result.value));\n return result;\n };\n return CoderString;\n}(Coder));\nfunction alignSize(size) {\n return 32 * Math.ceil(size / 32);\n}\nfunction pack(coders, values) {\n if (Array.isArray(values)) {\n // do nothing\n }\n else if (values && typeof (values) === 'object') {\n var arrayValues = [];\n coders.forEach(function (coder) {\n arrayValues.push(values[coder.localName]);\n });\n values = arrayValues;\n }\n else {\n errors.throwError('invalid tuple value', errors.INVALID_ARGUMENT, {\n coderType: 'tuple',\n value: values\n });\n }\n if (coders.length !== values.length) {\n errors.throwError('types/value length mismatch', errors.INVALID_ARGUMENT, {\n coderType: 'tuple',\n value: values\n });\n }\n var parts = [];\n coders.forEach(function (coder, index) {\n parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });\n });\n var staticSize = 0, dynamicSize = 0;\n parts.forEach(function (part) {\n if (part.dynamic) {\n staticSize += 32;\n dynamicSize += alignSize(part.value.length);\n }\n else {\n staticSize += alignSize(part.value.length);\n }\n });\n var offset = 0, dynamicOffset = staticSize;\n var data = new Uint8Array(staticSize + dynamicSize);\n parts.forEach(function (part) {\n if (part.dynamic) {\n //uint256Coder.encode(dynamicOffset).copy(data, offset);\n data.set(uint256Coder.encode(dynamicOffset), offset);\n offset += 32;\n //part.value.copy(data, dynamicOffset); @TODO\n data.set(part.value, dynamicOffset);\n dynamicOffset += alignSize(part.value.length);\n }\n else {\n //part.value.copy(data, offset); @TODO\n data.set(part.value, offset);\n offset += alignSize(part.value.length);\n }\n });\n return data;\n}\nfunction unpack(coders, data, offset) {\n var baseOffset = offset;\n var consumed = 0;\n var value = [];\n coders.forEach(function (coder) {\n if (coder.dynamic) {\n var dynamicOffset = uint256Coder.decode(data, offset);\n var result = coder.decode(data, baseOffset + dynamicOffset.value.toNumber());\n // The dynamic part is leap-frogged somewhere else; doesn't count towards size\n result.consumed = dynamicOffset.consumed;\n }\n else {\n var result = coder.decode(data, offset);\n }\n if (result.value != undefined) {\n value.push(result.value);\n }\n offset += result.consumed;\n consumed += result.consumed;\n });\n coders.forEach(function (coder, index) {\n var name = coder.localName;\n if (!name) {\n return;\n }\n if (name === 'length') {\n name = '_length';\n }\n if (value[name] != null) {\n return;\n }\n value[name] = value[index];\n });\n return {\n value: value,\n consumed: consumed\n };\n}\nvar CoderArray = /** @class */ (function (_super) {\n __extends(CoderArray, _super);\n function CoderArray(coerceFunc, coder, length, localName) {\n var _this = this;\n var type = (coder.type + '[' + (length >= 0 ? length : '') + ']');\n var dynamic = (length === -1 || coder.dynamic);\n _this = _super.call(this, coerceFunc, 'array', type, localName, dynamic) || this;\n _this.coder = coder;\n _this.length = length;\n return _this;\n }\n CoderArray.prototype.encode = function (value) {\n if (!Array.isArray(value)) {\n errors.throwError('expected array value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n value: value\n });\n }\n var count = this.length;\n var result = new Uint8Array(0);\n if (count === -1) {\n count = value.length;\n result = uint256Coder.encode(count);\n }\n errors.checkArgumentCount(count, value.length, ' in coder array' + (this.localName ? (\" \" + this.localName) : \"\"));\n var coders = [];\n for (var i = 0; i < value.length; i++) {\n coders.push(this.coder);\n }\n return bytes_1.concat([result, pack(coders, value)]);\n };\n CoderArray.prototype.decode = function (data, offset) {\n // @TODO:\n //if (data.length < offset + length * 32) { throw new Error('invalid array'); }\n var consumed = 0;\n var count = this.length;\n if (count === -1) {\n try {\n var decodedLength = uint256Coder.decode(data, offset);\n }\n catch (error) {\n errors.throwError('insufficient data for dynamic array length', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n value: error.value\n });\n }\n try {\n count = decodedLength.value.toNumber();\n }\n catch (error) {\n errors.throwError('array count too large', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n value: decodedLength.value.toString()\n });\n }\n consumed += decodedLength.consumed;\n offset += decodedLength.consumed;\n }\n var coders = [];\n for (var i = 0; i < count; i++) {\n coders.push(new CoderAnonymous(this.coder));\n }\n var result = unpack(coders, data, offset);\n result.consumed += consumed;\n result.value = this.coerceFunc(this.type, result.value);\n return result;\n };\n return CoderArray;\n}(Coder));\nvar CoderTuple = /** @class */ (function (_super) {\n __extends(CoderTuple, _super);\n function CoderTuple(coerceFunc, coders, localName) {\n var _this = this;\n var dynamic = false;\n var types = [];\n coders.forEach(function (coder) {\n if (coder.dynamic) {\n dynamic = true;\n }\n types.push(coder.type);\n });\n var type = ('tuple(' + types.join(',') + ')');\n _this = _super.call(this, coerceFunc, 'tuple', type, localName, dynamic) || this;\n _this.coders = coders;\n return _this;\n }\n CoderTuple.prototype.encode = function (value) {\n return pack(this.coders, value);\n };\n CoderTuple.prototype.decode = function (data, offset) {\n var result = unpack(this.coders, data, offset);\n result.value = this.coerceFunc(this.type, result.value);\n return result;\n };\n return CoderTuple;\n}(Coder));\n/*\nfunction getTypes(coders) {\n var type = coderTuple(coders).type;\n return type.substring(6, type.length - 1);\n}\n*/\nfunction splitNesting(value) {\n value = value.trim();\n var result = [];\n var accum = '';\n var depth = 0;\n for (var offset = 0; offset < value.length; offset++) {\n var c = value[offset];\n if (c === ',' && depth === 0) {\n result.push(accum);\n accum = '';\n }\n else {\n accum += c;\n if (c === '(') {\n depth++;\n }\n else if (c === ')') {\n depth--;\n if (depth === -1) {\n throw new Error('unbalanced parenthsis');\n }\n }\n }\n }\n if (accum) {\n result.push(accum);\n }\n return result;\n}\n// @TODO: Is there a way to return \"class\"?\nvar paramTypeSimple = {\n address: CoderAddress,\n bool: CoderBoolean,\n string: CoderString,\n bytes: CoderDynamicBytes,\n};\nfunction getTupleParamCoder(coerceFunc, components, localName) {\n if (!components) {\n components = [];\n }\n var coders = [];\n components.forEach(function (component) {\n coders.push(getParamCoder(coerceFunc, component));\n });\n return new CoderTuple(coerceFunc, coders, localName);\n}\nfunction getParamCoder(coerceFunc, param) {\n var coder = paramTypeSimple[param.type];\n if (coder) {\n return new coder(coerceFunc, param.name);\n }\n var match = param.type.match(paramTypeNumber);\n if (match) {\n var size = parseInt(match[2] || \"256\");\n if (size === 0 || size > 256 || (size % 8) !== 0) {\n errors.throwError('invalid ' + match[1] + ' bit length', errors.INVALID_ARGUMENT, {\n arg: 'param',\n value: param\n });\n }\n return new CoderNumber(coerceFunc, size / 8, (match[1] === 'int'), param.name);\n }\n var match = param.type.match(paramTypeBytes);\n if (match) {\n var size = parseInt(match[1]);\n if (size === 0 || size > 32) {\n errors.throwError('invalid bytes length', errors.INVALID_ARGUMENT, {\n arg: 'param',\n value: param\n });\n }\n return new CoderFixedBytes(coerceFunc, size, param.name);\n }\n var match = param.type.match(paramTypeArray);\n if (match) {\n var size = parseInt(match[2] || \"-1\");\n param = properties_1.shallowCopy(param);\n param.type = match[1];\n param = properties_1.deepCopy(param);\n return new CoderArray(coerceFunc, getParamCoder(coerceFunc, param), size, param.name);\n }\n if (param.type.substring(0, 5) === 'tuple') {\n return getTupleParamCoder(coerceFunc, param.components, param.name);\n }\n if (param.type === '') {\n return new CoderNull(coerceFunc, param.name);\n }\n errors.throwError('invalid type', errors.INVALID_ARGUMENT, {\n arg: 'type',\n value: param.type\n });\n return null;\n}\nvar AbiCoder = /** @class */ (function () {\n function AbiCoder(coerceFunc) {\n errors.checkNew(this, AbiCoder);\n if (!coerceFunc) {\n coerceFunc = exports.defaultCoerceFunc;\n }\n properties_1.defineReadOnly(this, 'coerceFunc', coerceFunc);\n }\n AbiCoder.prototype.encode = function (types, values) {\n if (types.length !== values.length) {\n errors.throwError('types/values length mismatch', errors.INVALID_ARGUMENT, {\n count: { types: types.length, values: values.length },\n value: { types: types, values: values }\n });\n }\n var coders = [];\n types.forEach(function (type) {\n // Convert types to type objects\n // - \"uint foo\" => { type: \"uint\", name: \"foo\" }\n // - \"tuple(uint, uint)\" => { type: \"tuple\", components: [ { type: \"uint\" }, { type: \"uint\" }, ] }\n var typeObject = null;\n if (typeof (type) === 'string') {\n typeObject = parseParam(type);\n }\n else {\n typeObject = type;\n }\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n }, this);\n return bytes_1.hexlify(new CoderTuple(this.coerceFunc, coders, '_').encode(values));\n };\n AbiCoder.prototype.decode = function (types, data) {\n var coders = [];\n types.forEach(function (type) {\n // See encode for details\n var typeObject = null;\n if (typeof (type) === 'string') {\n typeObject = parseParam(type);\n }\n else {\n typeObject = properties_1.deepCopy(type);\n }\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n }, this);\n return new CoderTuple(this.coerceFunc, coders, '_').decode(bytes_1.arrayify(data), 0).value;\n };\n return AbiCoder;\n}());\nexports.AbiCoder = AbiCoder;\nexports.defaultAbiCoder = new AbiCoder();\n","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isNaN(val) === false) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^((?:\\d+)?\\-?\\d?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* Active `debug` instances.\n\t*/\n\tcreateDebug.instances = [];\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn match;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.enabled = createDebug.enabled(namespace);\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = selectColor(namespace);\n\t\tdebug.destroy = destroy;\n\t\tdebug.extend = extend;\n\t\t// Debug.formatArgs = formatArgs;\n\t\t// debug.rawLog = rawLog;\n\n\t\t// env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\tcreateDebug.instances.push(debug);\n\n\t\treturn debug;\n\t}\n\n\tfunction destroy() {\n\t\tconst index = createDebug.instances.indexOf(this);\n\t\tif (index !== -1) {\n\t\t\tcreateDebug.instances.splice(index, 1);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0; i < createDebug.instances.length; i++) {\n\t\t\tconst instance = createDebug.instances[i];\n\t\t\tinstance.enabled = createDebug.enabled(instance.namespace);\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\nfunction log(...args) {\n\t// This hackery is required for IE8/9, where\n\t// the `console.log` function doesn't have 'apply'\n\treturn typeof console === 'object' &&\n\t\tconsole.log &&\n\t\tconsole.log(...args);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","import fetch from 'cross-fetch';\nimport { defaultAbiCoder } from 'ethers/utils/abi-coder';\nimport debug from 'debug';\nconst log = debug('multicall');\n\n// Function signature for: aggregate((address,bytes)[])\nexport const AGGREGATE_SELECTOR = '0x252dba42';\n\nexport function strip0x(str) {\n return str.replace(/^0x/, '');\n}\n\nexport function typesLength(types) {\n return types.length;\n}\n\nexport function encodeParameter(type, val) {\n return encodeParameters([type], [val]);\n}\n\nexport function encodeParameters(types, vals) {\n return defaultAbiCoder.encode(types, vals);\n}\n\nexport function decodeParameter(type, val) {\n return decodeParameters([type], val);\n}\n\nexport function decodeParameters(types, vals) {\n return defaultAbiCoder.decode(types, '0x' + vals.replace(/0x/i, ''));\n}\n\nexport function padLeft(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n new Array(padding).join(sign ? sign : '0') +\n string\n );\n}\n\nexport function padRight(string, chars, sign) {\n var hasPrefix = /^0x/i.test(string) || typeof string === 'number';\n string = string.toString(16).replace(/^0x/i, '');\n var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0;\n return (\n (hasPrefix ? '0x' : '') +\n string +\n new Array(padding).join(sign ? sign : '0')\n );\n}\n\nexport function isEmpty(obj) {\n if (Array.isArray(obj)) return obj.length === 0;\n return !obj || Object.keys(obj).length === 0;\n}\n\nexport async function ethCall(rawData, { id, web3, ethers, provider, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) {\n const abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData);\n if (ws) {\n log('Sending via WebSocket');\n return new Promise((resolve, reject) => {\n ws.send(JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id\n }));\n function onMessage(data) {\n if (typeof data !== 'string') data = data.data;\n const json = JSON.parse(data);\n if (!json.id || json.id !== id) return;\n log('Got WebSocket response id #%d', json.id);\n clearTimeout(timeoutHandle);\n ws.onmessage = null;\n resolve(json.result);\n }\n const timeoutHandle = setTimeout(() => {\n if (ws.onmessage !== onMessage) return;\n ws.onmessage = null;\n reject(new Error('WebSocket response timeout'));\n }, wsResponseTimeout);\n\n ws.onmessage = onMessage;\n });\n }\n else if (ethers) {\n log('Sending via ethers provider');\n return ethers.send({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (provider) {\n log('Sending via EIP-1193 provider');\n return provider.request({\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ]\n })\n }\n else if (web3) {\n log('Sending via web3 provider');\n return web3.eth.call({\n to: multicallAddress,\n data: abiEncodedData\n });\n } else {\n log('Sending via XHR fetch');\n const rawResponse = await fetch(rpcUrl, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n jsonrpc: '2.0',\n method: 'eth_call',\n params: [\n {\n to: multicallAddress,\n data: abiEncodedData\n },\n block || 'latest'\n ],\n id: 1\n })\n });\n const content = await rawResponse.json();\n if (!content || !content.result) {\n throw new Error('Multicall received an empty response. Check your call configuration for errors.');\n }\n return content.result;\n }\n}\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","var MapCache = require('./_MapCache');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n","import { id as keccak256 } from 'ethers/utils/hash';\nimport invariant from 'invariant';\nimport { strip0x, ethCall, encodeParameters, decodeParameters } from './helpers.js';\nimport memoize from 'lodash/memoize';\n\nconst INSIDE_EVERY_PARENTHESES = /\\(.*?\\)/g;\nconst FIRST_CLOSING_PARENTHESES = /^[^)]*\\)/;\n\nexport function _makeMulticallData(calls) {\n const values = [\n calls.map(({ target, method, args, returnTypes }) => [\n target,\n keccak256(method).substr(0, 10) +\n (args && args.length > 0\n ? strip0x(encodeParameters(args.map(a => a[1]), args.map(a => a[0])))\n : '')\n ])\n ];\n const calldata = encodeParameters(\n [\n {\n components: [{ type: 'address' }, { type: 'bytes' }],\n name: 'data',\n type: 'tuple[]'\n }\n ],\n values\n );\n return calldata;\n}\n\nconst makeMulticallData = memoize(_makeMulticallData, (...args) => JSON.stringify(args));\n\nexport default async function aggregate(calls, config) {\n calls = Array.isArray(calls) ? calls : [calls];\n\n const keyToArgMap = calls.reduce((acc, { call, returns }) => {\n const [, ...args] = call;\n if (args.length > 0) {\n for (let returnMeta of returns) {\n const [key] = returnMeta;\n acc[key] = args;\n }\n }\n return acc;\n }, {});\n\n calls = calls.map(({ call, target, returns }) => {\n if (!target) target = config.multicallAddress;\n const [method, ...argValues] = call;\n const [argTypesString, returnTypesString] = method\n .match(INSIDE_EVERY_PARENTHESES)\n .map(match => match.slice(1, -1));\n const argTypes = argTypesString.split(',').filter(e => !!e);\n invariant(\n argTypes.length === argValues.length,\n `Every method argument must have exactly one type.\n Comparing argument types ${JSON.stringify(argTypes)}\n to argument values ${JSON.stringify(argValues)}.\n `\n );\n const args = argValues.map((argValue, idx) => [argValue, argTypes[idx]]);\n const returnTypes = !!returnTypesString ? returnTypesString.split(',') : [];\n return {\n method: method.match(FIRST_CLOSING_PARENTHESES)[0],\n args,\n returnTypes,\n target,\n returns\n };\n });\n\n const callDataBytes = makeMulticallData(calls, false);\n const outerResults = await ethCall(callDataBytes, config);\n const returnTypeArray = calls\n .map(({ returnTypes }) => returnTypes)\n .reduce((acc, ele) => acc.concat(ele), []);\n const returnDataMeta = calls\n .map(({ returns }) => returns)\n .reduce((acc, ele) => acc.concat(ele), []);\n\n invariant(\n returnTypeArray.length === returnDataMeta.length,\n 'Missing data needed to parse results'\n );\n\n const outerResultsDecoded = decodeParameters(['uint256', 'bytes[]'], outerResults);\n const blockNumber = outerResultsDecoded.shift();\n const parsedVals = outerResultsDecoded.reduce((acc, r) => {\n r.forEach((results, idx) => {\n const types = calls[idx].returnTypes;\n const resultsDecoded = decodeParameters(types, results);\n acc.push(\n ...resultsDecoded.map((r, idx) => {\n if (types[idx] === 'bool') return r.toString() === 'true';\n return r;\n })\n );\n });\n return acc;\n }, []);\n\n const retObj = { blockNumber, original: {}, transformed: {} };\n\n for (let i = 0; i < parsedVals.length; i++) {\n const [name, transform] = returnDataMeta[i];\n retObj.original[name] = parsedVals[i];\n retObj.transformed[name] = transform !== undefined ? transform(parsedVals[i]) : parsedVals[i];\n }\n\n return { results: retObj, keyToArgMap };\n}\n","// https://github.com/maxogden/websocket-stream/blob/48dc3ddf943e5ada668c31ccd94e9186f02fafbd/ws-fallback.js\n\nvar ws = null\n\nif (typeof WebSocket !== 'undefined') {\n ws = WebSocket\n} else if (typeof MozWebSocket !== 'undefined') {\n ws = MozWebSocket\n} else if (typeof global !== 'undefined') {\n ws = global.WebSocket || global.MozWebSocket\n} else if (typeof window !== 'undefined') {\n ws = window.WebSocket || window.MozWebSocket\n} else if (typeof self !== 'undefined') {\n ws = self.WebSocket || self.MozWebSocket\n}\n\nmodule.exports = ws\n","import WebSocket from 'isomorphic-ws';\nimport aggregate from './aggregate';\nimport { isEmpty } from './helpers';\nimport addresses from './addresses.json';\nimport debug from 'debug';\nconst log = debug('multicall');\n\nconst reWsEndpoint = /^wss?:\\/\\//i;\n\nfunction isNewState(type, value, store) {\n return (\n store[type] === undefined ||\n (value !== null &&\n store[type] !== null &&\n typeof value === 'object' &&\n typeof value.toString === 'function' &&\n typeof store[type] === 'object' &&\n typeof store[type].toString === 'function'\n ? value.toString() !== store[type].toString()\n : value !== store[type])\n );\n}\n\nfunction prepareConfig(config) {\n config = {\n interval: 1000,\n staleBlockRetryWait: 3000,\n errorRetryWait: 5000,\n wsResponseTimeout: 5000,\n wsReconnectTimeout: 5000,\n ...config\n };\n if (config.preset !== undefined) {\n if (addresses[config.preset] !== undefined) {\n config.multicallAddress = addresses[config.preset].multicall;\n config.rpcUrl = addresses[config.preset].rpcUrl;\n } else throw new Error(`Unknown preset ${config.preset}`);\n }\n return config;\n}\n\nexport default function createWatcher(model, config) {\n const state = {\n model: [...model],\n store: {},\n storeTransformed: {},\n keyToArgMap: {},\n latestPromiseId: 0,\n latestBlockNumber: null,\n id: 0,\n listeners: {\n subscribe: [],\n block: [],\n poll: [],\n error: []\n },\n handler: null,\n wsReconnectHandler: null,\n watching: false,\n config: prepareConfig(config),\n ws: null\n };\n\n function reconnectWebSocket(timeout) {\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = setTimeout(() => {\n destroyWebSocket();\n setupWebSocket();\n }, timeout);\n }\n\n function setupWebSocket() {\n if (reWsEndpoint.test(state.config.rpcUrl)) {\n log(`Connecting to WebSocket ${state.config.rpcUrl}...`);\n state.ws = new WebSocket(state.config.rpcUrl);\n state.ws.onopen = () => {\n log('WebSocket connected');\n if (state.handler) throw new Error('Existing poll setTimeout handler set');\n if (state.watching) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n };\n state.ws.onclose = err => {\n log('WebSocket closed: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n state.ws.onerror = err => {\n log('WebSocket error: %s', JSON.stringify(err));\n log(`Reconnecting in ${state.config.wsReconnectTimeout / 1000} seconds.`);\n reconnectWebSocket(state.config.wsReconnectTimeout);\n };\n }\n }\n\n function destroyWebSocket() {\n log('destroyWebSocket()');\n state.ws.onopen = null;\n state.ws.onclose = null;\n state.ws.onerror = null;\n state.ws.onmessage = null;\n state.ws.close();\n }\n\n setupWebSocket();\n\n state.initialFetchPromise = new Promise(resolve => {\n state.initialFetchResolver = resolve;\n });\n\n function subscribe(listener, id, batch = false) {\n if (!isEmpty(state.storeTransformed)) {\n const events = Object.entries(state.storeTransformed).map(([type, value]) => ({\n type,\n value,\n args: state.keyToArgMap[type] || []\n }));\n batch ? listener(events) : events.forEach(listener);\n }\n state.listeners.subscribe.push({ listener, id, batch });\n }\n\n function alertListeners(events) {\n if (!isEmpty(events))\n state.listeners.subscribe.forEach(({ listener, batch }) =>\n batch ? listener(events) : events.forEach(listener)\n );\n }\n\n function poll() {\n const interval = this.interval !== undefined ? this.interval : this.state.config.interval;\n log('poll() called, %s%s', 'interval: ' + interval, this.retry ? ', retry: ' + this.retry : '');\n this.state.handler = setTimeout(async () => {\n try {\n if (!this.state.handler) return;\n\n this.state.latestPromiseId++;\n const promiseId = this.state.latestPromiseId;\n\n state.listeners.poll.forEach(({ listener }) =>\n listener({\n id: promiseId,\n latestBlockNumber: this.state.latestBlockNumber,\n ...(this.retry ? { retry: this.retry } : {})\n })\n );\n\n const {\n results: {\n blockNumber,\n original: { ...data },\n transformed: { ...dataTransformed }\n },\n keyToArgMap\n } = await aggregate(this.state.model, {\n ...this.state.config,\n ws: this.state.ws,\n id: this.state.latestPromiseId\n });\n\n if (this.state.cancelPromiseId === promiseId) return;\n\n if (typeof this.resolveFetchPromise === 'function') this.resolveFetchPromise();\n\n if (this.state.latestBlockNumber !== null && blockNumber < this.state.latestBlockNumber) {\n // Retry if blockNumber is lower than latestBlockNumber\n log(\n `Stale block returned, retrying in ${this.state.config.staleBlockRetryWait /\n 1000} seconds`\n );\n poll.call({\n state: this.state,\n interval: this.state.config.staleBlockRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n } else {\n if (\n this.state.latestBlockNumber === null ||\n (this.state.latestBlockNumber !== null && blockNumber > this.state.latestBlockNumber)\n ) {\n this.state.latestBlockNumber = parseInt(blockNumber);\n state.listeners.block.forEach(({ listener }) => listener(this.state.latestBlockNumber));\n }\n const events = Object.entries(data)\n .filter(([type, value]) => isNewState(type, value, this.state.store))\n .map(([type]) => ({\n type,\n value: dataTransformed[type],\n args: keyToArgMap[type] || []\n }));\n this.state.store = { ...data };\n this.state.storeTransformed = { ...dataTransformed };\n this.state.keyToArgMap = { ...keyToArgMap };\n alertListeners(events);\n poll.call({ state: this.state });\n }\n } catch (err) {\n log('Error: %s', err.message);\n state.listeners.error.forEach(({ listener }) => listener(err, this.state));\n if (!this.state.handler) return;\n // Retry on error\n log(`Error occured, retrying in ${this.state.config.errorRetryWait / 1000} seconds`);\n poll.call({\n state: this.state,\n interval: this.state.config.errorRetryWait,\n retry: this.retry ? this.retry + 1 : 1\n });\n }\n }, interval);\n }\n\n const watcher = {\n tap(transform) {\n log('watcher.tap() called');\n const nextModel = transform([...state.model]);\n state.model = [...nextModel];\n return this.poll();\n },\n poll() {\n log('watcher.poll() called');\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n if (state.watching && (!state.ws || state.ws.readyState === WebSocket.OPEN)) {\n clearTimeout(state.handler);\n state.handler = null;\n poll.call({ state, interval: 0, resolveFetchPromise });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, false);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n batch() {\n return {\n subscribe(listener) {\n const id = state.id++;\n subscribe(listener, id, true);\n return {\n unsub() {\n state.listeners.subscribe = state.listeners.subscribe.filter(({ id: _id }) => _id !== id);\n }\n };\n }\n };\n },\n onNewBlock(listener) {\n const id = state.id++;\n state.latestBlockNumber && listener(state.latestBlockNumber);\n state.listeners.block.push({ listener, id });\n return {\n unsub() {\n state.listeners.block = state.listeners.block.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onPoll(listener) {\n const id = state.id++;\n state.listeners.poll.push({ listener, id });\n return {\n unsub() {\n state.listeners.poll = state.listeners.poll.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n onError(listener) {\n const id = state.id++;\n state.listeners.error.push({ listener, id });\n return {\n unsub() {\n state.listeners.error = state.listeners.error.filter(({ id: _id }) => _id !== id);\n }\n };\n },\n start() {\n log('watcher.start() called');\n state.watching = true;\n if (!state.ws || state.ws.readyState === WebSocket.OPEN) {\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise: state.initialFetchResolver\n });\n }\n return state.initialFetchPromise;\n },\n stop() {\n log('watcher.stop() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n state.watching = false;\n },\n recreate(model, config) {\n log('watcher.recreate() called');\n clearTimeout(state.handler);\n state.handler = null;\n clearTimeout(state.wsReconnectHandler);\n state.wsReconnectHandler = null;\n if (state.ws) destroyWebSocket();\n state.ws = null;\n state.config = prepareConfig(config);\n state.model = [...model];\n state.store = {};\n state.storeTransformed = {};\n state.latestBlockNumber = null;\n state.cancelPromiseId = state.latestPromiseId;\n setupWebSocket();\n if (state.watching && !state.ws) {\n let resolveFetchPromise;\n const fetchPromise = new Promise(resolve => {\n resolveFetchPromise = resolve;\n });\n poll.call({\n state,\n interval: 0,\n resolveFetchPromise\n });\n return fetchPromise;\n }\n return Promise.resolve();\n },\n awaitInitialFetch() {\n return state.initialFetchPromise;\n },\n get initialFetch() {\n return state.initialFetchPromise;\n },\n get schemas() {\n return state.model;\n }\n };\n\n return watcher;\n}\n"],"names":["Object","defineProperty","exports","value","_permanentCensorErrors","_censorErrors","throwError","message","code","params","Error","UNKNOWN_ERROR","messageDetails","keys","forEach","key","push","JSON","stringify","error","_version_1","version","reason","length","join","self","kind","MISSING_NEW","name","count","expectedCount","suffix","MISSING_ARGUMENT","UNEXPECTED_ARGUMENT","censorship","permanent","UNSUPPORTED_OPERATION","operation","form","normalize","String","LogLevels","debug","default","info","warn","off","LogLevel","log","logLevel","args","console","apply","_i","arguments","level","__importStar","this","mod","__esModule","result","k","hasOwnProperty","call","errors","require$$0","isHexable","addSlice","array","slice","Array","prototype","Uint8Array","isArrayish","parseInt","i","v","arrayify","INVALID_ARGUMENT","arg","toHexString","match","substring","substr","type","concat","objects","arrays","object","offset","set","isHexString","start","hexlify","NUMERIC_FAULT","operartion","fault","hex","Math","floor","hexZeroPad","splitSignature","signature","r","s","recoveryParam","argument","bytes","data","endOffset","module","assert","val","msg","inherits","ctor","superCtor","super_","TempCtor","constructor","BN","number","base","endian","isBN","negative","words","red","_init","Buffer","wordSize","e","parseHex","str","end","len","min","c","charCodeAt","parseBase","mul","num","isArray","max","left","right","cmp","_initNumber","_initArray","replace","_parseHex","_parseBase","strip","toArray","ceil","j","w","limbLen","limbPow","total","word","imuln","_iaddn","pow","copy","dest","clone","_expand","size","_normSign","inspect","toString","zeros","groupSizes","groupBases","smallMulTo","out","a","b","carry","ncarry","rword","maxJ","padding","groupSize","groupBase","isZero","modn","idivn","toNumber","ret","toJSON","toBuffer","toArrayLike","ArrayType","byteLength","reqLength","littleEndian","res","q","andln","iushrn","_countBits","clz32","t","_zeroBits","bitLength","hi","zeroBits","toTwos","width","abs","inotn","iaddn","fromTwos","testn","notn","ineg","isNeg","neg","iuor","ior","or","uor","iuand","iand","and","uand","iuxor","ixor","xor","uxor","bytesNeeded","bitsLeft","setn","bit","wbit","iadd","isub","add","sub","comb10MulTo","lo","mid","o","a0","al0","ah0","a1","al1","ah1","a2","al2","ah2","a3","al3","ah3","a4","al4","ah4","a5","al5","ah5","a6","al6","ah6","a7","al7","ah7","a8","al8","ah8","a9","al9","ah9","b0","bl0","bh0","b1","bl1","bh1","b2","bl2","bh2","b3","bl3","bh3","b4","bl4","bh4","b5","bl5","bh5","b6","bl6","bh6","b7","bl7","bh7","b8","bl8","bh8","b9","bl9","bh9","w0","imul","w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18","jumboMulTo","FFTM","mulp","x","y","mulTo","hncarry","bigMulTo","makeRBT","N","l","revBin","rb","permute","rbt","rws","iws","rtws","itws","transform","rtwdf","cos","PI","itwdf","sin","p","rtwdf_","itwdf_","re","ie","ro","io","rx","guessLen13b","n","m","odd","conjugate","normalize13b","ws","round","convert13b","stub","ph","_","rwst","iwst","nrws","nrwst","niwst","rmws","mulf","muln","sqr","isqr","toBitArray","iushln","bits","carryMask","newCarry","ishln","hint","extended","h","mask","maskedWords","ishrn","shln","ushln","shrn","ushrn","imaskn","maskn","isubn","addn","subn","iabs","_ishlnsubmul","shift","_wordDiv","mode","bhi","diff","qj","div","divmod","positive","divn","umod","divRound","dm","half","r2","acc","egcd","A","B","C","D","g","isEven","yp","xp","im","isOdd","jm","gcd","_invmp","x1","x2","delta","cmpn","invm","bincn","ucmp","gtn","gt","gten","gte","ltn","lt","lten","lte","eqn","eq","Red","toRed","ctx","convertTo","_forceRed","fromRed","convertFrom","forceRed","redAdd","redIAdd","redSub","redISub","redShl","shl","redMul","_verify2","redIMul","redSqr","_verify1","redISqr","redSqrt","sqrt","redInvm","redNeg","redPow","primes","k256","p224","p192","p25519","MPrime","tmp","_tmp","K256","P224","P192","P25519","prime","_prime","Mont","imod","rinv","minv","ireduce","rlen","split","imulK","input","output","outLen","prev","next","mod3","one","nOne","lpow","z","inv","wnd","current","currentLen","mont","u","defineReadOnly","enumerable","writable","isType","_ethersType","configurable","promises","Promise","then","all","properties","opaque","boolean","string","deepCopy","frozen","map","item","freeze","undefined","inheritable","parent","child","create","__importDefault","bn_js_1","require$$1","BN_1","toHex","bn","toBN","_bnify","bigNumberify","toBigNumber","BigNumber","_hex","checkNew","properties_1","setType","bytes_1","outputValue","details","other","isBigNumber","NegativeOne","bignumber_1","Zero","One","Two","WeiPerEther","MaxUint256","UnicodeNormalizationForm","toUtf8Bytes","errors_1","checkNormalize","c2","toUtf8String","ignoreErrors","extraLength","overlongMask","nextChar","fromCharCode","text","constants_1","HashZero","root","window","JS_SHA3_NO_NODE_JS","process","versions","node","global","COMMON_JS","JS_SHA3_NO_COMMON_JS","HEX_CHARS","SHIFT","RC","BITS","OUTPUT_TYPES","createOutputMethod","outputType","Keccak","update","createShakeOutputMethod","outputBits","createMethod","method","algorithms","methods","methodNames","algorithm","methodName","blocks","reset","block","blockCount","byteCount","outputBlocks","extraBytes","notString","ArrayBuffer","index","lastByteIndex","f","finalize","buffer","arrayBuffer","Uint32Array","digest","c0","c1","c3","c4","c5","c6","c7","c8","c9","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","sha3","keccak_256","Zeros","Partition","UseSTD3ASCIIRules","toLowerCase","partition","label","utf8_1","keccak256_1","keccak256","condition","format","d","argIndex","framesToPop","__self__","F","fetch","DOMException","support","Symbol","Blob","viewClasses","isArrayBufferView","isView","obj","indexOf","normalizeName","test","TypeError","normalizeValue","iteratorFor","items","iterator","done","Headers","headers","append","header","getOwnPropertyNames","consumed","body","bodyUsed","reject","fileReaderReady","reader","resolve","onload","onerror","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","view","Body","_initBody","_bodyInit","_bodyText","isPrototypeOf","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","get","rejected","readAsText","chars","readArrayBufferAsText","formData","decode","json","parse","oldValue","has","callback","thisArg","values","entries","Request","options","upcased","url","credentials","signal","toUpperCase","referrer","trim","decodeURIComponent","Response","bodyInit","status","ok","statusText","response","redirectStatuses","redirect","RangeError","location","err","stack","init","request","aborted","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","line","parts","responseURL","responseText","ontimeout","onabort","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","removeEventListener","send","polyfill","arrayifyInteger","unshift","unarrayifyInteger","_decodeChildren","childOffset","decoded","_decode","lengthLength","_encode","payload","getChecksumAddress","address","hashed","i_1","ibanLookup","safeDigits","log10","LN10","ibanChecksum","expanded","checksum","getAddress","base36","transaction","from","nonce","rlp_1","encode","stripZeros","extendStatics","__extends","setPrototypeOf","__proto__","__","paramTypeBytes","RegExp","paramTypeNumber","paramTypeArray","regexParen","regexIdentifier","verifyType","parseParam","param","allowIndexed","originalParam","state","allowType","allowParams","components","indexed","allowName","allowArray","sibling","readArray","formatParamType","paramType","getParamCoder","defaultCoerceFunc","fragment","inputs","abi","anonymous","splitNesting","modifier","parseSignatureEvent","constant","gas","outputs","payable","stateMutability","comps","parseSignatureFunction","Coder","coerceFunc","localName","dynamic","CoderAnonymous","_super","coder","_this","CoderNull","CoderNumber","signed","bounds","padZeros","coderType","uint256Coder","CoderBoolean","CoderFixedBytes","CoderAddress","address_1","_encodeDynamicBytes","_decodeDynamicBytes","CoderDynamicBytes","CoderString","alignSize","pack","coders","arrayValues","staticSize","dynamicSize","part","dynamicOffset","unpack","baseOffset","CoderArray","checkArgumentCount","decodedLength","CoderTuple","types","accum","depth","paramTypeSimple","bool","shallowCopy","component","getTupleParamCoder","AbiCoder","typeObject","exec","parseFloat","isNaN","long","ms","msAbs","plural","fmtLong","fmtShort","isPlural","env","selectColor","namespace","hash","createDebug","colors","prevTime","enabled","curr","Number","Date","coerce","formatter","formatters","splice","formatArgs","useColors","color","destroy","extend","instances","delimiter","newDebug","toNamespace","regexp","disable","namespaces","names","skips","enable","save","instance","humanize","load","lastC","storage","setItem","removeItem","getItem","DEBUG","__nwjs","navigator","userAgent","document","documentElement","style","WebkitAppearance","firebug","exception","table","$1","localStorage","localstorage","strip0x","encodeParameters","vals","defaultAbiCoder","decodeParameters","isEmpty","freeSelf","Function","objectProto","nativeObjectToString","symToStringTag","toStringTag","isOwn","tag","unmasked","getRawTag","objectToString","uid","isObject","baseGetTag","coreJsData","maskSrcKey","IE_PROTO","func","funcToString","reIsHostCtor","reIsNative","isMasked","isFunction","toSource","getValue","baseIsNative","getNative","__data__","nativeCreate","Hash","clear","entry","hashDelete","hashGet","hashHas","hashSet","assocIndexOf","pop","ListCache","listCacheDelete","listCacheGet","listCacheHas","listCacheSet","isKeyable","getMapData","MapCache","Map","mapCacheDelete","mapCacheGet","mapCacheHas","mapCacheSet","memoize","resolver","memoized","cache","Cache","INSIDE_EVERY_PARENTHESES","FIRST_CLOSING_PARENTHESES","makeMulticallData","calls","target","async","aggregate","config","keyToArgMap","reduce","returns","multicallAddress","argValues","returnTypesString","argTypes","filter","invariant","argValue","idx","returnTypes","callDataBytes","outerResults","rawData","id","web3","ethers","provider","rpcUrl","wsResponseTimeout","abiEncodedData","onMessage","clearTimeout","timeoutHandle","onmessage","jsonrpc","to","setTimeout","eth","rawResponse","content","ethCall","returnTypeArray","ele","returnDataMeta","outerResultsDecoded","blockNumber","parsedVals","results","resultsDecoded","retObj","original","transformed","WebSocket","MozWebSocket","reWsEndpoint","prepareConfig","interval","staleBlockRetryWait","errorRetryWait","wsReconnectTimeout","preset","addresses","multicall","model","store","storeTransformed","latestPromiseId","latestBlockNumber","listeners","subscribe","poll","handler","wsReconnectHandler","watching","reconnectWebSocket","timeout","destroyWebSocket","setupWebSocket","onopen","resolveFetchPromise","initialFetchResolver","onclose","close","listener","batch","events","retry","promiseId","dataTransformed","cancelPromiseId","isNewState","alertListeners","initialFetchPromise","tap","nextModel","fetchPromise","OPEN","unsub","onNewBlock","onPoll","onError","stop","recreate","awaitInitialFetch"],"mappings":"ohBACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,UAAkB,wCCDlBF,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IAGtDD,gBAAwB,gBAExBA,kBAA0B,kBAG1BA,cAAsB,cAStBA,iBAAyB,iBAIzBA,mBAA2B,mBAI3BA,mBAA2B,mBAI3BA,sBAA8B,sBAI9BA,gBAAwB,gBAGxBA,qBAA6B,qBAG7BA,gBAAwB,gBAGxBA,0BAA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,GACdvQ,EAAMwQ,iBAAmB,GACzBxQ,EAAM0Q,kBAAoB,KAC1B1Q,EAAMgS,gBAAkBhS,EAAMyQ,gBAC9BW,IACIpR,EAAMgR,WAAahR,EAAMne,GAAI,KAC3ByvB,EACEgB,EAAe,IAAI7mB,SAAQ,SAAAsM,GAC/BuZ,EAAsBvZ,YAExB8Y,EAAK7hC,KAAK,CACRgxB,MAAAA,EACA+P,SAAU,EACVuB,oBAAAA,IAEKgB,SAEF7mB,QAAQsM,WAEjB+a,oCACS9S,EAAMmS,+CAGNnS,EAAMmS,0CAGNnS,EAAMsQ"} \ No newline at end of file diff --git a/src/helpers.js b/src/helpers.js index c15ca96..a607983 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -57,7 +57,7 @@ export function isEmpty(obj) { return !obj || Object.keys(obj).length === 0; } -export async function ethCall(rawData, { id, web3, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) { +export async function ethCall(rawData, { id, web3, ethers, provider, rpcUrl, block, multicallAddress, ws, wsResponseTimeout }) { const abiEncodedData = AGGREGATE_SELECTOR + strip0x(rawData); if (ws) { log('Sending via WebSocket'); @@ -92,6 +92,32 @@ export async function ethCall(rawData, { id, web3, rpcUrl, block, multicallAddre ws.onmessage = onMessage; }); } + else if (ethers) { + log('Sending via ethers provider'); + return ethers.send({ + method: 'eth_call', + params: [ + { + to: multicallAddress, + data: abiEncodedData + }, + block || 'latest' + ] + }) + } + else if (provider) { + log('Sending via EIP-1193 provider'); + return provider.request({ + method: 'eth_call', + params: [ + { + to: multicallAddress, + data: abiEncodedData + }, + block || 'latest' + ] + }) + } else if (web3) { log('Sending via web3 provider'); return web3.eth.call({