From 4fd35224b379a555595773e0acf057eb76e68c20 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Wed, 20 Jun 2018 21:14:56 -0400 Subject: [PATCH] Updated readme and dist files. --- README.md | 35 ++++++++++++++++++++++++++++++----- dist/ethers.d.ts | 2 +- dist/ethers.d.ts.map | 2 +- dist/ethers.js | 9 +++++---- dist/ethers.min.js | 2 +- dist/ethers.min.js.map | 2 +- src/utils/transaction.d.ts | 2 +- src/utils/transaction.js | 9 +++++---- 8 files changed, 45 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 73be3a6e9..7f3736368 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ethers.js [![npm version](https://badge.fury.io/js/ethers.svg)](https://badge.fury.io/js/ethers) -Complete Ethereum wallet implementation and utilities in JavaScript. +Complete Ethereum wallet implementation and utilities in JavaScript (and TypeScript). **Features:** @@ -12,11 +12,12 @@ Complete Ethereum wallet implementation and utilities in JavaScript. - Import and export BIP 39 **mnemonic phrases** (12 word backup phrases) and **HD Wallets** - Meta-classes create JavaScript objects from any contract ABI - Connect to Ethereum nodes over [JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC), [INFURA](https://infura.io), [Etherscan](https://etherscan.io), or [MetaMask](https://metamask.io) -- ENS names are first-class citizens; they can almost always used instead of Ethereum addresses -- **Tiny** (~79kb compressed; 242kb uncompressed) +- ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be +- **Tiny** (~82kb compressed; 263kb uncompressed) - **Complete** functionality for all your Ethereum needs - Extensive [documentation](https://docs.ethers.io/ethers.js/html/) - Large collection of test cases which are maintained and added to +- Fully TypeScript ready, with definition files and full TypeScript source - **MIT License** (including ALL dependencies); completely open source to do with as you please @@ -27,7 +28,7 @@ To use in a browser: ```html ``` @@ -39,7 +40,6 @@ To use in [node.js](https://nodejs.org/): ``` - Documentation ------------- @@ -48,6 +48,31 @@ Browse the [API Documentation](https://docs.ethers.io/ethers.js/html/) online. Documentation is generated using [Sphinx](http://www.sphinx-doc.org) and can be browsed locally from the /docs/build/html directory. +Hacking and Contributing +------------------------ + +The JavaScript code is now generated from TypeScript, so make sure you modify the +TypeScript and compile it, rather than modifying the JavaScript directly. To start +auto-compiling the TypeScript code, you may use: + +``` +/home/ethers> npm run auto-build +``` + +A very important part of ethers is its exhaustive test cases, so before making any +bug fix, please add a test case that fails prior to the fix, and succeeds after the +fix. All regression tests must pass. + +Pull requests are always welcome, but please keep a few points in mind: + +- Compatibility-breaking changes will not be accepted; they may be considered for the next major version +- Security is important; adding dependencies require fairly convincing arguments +- The library aims to be lean, so keep an eye on the `dist/ethers.min.js` filesize before and after your changes +- Add test cases for both expected and unexpected input +- Any new features need to be supported by us (issues, documentation, testing), so anything that is overly complicated or specific may not be accepted + +If in doubt, please start an issue, and we can have a nice public discussion. :) + Donations --------- diff --git a/dist/ethers.d.ts b/dist/ethers.d.ts index 477d203fb..f32e948dc 100644 --- a/dist/ethers.d.ts +++ b/dist/ethers.d.ts @@ -355,7 +355,7 @@ declare module "utils/transaction" { v?: number; } export type SignDigestFunc = (digest: Arrayish) => Signature; - export function sign(transaction: UnsignedTransaction, signDigest?: SignDigestFunc): string; + export function sign(transaction: UnsignedTransaction, signDigest: SignDigestFunc): string; export function parse(rawTransaction: Arrayish): Transaction; } declare module "wallet/wallet" { diff --git a/dist/ethers.d.ts.map b/dist/ethers.d.ts.map index 69a24298a..c27ca3949 100644 --- a/dist/ethers.d.ts.map +++ b/dist/ethers.d.ts.map @@ -1 +1 @@ -{"version":3,"sources":["src.ts/utils/keccak256.ts","src.ts/utils/properties.ts","src.ts/utils/errors.ts","src.ts/utils/secp256k1.ts","src.ts/utils/bytes.ts","src.ts/utils/bignumber.ts","src.ts/utils/rlp.ts","src.ts/utils/address.ts","src.ts/utils/utf8.ts","src.ts/utils/abi-coder.ts","src.ts/contracts/interface.ts","src.ts/wordlists/wordlist.ts","src.ts/wordlists/lang-en.ts","src.ts/utils/pbkdf2.ts","src.ts/utils/hmac.ts","src.ts/utils/sha2.ts","src.ts/wallet/hdnode.ts","src.ts/utils/random-bytes.ts","src.ts/wallet/signing-key.ts","src.ts/wallet/secret-storage.ts","src.ts/utils/hash.ts","src.ts/utils/transaction.ts","src.ts/wallet/wallet.ts","src.ts/providers/networks.ts","src.ts/providers/provider.ts","src.ts/contracts/contract.ts","src.ts/contracts/index.ts","src.ts/utils/base64.ts","src.ts/utils/web.ts","src.ts/providers/etherscan-provider.ts","src.ts/providers/fallback-provider.ts","src.ts/providers/json-rpc-provider.ts","src.ts/providers/ipc-provider.ts","src.ts/providers/infura-provider.ts","src.ts/providers/web3-provider.ts","src.ts/providers/index.ts","src.ts/utils/solidity.ts","src.ts/utils/units.ts","src.ts/utils/index.ts","src.ts/wallet/index.ts","src.ts/index.ts","src.ts/wordlists/lang-it.ts","src.ts/wordlists/lang-ja.ts","src.ts/wordlists/lang-ko.ts","src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":";IAIA,OAAO,EAAY,QAAQ,EAAE,oBAAgB;IAE7C,MAAM,oBAAoB,MAAM,QAAQ,GAAG,MAAM,CAEhD;;;ICND,MAAM,yBAAyB,QAAQ,GAAG,EAAE,MAAM,MAAM,EAAE,OAAO,GAAG,GAAG,IAAI,CAM1E;IAED,MAAM,uBAAuB,QAAQ,GAAG,EAAE,MAAM,MAAM,EAAE,OAAO,GAAG,GAAG,IAAI,CAMxE;IAED,MAAM,4BAA4B,QAAQ,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAkB3D;IAED,MAAM,sBAAsB,QAAQ,GAAG,GAAG,GAAG,CAI5C;IAED,MAAM,mBAAmB,QAAQ,GAAG,GAAG,GAAG,CAEzC;;;IC3CD,MAAM,CAAC,MAAM,aAAa,kBAAkB,CAAC;IAG7C,MAAM,CAAC,MAAM,eAAe,oBAAoB,CAAC;IAIjD,MAAM,CAAC,MAAM,WAAW,gBAAgB,CAAC;IAGzC,MAAM,CAAC,MAAM,cAAc,mBAAmB,CAAC;IAW/C,MAAM,CAA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,MAAM,CAAC;QAOtC,IAAI,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;KAGrC;IAED,MAAM,MAAM,QAAe,CAAC;IAG5B,OAAO,EAAE,MAAM,EAAE,CAAC;;;ICvIlB,OAAO,EAAY,QAAQ,EAAE,2BAAmB;IAuDhD,YAAa,SAAQ,QAAQ;;QAKzB,OAAO,CAAC,OAAO,MAAM,GAAG,MAAM;QAQ9B,YAAY,CAAC,MAAM,MAAM,GAAG,MAAM;KAIrC;IAED,MAAM,MAAM,QAAe,CAAC;IAG5B,OAAO,EAAE,MAAM,EAAE,CAAA;;;IC7EjB,OAAO,EAAY,QAAQ,EAAE,2BAAmB;IAiChD,YAAa,SAAQ,QAAQ;QACzB,OAAO,CAAC,QAAQ,CAAQ;oBACZ,OAAO,KAAA;QAKnB,OAAO,CAAC,OAAO,MAAM,GAAG,MAAM;QAI9B,YAAY,CAAC,MAAM,MAAM,GAAG,MAAM;QAIlC,KAAK,CAAC,UAAU,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;KAIzC;IAED,MAAM,QAAQ,QAAmB,CAAC;IAGlC,MAAM,QAAQ,QAAmB,CAAC;IAyBlC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC","file":"ethers.d.ts","sourcesContent":["'use strict';\n\nimport sha3 = require('js-sha3');\n\nimport { arrayify, Arrayish } from './bytes';\n\nexport function keccak256(data: Arrayish): string {\n return '0x' + sha3.keccak_256(arrayify(data));\n}\n\n//export default keccak256;\n","'use strict';\n\nexport function defineReadOnly(object: any, name: string, value: any): void {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n\nexport function defineFrozen(object: any, name: string, value: any): void {\n var frozen = JSON.stringify(value);\n Object.defineProperty(object, name, {\n enumerable: true,\n get: function() { return JSON.parse(frozen); }\n });\n}\n\nexport function resolveProperties(object: any): Promise {\n let result: any = {};\n\n let promises: Array> = [];\n Object.keys(object).forEach((key) => {\n let value = object[key];\n if (value instanceof Promise) {\n promises.push(\n value.then((value) => { result[key] = value; })\n );\n } else {\n result[key] = value;\n }\n });\n\n return Promise.all(promises).then(() => {\n return object;\n });\n}\n\nexport function shallowCopy(object: any): any {\n let result = {};\n for (var key in object) { result[key] = object[key]; }\n return result;\n}\n\nexport function jsonCopy(object: any): any {\n return JSON.parse(JSON.stringify(object));\n}\n","'use strict';\n\n// Unknown Error\nexport const UNKNOWN_ERROR = 'UNKNOWN_ERROR';\n\n// Not implemented\nexport const NOT_IMPLEMENTED = 'NOT_IMPLEMENTED';\n\n// Missing new operator to an object\n// - name: The name of the class\nexport const MISSING_NEW = 'MISSING_NEW';\n\n// Call exception\nexport const CALL_EXCEPTION = 'CALL_EXCEPTION';\n\n// Response from a server was invalid\n// - response: The body of the response\n//'BAD_RESPONSE',\n\n// Invalid argument (e.g. type) to a function:\n// - arg: The argument name that was invalid\n// - value: The value of the argument\n// - type: The type of the argument\n// - expected: What was expected\nexport const INVALID_ARGUMENT = 'INVALID_ARGUMENT';\n\n// Missing argument to a function:\n// - arg: The argument name that is required\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexport const MISSING_ARGUMENT = 'MISSING_ARGUMENT';\n\n// Too many arguments\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexport const UNEXPECTED_ARGUMENT = 'UNEXPECTED_ARGUMENT';\n\n// Numeric Fault\n// - operation: the operation being executed\n// - fault: the reason this faulted\nexport const NUMERIC_FAULT = 'NUMERIC_FAULT';\n\n\n// Unsupported operation\n// - operation\nexport const UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION';\n\n// @TODO: Enum\nexport function throwError(message: string, code: string, params: any): never {\n if (!code) { code = UNKNOWN_ERROR; }\n if (!params) { params = {}; }\n\n var messageDetails = [];\n Object.keys(params).forEach(function(key) {\n try {\n messageDetails.push(key + '=' + JSON.stringify(params[key]));\n } catch (error) {\n messageDetails.push(key + '=' + JSON.stringify(params[key].toString()));\n }\n });\n var reason = message;\n if (messageDetails.length) {\n message += ' (' + messageDetails.join(', ') + ')';\n }\n\n// @TODO: Any??\n var error: any = new Error(message);\n error.reason = reason;\n error.code = code\n\n Object.keys(params).forEach(function(key) {\n error[key] = params[key];\n });\n\n throw error;\n}\n\nexport function checkNew(self: any, kind: any): void {\n if (!(self instanceof kind)) {\n throwError('missing new', MISSING_NEW, { name: kind.name });\n }\n}\n\n","'use strict';\n\nimport { getAddress } from './address';\nimport { arrayify, Arrayish, hexlify, hexZeroPad } from './bytes';\nimport { keccak256 } from './keccak256';\nimport { defineReadOnly } from './properties';\n\nimport * as errors from './errors';\n\ninterface _BN {\n toString(radix: number): string;\n encode(encoding: string, compact: boolean): Uint8Array;\n toArray(endian: string, width: number): Uint8Array;\n}\n\ninterface _Signature {\n r: _BN,\n s: _BN,\n recoveryParam: number\n}\n\ninterface _KeyPair {\n sign(message: Uint8Array, options: { canonical?: boolean }): _Signature;\n getPublic(compressed: boolean, encoding?: string): string;\n getPublic(): _BN;\n getPrivate(encoding?: string): string;\n encode(encoding: string, compressed: boolean): string;\n priv: _BN;\n}\n\ninterface _EC {\n constructor(curve: string);\n\n n: _BN;\n\n keyFromPublic(publicKey: string | Uint8Array): _KeyPair;\n keyFromPrivate(privateKey: string | Uint8Array): _KeyPair;\n recoverPubKey(data: Uint8Array, signature: { r: Uint8Array, s: Uint8Array }, recoveryParam: number): _KeyPair;\n}\n\nimport * as elliptic from 'elliptic';\n\nconst curve:_EC = new elliptic.ec('secp256k1');\n\n\nexport const N = '0x' + curve.n.toString(16);\n\nexport interface Signature {\n r: string;\n s: string;\n recoveryParam: number;\n v?: number;\n}\n\nexport class KeyPair {\n\n readonly privateKey: string;\n\n readonly publicKey: string;\n readonly compressedPublicKey: string;\n\n readonly publicKeyBytes: Uint8Array;\n\n constructor(privateKey: Arrayish) {\n let keyPair: _KeyPair = curve.keyFromPrivate(arrayify(privateKey));\n\n defineReadOnly(this, 'privateKey', hexlify(keyPair.priv.toArray('be', 32)));\n defineReadOnly(this, 'publicKey', '0x' + keyPair.getPublic(false, 'hex'));\n defineReadOnly(this, 'compressedPublicKey', '0x' + keyPair.getPublic(true, 'hex'));\n defineReadOnly(this, 'publicKeyBytes', keyPair.getPublic().encode(null, true));\n }\n\n sign(digest: Arrayish): Signature {\n let keyPair: _KeyPair = curve.keyFromPrivate(arrayify(this.privateKey));\n let signature = keyPair.sign(arrayify(digest), {canonical: true});\n return {\n recoveryParam: signature.recoveryParam,\n r: hexZeroPad('0x' + signature.r.toString(16), 32),\n s: hexZeroPad('0x' + signature.s.toString(16), 32),\n v: 27 + signature.recoveryParam\n }\n\n }\n}\n\nexport function recoverPublicKey(digest: Arrayish, signature: Signature): string {\n let sig = {\n r: arrayify(signature.r),\n s: arrayify(signature.s)\n };\n return '0x' + curve.recoverPubKey(arrayify(digest), sig, signature.recoveryParam).encode('hex', false);\n}\n\nexport function computePublicKey(key: Arrayish, compressed?: boolean): string {\n\n let bytes = arrayify(key);\n\n if (bytes.length === 32) {\n let keyPair: KeyPair = new KeyPair(bytes);\n if (compressed) {\n return keyPair.compressedPublicKey;\n }\n return keyPair.publicKey;\n\n } else if (bytes.length === 33) {\n if (compressed) { return hexlify(bytes); }\n return '0x' + curve.keyFromPublic(bytes).getPublic(false, 'hex');\n\n } else if (bytes.length === 65) {\n if (!compressed) { return hexlify(bytes); }\n return '0x' + curve.keyFromPublic(bytes).getPublic(true, 'hex');\n }\n\n errors.throwError('invalid public or private key', errors.INVALID_ARGUMENT, { arg: 'key', value: '[REDACTED]' });\n return null;\n}\n\nexport function recoverAddress(digest: Arrayish, signature: Signature): string {\n return computeAddress(recoverPublicKey(digest, signature));\n}\n\nexport function computeAddress(key: string): string {\n // Strip off the leading \"0x04\"\n let publicKey = '0x' + computePublicKey(key).slice(4);\n return getAddress('0x' + keccak256(publicKey).substring(26));\n}\n\n","/**\n * Conversion Utilities\n *\n */\n\nimport { BigNumber } from './bignumber';\nimport { Signature } from './secp256k1';\n\nimport errors = require('./errors');\n\n\n\nexport type Arrayish = string | ArrayLike;\n\n\nfunction isBigNumber(value: any): value is BigNumber {\n return !!value._bn;\n}\n\nfunction addSlice(array: Uint8Array): Uint8Array {\n if (array.slice) { return array; }\n\n array.slice = function() {\n var args = Array.prototype.slice.call(arguments);\n return new Uint8Array(Array.prototype.slice.apply(array, args));\n }\n\n return array;\n}\n\nexport function isArrayish(value: any): boolean {\n if (!value || parseInt(value.length) != value.length || typeof(value) === 'string') {\n return false;\n }\n\n for (var i = 0; i < value.length; i++) {\n var v = value[i];\n if (v < 0 || v >= 256 || parseInt(v) != v) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function arrayify(value: Arrayish | BigNumber): Uint8Array {\n if (value == null) {\n errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (isBigNumber(value)) {\n value = value.toHexString();\n }\n\n if (typeof(value) === 'string') {\n let match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n value = value.substring(2);\n if (value.length % 2) { 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\n return addSlice(new Uint8Array(result));\n\n } else if (typeof(value) === 'string') {\n }\n\n if (isArrayish(value)) {\n return addSlice(new Uint8Array(value));\n }\n\n errors.throwError('invalid arrayify value', null, { arg: 'value', value: value, type: typeof(value) });\n return null;\n}\n\nexport function concat(objects: Array): Uint8Array {\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\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\n return addSlice(result);\n}\n\nexport function stripZeros(value: Arrayish): Uint8Array {\n let result: Uint8Array = arrayify(value);\n\n if (result.length === 0) { return result; }\n\n // Find the first non-zero entry\n var start = 0;\n while (result[start] === 0) { start++ }\n\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n\n return result;\n}\n\nexport function padZeros(value: Arrayish, length: number): Uint8Array {\n value = arrayify(value);\n\n if (length < value.length) { throw new Error('cannot pad'); }\n\n var result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\n\n\nexport function isHexString(value: any, length?: number): boolean {\n if (typeof(value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false\n }\n if (length && value.length !== 2 + 2 * length) { return false; }\n return true;\n}\n\nconst HexCharacters: string = '0123456789abcdef';\n\nexport function hexlify(value: Arrayish | BigNumber | number): string {\n\n if (isBigNumber(value)) {\n return value.toHexString();\n }\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\n var hex = '';\n while (value) {\n hex = HexCharacters[value & 0x0f] + hex;\n value = Math.trunc(value / 16);\n }\n\n if (hex.length) {\n if (hex.length % 2) { hex = '0' + hex; }\n return '0x' + hex;\n }\n\n return '0x00';\n }\n\n if (typeof(value) === 'string') {\n let match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (value.length % 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n }\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\n errors.throwError('invalid hexlify value', null, { arg: 'value', value: value });\n return 'never';\n}\n\nexport function hexDataLength(data: string) {\n if (!isHexString(data) || (data.length % 2) !== 0) {\n return null;\n }\n return (data.length - 2) / 2;\n}\n\nexport function hexDataSlice(data: string, offset: number, length?: number): string {\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\n if (length != null) {\n return '0x' + data.substring(offset, offset + 2 * length);\n }\n\n return '0x' + data.substring(offset);\n}\n\nexport function hexStripZeros(value: string): string {\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}\n\nexport function hexZeroPad(value: string, length: number): string {\n if (!isHexString(value)) {\n errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n while (value.length < 2 * length + 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n}\n\nexport function splitSignature(signature: Arrayish): Signature {\n let bytes: Uint8Array = arrayify(signature);\n if (bytes.length !== 65) {\n throw new Error('invalid signature');\n }\n\n var v = bytes[64];\n if (v !== 27 && v !== 28) {\n v = 27 + (v % 2);\n }\n\n return {\n r: hexlify(bytes.slice(0, 32)),\n s: hexlify(bytes.slice(32, 64)),\n recoveryParam: (v - 27),\n v: v\n }\n}\n\nexport function joinSignature(signature: Signature): string {\n return hexlify(concat([\n hexZeroPad(signature.r, 32),\n hexZeroPad(signature.s, 32),\n (signature.recoveryParam ? '0x1c': '0x1b')\n ]));\n}\n","'use strict';\n\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 */\n\nimport _BN from 'bn.js';\n\nimport { Arrayish, hexlify, isArrayish, isHexString } from './bytes';\nimport { defineReadOnly } from './properties';\nimport * as errors from '../utils/errors';\n\nfunction _isBigNumber(value: any): value is BigNumber {\n return isBigNumber(value);\n}\n\nexport type BigNumberish = BigNumber | string | number | Arrayish;\n\nexport class BigNumber {\n private readonly _bn: _BN.BN;\n constructor(value: BigNumberish) {\n errors.checkNew(this, BigNumber);\n\n if (typeof(value) === 'string') {\n if (isHexString(value)) {\n if (value == '0x') { value = '0x0'; }\n defineReadOnly(this, '_bn', new _BN.BN(value.substring(2), 16));\n\n } else if (value[0] === '-' && isHexString(value.substring(1))) {\n defineReadOnly(this, '_bn', (new _BN.BN(value.substring(3), 16)).mul(ConstantNegativeOne._bn));\n\n } else if (value.match(/^-?[0-9]*$/)) {\n if (value == '') { value = '0'; }\n defineReadOnly(this, '_bn', new _BN.BN(value));\n }\n\n } else if (typeof(value) === 'number') {\n if (Math.trunc(value) !== value) {\n errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: Math.trunc(value) });\n }\n try {\n defineReadOnly(this, '_bn', new _BN.BN(value));\n } catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n\n } else if (_BN.BN.isBN(value)) {\n defineReadOnly(this, '_bn', value);\n\n } else if (_isBigNumber(value)) {\n defineReadOnly(this, '_bn', value._bn);\n\n } else if (isArrayish(value)) {\n defineReadOnly(this, '_bn', new _BN.BN(hexlify(value).substring(2), 16));\n\n } else {\n errors.throwError('invalid BigNumber value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n }\n\n fromTwos(value: BigNumberish): BigNumber {\n return new BigNumber(this._bn.fromTwos(value));\n }\n\n toTwos(value: BigNumberish): BigNumber {\n return new BigNumber(this._bn.toTwos(value));\n }\n\n add(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.add(bigNumberify(other)._bn));\n }\n\n sub(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.sub(bigNumberify(other)._bn));\n }\n\n div(other: BigNumberish): BigNumber {\n let o: BigNumber = bigNumberify(other)._bn;\n if (o.isZero()) {\n errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });\n }\n return new BigNumber(this._bn.div(o));\n }\n\n mul(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.mul(bigNumberify(other)._bn));\n }\n\n mod(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.mod(bigNumberify(other)._bn));\n }\n\n pow(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.pow(bigNumberify(other)._bn));\n }\n\n maskn(value: BigNumberish): BigNumber {\n return new BigNumber(this._bn.maskn(value));\n }\n\n eq(other: BigNumberish): boolean {\n return this._bn.eq(bigNumberify(other)._bn);\n }\n\n lt(other: BigNumberish): boolean {\n return this._bn.lt(bigNumberify(other)._bn);\n }\n\n lte(other: BigNumberish): boolean {\n return this._bn.lte(bigNumberify(other)._bn);\n }\n\n gt(other: BigNumberish): boolean {\n return this._bn.gt(bigNumberify(other)._bn);\n }\n\n gte(other: BigNumberish): boolean {\n return this._bn.gte(bigNumberify(other)._bn);\n }\n\n isZero(): boolean {\n return this._bn.isZero();\n }\n\n toNumber(): number {\n try {\n return this._bn.toNumber();\n } catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n return null;\n }\n\n toString(): string {\n return this._bn.toString(10);\n }\n\n toHexString(): string {\n var hex = this._bn.toString(16);\n if (hex.length % 2) { hex = '0' + hex; }\n return '0x' + hex;\n }\n}\n\nexport function isBigNumber(value: any): boolean {\n return (value._bn && value._bn.mod);\n}\n\nexport function bigNumberify(value: BigNumberish): BigNumber {\n if (_isBigNumber(value)) { return value; }\n return new BigNumber(value);\n}\n\nexport const ConstantNegativeOne: BigNumber = bigNumberify(-1);\nexport const ConstantZero: BigNumber = bigNumberify(0);\nexport const ConstantOne: BigNumber = bigNumberify(1);\nexport const ConstantTwo: BigNumber = bigNumberify(2);\nexport const ConstantWeiPerEther: BigNumber = bigNumberify(new _BN.BN('1000000000000000000'));\n","//See: https://github.com/ethereum/wiki/wiki/RLP\n\n\nimport { arrayify, Arrayish, hexlify } from './bytes';\n\nfunction arrayifyInteger(value: number): Array {\n var result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\n\nfunction unarrayifyInteger(data: Uint8Array, offset: number, length: number): number {\n var result = 0;\n for (var i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\n\nfunction _encode(object: Array | string): Array {\n if (Array.isArray(object)) {\n var payload = [];\n object.forEach(function(child) {\n payload = payload.concat(_encode(child));\n });\n\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length)\n return payload;\n }\n\n var length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n\n return length.concat(payload);\n\n } else {\n let data: Array = Array.prototype.slice.call(arrayify(object));\n\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\n var length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n\n return length.concat(data);\n }\n}\n\nexport function encode(object: any): string {\n return hexlify(_encode(object));\n}\n\nfunction _decodeChildren(data, offset, childOffset, length) {\n var result = [];\n\n while (childOffset < offset + 1 + length) {\n var decoded = _decode(data, childOffset);\n\n result.push(decoded.result);\n\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n throw new Error('invalid rlp');\n }\n }\n\n return {consumed: (1 + length), result: result};\n}\n\n// returns { consumed: number, result: Object }\nfunction _decode(data: Uint8Array, offset: number): { consumed: number, result: any } {\n if (data.length === 0) { 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\n var length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n throw new Error('to short');\n }\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\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\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\n var result = 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\n var result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result }\n }\n return { consumed: 1, result: hexlify(data[offset]) };\n}\n\nexport function decode(data: Arrayish): any {\n let bytes = 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}\n\n","'use strict';\n\n// We use this for base 36 maths\nimport BN = require('bn.js');\n\nimport { BigNumber } from './bignumber';\nimport { arrayify, Arrayish, stripZeros, hexlify } from './bytes';\nimport { keccak256 } from './keccak256';\nimport { encode } from './rlp';\n\nimport errors = require('./errors');\n\n\nfunction getChecksumAddress(address: string): string {\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\n address = address.toLowerCase();\n\n let chars = address.substring(2).split('');\n\n let hashed = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n hashed[i] = chars[i].charCodeAt(0);\n }\n hashed = arrayify(keccak256(hashed));\n\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\n return '0x' + chars.join('');\n}\n\n// Shims for environments that are missing some required constants and functions\nvar MAX_SAFE_INTEGER: number = 0x1fffffffffffff;\n\nfunction log10(x: number): number {\n if (Math.log10) { return Math.log10(x); }\n return Math.log(x) / Math.LN10;\n}\n\n\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n\n// Create lookup table\nvar ibanLookup = {};\nfor (var i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); }\nfor (var i = 0; i < 26; i++) { 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));\n\nfunction ibanChecksum(address: string): string {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + '00';\n\n var expanded = '';\n address.split('').forEach(function(c) {\n expanded += ibanLookup[c];\n });\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\n var checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) { checksum = '0' + checksum; }\n\n return checksum;\n};\n\nexport function getAddress(address: string): string {\n var result = null;\n\n if (typeof(address) !== 'string') {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n\n // Missing the 0x prefix\n if (address.substring(0, 2) !== '0x') { address = '0x' + address; }\n\n result = getChecksumAddress(address);\n\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\n // Maybe ICAP? (we only support direct mode)\n } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n\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\n result = (new BN(address.substring(4), 36)).toString(16);\n while (result.length < 40) { result = '0' + result; }\n result = getChecksumAddress('0x' + result);\n\n } else {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n\n return result;\n}\n\nexport function getIcapAddress(address: string): string {\n var base36 = (new BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();\n while (base36.length < 30) { base36 = '0' + base36; }\n return 'XE' + ibanChecksum('XE00' + base36) + base36;\n}\n\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\nexport function getContractAddress(transaction: { from: string, nonce: Arrayish | BigNumber | number }) {\n if (!transaction.from) { throw new Error('missing from address'); }\n var nonce = transaction.nonce;\n\n return getAddress('0x' + keccak256(encode([\n getAddress(transaction.from),\n stripZeros(hexlify(nonce))\n ])).substring(26));\n}\n\n","'use strict';\n\nimport { arrayify, Arrayish } from './bytes';\n\nexport enum UnicodeNormalizationForm {\n current = '',\n NFC = 'NFC',\n NFD = 'NFD',\n NFKC = 'NFKC',\n NFKD = 'NFKD'\n};\n\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nexport function toUtf8Bytes(str: string, form: UnicodeNormalizationForm = UnicodeNormalizationForm.current): Uint8Array {\n\n if (form != UnicodeNormalizationForm.current) {\n str = str.normalize(form);\n }\n\n var result = [];\n var offset = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 128) {\n result[offset++] = c;\n } else if (c < 2048) {\n result[offset++] = (c >> 6) | 192;\n result[offset++] = (c & 63) | 128;\n } else if (((c & 0xFC00) == 0xD800) && (i + 1) < str.length && ((str.charCodeAt(i + 1) & 0xFC00) == 0xDC00)) {\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF);\n result[offset++] = (c >> 18) | 240;\n result[offset++] = ((c >> 12) & 63) | 128;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n } else {\n result[offset++] = (c >> 12) | 224;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n }\n }\n\n return arrayify(result);\n};\n\n\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nexport function toUtf8String(bytes: Arrayish): string {\n bytes = arrayify(bytes);\n\n var result = '';\n var i = 0;\n\n // Invalid bytes are ignored\n while(i < bytes.length) {\n var c = bytes[i++];\n if (c >> 7 == 0) {\n // 0xxx xxxx\n result += String.fromCharCode(c);\n continue;\n }\n\n // Invalid starting byte\n if (c >> 6 == 0x02) { continue; }\n\n // Multibyte; how many bytes left for thus character?\n var extraLength = null;\n if (c >> 5 == 0x06) {\n extraLength = 1;\n } else if (c >> 4 == 0x0e) {\n extraLength = 2;\n } else if (c >> 3 == 0x1e) {\n extraLength = 3;\n } else if (c >> 2 == 0x3e) {\n extraLength = 4;\n } else if (c >> 1 == 0x7e) {\n extraLength = 5;\n } else {\n continue;\n }\n\n // Do we have enough bytes in our data?\n if (i + extraLength > bytes.length) {\n\n // If there is an invalid unprocessed byte, try to continue\n for (; i < bytes.length; i++) {\n if (bytes[i] >> 6 != 0x02) { break; }\n }\n if (i != bytes.length) continue;\n\n // All leftover bytes are valid.\n return result;\n }\n\n // Remove the UTF-8 prefix from the char (res)\n var res = c & ((1 << (8 - extraLength - 1)) - 1);\n\n var count;\n for (count = 0; count < extraLength; count++) {\n var nextChar = bytes[i++];\n\n // Is the char valid multibyte part?\n if (nextChar >> 6 != 0x02) {break;};\n res = (res << 6) | (nextChar & 0x3f);\n }\n\n if (count != extraLength) {\n i--;\n continue;\n }\n\n if (res <= 0xffff) {\n result += String.fromCharCode(res);\n continue;\n }\n\n res -= 0x10000;\n result += String.fromCharCode(((res >> 10) & 0x3ff) + 0xd800, (res & 0x3ff) + 0xdc00);\n }\n\n return result;\n}\n\n","'use strict';\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\nimport { getAddress } from './address';\nimport { bigNumberify, BigNumberish } from './bignumber';\nimport { arrayify, Arrayish, concat, hexlify, padZeros } from './bytes';\nimport { toUtf8Bytes, toUtf8String } from './utf8';\nimport { defineReadOnly, jsonCopy } from './properties';\n\nimport * as errors from './errors';\n\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nconst paramTypeArray = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\n\n// @TODO: Add enum for param types\nexport type CoerceFunc = (type: string, value: any) => any;\nexport type ParamType = { name?: string, type: string, indexed?: boolean, components?: Array };\n\nexport const defaultCoerceFunc: CoerceFunc = function(type: string, value: any): any {\n var match = type.match(paramTypeNumber)\n if (match && parseInt(match[2]) <= 48) { return value.toNumber(); }\n return value;\n}\n\n\n///////////////////////////////////\n// Parsing for Solidity Signatures\n\nconst regexParen = new RegExp(\"^([^)(]*)\\\\((.*)\\\\)([^)(]*)$\");\nconst regexIdentifier = new RegExp(\"^[A-Za-z_][A-Za-z0-9_]*$\");\n\nfunction verifyType(type: string): string {\n\n // These need to be transformed to their full description\n if (type.match(/^uint($|[^1-9])/)) {\n type = 'uint256' + type.substring(4);\n } else if (type.match(/^int($|[^1-9])/)) {\n type = 'int256' + type.substring(3);\n }\n\n return type;\n}\n\ntype ParseState = {\n allowArray?: boolean,\n allowName?: boolean,\n allowParams?: boolean,\n allowType?: boolean,\n readArray?: boolean,\n};\n\ntype ParseNode = {\n parent?: any,\n type?: string,\n name?: string,\n state?: ParseState,\n indexed?: boolean,\n components?: Array\n};\n\n\nfunction parseParam(param: string, allowIndexed?: boolean): ParamType {\n function throwError(i) {\n throw new Error('unexpected character \"' + param[i] + '\" at position ' + i + ' in \"' + param + '\"');\n }\n\n var parent: ParseNode = { type: '', name: '', state: { allowType: true } };\n var node = parent;\n\n for (var i = 0; i < param.length; i++) {\n var c = param[i];\n switch (c) {\n case '(':\n if (!node.state.allowParams) { throwError(i); }\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\n case ')':\n delete node.state;\n node.type = verifyType(node.type);\n\n var child = node;\n node = node.parent;\n if (!node) { throwError(i); }\n delete child.parent;\n node.state.allowParams = false;\n node.state.allowName = true;\n node.state.allowArray = true;\n break;\n\n case ',':\n delete node.state;\n node.type = verifyType(node.type);\n\n var sibling: ParseNode = { type: '', name: '', parent: node.parent, state: { allowType: true } };\n node.parent.components.push(sibling);\n delete node.parent;\n node = sibling;\n break;\n\n // Hit a space...\n case ' ':\n\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\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 } else {\n node.state.allowName = false;\n }\n }\n }\n\n break;\n\n case '[':\n if (!node.state.allowArray) { throwError(i); }\n\n node.type += c;\n\n node.state.allowArray = false;\n node.state.allowName = false;\n node.state.readArray = true;\n break;\n\n case ']':\n if (!node.state.readArray) { throwError(i); }\n\n node.type += c;\n\n node.state.readArray = false;\n node.state.allowArray = true;\n node.state.allowName = true;\n break;\n\n default:\n if (node.state.allowType) {\n node.type += c;\n node.state.allowParams = true;\n node.state.allowArray = true;\n } else if (node.state.allowName) {\n node.name += c;\n delete node.state.allowArray;\n } else if (node.state.readArray) {\n node.type += c;\n } else {\n throwError(i);\n }\n }\n }\n\n if (node.parent) { throw new Error(\"unexpected eof\"); }\n\n delete parent.state;\n parent.type = verifyType(parent.type);\n\n return (parent);\n}\n\n// @TODO: should this just be a combined Fragment?\n\nexport type EventFragment = {\n type: string\n name: string,\n\n anonymous: boolean,\n\n inputs: Array,\n};\n\nexport type FunctionFragment = {\n type: string\n name: string,\n\n constant: boolean,\n\n inputs: Array,\n outputs: Array,\n\n payable: boolean,\n stateMutability: string,\n};\n\n// @TODO: Better return type\nfunction parseSignatureEvent(fragment: string): EventFragment {\n\n var abi = {\n anonymous: false,\n inputs: [],\n name: '',\n type: 'event'\n }\n\n var match = fragment.match(regexParen);\n if (!match) { throw new Error('invalid event: ' + fragment); }\n\n abi.name = match[1].trim();\n\n splitNesting(match[2]).forEach(function(param) {\n param = parseParam(param, true);\n param.indexed = !!param.indexed;\n abi.inputs.push(param);\n });\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 console.log('unknown modifier: ' + modifier);\n }\n });\n\n if (abi.name && !abi.name.match(regexIdentifier)) {\n throw new Error('invalid identifier: \"' + abi.name + '\"');\n }\n\n return abi;\n}\n\nfunction parseSignatureFunction(fragment: string): FunctionFragment {\n var abi = {\n constant: false,\n inputs: [],\n name: '',\n outputs: [],\n payable: false,\n stateMutability: null,\n type: 'function'\n };\n\n var comps = fragment.split(' returns ');\n var left = comps[0].match(regexParen);\n if (!left) { 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\n splitNesting(left[2]).forEach(function(param) {\n abi.inputs.push(parseParam(param));\n });\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 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 '':\n break;\n default:\n console.log('unknown modifier: ' + modifier);\n }\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\n splitNesting(right[2]).forEach(function(param) {\n abi.outputs.push(parseParam(param));\n });\n }\n\n return abi;\n}\n\nexport function parseParamType(type: string): ParamType {\n return parseParam(type, true);\n}\n\nexport function parseSignature(fragment: string): EventFragment | FunctionFragment {\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(/\\(/g, ' (').replace(/\\)/g, ') ').replace(/\\s+/g, ' ');\n fragment = fragment.trim();\n\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\n throw new Error('unknown signature');\n}\n\n\n///////////////////////////////////\n// Coders\n\ntype DecodedResult = { consumed: number, value: any };\nabstract class Coder {\n readonly coerceFunc: CoerceFunc;\n readonly name: string;\n readonly type: string;\n readonly localName: string;\n readonly dynamic: boolean;\n constructor(coerceFunc: CoerceFunc, name: string, type: string, localName: string, dynamic: boolean) {\n this.coerceFunc = coerceFunc;\n this.name = name;\n this.type = type;\n this.localName = localName;\n this.dynamic = dynamic;\n }\n\n abstract encode(value: any): Uint8Array;\n abstract decode(data: Uint8Array, offset: number): DecodedResult;\n}\n\nclass CoderNull extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'null', '', localName, false);\n }\n\n encode(value: any): Uint8Array {\n return arrayify([]);\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n if (offset > data.length) { throw new Error('invalid null'); }\n return {\n consumed: 0,\n value: this.coerceFunc('null', undefined)\n }\n }\n}\n\nclass CoderNumber extends Coder {\n readonly size: number;\n readonly signed: boolean;\n constructor(coerceFunc, size, signed, localName) {\n const name = ((signed ? 'int': 'uint') + (size * 8));\n super(coerceFunc, name, name, localName, false);\n\n this.size = size;\n this.signed = signed;\n }\n\n encode(value: BigNumberish): Uint8Array {\n try {\n let v = bigNumberify(value);\n v = v.toTwos(this.size * 8).maskn(this.size * 8);\n //value = value.toTwos(size * 8).maskn(size * 8);\n if (this.signed) {\n v = v.fromTwos(this.size * 8).toTwos(256);\n }\n return padZeros(arrayify(v), 32);\n\n } catch (error) {\n errors.throwError('invalid number value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: value\n });\n }\n return null;\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n var junkLength = 32 - this.size;\n var value = bigNumberify(data.slice(offset + junkLength, offset + 32));\n if (this.signed) {\n value = value.fromTwos(this.size * 8);\n } else {\n value = value.maskn(this.size * 8);\n }\n\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, value),\n }\n }\n}\nvar uint256Coder = new CoderNumber(function(type, value) { return value; }, 32, false, 'none');\n\nclass CoderBoolean extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'bool', 'bool', localName, false);\n }\n\n encode(value: boolean): Uint8Array {\n return uint256Coder.encode(!!value ? 1: 0);\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n try {\n var result = uint256Coder.decode(data, offset);\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}\n\nclass CoderFixedBytes extends Coder {\n readonly length: number;\n constructor(coerceFunc, length, localName) {\n const name = ('bytes' + length);\n super(coerceFunc, name, name, localName, false);\n this.length = length;\n }\n\n encode(value: Arrayish): Uint8Array {\n var result = new Uint8Array(32);\n\n try {\n let data = arrayify(value);\n if (data.length > 32) { throw new Error(); }\n result.set(data);\n } catch (error) {\n errors.throwError('invalid ' + this.name + ' value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: (error.value || value)\n });\n }\n\n return result;\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, hexlify(data.slice(offset, offset + this.length)))\n }\n }\n}\n\nclass CoderAddress extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'address', 'address', localName, false);\n }\n encode(value: string): Uint8Array {\n let result = new Uint8Array(32);\n try {\n result.set(arrayify(getAddress(value)), 12);\n } catch (error) {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: value\n });\n }\n return result;\n }\n decode(data: Uint8Array, offset: number): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n return {\n consumed: 32,\n value: this.coerceFunc('address', getAddress(hexlify(data.slice(offset + 12, offset + 32))))\n }\n }\n}\n\nfunction _encodeDynamicBytes(value: Uint8Array): Uint8Array {\n var dataLength = Math.trunc(32 * Math.ceil(value.length / 32));\n var padding = new Uint8Array(dataLength - value.length);\n\n return concat([\n uint256Coder.encode(value.length),\n value,\n padding\n ]);\n}\n\nfunction _decodeDynamicBytes(data: Uint8Array, offset: number, localName: string): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n\n var length = uint256Coder.decode(data, offset).value;\n try {\n length = length.toNumber();\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\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: hexlify(data.slice(offset, offset + 32 + length))\n });\n }\n\n return {\n consumed: Math.trunc(32 + 32 * Math.ceil(length / 32)),\n value: data.slice(offset + 32, offset + 32 + length),\n }\n}\n\nclass CoderDynamicBytes extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'bytes', 'bytes', localName, true);\n }\n encode(value: Arrayish): Uint8Array {\n try {\n return _encodeDynamicBytes(arrayify(value));\n } catch (error) {\n errors.throwError('invalid bytes value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: error.value\n });\n }\n return null;\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('bytes', hexlify(result.value));\n return result;\n }\n}\n\nclass CoderString extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'string', 'string', localName, true);\n }\n\n encode(value: string): Uint8Array {\n if (typeof(value) !== 'string') {\n errors.throwError('invalid string value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: value\n });\n }\n return _encodeDynamicBytes(toUtf8Bytes(value));\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('string', toUtf8String(result.value));\n return result;\n }\n}\n\nfunction alignSize(size: number): number {\n return Math.trunc(32 * Math.ceil(size / 32));\n}\n\nfunction pack(coders: Array, values: Array): Uint8Array {\n\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 type: typeof(values),\n value: values\n });\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\n var parts = [];\n\n coders.forEach(function(coder, index) {\n parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });\n });\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 } else {\n staticSize += alignSize(part.value.length);\n }\n });\n\n var offset = 0, dynamicOffset = staticSize;\n var data = new Uint8Array(staticSize + dynamicSize);\n\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\n //part.value.copy(data, dynamicOffset); @TODO\n data.set(part.value, dynamicOffset);\n dynamicOffset += alignSize(part.value.length);\n } else {\n //part.value.copy(data, offset); @TODO\n data.set(part.value, offset);\n offset += alignSize(part.value.length);\n }\n });\n\n return data;\n}\n\nfunction unpack(coders: Array, data: Uint8Array, offset: number): DecodedResult {\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 } else {\n var result = coder.decode(data, offset);\n }\n\n if (result.value != undefined) {\n value.push(result.value);\n }\n\n offset += result.consumed;\n consumed += result.consumed;\n });\n\n coders.forEach(function(coder: Coder, index: number) {\n let name: string = coder.localName;\n if (!name) { return; }\n\n if (name === 'length') { name = '_length'; }\n\n if (value[name] != null) { return; }\n\n value[name] = value[index];\n });\n\n return {\n value: value,\n consumed: consumed\n }\n}\n\nclass CoderArray extends Coder {\n readonly coder: Coder;\n readonly length: number;\n constructor(coerceFunc, coder, length, localName) {\n const type = (coder.type + '[' + (length >= 0 ? length: '') + ']');\n const dynamic = (length === -1 || coder.dynamic);\n super(coerceFunc, 'array', type, localName, dynamic);\n\n this.coder = coder;\n this.length = length;\n }\n\n encode(value: Array): Uint8Array {\n if (!Array.isArray(value)) {\n errors.throwError('expected array value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n type: typeof(value),\n value: value\n });\n }\n\n var count = this.length;\n\n var result = new Uint8Array(0);\n if (count === -1) {\n count = value.length;\n result = uint256Coder.encode(count);\n }\n\n if (count !== value.length) {\n errors.throwError('array value length mismatch', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n count: value.length,\n expectedCount: count,\n value: value\n });\n }\n\n var coders = [];\n for (var i = 0; i < value.length; i++) { coders.push(this.coder); }\n\n return concat([result, pack(coders, value)]);\n }\n\n decode(data, offset) {\n // @TODO:\n //if (data.length < offset + length * 32) { throw new Error('invalid array'); }\n\n var consumed = 0;\n\n var count = this.length;\n\n if (count === -1) {\n try {\n var decodedLength = uint256Coder.decode(data, offset);\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 } 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\n var coders = [];\n for (var i = 0; i < count; i++) { coders.push(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}\n\nclass CoderTuple extends Coder {\n readonly coders: Array;\n constructor(coerceFunc, coders, localName) {\n var dynamic = false;\n var types = [];\n coders.forEach(function(coder) {\n if (coder.dynamic) { dynamic = true; }\n types.push(coder.type);\n });\n var type = ('tuple(' + types.join(',') + ')');\n\n super(coerceFunc, 'tuple', type, localName, dynamic);\n this.coders = coders;\n }\n encode(value: Array): Uint8Array {\n return pack(this.coders, value);\n }\n decode(data: Uint8Array, offset: number): DecodedResult {\n var result = unpack(this.coders, data, offset);\n result.value = this.coerceFunc(this.type, result.value);\n return result;\n }\n}\n/*\nfunction getTypes(coders) {\n var type = coderTuple(coders).type;\n return type.substring(6, type.length - 1);\n}\n*/\nfunction splitNesting(value: string): Array {\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 } else {\n accum += c;\n if (c === '(') {\n depth++;\n } else if (c === ')') {\n depth--;\n if (depth === -1) {\n throw new Error('unbalanced parenthsis');\n }\n }\n }\n }\n result.push(accum);\n\n return result;\n}\n\nconst paramTypeSimple = {\n address: CoderAddress,\n bool: CoderBoolean,\n string: CoderString,\n bytes: CoderDynamicBytes,\n};\n\nfunction getTupleParamCoder(coerceFunc: CoerceFunc, components: Array, localName: string): CoderTuple {\n if (!components) { components = []; }\n var coders = [];\n components.forEach(function(component) {\n coders.push(getParamCoder(coerceFunc, component));\n });\n\n return new CoderTuple(coerceFunc, coders, localName);\n}\n\nfunction getParamCoder(coerceFunc: CoerceFunc, param: ParamType): Coder {\n var coder = paramTypeSimple[param.type];\n if (coder) { return new coder(coerceFunc, param.name); }\n var match = param.type.match(paramTypeNumber);\n if (match) {\n let 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\n var match = param.type.match(paramTypeBytes);\n if (match) {\n let 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\n var match = param.type.match(paramTypeArray);\n if (match) {\n let size = parseInt(match[2] || \"-1\");\n param.type = match[1];\n return new CoderArray(coerceFunc, getParamCoder(coerceFunc, param), size, param.name);\n }\n\n if (param.type.substring(0, 5) === 'tuple') {\n return getTupleParamCoder(coerceFunc, param.components, param.name);\n }\n\n if (param.type === '') {\n return new CoderNull(coerceFunc, param.name);\n }\n\n errors.throwError('invalid type', errors.INVALID_ARGUMENT, {\n arg: 'type',\n value: param.type\n });\n\n return null;\n}\n\n\nexport class AbiCoder {\n readonly coerceFunc: CoerceFunc;\n constructor(coerceFunc?: CoerceFunc) {\n errors.checkNew(this, AbiCoder);\n\n if (!coerceFunc) { coerceFunc = defaultCoerceFunc; }\n defineReadOnly(this, 'coerceFunc', coerceFunc);\n }\n\n encode(types: Array, values: Array): string {\n\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\n var coders: Array = [];\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\n let typeObject: ParamType = null;\n if (typeof(type) === 'string') {\n typeObject = parseParam(type);\n } else {\n typeObject = jsonCopy(type);\n }\n\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n\n }, this);\n\n return hexlify(new CoderTuple(this.coerceFunc, coders, '_').encode(values));\n }\n\n decode(types: Array, data: Arrayish): any {\n\n var coders = [];\n types.forEach(function(type) {\n\n // See encode for details\n let typeObject: ParamType = null;\n if (typeof(type) === 'string') {\n typeObject = parseParam(type);\n } else {\n typeObject = jsonCopy(type);\n }\n\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n }, this);\n\n return new CoderTuple(this.coerceFunc, coders, '_').decode(arrayify(data), 0).value;\n }\n}\n\nexport const defaultAbiCoder: AbiCoder = new AbiCoder();\n","'use strict';\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\nimport { defaultAbiCoder, ParamType, parseSignature } from '../utils/abi-coder';\nimport { BigNumber, bigNumberify, BigNumberish } from '../utils/bignumber';\nimport { arrayify, concat, isHexString } from '../utils/bytes';\nimport { keccak256 } from '../utils/keccak256';\nimport { toUtf8Bytes } from '../utils/utf8';\nimport { defineReadOnly, defineFrozen } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nfunction parseParams(params: Array): { names: Array, types: Array } {\n var names = [];\n var types = [];\n\n params.forEach(function(param) {\n if (param.components != null) {\n if (param.type.substring(0, 5) !== 'tuple') {\n throw new Error('internal error; report on GitHub');\n }\n var suffix = '';\n var arrayBracket = param.type.indexOf('[');\n if (arrayBracket >= 0) { suffix = param.type.substring(arrayBracket); }\n\n var result = parseParams(param.components);\n names.push({ name: (param.name || null), names: result.names });\n types.push('tuple(' + result.types.join(',') + ')' + suffix)\n } else {\n names.push(param.name || null);\n types.push(param.type);\n }\n });\n\n return {\n names: names,\n types: types\n }\n}\n\nexport class Description {\n readonly type: string;\n constructor(info: any) {\n for (var key in info) {\n let value = info[key];\n if (value != null && typeof(value) === 'object') {\n defineFrozen(this, key, info[key]);\n } else {\n defineReadOnly(this, key, info[key]);\n }\n }\n }\n}\n\n// @TOOD: Make this a description\nexport class Indexed extends Description {\n readonly hash: string;\n}\n\nexport class DeployDescription extends Description {\n readonly inputs: Array;\n readonly payable: boolean;\n\n encode(bytecode: string, params: Array): string {\n if (!isHexString(bytecode)) {\n errors.throwError('invalid contract bytecode', errors.INVALID_ARGUMENT, {\n arg: 'bytecode',\n type: typeof(bytecode),\n value: bytecode\n });\n }\n\n if (params.length < this.inputs.length) {\n errors.throwError('missing constructor argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length\n });\n\n } else if (params.length > this.inputs.length) {\n errors.throwError('too many constructor arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n\n try {\n return (bytecode + defaultAbiCoder.encode(this.inputs, params).substring(2));\n } catch (error) {\n errors.throwError('invalid constructor argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n\n return null;\n }\n}\n\nexport class FunctionDescription extends Description {\n readonly name: string;\n readonly signature: string;\n readonly sighash: string;\n\n readonly inputs: Array;\n readonly outputs: Array;\n readonly payable: boolean;\n\n encode(params: Array): string {\n if (params.length < this.inputs.length) {\n errors.throwError('missing input argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length,\n name: this.name\n });\n } else if (params.length > this.inputs.length) {\n errors.throwError('too many input arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n\n try {\n return this.sighash + defaultAbiCoder.encode(this.inputs, params).substring(2);\n } catch (error) {\n errors.throwError('invalid input argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n\n return null;\n }\n\n decode(data: string): any {\n try {\n return defaultAbiCoder.decode(this.outputs, arrayify(data));\n } catch(error) {\n errors.throwError('invalid data for function output', errors.INVALID_ARGUMENT, {\n arg: 'data',\n errorArg: error.arg,\n errorValue: error.value,\n value: data,\n reason: error.reason\n });\n }\n }\n}\n\nclass Result extends Description {\n [key: string]: any;\n [key: number]: any;\n}\n\nexport class EventDescription extends Description {\n readonly name: string;\n readonly signature: string;\n\n readonly inputs: Array;\n readonly anonymous: boolean;\n readonly topic: string;\n\n decode(data: string, topics?: Array): any {\n // Strip the signature off of non-anonymous topics\n if (topics != null && !this.anonymous) { topics = topics.slice(1); }\n\n let inputIndexed = [], inputNonIndexed = [];\n let inputDynamic = [];\n this.inputs.forEach(function(param, index) {\n\n if (param.indexed) {\n if (param.type === 'string' || param.type === 'bytes' || param.type.indexOf('[') >= 0 || param.type.substring(0, 5) === 'tuple') {\n inputIndexed.push({ type: 'bytes32', name: (param.name || '')});\n inputDynamic.push(true);\n } else {\n inputIndexed.push(param);\n inputDynamic.push(false);\n }\n } else {\n inputNonIndexed.push(param);\n inputDynamic.push(false);\n }\n });\n\n if (topics != null) {\n var resultIndexed = defaultAbiCoder.decode(\n inputIndexed,\n concat(topics)\n );\n }\n\n var resultNonIndexed = defaultAbiCoder.decode(\n inputNonIndexed,\n arrayify(data)\n );\n\n var result = new Result({});\n var nonIndexedIndex = 0, indexedIndex = 0;\n this.inputs.forEach(function(input, index) {\n if (input.indexed) {\n if (topics == null) {\n result[index] = new Indexed({ type: 'indexed', hash: null });\n\n } else if (inputDynamic[index]) {\n result[index] = new Indexed({ type: 'indexed', hash: resultIndexed[indexedIndex++] });\n } else {\n result[index] = resultIndexed[indexedIndex++];\n }\n } else {\n result[index] = resultNonIndexed[nonIndexedIndex++];\n }\n if (input.name) { result[input.name] = result[index]; }\n });\n\n result.length = this.inputs.length;\n\n return result;\n }\n}\n\nclass TransactionDescription extends Description {\n readonly name: string;\n readonly args: Array;\n readonly signature: string;\n readonly sighash: string;\n readonly decode: (data: string) => any;\n readonly value: BigNumber;\n}\n\nclass LogDescription extends Description {\n readonly name: string;\n readonly signature: string;\n readonly topic: string;\n readonly values: Array\n}\n\n\nfunction addMethod(method: any): void {\n switch (method.type) {\n case 'constructor': {\n let description = new DeployDescription({\n inputs: method.inputs,\n payable: (method.payable == null || !!method.payable),\n type: 'deploy'\n });\n\n if (!this.deployFunction) { this.deployFunction = description; }\n\n break;\n }\n\n case 'function': {\n // @TODO: See event\n let signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n\n let sighash = keccak256(toUtf8Bytes(signature)).substring(0, 10);\n\n let description = new FunctionDescription({\n inputs: method.inputs,\n outputs: method.outputs,\n\n payable: (method.payable == null || !!method.payable),\n type: ((method.constant) ? 'call': 'transaction'),\n\n signature: signature,\n sighash: sighash,\n });\n\n // Expose the first (and hopefully unique named function\n if (method.name && this.functions[method.name] == null) {\n defineReadOnly(this.functions, method.name, description);\n }\n\n // Expose all methods by their signature, for overloaded functions\n if (this.functions[description.signature] == null) {\n defineReadOnly(this.functions, description.signature, description);\n }\n\n break;\n }\n\n case 'event': {\n // @TODO: method.params instead? As well? Different fomrat?\n //let inputParams = parseParams(method.inputs);\n\n // @TODO: Don't use parseParams (create new function in ABI, formatSignature)\n let signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n\n let description = new EventDescription({\n name: method.name,\n signature: signature,\n\n inputs: method.inputs,\n topic: keccak256(toUtf8Bytes(signature)),\n anonymous: (!!method.anonymous),\n\n type: 'event'\n });\n\n // Expose the first (and hopefully unique) event name\n if (method.name && this.events[method.name] == null) {\n defineReadOnly(this.events, method.name, description);\n }\n\n // Expose all events by their signature, for overloaded functions\n if (this.events[description.signature] == null) {\n defineReadOnly(this.events, description.signature, description);\n }\n\n break;\n }\n\n\n case 'fallback':\n // Nothing to do for fallback\n break;\n\n default:\n console.log('WARNING: unsupported ABI type - ' + method.type);\n break;\n }\n}\n\nexport class Interface {\n readonly abi: Array;\n readonly functions: Array;\n readonly events: Array;\n readonly deployFunction: DeployDescription;\n\n constructor(abi: Array | string) {\n errors.checkNew(this, Interface);\n\n if (typeof(abi) === 'string') {\n try {\n abi = JSON.parse(abi);\n } catch (error) {\n errors.throwError('could not parse ABI JSON', errors.INVALID_ARGUMENT, {\n arg: 'abi',\n errorMessage: error.message,\n value: abi\n });\n }\n\n if (!Array.isArray(abi)) {\n errors.throwError('invalid abi', errors.INVALID_ARGUMENT, { arg: 'abi', value: abi });\n return null;\n }\n }\n\n defineReadOnly(this, 'functions', { });\n defineReadOnly(this, 'events', { });\n\n // Convert any supported ABI format into a standard ABI format\n let _abi = [];\n abi.forEach((fragment) => {\n if (typeof(fragment) === 'string') {\n fragment = parseSignature(fragment);\n }\n _abi.push(fragment);\n });\n\n defineFrozen(this, 'abi', _abi);\n\n _abi.forEach(addMethod, this);\n\n // If there wasn't a constructor, create the default constructor\n if (!this.deployFunction) {\n addMethod.call(this, {type: 'constructor', inputs: []});\n }\n }\n\n parseTransaction(tx: { data: string, value?: BigNumberish }): TransactionDescription {\n var sighash = tx.data.substring(0, 10).toLowerCase();\n for (var name in this.functions) {\n if (name.indexOf('(') === -1) { continue; }\n var func = this.functions[name];\n if (func.sighash === sighash) {\n var result = defaultAbiCoder.decode(func.inputs, '0x' + tx.data.substring(10));\n return new TransactionDescription({\n args: result,\n decode: func.decode,\n name: name,\n signature: func.signature,\n sighash: func.sighash,\n type: 'transaction',\n value: bigNumberify(tx.value || 0),\n });\n }\n }\n\n return null;\n }\n\n parseLog(log: { topics: Array, data: string}): LogDescription {\n for (var name in this.events) {\n if (name.indexOf('(') === -1) { continue; }\n var event = this.events[name];\n if (event.anonymous) { continue; }\n if (event.topic !== log.topics[0]) { continue; }\n\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse and return it?\n\n return new LogDescription({\n name: event.name,\n signature: event.signature,\n topic: event.topic,\n type: 'log',\n values: event.decode(log.data, log.topics)\n });\n }\n\n return null;\n }\n}\n","\n// This gets overriddenby gulp during bip39-XX\nvar exportWordlist = false;\n\nimport { defineReadOnly } from '../utils/properties';\n\nexport abstract class Wordlist {\n locale: string;\n\n constructor(locale: string) {\n defineReadOnly(this, 'locale', locale);\n }\n\n abstract getWord(index: number): string;\n abstract getWordIndex(word: string): number;\n\n // Subclasses may override this\n split(mnemonic: string): Array {\n return mnemonic.toLowerCase().split(/ +/g)\n }\n\n // Subclasses may override this\n join(words: Array): string {\n return words.join(' ');\n }\n}\n\nexport function register(lang) {\n if (exportWordlist) {\n if (!global['wordlists']) { defineReadOnly(global, 'wordlists', { }); }\n defineReadOnly(global['wordlists'], lang.locale, lang);\n }\n}\n","'use strict';\n\nimport { register, Wordlist } from './wordlist';\n\nimport * as errors from '../utils/errors';\n\n\nconst words = \"AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo\";\n\nlet wordlist: Array = null;\n\n\nfunction loadWords(): void {\n if (wordlist != null) { return; }\n wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' ');\n}\n\nclass LangEn extends Wordlist {\n constructor() {\n super('en');\n }\n\n getWord(index: number): string {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n }\n\n getWordIndex(word: string): number {\n loadWords();\n return wordlist.indexOf(word);\n }\n}\n\nconst langEn = new LangEn();\nregister(langEn);\n\nexport { langEn };\n","'use strict';\n\nimport { pbkdf2Sync as _pbkdf2 } from 'crypto';\n\nimport { arrayify, Arrayish } from './bytes';\n\nfunction bufferify(value: Arrayish): Buffer {\n return new Buffer(arrayify(value));\n}\n\nexport function pbkdf2(password: Arrayish, salt: Arrayish, iterations: number, keylen: number, hashAlgorithm: string): Uint8Array {\n return arrayify(_pbkdf2(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm));\n}\n","'use strict';\n\nimport { createHmac } from 'crypto';\n\nimport { arrayify, Arrayish } from './bytes';\n\nimport * as errors from './errors';\n\nconst supportedAlgorithms = { sha256: true, sha512: true };\nexport function computeHmac(algorithm: string, key: Arrayish, data: Arrayish): Uint8Array {\n if (!supportedAlgorithms[algorithm]) {\n errors.throwError('unsupported algorithm ' + algorithm, errors.UNSUPPORTED_OPERATION, { operation: 'hmac', algorithm: algorithm });\n }\n //return arrayify(_hmac(_hash[algorithm], arrayify(key)).update(arrayify(data)).digest());\n return arrayify(createHmac(algorithm, new Buffer(arrayify(key))).update(new Buffer(arrayify(data))).digest());\n}\n\n","'use strict';\n\nimport * as _hash from 'hash.js';\n\nimport { arrayify, Arrayish } from './bytes';\n\n\ninterface HashFunc {\n (): HashFunc;\n update(chunk: Uint8Array): HashFunc;\n digest(encoding?: string): string;\n}\n\nconst _sha256: HashFunc = _hash['sha256'];\nconst _sha512: HashFunc = _hash['sha512'];\n\n\nexport function sha256(data: Arrayish): string {\n return '0x' + (_sha256().update(arrayify(data)).digest('hex'));\n}\n\nexport function sha512(data: Arrayish): string {\n return '0x' + (_sha512().update(arrayify(data)).digest('hex'));\n}\n","'use strict';\n\n// See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki\n// See: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\n\n// The English language word list.\n// For additional word lists, please see /src.tc/wordlists/\nimport { langEn } from '../wordlists/lang-en';\n\nimport { Wordlist } from '../wordlists/wordlist';\n\nimport { arrayify, Arrayish, hexlify } from '../utils/bytes';\nimport { bigNumberify } from '../utils/bignumber';\nimport { toUtf8Bytes, UnicodeNormalizationForm } from '../utils/utf8';\nimport { pbkdf2 } from '../utils/pbkdf2';\nimport { computeHmac } from '../utils/hmac';\nimport { defineReadOnly } from '../utils/properties';\nimport { KeyPair, N } from '../utils/secp256k1';\nimport { sha256 } from '../utils/sha2';\n\nimport * as errors from '../utils/errors';\n\n// \"Bitcoin seed\"\nvar MasterSecret = toUtf8Bytes('Bitcoin seed');\n\nvar HardenedBit = 0x80000000;\n\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits: number): number {\n return ((1 << bits) - 1) << (8 - bits);\n}\n\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits: number): number {\n return (1 << bits) - 1;\n}\n\nexport const defaultPath = \"m/44'/60'/0'/0/0\";\n\nexport class HDNode {\n private readonly keyPair: KeyPair;\n\n readonly privateKey: string;\n readonly publicKey: string;\n\n readonly mnemonic: string;\n readonly path: string;\n\n readonly chainCode: string;\n\n readonly index: number;\n readonly depth: number;\n\n /**\n * This constructor should not be called directly.\n *\n * Please use:\n * - fromMnemonic\n * - fromSeed\n */\n constructor(privateKey: Arrayish, chainCode: Uint8Array, index: number, depth: number, mnemonic: string, path: string) {\n errors.checkNew(this, HDNode);\n\n defineReadOnly(this, 'keyPair', new KeyPair(privateKey));\n\n defineReadOnly(this, 'privateKey', this.keyPair.privateKey);\n defineReadOnly(this, 'publicKey', this.keyPair.compressedPublicKey);\n\n defineReadOnly(this, 'chainCode', hexlify(chainCode));\n\n defineReadOnly(this, 'index', index);\n defineReadOnly(this, 'depth', depth);\n\n defineReadOnly(this, 'mnemonic', mnemonic);\n defineReadOnly(this, 'path', path);\n }\n\n private _derive(index: number): HDNode {\n\n // Public parent key -> public child key\n if (!this.privateKey) {\n if (index >= HardenedBit) { throw new Error('cannot derive child of neutered node'); }\n throw new Error('not implemented');\n }\n\n var data = new Uint8Array(37);\n\n // Base path\n var mnemonic = this.mnemonic;\n var path = this.path;\n if (path) { path += '/' + index; }\n\n if (index & HardenedBit) {\n // Data = 0x00 || ser_256(k_par)\n data.set(arrayify(this.privateKey), 1);\n\n // Hardened path\n if (path) { path += \"'\"; }\n\n } else {\n // Data = ser_p(point(k_par))\n data.set(this.keyPair.publicKeyBytes);\n }\n\n // Data += ser_32(i)\n for (var i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); }\n\n var I = computeHmac('sha512', this.chainCode, data);\n var IL = bigNumberify(I.slice(0, 32));\n var IR = I.slice(32);\n\n var ki = IL.add(this.keyPair.privateKey).mod(N);\n\n return new HDNode(arrayify(ki), IR, index, this.depth + 1, mnemonic, path);\n }\n\n derivePath(path: string): HDNode {\n var components = path.split('/');\n\n if (components.length === 0 || (components[0] === 'm' && this.depth !== 0)) {\n throw new Error('invalid path');\n }\n\n if (components[0] === 'm') { components.shift(); }\n\n var result: HDNode = this;\n for (var i = 0; i < components.length; i++) {\n var component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n var index = parseInt(component.substring(0, component.length - 1));\n if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); }\n result = result._derive(HardenedBit + index);\n } else if (component.match(/^[0-9]+$/)) {\n var index = parseInt(component);\n if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); }\n result = result._derive(index);\n } else {\n throw new Error('invlaid path component - ' + component);\n }\n }\n\n return result;\n }\n}\n\nfunction _fromSeed(seed: Arrayish, mnemonic: string): HDNode {\n let seedArray: Uint8Array = arrayify(seed);\n if (seedArray.length < 16 || seedArray.length > 64) { throw new Error('invalid seed'); }\n\n var I: Uint8Array = arrayify(computeHmac('sha512', MasterSecret, seedArray));\n\n return new HDNode(I.slice(0, 32), I.slice(32), 0, 0, mnemonic, 'm');\n}\n\nexport function fromMnemonic(mnemonic: string, wordlist?: Wordlist): HDNode {\n // Check that the checksum s valid (will throw an error)\n mnemonicToEntropy(mnemonic, wordlist);\n\n return _fromSeed(mnemonicToSeed(mnemonic), mnemonic);\n}\n\nexport function fromSeed(seed: Arrayish): HDNode {\n return _fromSeed(seed, null);\n}\n\nexport function mnemonicToSeed(mnemonic: string, password?: string): string {\n if (!password) { password = ''; }\n\n var salt = toUtf8Bytes('mnemonic' + password, UnicodeNormalizationForm.NFKD);\n\n return hexlify(pbkdf2(toUtf8Bytes(mnemonic, UnicodeNormalizationForm.NFKD), salt, 2048, 64, 'sha512'));\n}\n\nexport function mnemonicToEntropy(mnemonic: string, wordlist?: Wordlist): string {\n if (!wordlist) { wordlist = langEn; }\n\n var words = wordlist.split(mnemonic);\n if ((words.length % 3) !== 0) { throw new Error('invalid mnemonic'); }\n\n var entropy = arrayify(new Uint8Array(Math.ceil(11 * words.length / 8)));\n\n var offset = 0;\n for (var i = 0; i < words.length; i++) {\n var index = wordlist.getWordIndex(words[i].normalize('NFKD'));\n if (index === -1) { throw new Error('invalid mnemonic'); }\n\n for (var bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n\n var entropyBits = 32 * words.length / 3;\n\n var checksumBits = words.length / 3;\n var checksumMask = getUpperMask(checksumBits);\n\n var checksum = arrayify(sha256(entropy.slice(0, entropyBits / 8)))[0];\n checksum &= checksumMask;\n\n if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {\n throw new Error('invalid checksum');\n }\n\n return hexlify(entropy.slice(0, entropyBits / 8));\n}\n\nexport function entropyToMnemonic(entropy: Arrayish, wordlist?: Wordlist): string {\n entropy = arrayify(entropy);\n\n if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) {\n throw new Error('invalid entropy');\n }\n\n var indices: Array = [ 0 ];\n\n var remainingBits = 11;\n for (var i = 0; i < entropy.length; i++) {\n\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n\n remainingBits -= 8;\n\n // This byte will complete an 11-bit index\n } else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n\n remainingBits += 3;\n }\n }\n\n // Compute the checksum bits\n var checksum = arrayify(sha256(entropy))[0];\n var checksumBits = entropy.length / 4;\n checksum &= getUpperMask(checksumBits);\n\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n\n if (!wordlist) { wordlist = langEn; }\n\n return wordlist.join(indices.map((index) => wordlist.getWord(index)));\n}\n\nexport function isValidMnemonic(mnemonic: string, wordlist?: Wordlist): boolean {\n try {\n mnemonicToEntropy(mnemonic, wordlist);\n return true;\n } catch (error) { }\n return false;\n}\n\n","'use strict';\n\nimport { arrayify } from './bytes';\n\nimport { randomBytes as _randomBytes } from 'crypto';\n\nexport function randomBytes(length: number): Uint8Array {\n return arrayify(_randomBytes(length));\n}\n\n","'use strict';\n\n/**\n * SigningKey\n *\n *\n */\n\nimport { getAddress } from '../utils/address';\nimport { arrayify, Arrayish, hexlify } from '../utils/bytes';\nimport { HDNode } from './hdnode';\nimport { keccak256 } from '../utils/keccak256';\nimport { defineReadOnly } from '../utils/properties';\nimport { computePublicKey, KeyPair, recoverPublicKey, Signature } from '../utils/secp256k1';\n\nimport errors = require('../utils/errors');\n\nexport class SigningKey {\n\n readonly privateKey: string;\n readonly publicKey: string;\n readonly address: string;\n\n readonly mnemonic: string;\n readonly path: string;\n\n private readonly keyPair: KeyPair;\n\n constructor(privateKey: Arrayish | HDNode) {\n errors.checkNew(this, SigningKey);\n\n let privateKeyBytes = null;\n\n if (privateKey instanceof HDNode) {\n defineReadOnly(this, 'mnemonic', privateKey.mnemonic);\n defineReadOnly(this, 'path', privateKey.path);\n privateKeyBytes = arrayify(privateKey.privateKey);\n } else {\n privateKeyBytes = arrayify(privateKey);\n }\n\n try {\n if (privateKeyBytes.length !== 32) {\n errors.throwError('exactly 32 bytes required', errors.INVALID_ARGUMENT, { value: privateKey });\n }\n } catch(error) {\n var params: any = { arg: 'privateKey', reason: error.reason, value: '[REDACTED]' }\n if (error.value) {\n if(typeof(error.value.length) === 'number') {\n params.length = error.value.length;\n }\n params.type = typeof(error.value);\n }\n errors.throwError('invalid private key', error.code, params);\n }\n\n defineReadOnly(this, 'privateKey', hexlify(privateKeyBytes));\n defineReadOnly(this, 'keyPair', new KeyPair(privateKeyBytes));\n defineReadOnly(this, 'publicKey', this.keyPair.publicKey);\n defineReadOnly(this, 'address', computeAddress(this.keyPair.publicKey));\n }\n\n signDigest(digest: Arrayish): Signature {\n return this.keyPair.sign(digest);\n }\n}\n\nexport function recoverAddress(digest: Arrayish, signature: Signature): string {\n return computeAddress(recoverPublicKey(digest, signature));\n}\n\nexport function computeAddress(key: string): string {\n // Strip off the leading \"0x04\"\n let publicKey = '0x' + computePublicKey(key).slice(4);\n return getAddress('0x' + keccak256(publicKey).substring(26));\n}\n","'use strict';\n\nimport aes = require('aes-js');\nimport scrypt = require('scrypt-js');\nimport uuid = require('uuid');\n\nimport { getAddress } from '../utils/address';\nimport { arrayify, Arrayish, concat, hexlify } from '../utils/bytes';\n\nimport { pbkdf2 } from '../utils/pbkdf2';\nimport { keccak256 } from '../utils/keccak256';\nimport { toUtf8Bytes, UnicodeNormalizationForm } from '../utils/utf8';\nimport { randomBytes } from '../utils/random-bytes';\n\nimport { SigningKey } from './signing-key';\nimport * as HDNode from './hdnode';\n\n// @TODO: Maybe move this to HDNode?\nvar defaultPath = \"m/44'/60'/0'/0/0\";\n\nexport interface ProgressCallback {\n (percent: number): void\n}\n\nfunction looseArrayify(hexString: string): Uint8Array {\n if (typeof(hexString) === 'string' && hexString.substring(0, 2) !== '0x') {\n hexString = '0x' + hexString;\n }\n return arrayify(hexString);\n}\n\nfunction zpad(value: String | number, length: number): String {\n value = String(value);\n while (value.length < length) { value = '0' + value; }\n return value;\n}\n\nfunction getPassword(password: Arrayish): Uint8Array {\n if (typeof(password) === 'string') {\n return toUtf8Bytes(password, UnicodeNormalizationForm.NFKC);\n }\n return arrayify(password);\n}\n\n// Search an Object and its children recursively, caselessly.\nfunction searchPath(object: any, path: string): string {\n var currentChild = object;\n\n var comps = path.toLowerCase().split('/');\n for (var i = 0; i < comps.length; i++) {\n\n // Search for a child object with a case-insensitive matching key\n var matchingChild = null;\n for (var key in currentChild) {\n if (key.toLowerCase() === comps[i]) {\n matchingChild = currentChild[key];\n break;\n }\n }\n\n // Didn't find one. :'(\n if (matchingChild === null) {\n return null;\n }\n\n // Now check this child...\n currentChild = matchingChild;\n }\n\n return currentChild;\n}\n\nexport function isCrowdsaleWallet(json: string): boolean {\n try {\n var data = JSON.parse(json);\n } catch (error) { return false; }\n\n return (data.encseed && data.ethaddr);\n}\n\nexport function isValidWallet(json: string): boolean {\n try {\n var data = JSON.parse(json);\n } catch (error) { return false; }\n\n if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) {\n return false;\n }\n\n // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff\n return true;\n}\n\n// @TODO: Make a type for string or arrayish\n// See: https://github.com/ethereum/pyethsaletool\nexport function decryptCrowdsale(json: string, password: Arrayish | string): SigningKey {\n var data = JSON.parse(json);\n\n password = getPassword(password);\n\n // Ethereum Address\n var ethaddr = getAddress(searchPath(data, 'ethaddr'));\n\n // Encrypted Seed\n var encseed = looseArrayify(searchPath(data, 'encseed'));\n if (!encseed || (encseed.length % 16) !== 0) {\n throw new Error('invalid encseed');\n }\n\n let key = pbkdf2(password, password, 2000, 32, 'sha256').slice(0, 16);\n\n var iv = encseed.slice(0, 16);\n var encryptedSeed = encseed.slice(16);\n\n // Decrypt the seed\n var aesCbc = new aes.ModeOfOperation.cbc(key, iv);\n var seed = arrayify(aesCbc.decrypt(encryptedSeed));\n seed = aes.padding.pkcs7.strip(seed);\n\n // This wallet format is weird... Convert the binary encoded hex to a string.\n var seedHex = '';\n for (var i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n\n var seedHexBytes = toUtf8Bytes(seedHex);\n\n var signingKey = new SigningKey(keccak256(seedHexBytes));\n\n if (signingKey.address !== ethaddr) {\n throw new Error('corrupt crowdsale wallet');\n }\n\n return signingKey;\n}\n\n//@TODO: string or arrayish\nexport function decrypt(json: string, password: any, progressCallback?: ProgressCallback): Promise {\n var data = JSON.parse(json);\n\n password = getPassword(password);\n\n var decrypt = function(key, ciphertext) {\n var cipher = searchPath(data, 'crypto/cipher');\n if (cipher === 'aes-128-ctr') {\n var iv = looseArrayify(searchPath(data, 'crypto/cipherparams/iv'))\n var counter = new aes.Counter(iv);\n\n var aesCtr = new aes.ModeOfOperation.ctr(key, counter);\n\n return arrayify(aesCtr.decrypt(ciphertext));\n }\n\n return null;\n };\n\n var computeMAC = function(derivedHalf, ciphertext) {\n return keccak256(concat([derivedHalf, ciphertext]));\n }\n\n var getSigningKey = function(key, reject) {\n var ciphertext = looseArrayify(searchPath(data, 'crypto/ciphertext'));\n\n var computedMAC = hexlify(computeMAC(key.slice(16, 32), ciphertext)).substring(2);\n if (computedMAC !== searchPath(data, 'crypto/mac').toLowerCase()) {\n reject(new Error('invalid password'));\n return null;\n }\n\n var privateKey = decrypt(key.slice(0, 16), ciphertext);\n var mnemonicKey = key.slice(32, 64);\n\n if (!privateKey) {\n reject(new Error('unsupported cipher'));\n return null;\n }\n\n var signingKey = new SigningKey(privateKey);\n if (signingKey.address !== getAddress(data.address)) {\n reject(new Error('address mismatch'));\n return null;\n }\n\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n if (searchPath(data, 'x-ethers/version') === '0.1') {\n var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext'));\n var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter'));\n\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n\n var path = searchPath(data, 'x-ethers/path') || defaultPath;\n\n var entropy = arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext));\n var mnemonic = HDNode.entropyToMnemonic(entropy);\n\n var node = HDNode.fromMnemonic(mnemonic).derivePath(path);\n if (node.privateKey != hexlify(privateKey)) {\n reject(new Error('mnemonic mismatch'));\n return null;\n }\n\n signingKey = new SigningKey(node);\n }\n\n return signingKey;\n }\n\n\n return new Promise(function(resolve, reject) {\n var kdf = searchPath(data, 'crypto/kdf');\n if (kdf && typeof(kdf) === 'string') {\n if (kdf.toLowerCase() === 'scrypt') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n var N = parseInt(searchPath(data, 'crypto/kdfparams/n'));\n var r = parseInt(searchPath(data, 'crypto/kdfparams/r'));\n var p = parseInt(searchPath(data, 'crypto/kdfparams/p'));\n if (!N || !r || !p) {\n reject(new Error('unsupported key-derivation function parameters'));\n return;\n }\n\n // Make sure N is a power of 2\n if ((N & (N - 1)) !== 0) {\n reject(new Error('unsupported key-derivation function parameter value for N'));\n return;\n }\n\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject( new Error('unsupported key-derivation derived-key length'));\n return;\n }\n\n scrypt(password, salt, N, r, p, 64, function(error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n\n } else if (key) {\n key = arrayify(key);\n\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) { return; }\n\n if (progressCallback) { progressCallback(1); }\n resolve(signingKey);\n\n } else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n\n } else if (kdf.toLowerCase() === 'pbkdf2') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n\n var prfFunc = null;\n var prf = searchPath(data, 'crypto/kdfparams/prf');\n if (prf === 'hmac-sha256') {\n prfFunc = 'sha256';\n } else if (prf === 'hmac-sha512') {\n prfFunc = 'sha512';\n } else {\n reject(new Error('unsupported prf'));\n return;\n }\n\n var c = parseInt(searchPath(data, 'crypto/kdfparams/c'));\n\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject( new Error('unsupported key-derivation derived-key length'));\n return;\n }\n\n var key = pbkdf2(password, salt, c, dkLen, prfFunc);\n\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) { return; }\n\n resolve(signingKey);\n\n } else {\n reject(new Error('unsupported key-derivation function'));\n }\n\n } else {\n reject(new Error('unsupported key-derivation function'));\n }\n });\n}\n\n// @TOOD: Options\nexport function encrypt(privateKey: Arrayish | SigningKey, password: Arrayish | string, options?: any, progressCallback?: ProgressCallback): Promise {\n\n // the options are optional, so adjust the call as needed\n if (typeof(options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (!options) { options = {}; }\n\n // Check the private key\n let privateKeyBytes = null;\n if (privateKey instanceof SigningKey) {\n privateKeyBytes = arrayify(privateKey.privateKey);\n } else {\n privateKeyBytes = arrayify(privateKey);\n }\n if (privateKeyBytes.length !== 32) { throw new Error('invalid private key'); }\n\n password = getPassword(password);\n\n var entropy = options.entropy;\n if (options.mnemonic) {\n if (entropy) {\n if (HDNode.entropyToMnemonic(entropy) !== options.mnemonic) {\n throw new Error('entropy and mnemonic mismatch');\n }\n } else {\n entropy = HDNode.mnemonicToEntropy(options.mnemonic);\n }\n }\n if (entropy) {\n entropy = arrayify(entropy);\n }\n\n var path = options.path;\n if (entropy && !path) {\n path = defaultPath;\n }\n\n var client = options.client;\n if (!client) { client = \"ethers.js\"; }\n\n // Check/generate the salt\n var salt = options.salt;\n if (salt) {\n salt = arrayify(salt);\n } else {\n salt = randomBytes(32);;\n }\n\n // Override initialization vector\n var iv = null;\n if (options.iv) {\n iv = arrayify(options.iv);\n if (iv.length !== 16) { throw new Error('invalid iv'); }\n } else {\n iv = randomBytes(16);\n }\n\n // Override the uuid\n var uuidRandom = options.uuid;\n if (uuidRandom) {\n uuidRandom = arrayify(uuidRandom);\n if (uuidRandom.length !== 16) { throw new Error('invalid uuid'); }\n } else {\n uuidRandom = randomBytes(16);\n }\n\n // Override the scrypt password-based key derivation function parameters\n var N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) { N = options.scrypt.N; }\n if (options.scrypt.r) { r = options.scrypt.r; }\n if (options.scrypt.p) { p = options.scrypt.p; }\n }\n\n return new Promise(function(resolve, reject) {\n\n // We take 64 bytes:\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n scrypt(password, salt, N, r, p, 64, function(error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n\n } else if (key) {\n key = arrayify(key);\n\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n var derivedKey = key.slice(0, 16);\n var macPrefix = key.slice(16, 32);\n\n // This will be used to encrypt the mnemonic phrase (if any)\n var mnemonicKey = key.slice(32, 64);\n\n // Get the address for this private key\n var address = (new SigningKey(privateKeyBytes)).address;\n\n // Encrypt the private key\n var counter = new aes.Counter(iv);\n var aesCtr = new aes.ModeOfOperation.ctr(derivedKey, counter);\n var ciphertext = arrayify(aesCtr.encrypt(privateKeyBytes));\n\n // Compute the message authentication code, used to check the password\n var mac = keccak256(concat([macPrefix, ciphertext]))\n\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n var data = {\n address: address.substring(2).toLowerCase(),\n id: uuid.v4({ random: uuidRandom }),\n version: 3,\n Crypto: {\n cipher: 'aes-128-ctr',\n cipherparams: {\n iv: hexlify(iv).substring(2),\n },\n ciphertext: hexlify(ciphertext).substring(2),\n kdf: 'scrypt',\n kdfparams: {\n salt: hexlify(salt).substring(2),\n n: N,\n dklen: 32,\n p: p,\n r: r\n },\n mac: mac.substring(2)\n }\n };\n\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (entropy) {\n var mnemonicIv = randomBytes(16);\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n var mnemonicCiphertext = arrayify(mnemonicAesCtr.encrypt(entropy));\n var now = new Date();\n var timestamp = (now.getUTCFullYear() + '-' +\n zpad(now.getUTCMonth() + 1, 2) + '-' +\n zpad(now.getUTCDate(), 2) + 'T' +\n zpad(now.getUTCHours(), 2) + '-' +\n zpad(now.getUTCMinutes(), 2) + '-' +\n zpad(now.getUTCSeconds(), 2) + '.0Z'\n );\n data['x-ethers'] = {\n client: client,\n gethFilename: ('UTC--' + timestamp + '--' + data.address),\n mnemonicCounter: hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\"\n };\n }\n\n if (progressCallback) { progressCallback(1); }\n resolve(JSON.stringify(data));\n\n } else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n}\n\n","'use strict';\n\nimport { Arrayish, concat, hexlify } from './bytes';\nimport { toUtf8Bytes } from './utf8';\nimport { keccak256 } from './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.-]*$\");\n\nexport function namehash(name: string): string {\n name = name.toLowerCase();\n\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 throw new Error('contains invalid UseSTD3ASCIIRules characters');\n }\n\n var result: string | Uint8Array = Zeros;\n while (name.length) {\n var partition = name.match(Partition);\n var label = toUtf8Bytes(partition[3]);\n result = keccak256(concat([result, keccak256(label)]));\n\n name = partition[2] || '';\n }\n\n return hexlify(result);\n}\n\n\nexport function id(text: string): string {\n return keccak256(toUtf8Bytes(text));\n}\n\nexport function hashMessage(message: Arrayish | string): string {\n var payload = concat([\n toUtf8Bytes('\\x19Ethereum Signed Message:\\n'),\n toUtf8Bytes(String(message.length)),\n ((typeof(message) === 'string') ? toUtf8Bytes(message): message)\n ]);\n return keccak256(payload);\n}\n\n","\nimport { getAddress } from './address';\nimport { BigNumber, bigNumberify, BigNumberish,ConstantZero } from './bignumber';\nimport { arrayify, Arrayish, hexlify, hexZeroPad, stripZeros, } from './bytes';\nimport { keccak256 } from './keccak256';\nimport { recoverAddress, Signature } from './secp256k1';\nimport * as RLP from './rlp';\n\nexport type UnsignedTransaction = {\n to?: string;\n nonce?: number;\n\n gasLimit?: BigNumberish;\n gasPrice?: BigNumberish;\n\n data?: Arrayish;\n value?: BigNumberish;\n chainId?: number;\n}\n\n\nexport interface Transaction {\n hash?: string;\n\n to?: string;\n from?: string;\n nonce: number;\n\n gasLimit: BigNumber;\n gasPrice: BigNumber;\n\n data: string;\n value: BigNumber;\n chainId: number;\n\n r?: string;\n s?: string;\n v?: number;\n}\n\n\nfunction handleAddress(value: string): string {\n if (value === '0x') { return null; }\n return getAddress(value);\n}\n\nfunction handleNumber(value: string): BigNumber {\n if (value === '0x') { return ConstantZero; }\n return bigNumberify(value);\n}\n\nvar transactionFields = [\n {name: 'nonce', maxLength: 32 },\n {name: 'gasPrice', maxLength: 32 },\n {name: 'gasLimit', maxLength: 32 },\n {name: 'to', length: 20 },\n {name: 'value', maxLength: 32 },\n {name: 'data' },\n];\n\n\nexport type SignDigestFunc = (digest: Arrayish) => Signature;\n\nexport function sign(transaction: UnsignedTransaction, signDigest?: SignDigestFunc): string {\n\n var raw = [];\n\n transactionFields.forEach(function(fieldInfo) {\n let value = transaction[fieldInfo.name] || ([]);\n value = arrayify(hexlify(value));\n\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n let error: any = new Error('invalid ' + fieldInfo.name);\n error.reason = 'wrong length';\n error.value = value;\n throw error;\n }\n\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = stripZeros(value);\n if (value.length > fieldInfo.maxLength) {\n let error: any = new Error('invalid ' + fieldInfo.name);\n error.reason = 'too long';\n error.value = value;\n throw error;\n }\n }\n\n raw.push(hexlify(value));\n });\n\n// @TOOD:\nthrow new Error('implement');\n // Requesting an unsigned transation\n if (!signDigest) {\n let v = 27 + signature.recoveryParam\n if (transaction.chainId) {\n v += transaction.chainId * 2 + 8;\n }\n //raw.push(hexlify(transaction.chainId));\n raw.push(hexlify(v));\n raw.push('0x');\n raw.push('0x');\n }\n\n if (transaction.chainId) {\n raw.push(hexlify(transaction.chainId));\n raw.push('0x');\n raw.push('0x');\n }\n\n var digest = keccak256(RLP.encode(raw));\n\n var signature = signDigest(digest);\n\n var v = 27 + signature.recoveryParam\n if (transaction.chainId) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += transaction.chainId * 2 + 8;\n }\n\n raw.push(hexlify(v));\n raw.push(stripZeros(arrayify(signature.r)));\n raw.push(stripZeros(arrayify(signature.s)));\n\n return RLP.encode(raw);\n}\n\nexport function parse(rawTransaction: Arrayish): Transaction {\n var signedTransaction = RLP.decode(rawTransaction);\n if (signedTransaction.length !== 9) { throw new Error('invalid transaction'); }\n\n let tx: Transaction = {\n nonce: handleNumber(signedTransaction[0]).toNumber(),\n gasPrice: handleNumber(signedTransaction[1]),\n gasLimit: handleNumber(signedTransaction[2]),\n to: handleAddress(signedTransaction[3]),\n value: handleNumber(signedTransaction[4]),\n data: signedTransaction[5],\n chainId: 0\n };\n\n var v = arrayify(signedTransaction[6]);\n var r = arrayify(signedTransaction[7]);\n var s = arrayify(signedTransaction[8]);\n\n if (v.length >= 1 && r.length >= 1 && r.length <= 32 && s.length >= 1 && s.length <= 32) {\n tx.v = bigNumberify(v).toNumber();\n tx.r = hexZeroPad(signedTransaction[7], 32);\n tx.s = hexZeroPad(signedTransaction[8], 32);\n\n var chainId = (tx.v - 35) / 2;\n if (chainId < 0) { chainId = 0; }\n chainId = Math.trunc(chainId);\n\n tx.chainId = chainId;\n\n var recoveryParam = tx.v - 27;\n\n let raw = signedTransaction.slice(0, 6);\n\n if (chainId) {\n raw.push(hexlify(chainId));\n raw.push('0x');\n raw.push('0x');\n recoveryParam -= chainId * 2 + 8;\n }\n\n var digest = keccak256(RLP.encode(raw));\n try {\n tx.from = recoverAddress(digest, { r: hexlify(r), s: hexlify(s), recoveryParam: recoveryParam });\n } catch (error) {\n console.log(error);\n }\n\n tx.hash = keccak256(rawTransaction);\n }\n\n return tx;\n}\n","'use strict';\n\nimport scrypt from 'scrypt-js';\n\nimport { defaultPath, entropyToMnemonic, fromMnemonic, HDNode } from './hdnode';\nimport * as secretStorage from './secret-storage';\nimport { ProgressCallback } from './secret-storage';\nimport { recoverAddress, SigningKey } from './signing-key';\n\nimport { BlockTag, Provider, TransactionRequest, TransactionResponse } from '../providers/provider';\nimport { Wordlist } from '../wordlists/wordlist';\n\nimport { BigNumber, BigNumberish } from '../utils/bignumber';\nimport { arrayify, Arrayish, concat, hexlify, joinSignature } from '../utils/bytes';\nimport { hashMessage } from '../utils/hash';\nimport { keccak256 } from '../utils/keccak256';\nimport { defineReadOnly, resolveProperties, shallowCopy } from '../utils/properties';\nimport { randomBytes } from '../utils/random-bytes';\nimport { sign as signTransaction } from '../utils/transaction';\nimport { toUtf8Bytes, UnicodeNormalizationForm } from '../utils/utf8';\n\nimport * as errors from '../utils/errors';\n\n\n// This ensures we inject a setImmediate into the global space, which\n// dramatically improves the performance of the scrypt PBKDF.\nconsole.log(\"Fix this! Setimmediate\");\n//import _setimmediate = require('setimmediate');\n\nexport abstract class Signer {\n provider?: Provider;\n\n abstract getAddress(): Promise\n\n abstract signMessage(transaction: Arrayish | string): Promise;\n abstract sendTransaction(transaction: TransactionRequest): Promise;\n}\n\n\nexport class Wallet extends Signer {\n\n readonly provider: Provider;\n\n private readonly signingKey: SigningKey;\n\n constructor(privateKey: SigningKey | HDNode | Arrayish, provider?: Provider) {\n super();\n errors.checkNew(this, Wallet);\n\n // Make sure we have a valid signing key\n if (privateKey instanceof SigningKey) {\n defineReadOnly(this, 'signingKey', privateKey);\n } else {\n defineReadOnly(this, 'signingKey', new SigningKey(privateKey));\n }\n\n defineReadOnly(this, 'provider', provider);\n }\n\n get address(): string { return this.signingKey.address; }\n\n get mnemonic(): string { return this.signingKey.mnemonic; }\n get path(): string { return this.signingKey.mnemonic; }\n\n get privateKey(): string { return this.signingKey.privateKey; }\n\n\n /**\n * Create a new instance of this Wallet connected to provider.\n */\n connect(provider: Provider): Wallet {\n return new Wallet(this.signingKey, provider);\n }\n\n\n getAddress(): Promise {\n return Promise.resolve(this.address);\n }\n\n sign(transaction: TransactionRequest): Promise {\n return resolveProperties(transaction).then((tx) => {\n return signTransaction(tx, this.signingKey.signDigest.bind(this.signingKey));\n });\n }\n\n signMessage(message: Arrayish | string): Promise {\n return Promise.resolve(joinSignature(this.signingKey.signDigest(hashMessage(message))));\n }\n\n\n getBalance(blockTag?: BlockTag): Promise {\n if (!this.provider) { throw new Error('missing provider'); }\n return this.provider.getBalance(this.address, blockTag);\n }\n\n getTransactionCount(blockTag?: BlockTag): Promise {\n if (!this.provider) { throw new Error('missing provider'); }\n return this.provider.getTransactionCount(this.address, blockTag);\n }\n\n sendTransaction(transaction: TransactionRequest): Promise {\n if (!this.provider) { throw new Error('missing provider'); }\n\n if (!transaction || typeof(transaction) !== 'object') {\n throw new Error('invalid transaction object');\n }\n\n var tx = shallowCopy(transaction);\n\n if (tx.to != null) {\n tx.to = this.provider.resolveName(tx.to);\n }\n\n if (tx.gasLimit == null) {\n tx.gasLimit = this.provider.estimateGas(tx);\n }\n\n if (tx.gasPrice == null) {\n tx.gasPrice = this.provider.getGasPrice();\n }\n\n if (tx.nonce == null) {\n tx.nonce = this.getTransactionCount();\n }\n\n if (tx.chainId == null) {\n tx.chainId = this.provider.getNetwork().then((network) => network.chainId);\n }\n\n return resolveProperties(tx).then((tx) => {\n console.log('To Sign', tx);\n return this.provider.sendTransaction(this.sign(tx));\n });\n\n }\n\n send(addressOrName: string, amountWei: BigNumberish, options: any): Promise {\n if (!options) { options = {}; }\n\n return this.sendTransaction({\n to: addressOrName,\n gasLimit: options.gasLimit,\n gasPrice: options.gasPrice,\n nonce: options.nonce,\n value: amountWei,\n });\n }\n\n\n encrypt(password: Arrayish | string, options: any, progressCallback: ProgressCallback): Promise {\n if (typeof(options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n\n if (progressCallback && typeof(progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n\n if (!options) { options = {}; }\n\n if (this.mnemonic) {\n // Make sure we don't accidentally bubble the mnemonic up the call-stack\n var safeOptions = {};\n for (var key in options) { safeOptions[key] = options[key]; }\n options = safeOptions;\n\n // Set the mnemonic and path\n options.mnemonic = this.mnemonic;\n options.path = this.path\n }\n\n return secretStorage.encrypt(this.privateKey, password, options, progressCallback);\n }\n\n\n /**\n * Static methods to create Wallet instances.\n */\n static createRandom(options: any): Wallet {\n var entropy: Uint8Array = randomBytes(16);\n\n if (!options) { options = { }; }\n\n if (options.extraEntropy) {\n entropy = arrayify(keccak256(concat([entropy, options.extraEntropy])).substring(0, 34));\n }\n\n var mnemonic = entropyToMnemonic(entropy, options.locale);\n return Wallet.fromMnemonic(mnemonic, options.path, options.locale);\n }\n\n static fromEncryptedWallet(json: string, password: Arrayish, progressCallback: ProgressCallback): Promise {\n if (progressCallback && typeof(progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n\n return new Promise(function(resolve, reject) {\n\n if (secretStorage.isCrowdsaleWallet(json)) {\n try {\n var privateKey = secretStorage.decryptCrowdsale(json, password);\n resolve(new Wallet(privateKey));\n } catch (error) {\n reject(error);\n }\n\n } else if (secretStorage.isValidWallet(json)) {\n\n secretStorage.decrypt(json, password, progressCallback).then(function(signingKey) {\n var wallet = new Wallet(signingKey);\n /*\n if (signingKey.mnemonic && signingKey.path) {\n wallet.mnemonic = signingKey.mnemonic;\n wallet.path = signingKey.path;\n }\n */\n resolve(wallet);\n }, function(error) {\n reject(error);\n });\n\n } else {\n reject('invalid wallet JSON');\n }\n });\n }\n\n static fromMnemonic(mnemonic: string, path?: string, wordlist?: Wordlist): Wallet {\n if (!path) { path = defaultPath; }\n return new Wallet(fromMnemonic(mnemonic, wordlist).derivePath(path));\n }\n\n\n static fromBrainWallet(username: Arrayish | string, password: Arrayish | string, progressCallback: ProgressCallback): Promise {\n if (progressCallback && typeof(progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n\n if (typeof(username) === 'string') {\n username = toUtf8Bytes(username, UnicodeNormalizationForm.NFKC);\n } else {\n username = arrayify(username);\n }\n\n if (typeof(password) === 'string') {\n password = toUtf8Bytes(password, UnicodeNormalizationForm.NFKC);\n } else {\n password = arrayify(password);\n }\n\n return new Promise(function(resolve, reject) {\n scrypt(password, username, (1 << 18), 8, 1, 32, function(error, progress, key) {\n if (error) {\n reject(error);\n\n } else if (key) {\n resolve(new Wallet(hexlify(key)));\n\n } else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n }\n\n\n /**\n * Determine if this is an encryped JSON wallet.\n */\n static isEncryptedWallet(json: string): boolean {\n return (secretStorage.isValidWallet(json) || secretStorage.isCrowdsaleWallet(json));\n }\n\n\n /**\n * Verify a signed message, returning the address of the signer.\n */\n static verifyMessage(message: Arrayish | string, signature: string): string {\n signature = hexlify(signature);\n if (signature.length != 132) { throw new Error('invalid signature'); }\n var digest = hashMessage(message);\n\n var recoveryParam = parseInt(signature.substring(130), 16);\n if (recoveryParam >= 27) { recoveryParam -= 27; }\n if (recoveryParam < 0) { throw new Error('invalid signature'); }\n\n return recoverAddress(\n digest,\n {\n r: signature.substring(0, 66),\n s: '0x' + signature.substring(66, 130),\n recoveryParam: recoveryParam\n }\n );\n }\n}\n","'use strict';\n\nimport * as errors from '../utils/errors';\n\nexport type Network = {\n name: string,\n chainId: number,\n ensAddress?: string,\n}\n\nexport type Networkish = Network | string | number;\n\n\nconst homestead = {\n chainId: 1,\n ensAddress: \"0x314159265dd8dbb310642f98f50c066173c1259b\",\n name: \"homestead\"\n};\n\nconst ropsten = {\n chainId: 3,\n ensAddress: \"0x112234455c3a32fd11230c42e7bccd4a84e02010\",\n name: \"ropsten\"\n};\n\nconst networks = {\n unspecified: {\n chainId: 0\n },\n\n homestead: homestead,\n mainnet: homestead,\n\n morden: {\n chainId: 2\n },\n\n ropsten: ropsten,\n testnet: ropsten,\n\n rinkeby: {\n chainId: 4,\n ensAddress: \"0xe7410170f87102DF0055eB195163A03B7F2Bff4A\"\n },\n\n kovan: {\n chainId: 42\n },\n\n classic: {\n chainId: 61\n }\n}\n\n/**\n * getNetwork\n *\n * Converts a named common networks or chain ID (network ID) to a Network\n * and verifies a network is a valid Network..\n */\nexport function getNetwork(network: Networkish): Network {\n // No network (null) or unspecified (chainId = 0)\n if (!network) { return null; }\n\n if (typeof(network) === 'number') {\n for (var name in networks) {\n let n = networks[name];\n if (n.chainId === network) {\n return {\n name: name,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n }\n }\n\n return {\n chainId: network,\n name: 'unknown'\n };\n }\n\n if (typeof(network) === 'string') {\n let n = networks[network];\n if (n == null) { return null; }\n return {\n name: network,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n }\n\n let n = networks[network.name];\n\n // Not a standard network; check that it is a valid network in general\n if (!n) {\n if (typeof(n.chainId) !== 'number') {\n errors.throwError('invalid network chainId', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n return network;\n }\n\n // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155)\n if (network.chainId !== 0 && network.chainId !== n.chainId) {\n errors.throwError('network chainId mismatch', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n\n // Standard Network\n return {\n name: network.name,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n}\n","'use strict';\n\n//import inherits = require('inherits');\n\nimport { Signer } from '../wallet/wallet';\n\nimport { getAddress, getContractAddress } from '../utils/address';\nimport { BigNumber, bigNumberify, BigNumberish } from '../utils/bignumber';\nimport { Arrayish, hexDataLength, hexDataSlice, hexlify, hexStripZeros, isHexString, joinSignature, stripZeros } from '../utils/bytes';\nimport { toUtf8String } from '../utils/utf8';\nimport { decode as rlpDecode, encode as rlpEncode } from '../utils/rlp';\nimport { hashMessage, namehash } from '../utils/hash';\nimport { getNetwork, Network, Networkish } from './networks';\nimport { defineReadOnly, resolveProperties, shallowCopy } from '../utils/properties';\nimport { parse as parseTransaction, sign as signTransaction, SignDigestFunc, Transaction } from '../utils/transaction';\n\nimport * as errors from '../utils/errors';\n\nfunction copyObject(obj) {\n var result = {};\n for (var key in obj) { result[key] = obj[key]; }\n return result;\n}\n\n//////////////////////////////\n// Exported Types\n\nexport type BlockTag = string | number;\n\nexport interface Block {\n hash: string;\n parentHash: string;\n number: number;\n\n timestamp: number;\n nonce: string;\n difficulty: number;\n\n gasLimit: BigNumber;\n gasUsed: BigNumber;\n\n miner: string;\n extraData: string;\n\n transactions: Array;\n}\n\nexport type TransactionRequest = {\n to?: string | Promise,\n from?: string | Promise,\n nonce?: number | string | Promise,\n\n gasLimit?: BigNumberish | Promise,\n gasPrice?: BigNumberish | Promise,\n\n data?: Arrayish | Promise,\n value?: BigNumberish | Promise,\n chainId?: number | Promise,\n}\n\nexport interface TransactionResponse extends Transaction {\n // Only if a transaction has been mined\n blockNumber?: number,\n blockHash?: string,\n timestamp?: number,\n\n // Not optional (as it is in Transaction)\n from: string;\n\n // This function waits until the transaction has been mined\n wait: (timeout?: number) => Promise\n};\n\nexport interface TransactionReceipt {\n contractAddress?: string,\n transactionIndex?: number,\n root?: string,\n gasUsed?: BigNumber,\n logsBloom?: string,\n blockHash?: string,\n transactionHash?: string,\n logs?: Array,\n blockNumber?: number,\n cumulativeGasUsed?: BigNumber,\n status?: number // @TOOD: Check 0 or 1?\n};\n\nexport type Filter = {\n fromBlock?: BlockTag,\n toBlock?: BlockTag,\n address?: string,\n topics?: Array\n}\n\n// @TODO: Some of these are not options; force them?\nexport interface Log {\n blockNumber?: number;\n blockHash?: string;\n transactionIndex?: number;\n\n removed?: boolean;\n\n address: string;\n data?: string;\n\n topics?: Array;\n\n transactionHash?: string;\n logIndex?: number;\n}\n\n//////////////////////////////\n// Request and Response Checking\n\n// @TODO: not any?\nfunction check(format: any, object: any): any {\n var result = {};\n for (var key in format) {\n try {\n var value = format[key](object[key]);\n if (value !== undefined) { result[key] = value; }\n } catch (error) {\n error.checkKey = key;\n error.checkValue = object[key];\n throw error;\n }\n }\n return result;\n}\n\ntype CheckFunc = (value: any) => any;\n\nfunction allowNull(check: CheckFunc, nullValue?: any): CheckFunc {\n return (function(value: any) {\n if (value == null) { return nullValue; }\n return check(value);\n });\n}\n\nfunction allowFalsish(check: CheckFunc, replaceValue): CheckFunc {\n return (function(value) {\n if (!value) { return replaceValue; }\n return check(value);\n });\n}\n\nfunction arrayOf(check: CheckFunc): CheckFunc {\n return (function(array: any): Array {\n if (!Array.isArray(array)) { throw new Error('not an array'); }\n\n var result = [];\n\n array.forEach(function(value) {\n result.push(check(value));\n });\n\n return result;\n });\n}\n\nfunction checkHash(hash: any): string {\n if (typeof(hash) === 'string' && hexDataLength(hash) === 32) {\n return hash;\n }\n errors.throwError('invalid hash', errors.INVALID_ARGUMENT, { arg: 'hash', value: hash });\n return null;\n}\n\nfunction checkNumber(number): number {\n return bigNumberify(number).toNumber();\n}\n\n// Returns the difficulty as a number, or if too large (i.e. PoA network) null\nfunction checkDifficulty(value: BigNumberish): number {\n let v = bigNumberify(value);\n\n try {\n return v.toNumber();\n } catch (error) { }\n\n return null;\n}\n\nfunction checkBoolean(value): boolean {\n if (typeof(value) === 'boolean') { return value; }\n if (typeof(value) === 'string') {\n if (value === 'true') { return true; }\n if (value === 'false') { return false; }\n }\n throw new Error('invaid boolean - ' + value);\n}\n\nfunction checkUint256(uint256: string): string {\n if (!isHexString(uint256)) {\n throw new Error('invalid uint256');\n }\n while (uint256.length < 66) {\n uint256 = '0x0' + uint256.substring(2);\n }\n return uint256;\n}\n\n/*\nfunction checkString(string) {\n if (typeof(string) !== 'string') { throw new Error('invalid string'); }\n return string;\n}\n*/\n\nfunction checkBlockTag(blockTag: BlockTag): string {\n if (blockTag == null) { return 'latest'; }\n\n if (blockTag === 'earliest') { return '0x0'; }\n\n if (blockTag === 'latest' || blockTag === 'pending') {\n return blockTag;\n }\n\n if (typeof(blockTag) === 'number') {\n return hexStripZeros(hexlify(blockTag));\n }\n\n if (isHexString(blockTag)) { return hexStripZeros(blockTag); }\n\n throw new Error('invalid blockTag');\n}\n\nvar formatBlock = {\n hash: checkHash,\n parentHash: checkHash,\n number: checkNumber,\n\n timestamp: checkNumber,\n nonce: allowNull(hexlify),\n difficulty: checkDifficulty,\n\n gasLimit: bigNumberify,\n gasUsed: bigNumberify,\n\n miner: getAddress,\n extraData: hexlify,\n\n //transactions: allowNull(arrayOf(checkTransaction)),\n transactions: allowNull(arrayOf(checkHash)),\n\n //transactionRoot: checkHash,\n //stateRoot: checkHash,\n //sha3Uncles: checkHash,\n\n //logsBloom: hexlify,\n};\n\nfunction checkBlock(block) {\n if (block.author != null && block.miner == null) {\n block.miner = block.author;\n }\n return check(formatBlock, block);\n}\n\n\nvar formatTransaction = {\n hash: checkHash,\n\n blockHash: allowNull(checkHash, null),\n blockNumber: allowNull(checkNumber, null),\n transactionIndex: allowNull(checkNumber, null),\n\n from: getAddress,\n\n gasPrice: bigNumberify,\n gasLimit: bigNumberify,\n to: allowNull(getAddress, null),\n value: bigNumberify,\n nonce: checkNumber,\n data: hexlify,\n\n r: allowNull(checkUint256),\n s: allowNull(checkUint256),\n v: allowNull(checkNumber),\n\n creates: allowNull(getAddress, null),\n\n raw: allowNull(hexlify),\n};\n\nexport function checkTransactionResponse(transaction: any): TransactionResponse {\n\n // Rename gas to gasLimit\n if (transaction.gas != null && transaction.gasLimit == null) {\n transaction.gasLimit = transaction.gas;\n }\n\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (transaction.to && bigNumberify(transaction.to).isZero()) {\n transaction.to = '0x0000000000000000000000000000000000000000';\n }\n\n // Rename input to data\n if (transaction.input != null && transaction.data == null) {\n transaction.data = transaction.input;\n }\n\n // If to and creates are empty, populate the creates from the transaction\n if (transaction.to == null && transaction.creates == null) {\n transaction.creates = getContractAddress(transaction);\n }\n\n if (!transaction.raw) {\n // Very loose providers (e.g. TestRPC) don't provide a signature or raw\n if (transaction.v && transaction.r && transaction.s) {\n var raw = [\n stripZeros(hexlify(transaction.nonce)),\n stripZeros(hexlify(transaction.gasPrice)),\n stripZeros(hexlify(transaction.gasLimit)),\n (transaction.to || \"0x\"),\n stripZeros(hexlify(transaction.value || '0x')),\n hexlify(transaction.data || '0x'),\n stripZeros(hexlify(transaction.v || '0x')),\n stripZeros(hexlify(transaction.r)),\n stripZeros(hexlify(transaction.s)),\n ];\n\n transaction.raw = rlpEncode(raw);\n }\n }\n\n\n var result = check(formatTransaction, transaction);\n\n var networkId = transaction.networkId;\n\n if (isHexString(networkId)) {\n networkId = bigNumberify(networkId).toNumber();\n }\n\n if (typeof(networkId) !== 'number' && result.v != null) {\n networkId = (result.v - 35) / 2;\n if (networkId < 0) { networkId = 0; }\n networkId = parseInt(networkId);\n }\n\n if (typeof(networkId) !== 'number') { networkId = 0; }\n\n result.networkId = networkId;\n \n // 0x0000... should actually be null\n if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {\n result.blockHash = null;\n }\n\n return result;\n}\n\nvar formatTransactionRequest = {\n from: allowNull(getAddress),\n nonce: allowNull(checkNumber),\n gasLimit: allowNull(bigNumberify),\n gasPrice: allowNull(bigNumberify),\n to: allowNull(getAddress),\n value: allowNull(bigNumberify),\n data: allowNull(hexlify),\n};\n\nfunction checkTransactionRequest(transaction) {\n return check(formatTransactionRequest, transaction);\n}\n\nvar formatTransactionReceiptLog = {\n transactionLogIndex: allowNull(checkNumber),\n transactionIndex: checkNumber,\n blockNumber: checkNumber,\n transactionHash: checkHash,\n address: getAddress,\n topics: arrayOf(checkHash),\n data: hexlify,\n logIndex: checkNumber,\n blockHash: checkHash,\n};\n\nfunction checkTransactionReceiptLog(log) {\n return check(formatTransactionReceiptLog, log);\n}\n\nvar formatTransactionReceipt = {\n contractAddress: allowNull(getAddress, null),\n transactionIndex: checkNumber,\n root: allowNull(checkHash),\n gasUsed: bigNumberify,\n logsBloom: allowNull(hexlify),\n blockHash: checkHash,\n transactionHash: checkHash,\n logs: arrayOf(checkTransactionReceiptLog),\n blockNumber: checkNumber,\n cumulativeGasUsed: bigNumberify,\n status: allowNull(checkNumber)\n};\n\nfunction checkTransactionReceipt(transactionReceipt) {\n //var status = transactionReceipt.status;\n //var root = transactionReceipt.root;\n\n var result = check(formatTransactionReceipt, transactionReceipt);\n result.logs.forEach(function(entry, index) {\n if (entry.transactionLogIndex == null) {\n entry.transactionLogIndex = index;\n }\n });\n if (transactionReceipt.status != null) {\n result.byzantium = true;\n }\n return result;\n}\n\nfunction checkTopics(topics) {\n if (Array.isArray(topics)) {\n topics.forEach(function(topic) {\n checkTopics(topic);\n });\n\n } else if (topics != null) {\n checkHash(topics);\n }\n\n return topics;\n}\n\nvar formatFilter = {\n fromBlock: allowNull(checkBlockTag, undefined),\n toBlock: allowNull(checkBlockTag, undefined),\n address: allowNull(getAddress, undefined),\n topics: allowNull(checkTopics, undefined),\n};\n\nfunction checkFilter(filter) {\n return check(formatFilter, filter);\n}\n\nvar formatLog = {\n blockNumber: allowNull(checkNumber),\n blockHash: allowNull(checkHash),\n transactionIndex: checkNumber,\n\n removed: allowNull(checkBoolean),\n\n address: getAddress,\n data: allowFalsish(hexlify, '0x'),\n\n topics: arrayOf(checkHash),\n\n transactionHash: checkHash,\n logIndex: checkNumber,\n}\n\nfunction checkLog(log) {\n return check(formatLog, log);\n}\n\n//////////////////////////////\n// Defer Promises\n\ntype AllowNullFunc = () => boolean;\ntype ExecuteFunc = () => Promise\nfunction stallPromise(allowNullFunc: AllowNullFunc, executeFunc: ExecuteFunc): Promise {\n return new Promise(function(resolve, reject) {\n var attempt = 0;\n function check() {\n executeFunc().then(function(result) {\n // If we have a result, or are allowed null then we're done\n if (result || allowNullFunc()) {\n resolve(result);\n\n // Otherwise, exponential back-off (up to 10s) our next request\n } else {\n attempt++;\n var timeout = 500 + 250 * Math.trunc(Math.random() * (1 << attempt));\n if (timeout > 10000) { timeout = 10000; }\n setTimeout(check, timeout);\n }\n }, function(error) {\n reject(error);\n });\n }\n check();\n });\n}\n\n//////////////////////////////\n// Event Serializeing\n\nfunction recurse(object, convertFunc) {\n if (Array.isArray(object)) {\n var result = [];\n object.forEach(function(object) {\n result.push(recurse(object, convertFunc));\n });\n return result;\n }\n return convertFunc(object);\n}\n\nfunction getEventString(object) {\n try {\n return 'address:' + getAddress(object);\n } catch (error) { }\n\n if (object === 'block') {\n return 'block';\n\n } else if (object === 'pending') {\n return 'pending';\n\n } else if (hexDataLength(object) === 32) {\n return 'tx:' + object;\n\n } else if (Array.isArray(object)) {\n object = recurse(object, function(object) {\n if (object == null) { object = '0x'; }\n return object;\n });\n\n try {\n return 'topic:' + rlpEncode(object);\n } catch (error) {\n console.log(error);\n }\n }\n try {\n throw new Error();\n } catch(e) {\n console.log(e.stack);\n }\n\n throw new Error('invalid event - ' + object);\n}\n\nfunction parseEventString(string) {\n if (string.substring(0, 3) === 'tx:') {\n return {type: 'transaction', hash: string.substring(3)};\n\n } else if (string === 'block') {\n return {type: 'block'};\n\n } else if (string === 'pending') {\n return {type: 'pending'};\n\n } else if (string.substring(0, 8) === 'address:') {\n return {type: 'address', address: string.substring(8)};\n\n } else if (string.substring(0, 6) === 'topic:') {\n try {\n var object = rlpDecode(string.substring(6));\n object = recurse(object, function(object) {\n if (object === '0x') { object = null; }\n return object;\n });\n return {type: 'topic', topic: object};\n } catch (error) {\n console.log(error);\n }\n }\n\n throw new Error('invalid event string');\n}\n//////////////////////////////\n// Provider Object\n\n\n/* @TODO:\ntype Event = {\n eventName: string,\n listener: any, // @TODO: Function any: any\n type: string,\n}\n*/\n\n// @TODO: Perhaps allow a SignDigestAsyncFunc?\n\n// Enable a simple signing function and provider to provide a full Signer\nexport class ProviderSigner extends Signer {\n readonly provider: Provider;\n readonly signDigest: SignDigestFunc;\n\n private _addressPromise: Promise;\n\n constructor(address: string | Promise, signDigest: SignDigestFunc, provider: Provider) {\n super();\n errors.checkNew(this, ProviderSigner);\n defineReadOnly(this, '_addressPromise', Promise.resolve(address));\n defineReadOnly(this, 'signDigest', signDigest);\n defineReadOnly(this, 'provider', provider);\n }\n\n getAddress(): Promise {\n return this._addressPromise;\n }\n\n signMessage(message: Arrayish | string): Promise {\n return Promise.resolve(joinSignature(this.signDigest(hashMessage(message))));\n }\n\n sendTransaction(transaction: TransactionRequest): Promise {\n transaction = shallowCopy(transaction);\n\n if (transaction.chainId == null) {\n transaction.chainId = this.provider.getNetwork().then((network) => {\n return network.chainId;\n });\n }\n\n if (transaction.from == null) {\n transaction.from = this.getAddress();\n }\n\n if (transaction.gasLimit == null) {\n transaction.gasLimit = this.provider.estimateGas(transaction);\n }\n\n if (transaction.gasPrice == null) {\n transaction.gasPrice = this.provider.getGasPrice();\n }\n\n return resolveProperties(transaction).then((tx) => {\n let signedTx = signTransaction(tx, this.signDigest);\n return this._addressPromise.then((address) => {\n if (parseTransaction(signedTx).from !== address) {\n errors.throwError('signing address does not match expected address', errors.UNKNOWN_ERROR, { address: parseTransaction(signedTx).from, expectedAddress: address, signedTransaction: signedTx });\n }\n return this.provider.sendTransaction(signedTx);\n });\n });\n }\n}\n\nexport class Provider {\n private _network: Network;\n\n // string => Event\n private _events: any;\n protected _emitted: any;\n\n private _pollingInterval: number;\n private _poller: any; // @TODO: what does TypeScript thing setInterval returns?\n\n private _lastBlockNumber: number;\n\n // string => BigNumber\n private _balances: any;\n\n\n /**\n * ready\n *\n * A Promise that resolves only once the provider is ready.\n *\n * Sub-classes that call the super with a network without a chainId\n * MUST set this. Standard named networks have a known chainId.\n *\n */\n protected ready: Promise;\n\n constructor(network: Networkish | Promise) {\n errors.checkNew(this, Provider);\n\n if (network instanceof Promise) {\n defineReadOnly(this, 'ready', network.then((network) => {\n defineReadOnly(this, '_network', network);\n return network;\n }));\n\n } else {\n let knownNetwork = getNetwork((network == null) ? 'homestead': network);\n if (knownNetwork) {\n defineReadOnly(this, '_network', knownNetwork);\n defineReadOnly(this, 'ready', Promise.resolve(this._network));\n\n } else {\n errors.throwError('invalid network', errors.INVALID_ARGUMENT, { arg: 'network', value: network });\n }\n }\n\n this._lastBlockNumber = -2;\n\n // Balances being watched for changes\n this._balances = {};\n\n // Events being listened to\n this._events = {};\n\n this._pollingInterval = 4000;\n\n // We use this to track recent emitted events; for example, if we emit a \"block\" of 100\n // and we get a `getBlock(100)` request which would result in null, we should retry\n // until we get a response. This provides devs with a consistent view. Similarly for\n // transaction hashes.\n this._emitted = { block: this._lastBlockNumber };\n }\n\n private _doPoll(): void {\n this.getBlockNumber().then((blockNumber) => {\n\n // If the block hasn't changed, meh.\n if (blockNumber === this._lastBlockNumber) { return; }\n\n if (this._lastBlockNumber === -2) { this._lastBlockNumber = blockNumber - 1; }\n\n // Notify all listener for each block that has passed\n for (var i = this._lastBlockNumber + 1; i <= blockNumber; i++) {\n if (this._emitted.block < i) {\n this._emitted.block = i;\n\n // Evict any transaction hashes or block hashes over 12 blocks\n // old, since they should not return null anyways\n Object.keys(this._emitted).forEach((key) => {\n if (key === 'block') { return; }\n\n if (this._emitted[key] > i + 12) {\n delete this._emitted[key];\n }\n });\n }\n this.emit('block', i);\n }\n\n // Sweep balances and remove addresses we no longer have events for\n var newBalances: any = {};\n\n // Find all transaction hashes we are waiting on\n Object.keys(this._events).forEach((eventName) => {\n var event = parseEventString(eventName);\n\n if (event.type === 'transaction') {\n this.getTransaction(event.hash).then((transaction) => {\n if (!transaction || transaction.blockNumber == null) { return; }\n this._emitted['t:' + transaction.hash.toLowerCase()] = transaction.blockNumber;\n this.emit(event.hash, transaction);\n });\n\n } else if (event.type === 'address') {\n if (this._balances[event.address]) {\n newBalances[event.address] = this._balances[event.address];\n }\n this.getBalance(event.address, 'latest').then(function(balance) {\n var lastBalance = this._balances[event.address];\n if (lastBalance && balance.eq(lastBalance)) { return; }\n this._balances[event.address] = balance;\n this.emit(event.address, balance);\n });\n\n } else if (event.type === 'topic') {\n this.getLogs({\n fromBlock: this._lastBlockNumber + 1,\n toBlock: blockNumber,\n topics: event.topic\n }).then((logs) => {\n if (logs.length === 0) { return; }\n logs.forEach((log) => {\n this._emitted['b:' + log.blockHash.toLowerCase()] = log.blockNumber;\n this._emitted['t:' + log.transactionHash.toLowerCase()] = log.blockNumber;\n this.emit(event.topic, log);\n });\n });\n }\n });\n\n this._lastBlockNumber = blockNumber;\n\n this._balances = newBalances;\n });\n this.doPoll();\n }\n\n resetEventsBlock(blockNumber: number): void {\n this._lastBlockNumber = this.blockNumber;\n this._doPoll();\n }\n\n get network(): Network {\n return this._network;\n }\n\n getNetwork(): Promise {\n return this.ready;\n }\n\n get blockNumber(): number {\n if (this._lastBlockNumber < 0) { return null; }\n return this._lastBlockNumber;\n }\n\n get polling(): boolean {\n return (this._poller != null);\n }\n\n set polling(value: boolean) {\n setTimeout(() => {\n if (value && !this._poller) {\n this._poller = setInterval(this._doPoll.bind(this), this.pollingInterval);\n\n } else if (!value && this._poller) {\n clearInterval(this._poller);\n this._poller = null;\n }\n }, 0);\n }\n\n get pollingInterval(): number {\n return this._pollingInterval;\n }\n\n set pollingInterval(value: number) {\n if (typeof(value) !== 'number' || value <= 0 || Math.trunc(value) != value) {\n throw new Error('invalid polling interval');\n }\n\n this._pollingInterval = value;\n\n if (this._poller) {\n clearInterval(this._poller);\n this._poller = setInterval(() => { this._doPoll() }, this._pollingInterval);\n }\n }\n\n // @TODO: Add .poller which must be an event emitter with a 'start', 'stop' and 'block' event;\n // this will be used once we move to the WebSocket or other alternatives to polling\n\n waitForTransaction(transactionHash: string, timeout?: number): Promise {\n var self = this;\n return new Promise(function(resolve, reject) {\n var timer = null;\n\n function complete(transaction) {\n if (timer) { clearTimeout(timer); }\n resolve(transaction);\n }\n\n self.once(transactionHash, complete);\n\n if (typeof(timeout) === 'number' && timeout > 0) {\n timer = setTimeout(function() {\n self.removeListener(transactionHash, complete);\n reject(new Error('timeout'));\n }, timeout);\n }\n });\n }\n\n getBlockNumber(): Promise {\n return this.ready.then(() => {\n return this.perform('getBlockNumber', { }).then((result) => {\n var value = Math.trunc(result);\n if (value != result) { throw new Error('invalid response - getBlockNumber'); }\n return value;\n });\n });\n }\n\n getGasPrice(): Promise {\n return this.ready.then(() => {\n return this.perform('getGasPrice', { }).then((result) => {\n return bigNumberify(result);\n });\n });\n }\n\n\n getBalance(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return this.perform('getBalance', params).then((result) => {\n return bigNumberify(result);\n });\n });\n });\n });\n }\n\n getTransactionCount(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return this.perform('getTransactionCount', params).then((result) => {\n var value = parseInt(result);\n if (value != result) { throw new Error('invalid response - getTransactionCount'); }\n return value;\n });\n });\n });\n });\n }\n\n getCode(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = {address: address, blockTag: checkBlockTag(blockTag)};\n return this.perform('getCode', params).then((result) => {\n return hexlify(result);\n });\n });\n });\n });\n }\n\n getStorageAt(addressOrName: string | Promise, position: BigNumberish | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(({ addressOrName, position, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = {\n address: address,\n blockTag: checkBlockTag(blockTag),\n position: hexStripZeros(hexlify(position)),\n };\n return this.perform('getStorageAt', params).then((result) => {\n return hexlify(result);\n });\n });\n });\n });\n }\n\n sendTransaction(signedTransaction: string | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ signedTransaction: signedTransaction }).then(({ signedTransaction }) => {\n var params = { signedTransaction: hexlify(signedTransaction) };\n return this.perform('sendTransaction', params).then((hash) => {\n if (hexDataLength(hash) !== 32) { throw new Error('invalid response - sendTransaction'); }\n\n // A signed transaction always has a from (and we add wait below)\n var tx = parseTransaction(signedTransaction);\n\n // Check the hash we expect is the same as the hash the server reported\n if (tx.hash !== hash) {\n errors.throwError('Transaction hash mismatch from Proivder.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n this._emitted['t:' + tx.hash.toLowerCase()] = 'pending';\n tx.wait = (timeout?: number) => {\n return this.waitForTransaction(hash, timeout);\n };\n\n return tx;\n });\n });\n });\n }\n\n\n call(transaction: TransactionRequest): Promise {\n return this.ready.then(() => {\n return resolveProperties(transaction).then((transaction) => {\n return this._resolveNames(transaction, [ 'to', 'from' ]).then((transaction) => {\n var params = { transaction: checkTransactionRequest(transaction) };\n return this.perform('call', params).then((result) => {\n return hexlify(result);\n });\n });\n });\n });\n }\n\n estimateGas(transaction: TransactionRequest) {\n return this.ready.then(() => {\n return resolveProperties(transaction).then((transaction) => {\n return this._resolveNames(transaction, [ 'to', 'from' ]).then((transaction) => {\n var params = {transaction: checkTransactionRequest(transaction)};\n return this.perform('estimateGas', params).then((result) => {\n return bigNumberify(result);\n });\n });\n });\n });\n }\n\n getBlock(blockHashOrBlockTag: BlockTag | string | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(({ blockHashOrBlockTag }) => {\n try {\n var blockHash = hexlify(blockHashOrBlockTag);\n if (hexDataLength(blockHash) === 32) {\n return stallPromise(() => {\n return (this._emitted['b:' + blockHash.toLowerCase()] == null);\n }, () => {\n return this.perform('getBlock', {blockHash: blockHash}).then((block) => {\n if (block == null) { return null; }\n return checkBlock(block);\n });\n });\n }\n } catch (error) { }\n\n try {\n var blockTag = checkBlockTag(blockHashOrBlockTag);\n return stallPromise(() => {\n if (isHexString(blockTag)) {\n var blockNumber = parseInt(blockTag.substring(2), 16);\n return blockNumber > this._emitted.block;\n }\n return true;\n }, () => {\n return this.perform('getBlock', { blockTag: blockTag }).then((block) => {\n if (block == null) { return null; }\n return checkBlock(block);\n });\n });\n } catch (error) { }\n\n throw new Error('invalid block hash or block tag');\n });\n });\n }\n\n getTransaction(transactionHash: string): Promise {\n return this.ready.then(() => {\n return resolveProperties({ transactionHash: transactionHash }).then(({ transactionHash }) => {\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(() => {\n return (this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, () => {\n return this.perform('getTransaction', params).then((result) => {\n if (result != null) { result = checkTransactionResponse(result); }\n return result;\n });\n });\n });\n });\n }\n\n getTransactionReceipt(transactionHash: string): Promise {\n return this.ready.then(() => {\n return resolveProperties({ transactionHash: transactionHash }).then(({ transactionHash }) => {\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(() => {\n return (this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, () => {\n return this.perform('getTransactionReceipt', params).then((result) => {\n if (result != null) { result = checkTransactionReceipt(result); }\n return result;\n });\n });\n });\n });\n }\n\n getLogs(filter: Filter): Promise>{\n return this.ready.then(() => {\n return resolveProperties(filter).then((filter) => {\n return this._resolveNames(filter, ['address']).then((filter) => {\n var params = { filter: checkFilter(filter) };\n return this.perform('getLogs', params).then((result) => {\n return arrayOf(checkLog)(result);\n });\n });\n });\n });\n }\n\n getEtherPrice(): Promise {\n return this.ready.then(() => {\n return this.perform('getEtherPrice', {}).then((result) => {\n // @TODO: Check valid float\n return result;\n });\n });\n }\n\n _resolveNames(object: any, keys: Array): Promise {\n var promises = [];\n\n var result = copyObject(object);\n\n keys.forEach(function(key) {\n if (result[key] === undefined) { return; }\n promises.push(this.resolveName(result[key]).then(function(address) {\n result[key] = address;\n }));\n }, this);\n\n return Promise.all(promises).then(function() { return result; });\n }\n\n _getResolver(name: string): Promise {\n // Get the resolver from the blockchain\n return this.getNetwork().then((network) => {\n\n // No ENS...\n if (!network.ensAddress) {\n errors.throwError(\n 'network does support ENS',\n errors.UNSUPPORTED_OPERATION,\n { operation: 'ENS', network: network.name }\n );\n }\n\n // keccak256('resolver(bytes32)')\n var data = '0x0178b8bf' + namehash(name).substring(2);\n var transaction = { to: network.ensAddress, data: data };\n\n return this.call(transaction).then((data) => {\n\n // extract the address from the data\n if (hexDataLength(data) !== 32) { return null; }\n return getAddress(hexDataSlice(data, 12));\n });\n });\n }\n\n resolveName(name: string | Promise): Promise {\n\n // If it is a promise, resolve it then recurse\n if (name instanceof Promise) {\n return name.then((addressOrName) => {\n return this.resolveName(addressOrName);\n });\n }\n\n // If it is already an address, nothing to resolve\n try {\n return Promise.resolve(getAddress(name));\n } catch (error) { }\n\n var self = this;\n\n var nodeHash = namehash(name);\n\n // Get the addr from the resovler\n return this._getResolver(name).then(function(resolverAddress) {\n\n // keccak256('addr(bytes32)')\n var data = '0x3b3b57de' + nodeHash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n\n // extract the address from the data\n }).then(function(data) {\n if (hexDataLength(data) !== 32) { return null; }\n var address = getAddress(hexDataSlice(data, 12));\n if (address === '0x0000000000000000000000000000000000000000') { return null; }\n return address;\n });\n }\n\n lookupAddress(address: string | Promise): Promise {\n if (address instanceof Promise) {\n return address.then((address) => {\n return this.lookupAddress(address);\n });\n }\n\n address = getAddress(address);\n\n var name = address.substring(2) + '.addr.reverse'\n var nodehash = namehash(name);\n\n var self = this;\n\n return this._getResolver(name).then(function(resolverAddress) {\n if (!resolverAddress) { return null; }\n\n // keccak('name(bytes32)')\n var data = '0x691f3431' + nodehash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n\n }).then(function(data) {\n // Strip off the \"0x\"\n data = data.substring(2);\n\n // Strip off the dynamic string pointer (0x20)\n if (data.length < 64) { return null; }\n data = data.substring(64);\n\n if (data.length < 64) { return null; }\n var length = bigNumberify('0x' + data.substring(0, 64)).toNumber();\n data = data.substring(64);\n\n if (2 * length > data.length) { return null; }\n\n var name = toUtf8String('0x' + data.substring(0, 2 * length));\n\n // Make sure the reverse record matches the foward record\n return self.resolveName(name).then(function(addr) {\n if (addr != address) { return null; }\n return name;\n });\n\n });\n }\n\n doPoll(): void {\n }\n\n perform(method: string, params: any): Promise {\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n }\n\n _startPending(): void {\n console.log('WARNING: this provider does not support pending events');\n }\n\n _stopPending(): void {\n }\n\n on(eventName, listener): Provider {\n var key = getEventString(eventName);\n if (!this._events[key]) { this._events[key] = []; }\n this._events[key].push({eventName: eventName, listener: listener, type: 'on'});\n if (key === 'pending') { this._startPending(); }\n this.polling = true;\n\n return this;\n }\n\n once(eventName, listener): Provider {\n var key = getEventString(eventName);\n if (!this._events[key]) { this._events[key] = []; }\n this._events[key].push({eventName: eventName, listener: listener, type: 'once'});\n if (key === 'pending') { this._startPending(); }\n this.polling = true;\n\n return this;\n }\n\n emit(eventName, ...args): boolean {\n let result = false;\n\n var key = getEventString(eventName);\n\n //var args = Array.prototype.slice.call(arguments, 1);\n var listeners = this._events[key];\n if (!listeners) { return result; }\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n if (listener.type === 'once') {\n listeners.splice(i, 1);\n i--;\n }\n\n try {\n listener.listener.apply(this, args);\n result = true;\n } catch (error) {\n console.log('Event Listener Error: ' + error.message);\n }\n }\n\n if (listeners.length === 0) {\n delete this._events[key];\n if (key === 'pending') { this._stopPending(); }\n }\n\n if (this.listenerCount() === 0) { this.polling = false; }\n\n return result;\n }\n\n // @TODO: type EventName\n listenerCount(eventName?: any): number {\n if (!eventName) {\n var result = 0;\n for (var key in this._events) {\n result += this._events[key].length;\n }\n return result;\n }\n\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) { return 0; }\n return listeners.length;\n }\n\n // @TODO: func\n listeners(eventName): Array {\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) { return []; }\n var result = [];\n for (var i = 0; i < listeners.length; i++) {\n result.push(listeners[i].listener);\n }\n return result;\n }\n\n removeAllListeners(eventName): Provider {\n delete this._events[getEventString(eventName)];\n if (this.listenerCount() === 0) { this.polling = false; }\n\n return this;\n }\n\n removeListener(eventName, listener): Provider {\n var eventNameString = getEventString(eventName);\n var listeners = this._events[eventNameString];\n if (!listeners) { return this; }\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].listener === listener) {\n listeners.splice(i, 1);\n break;\n }\n }\n\n if (listeners.length === 0) {\n this.removeAllListeners(eventName);\n }\n\n return this;\n }\n}\n\n/*\nfunction inheritable(parent) {\n return function(child) {\n inherits(child, parent);\n defineProperty(child, 'inherits', inheritable(child));\n }\n}\n\ndefineProperty(Provider, 'inherits', inheritable(Provider));\n*/\n/*\nfunction(child) {\n inherits(child, Provider);\n child.inherits = function(grandchild) {\n inherits(grandchild, child)\n }\n});\n*/\n","'use strict';\n\nimport { Interface } from './interface';\n\nimport { Provider, TransactionResponse } from '../providers/provider';\nimport { Signer } from '../wallet/wallet';\n\nimport { getContractAddress } from '../utils/address';\nimport { isHexString } from '../utils/bytes';\nimport { ParamType } from '../utils/abi-coder';\nimport { BigNumber, ConstantZero } from '../utils/bignumber';\nimport { defineReadOnly, shallowCopy } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nvar allowedTransactionKeys = {\n data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true\n}\n\n// Recursively replaces ENS names with promises to resolve the name and\n// stalls until all promises have returned\n// @TODO: Expand this to resolve any promises too\nfunction resolveAddresses(provider, value, paramType): Promise {\n if (Array.isArray(paramType)) {\n var promises = [];\n paramType.forEach((paramType, index) => {\n var v = null;\n if (Array.isArray(value)) {\n v = value[index];\n } else {\n v = value[paramType.name];\n }\n promises.push(resolveAddresses(provider, v, paramType));\n });\n return Promise.all(promises);\n }\n\n if (paramType.type === 'address') {\n return provider.resolveName(value);\n }\n\n if (paramType.components) {\n return resolveAddresses(provider, value, paramType.components);\n }\n\n return Promise.resolve(value);\n}\n\n\ntype RunFunction = (...params: Array) => Promise;\n\nfunction runMethod(contract: Contract, functionName: string, estimateOnly: boolean): RunFunction {\n let method = contract.interface.functions[functionName];\n return function(...params): Promise {\n var tx: any = {}\n\n // If 1 extra parameter was passed in, it contains overrides\n if (params.length === method.inputs.length + 1 && typeof(params[params.length - 1]) === 'object') {\n tx = shallowCopy(params.pop());\n\n // Check for unexpected keys (e.g. using \"gas\" instead of \"gasLimit\")\n for (var key in tx) {\n if (!allowedTransactionKeys[key]) {\n throw new Error('unknown transaction override ' + key);\n }\n }\n }\n\n if (params.length != method.inputs.length) {\n throw new Error('incorrect number of arguments');\n }\n\n // Check overrides make sense\n ['data', 'to'].forEach(function(key) {\n if (tx[key] != null) {\n errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key })\n }\n });\n\n // Send to the contract address\n tx.to = contract.addressPromise;\n\n return resolveAddresses(contract.provider, params, method.inputs).then((params) => {\n tx.data = method.encode(params);\n if (method.type === 'call') {\n\n // Call (constant functions) always cost 0 ether\n if (estimateOnly) {\n return Promise.resolve(ConstantZero);\n }\n\n if (!contract.provider) {\n errors.throwError('call (constant functions) require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'call' })\n }\n\n // Check overrides make sense\n ['gasLimit', 'gasPrice', 'value'].forEach(function(key) {\n if (tx[key] != null) {\n throw new Error('call cannot override ' + key) ;\n }\n });\n\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress()\n }\n\n return contract.provider.call(tx).then((value) => {\n try {\n let result = method.decode(value);\n if (method.outputs.length === 1) {\n result = result[0];\n }\n return result;\n\n } catch (error) {\n if (value === '0x' && method.outputs.length > 0) {\n errors.throwError('call exception', errors.CALL_EXCEPTION, {\n address: contract.address,\n method: method.signature,\n value: params\n });\n }\n throw error;\n }\n });\n\n } else if (method.type === 'transaction') {\n\n // Only computing the transaction estimate\n if (estimateOnly) {\n if (!contract.provider) {\n errors.throwError('estimate gas require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'estimateGas' })\n }\n\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress()\n }\n\n return contract.provider.estimateGas(tx);\n }\n\n if (!contract.signer) {\n errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })\n }\n\n // Make sure they aren't overriding something they shouldn't\n if (tx.from != null) {\n errors.throwError('cannot override from in a transaction', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })\n }\n\n return contract.signer.sendTransaction(tx);\n }\n\n throw new Error('invalid type - ' + method.type);\n return null;\n });\n }\n}\n\nexport type ContractEstimate = (...params: Array) => Promise;\nexport type ContractFunction = (...params: Array) => Promise;\nexport type ContractEvent = (...params: Array) => void;\n\ninterface Bucket {\n [name: string]: T;\n}\n\nexport type Contractish = Array | Interface | string;\nexport class Contract {\n readonly address: string;\n readonly interface: Interface;\n\n readonly signer: Signer;\n readonly provider: Provider;\n\n readonly estimate: Bucket;\n readonly functions: Bucket;\n readonly events: Bucket;\n\n readonly addressPromise: Promise;\n\n // This is only set if the contract was created with a call to deploy\n readonly deployTransaction: TransactionResponse;\n\n // https://github.com/Microsoft/TypeScript/issues/5453\n // Once this issue is resolved (there are open PR) we can do this nicer\n // by making addressOrName default to null for 2 operand calls. :)\n\n constructor(addressOrName: string, contractInterface: Contractish, signerOrProvider: Signer | Provider) {\n errors.checkNew(this, Contract);\n\n // @TODO: Maybe still check the addressOrName looks like a valid address or name?\n //address = getAddress(address);\n if (contractInterface instanceof Interface) {\n defineReadOnly(this, 'interface', contractInterface);\n } else {\n defineReadOnly(this, 'interface', new Interface(contractInterface));\n }\n\n if (signerOrProvider instanceof Signer) {\n defineReadOnly(this, 'provider', signerOrProvider.provider);\n defineReadOnly(this, 'signer', signerOrProvider);\n } else if (signerOrProvider instanceof Provider) {\n defineReadOnly(this, 'provider', signerOrProvider);\n defineReadOnly(this, 'signer', null);\n } else {\n errors.throwError('invalid signer or provider', errors.INVALID_ARGUMENT, { arg: 'signerOrProvider', value: signerOrProvider });\n }\n\n defineReadOnly(this, 'estimate', { });\n defineReadOnly(this, 'events', { });\n defineReadOnly(this, 'functions', { });\n\n // Not connected to an on-chain instance, so do not connect functions and events\n if (!addressOrName) {\n defineReadOnly(this, 'address', null);\n defineReadOnly(this, 'addressPromise', Promise.resolve(null));\n return;\n }\n\n defineReadOnly(this, 'address', addressOrName);\n defineReadOnly(this, 'addressPromise', this.provider.resolveName(addressOrName));\n\n Object.keys(this.interface.functions).forEach((name) => {\n var run = runMethod(this, name, false);\n\n if (this[name] == null) {\n defineReadOnly(this, name, run);\n } else {\n console.log('WARNING: Multiple definitions for ' + name);\n }\n\n if (this.functions[name] == null) {\n defineReadOnly(this.functions, name, run);\n defineReadOnly(this.estimate, name, runMethod(this, name, true));\n }\n });\n\n Object.keys(this.interface.events).forEach((eventName) => {\n let eventInfo = this.interface.events[eventName];\n\n let eventCallback = null;\n\n let contract = this;\n function handleEvent(log) {\n contract.addressPromise.then((address) => {\n // Not meant for us (the topics just has the same name)\n if (address != log.address) { return; }\n\n try {\n let result = eventInfo.decode(log.data, log.topics);\n\n // Some useful things to have with the log\n log.args = result;\n log.event = eventName;\n log.parse = eventInfo.parse;\n log.removeListener = function() {\n contract.provider.removeListener([ eventInfo.topic ], handleEvent);\n }\n\n log.getBlock = function() { return contract.provider.getBlock(log.blockHash);; }\n log.getTransaction = function() { return contract.provider.getTransaction(log.transactionHash); }\n log.getTransactionReceipt = function() { return contract.provider.getTransactionReceipt(log.transactionHash); }\n log.eventSignature = eventInfo.signature;\n\n eventCallback.apply(log, Array.prototype.slice.call(result));\n } catch (error) {\n console.log(error);\n }\n });\n }\n\n var property = {\n enumerable: true,\n get: function() {\n return eventCallback;\n },\n set: function(value) {\n if (!value) { value = null; }\n\n if (!contract.provider) {\n errors.throwError('events require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'events' })\n }\n\n if (!value && eventCallback) {\n contract.provider.removeListener([ eventInfo.topic ], handleEvent);\n\n } else if (value && !eventCallback) {\n contract.provider.on([ eventInfo.topic ], handleEvent);\n }\n\n eventCallback = value;\n }\n };\n\n var propertyName = 'on' + eventName.toLowerCase();\n if (this[propertyName] == null) {\n Object.defineProperty(this, propertyName, property);\n }\n\n Object.defineProperty(this.events, eventName, property);\n\n }, this);\n }\n\n // Reconnect to a different signer or provider\n connect(signerOrProvider: Signer | Provider): Contract {\n return new Contract(this.address, this.interface, signerOrProvider);\n }\n\n // Deploy the contract with the bytecode, resolving to the deployed address.\n // Use contract.deployTransaction.wait() to wait until the contract has\n // been mined.\n deploy(bytecode: string, ...args: Array): Promise {\n if (this.signer == null) {\n throw new Error('missing signer'); // @TODO: errors.throwError\n }\n\n if (!isHexString(bytecode)) {\n errors.throwError('bytecode must be a valid hex string', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n\n if ((bytecode.length % 2) !== 0) {\n errors.throwError('bytecode must be valid data (even length)', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n\n // @TODO: overrides of args.length = this.interface.deployFunction.inputs.length + 1\n return this.signer.sendTransaction({\n data: this.interface.deployFunction.encode(bytecode, args)\n }).then((tx) => {\n let contract = new Contract(getContractAddress(tx), this.interface, this.signer || this.provider);\n defineReadOnly(contract, 'deployTransaction', tx);\n return contract;\n });\n }\n}\n","'use strict';\n\nimport { Contract } from './contract';\nimport { Interface } from './interface';\n\nexport {\n Contract,\n Interface\n}\n\n","'use strict';\n\nimport { arrayify, Arrayish } from './bytes';\n\ndeclare class Buffer implements ArrayLike {\n constructor(data: any, encoding?: string);\n toString(encoding?: string): any;\n [key: number]: number;\n length: number;\n}\n\nexport function decode(textData: string): Uint8Array {\n return arrayify(new Uint8Array(new Buffer(textData, 'base64')));\n};\n\nexport function encode(data: Arrayish): string {\n return new Buffer(arrayify(data)).toString('base64');\n}\n","\nimport { XMLHttpRequest } from 'xmlhttprequest';\nimport { toUtf8Bytes } from './utf8';\nimport { encode as base64Encode } from './base64';\n\nexport type ConnectionInfo = {\n url: string,\n user?: string,\n password?: string,\n allowInsecure?: boolean\n};\n\nimport * as errors from './errors';\n\nexport type ProcessFunc = (value: any) => any;\n\ntype Header = { key: string, value: string };\n\nexport function fetchJson(url: string | ConnectionInfo, json: string, processFunc: ProcessFunc): Promise {\n let headers: Array
= [ ];\n\n if (typeof(url) === 'object' && url.url != null) {\n if (url.url == null) {\n errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });\n }\n if (url.user != null && url.password != null) {\n if (url.url.substring(0, 6) !== 'https:' && url.allowInsecure !== true) {\n errors.throwError(\n 'basic authentication requires a secure https url', \n errors.INVALID_ARGUMENT,\n { arg: 'url', url: url.url, user: url.user, password: '[REDACTED]' }\n );\n }\n\n var authorization = url.user + ':' + url.password;\n headers.push({\n key: 'Authorization',\n value: 'Basic ' + base64Encode(toUtf8Bytes(authorization))\n });\n }\n\n url = url.url;\n }\n\n return new Promise(function(resolve, reject) {\n var request = new XMLHttpRequest();\n\n if (json) {\n request.open('POST', url, true);\n headers.push({ key: 'Content-Type', value: 'application/json' });\n } else {\n request.open('GET', url, true);\n }\n\n headers.forEach(function(header) {\n request.setRequestHeader(header.key, header.value);\n });\n\n request.onreadystatechange = function() {\n if (request.readyState !== 4) { return; }\n\n try {\n var result = JSON.parse(request.responseText);\n } catch (error) {\n // @TODO: not any!\n var jsonError: any = new Error('invalid json response');\n jsonError.orginialError = error;\n jsonError.responseText = request.responseText;\n jsonError.url = url;\n reject(jsonError);\n return;\n }\n\n if (processFunc) {\n try {\n result = processFunc(result);\n } catch (error) {\n error.url = url;\n error.body = json;\n error.responseText = request.responseText;\n reject(error);\n return;\n }\n }\n\n if (request.status != 200) {\n // @TODO: not any!\n var error: any = new Error('invalid response - ' + request.status);\n error.statusCode = request.statusCode;\n reject(error);\n return;\n }\n\n resolve(result);\n };\n\n request.onerror = function(error) {\n reject(error);\n }\n\n try {\n if (json) {\n request.send(json);\n } else {\n request.send();\n }\n\n } catch (error) {\n // @TODO: not any!\n var connectionError: any = new Error('connection error');\n connectionError.error = error;\n reject(connectionError);\n }\n });\n}\n\n","\nimport { BlockTag, checkTransactionResponse, Provider, TransactionRequest, TransactionResponse } from './provider';\nimport { Networkish } from './networks';\n\nimport { hexlify, hexStripZeros } from '../utils/bytes';\nimport { defineReadOnly } from '../utils/properties';\nimport { fetchJson } from '../utils/web';\n\nimport * as errors from '../utils/errors';\n\n// The transaction has already been sanitized by the calls in Provider\nfunction getTransactionString(transaction: TransactionRequest): string {\n var result = [];\n for (var key in transaction) {\n if (transaction[key] == null) { continue; }\n var value = hexlify(transaction[key]);\n if ({ gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) {\n value = hexStripZeros(value);\n }\n result.push(key + '=' + value);\n }\n return result.join('&');\n}\n\nfunction getResult(result) {\n // getLogs, getHistory have weird success responses\n if (result.status == 0 && (result.message === 'No records found' || result.message === 'No transactions found')) {\n return result.result;\n }\n\n if (result.status != 1 || result.message != 'OK') {\n // @TODO: not any\n var error: any = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n\n return result.result;\n}\n\nfunction getJsonResult(result) {\n if (result.jsonrpc != '2.0') {\n // @TODO: not any\n let error: any = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n\n if (result.error) {\n // @TODO: not any\n let error: any = new Error(result.error.message || 'unknown error');\n if (result.error.code) { error.code = result.error.code; }\n if (result.error.data) { error.data = result.error.data; }\n throw error;\n }\n\n return result.result;\n}\n\n// The blockTag was normalized as a string by the Provider pre-perform operations\nfunction checkLogTag(blockTag: string): number | \"latest\" {\n if (blockTag === 'pending') { throw new Error('pending not supported'); }\n if (blockTag === 'latest') { return blockTag; }\n\n return parseInt(blockTag.substring(2), 16);\n}\n\n\nexport class EtherscanProvider extends Provider{\n readonly baseUrl: string;\n readonly apiKey: string;\n constructor(network?: Networkish, apiKey?: string) {\n super(network);\n errors.checkNew(this, EtherscanProvider);\n\n let name = 'invalid';\n if (this.network) { name = this.network.name; }\n\n let baseUrl = null;\n switch(name) {\n case 'homestead':\n baseUrl = 'https://api.etherscan.io';\n break;\n case 'ropsten':\n baseUrl = 'https://api-ropsten.etherscan.io';\n break;\n case 'rinkeby':\n baseUrl = 'https://api-rinkeby.etherscan.io';\n break;\n case 'kovan':\n baseUrl = 'https://api-kovan.etherscan.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n\n defineReadOnly(this, 'baseUrl', baseUrl);\n defineReadOnly(this, 'apiKey', apiKey);\n }\n\n\n perform(method: string, params: any) {\n //if (!params) { params = {}; }\n\n var url = this.baseUrl;\n\n let apiKey = '';\n if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; }\n\n switch (method) {\n case 'getBlockNumber':\n url += '/api?module=proxy&action=eth_blockNumber' + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getGasPrice':\n url += '/api?module=proxy&action=eth_gasPrice' + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getBalance':\n // Returns base-10 result\n url += '/api?module=account&action=balance&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getResult);\n\n case 'getTransactionCount':\n url += '/api?module=proxy&action=eth_getTransactionCount&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'getCode':\n url += '/api?module=proxy&action=eth_getCode&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getStorageAt':\n url += '/api?module=proxy&action=eth_getStorageAt&address=' + params.address;\n url += '&position=' + params.position;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'sendTransaction':\n url += '/api?module=proxy&action=eth_sendRawTransaction&hex=' + params.signedTransaction;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'getBlock':\n if (params.blockTag) {\n url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;\n url += '&boolean=false';\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n }\n throw new Error('getBlock by blockHash not implmeneted');\n\n case 'getTransaction':\n url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getTransactionReceipt':\n url += '/api?module=proxy&action=eth_getTransactionReceipt&txhash=' + params.transactionHash;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'call':\n var transaction = getTransactionString(params.transaction);\n if (transaction) { transaction = '&' + transaction; }\n url += '/api?module=proxy&action=eth_call' + transaction;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'estimateGas':\n var transaction = getTransactionString(params.transaction);\n if (transaction) { transaction = '&' + transaction; }\n url += '/api?module=proxy&action=eth_estimateGas&' + transaction;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getLogs':\n url += '/api?module=logs&action=getLogs';\n try {\n if (params.filter.fromBlock) {\n url += '&fromBlock=' + checkLogTag(params.filter.fromBlock);\n }\n\n if (params.filter.toBlock) {\n url += '&toBlock=' + checkLogTag(params.filter.toBlock);\n }\n\n if (params.filter.address) {\n url += '&address=' + params.filter.address;\n }\n\n // @TODO: We can handle slightly more complicated logs using the logs API\n if (params.filter.topics && params.filter.topics.length > 0) {\n if (params.filter.topics.length > 1) {\n throw new Error('unsupported topic format');\n }\n var topic0 = params.filter.topics[0];\n if (typeof(topic0) !== 'string' || topic0.length !== 66) {\n throw new Error('unsupported topic0 format');\n }\n url += '&topic0=' + topic0;\n }\n } catch (error) {\n return Promise.reject(error);\n }\n\n url += apiKey;\n\n var self = this;\n return fetchJson(url, null, getResult).then(function(logs) {\n var txs = {};\n\n var seq = Promise.resolve();\n logs.forEach(function(log) {\n seq = seq.then(function() {\n if (log.blockHash != null) { return null; }\n log.blockHash = txs[log.transactionHash];\n if (log.blockHash == null) {\n return self.getTransaction(log.transactionHash).then(function(tx) {\n txs[log.transactionHash] = tx.blockHash;\n log.blockHash = tx.blockHash;\n });\n }\n return null;\n });\n });\n\n return seq.then(function() {\n return logs;\n });\n });\n\n case 'getEtherPrice':\n if (this.network.name !== 'homestead') { return Promise.resolve(0.0); }\n url += '/api?module=stats&action=ethprice';\n url += apiKey;\n return fetchJson(url, null, getResult).then(function(result) {\n return parseFloat(result.ethusd);\n });\n\n default:\n break;\n }\n\n return super.perform(method, params);\n }\n\n // @TODO: Allow startBlock and endBlock to be Promises\n getHistory(addressOrName: string | Promise, startBlock?: BlockTag, endBlock?: BlockTag): Promise> {\n\n let url = this.baseUrl;\n\n let apiKey = '';\n if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; }\n\n if (startBlock == null) { startBlock = 0; }\n if (endBlock == null) { endBlock = 99999999; }\n\n return this.resolveName(addressOrName).then((address) => {\n url += '/api?module=account&action=txlist&address=' + address;\n url += '&startblock=' + startBlock;\n url += '&endblock=' + endBlock;\n url += '&sort=asc' + apiKey;\n\n return fetchJson(url, null, getResult).then((result) => {\n var output: Array = [];\n result.forEach((tx) => {\n ['contractAddress', 'to'].forEach(function(key) {\n if (tx[key] == '') { delete tx[key]; }\n });\n if (tx.creates == null && tx.contractAddress != null) {\n tx.creates = tx.contractAddress;\n }\n let item = checkTransactionResponse(tx);\n if (tx.timeStamp) { item.timestamp = parseInt(tx.timeStamp); }\n output.push(item);\n });\n return output;\n });\n });\n }\n}\n","'use strict';\n\nimport { Network } from './networks';\nimport { Provider } from './provider';\n\nimport * as errors from '../utils/errors';\n\n// Returns:\n// - true is all networks match\n// - false if any network is null\n// - throws if any 2 networks do not match\nfunction checkNetworks(networks: Array): boolean {\n var result = true;\n\n let check = null;\n networks.forEach((network) => {\n\n // Null\n if (network == null) {\n result = false;\n return;\n }\n\n // Have nothing to compre to yet\n if (check == null) {\n check = network;\n return;\n }\n\n // Matches!\n if (check.name === network.name &&\n check.chainId === network.chainId &&\n check.ensAddress === network.ensAddress) { return; }\n\n errors.throwError(\n 'provider mismatch',\n errors.INVALID_ARGUMENT,\n { arg: 'providers', networks: networks }\n );\n });\n\n return result;\n}\n\nexport class FallbackProvider extends Provider {\n private _providers: Array;\n\n constructor(providers: Array) {\n\n if (providers.length === 0) { throw new Error('no providers'); }\n\n // All networks are ready, we can know the network for certain\n let ready = checkNetworks(providers.map((p) => p.network));\n if (ready) {\n super(providers[0].network);\n\n } else {\n // The network won't be known until all child providers know\n let ready = Promise.all(providers.map((p) => p.getNetwork())).then((networks) => {\n if (!checkNetworks(networks)) {\n errors.throwError('getNetwork returned null', errors.UNKNOWN_ERROR, { })\n }\n return networks[0];\n });\n\n super(ready);\n }\n errors.checkNew(this, FallbackProvider);\n\n // Preserve a copy, so we don't get mutated\n this._providers = providers.slice(0);\n }\n\n get providers(): Array {\n // Return a copy, so we don't get mutated\n return this._providers.slice(0);\n }\n\n perform(method: string, params: any): any {\n // Creates a copy of the providers array\n var providers = this.providers;\n\n return new Promise((resolve, reject) => {\n var firstError = null;\n function next() {\n if (!providers.length) {\n reject(firstError);\n return;\n }\n\n var provider = providers.shift();\n provider.perform(method, params).then(function(result) {\n resolve(result);\n }, function (error) {\n if (!firstError) { firstError = error; }\n next();\n });\n }\n next();\n });\n }\n}\n\n","'use strict';\n\n// See: https://github.com/ethereum/wiki/wiki/JSON-RPC\n\nimport { getNetwork, Network, Networkish } from './networks';\nimport { BlockTag, Provider, TransactionRequest, TransactionResponse } from './provider';\nimport { Signer } from '../wallet/wallet';\n\nimport { getAddress } from '../utils/address';\nimport { BigNumber } from '../utils/bignumber';\nimport { Arrayish, hexlify, hexStripZeros } from '../utils/bytes';\nimport { defineReadOnly, resolveProperties } from '../utils/properties';\nimport { toUtf8Bytes } from '../utils/utf8';\nimport { ConnectionInfo, fetchJson } from '../utils/web';\n\nimport * as errors from '../utils/errors';\n\nfunction timer(timeout: number): Promise {\n return new Promise(function(resolve) {\n setTimeout(function() {\n resolve();\n }, timeout);\n });\n}\n\nfunction getResult(payload) {\n if (payload.error) {\n // @TODO: not any\n var error: any = new Error(payload.error.message);\n error.code = payload.error.code;\n error.data = payload.error.data;\n throw error;\n }\n\n return payload.result;\n}\n\n// Convert an ethers.js transaction into a JSON-RPC transaction\n// - gasLimit => gas\n// - All values hexlified\n// - All numeric values zero-striped\nexport function hexlifyTransaction(transaction: TransactionRequest) {\n var result: any = {};\n\n // Some nodes (INFURA ropsten; INFURA mainnet is fine) don't like extra zeros.\n ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(function(key) {\n if (transaction[key] == null) { return; }\n let value = hexStripZeros(hexlify(transaction[key]));\n if (key === 'gasLimit') { key = 'gas'; }\n result[key] = value;\n });\n\n ['from', 'to', 'data'].forEach(function(key) {\n if (transaction[key] == null) { return; }\n result[key] = hexlify(transaction[key]);\n });\n\n return result;\n}\n\nfunction getLowerCase(value: string): string {\n if (value) { return value.toLowerCase(); }\n return value;\n}\n\nexport class JsonRpcSigner extends Signer {\n readonly provider: JsonRpcProvider;\n private _address: string;\n\n constructor(provider: JsonRpcProvider, address?: string) {\n super();\n errors.checkNew(this, JsonRpcSigner);\n\n defineReadOnly(this, 'provider', provider);\n\n // Statically attach to a given address\n if (address) {\n defineReadOnly(this, '_address', address);\n }\n }\n\n get address(): string {\n if (!this._address) {\n errors.throwError('no sync sync address available; use getAddress', errors.UNSUPPORTED_OPERATION, { operation: 'address' });\n }\n return this._address\n }\n\n getAddress(): Promise {\n if (this._address) {\n return Promise.resolve(this._address);\n }\n\n return this.provider.send('eth_accounts', []).then((accounts) => {\n if (accounts.length === 0) {\n errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });\n }\n return getAddress(accounts[0]);\n });\n }\n\n getBalance(blockTag?: BlockTag): Promise {\n return this.provider.getBalance(this.getAddress(), blockTag);\n }\n\n getTransactionCount(blockTag): Promise {\n return this.provider.getTransactionCount(this.getAddress(), blockTag);\n }\n\n sendTransaction(transaction: TransactionRequest): Promise {\n let tx = hexlifyTransaction(transaction);\n\n if (tx.from == null) {\n tx.from = this.getAddress().then((address) => {\n if (!address) { return null; }\n return address.toLowerCase();\n });\n }\n\n return resolveProperties(tx).then((tx) => {\n return this.provider.send('eth_sendTransaction', [ transaction ]);\n });\n }\n\n signMessage(message: Arrayish | string): Promise {\n var data = ((typeof(message) === 'string') ? toUtf8Bytes(message): message);\n return this.getAddress().then((address) => {\n\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n return this.provider.send('eth_sign', [ address.toLowerCase(), hexlify(data) ]);\n });\n }\n\n unlock(password): Promise {\n var provider = this.provider;\n\n return this.getAddress().then(function(address) {\n return provider.send('personal_unlockAccount', [ address.toLowerCase(), password, null ]);\n });\n }\n}\n\nexport class JsonRpcProvider extends Provider {\n readonly connection: ConnectionInfo;\n\n private _pendingFilter: Promise;\n\n constructor(url?: ConnectionInfo | string, network?: Networkish) {\n\n // One parameter, but it is a network name, so swap it with the URL\n if (typeof(url) === 'string') {\n if (network === null && getNetwork(url)) {\n network = url;\n url = null;\n }\n }\n\n if (network) {\n // The network has been specified explicitly, we can use it\n super(network);\n\n } else {\n\n // The network is unknown, query the JSON-RPC for it\n let ready: Promise = new Promise((resolve, reject) => {\n setTimeout(() => {\n this.send('net_version', [ ]).then((result) => {\n let chainId = parseInt(result);\n\n resolve(getNetwork(chainId));\n });\n });\n });\n super(ready);\n }\n\n errors.checkNew(this, JsonRpcProvider);\n\n // Default URL\n if (!url) { url = 'http://localhost:8545'; }\n\n if (typeof(url) === 'string') {\n this.connection = {\n url: url\n };\n } else {\n this.connection = url;\n }\n\n }\n\n getSigner(address: string): JsonRpcSigner {\n return new JsonRpcSigner(this, address);\n }\n\n listAccounts(): Promise> {\n return this.send('eth_accounts', []).then((accounts) => {\n return accounts.map((a) => getAddress(a));\n });\n }\n\n send(method: string, params: any): Promise {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n\n return fetchJson(this.connection, JSON.stringify(request), getResult);\n }\n\n perform(method: string, params: any): Promise {\n switch (method) {\n case 'getBlockNumber':\n return this.send('eth_blockNumber', []);\n\n case 'getGasPrice':\n return this.send('eth_gasPrice', []);\n\n case 'getBalance':\n return this.send('eth_getBalance', [ getLowerCase(params.address), params.blockTag ]);\n\n case 'getTransactionCount':\n return this.send('eth_getTransactionCount', [ getLowerCase(params.address), params.blockTag ]);\n\n case 'getCode':\n return this.send('eth_getCode', [ getLowerCase(params.address), params.blockTag ]);\n\n case 'getStorageAt':\n return this.send('eth_getStorageAt', [ getLowerCase(params.address), params.position, params.blockTag ]);\n\n case 'sendTransaction':\n return this.send('eth_sendRawTransaction', [ params.signedTransaction ]);\n\n case 'getBlock':\n if (params.blockTag) {\n return this.send('eth_getBlockByNumber', [ params.blockTag, false ]);\n } else if (params.blockHash) {\n return this.send('eth_getBlockByHash', [ params.blockHash, false ]);\n }\n return Promise.reject(new Error('invalid block tag or block hash'));\n\n case 'getTransaction':\n return this.send('eth_getTransactionByHash', [ params.transactionHash ]);\n\n case 'getTransactionReceipt':\n return this.send('eth_getTransactionReceipt', [ params.transactionHash ]);\n\n case 'call':\n return this.send('eth_call', [ hexlifyTransaction(params.transaction), 'latest' ]);\n\n case 'estimateGas':\n return this.send('eth_estimateGas', [ hexlifyTransaction(params.transaction) ]);\n\n case 'getLogs':\n if (params.filter && params.filter.address != null) {\n params.filter.address = getLowerCase(params.filter.address);\n }\n return this.send('eth_getLogs', [ params.filter ]);\n\n default:\n break;\n }\n\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n }\n\n _startPending(): void {\n if (this._pendingFilter != null) { return; }\n var self = this;\n\n var pendingFilter: Promise = this.send('eth_newPendingTransactionFilter', []);\n this._pendingFilter = pendingFilter;\n\n pendingFilter.then(function(filterId) {\n function poll() {\n self.send('eth_getFilterChanges', [ filterId ]).then(function(hashes) {\n if (self._pendingFilter != pendingFilter) { return null; }\n\n var seq = Promise.resolve();\n hashes.forEach(function(hash) {\n self._emitted['t:' + hash.toLowerCase()] = 'pending';\n seq = seq.then(function() {\n return self.getTransaction(hash).then(function(tx) {\n self.emit('pending', tx);\n });\n });\n });\n\n return seq.then(function() {\n return timer(1000);\n });\n }).then(function() {\n if (self._pendingFilter != pendingFilter) {\n self.send('eth_uninstallFilter', [ filterId ]);\n return;\n }\n setTimeout(function() { poll(); }, 0);\n });\n }\n poll();\n\n return filterId;\n });\n }\n\n _stopPending(): void {\n this._pendingFilter = null;\n }\n}\n","\nimport net from 'net';\n\nimport { JsonRpcProvider } from './json-rpc-provider';\nimport { Networkish } from './networks';\n\nimport { defineReadOnly } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nexport class IpcProvider extends JsonRpcProvider {\n readonly path: string;\n\n constructor(path: string, network?: Networkish) {\n if (path == null) {\n errors.throwError('missing path', errors.MISSING_ARGUMENT, { arg: 'path' });\n }\n\n super('ipc://' + path, network);\n errors.checkNew(this, IpcProvider);\n\n defineReadOnly(this, 'path', path);\n }\n\n // @TODO: Create a connection to the IPC path and use filters instead of polling for block\n\n send(method: string, params: any): Promise {\n // This method is very simple right now. We create a new socket\n // connection each time, which may be slower, but the main\n // advantage we are aiming for now is security. This simplifies\n // multiplexing requests (since we do not need to multiplex).\n\n var payload = JSON.stringify({\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n });\n\n return new Promise((resolve, reject) => {\n var stream = net.connect(this.path);\n stream.on('data', function(data) {\n try {\n resolve(JSON.parse(data.toString('utf8')).result);\n // @TODO: Better pull apart the error\n stream.destroy();\n } catch (error) {\n reject(error);\n stream.destroy();\n }\n });\n\n stream.on('end', function() {\n stream.destroy();\n });\n\n stream.on('error', function(error) {\n reject(error);\n stream.destroy();\n });\n stream.write(payload);\n stream.end();\n });\n }\n}\n","'use strict';\n\nimport { JsonRpcProvider, JsonRpcSigner } from './json-rpc-provider';\nimport { getNetwork, Networkish } from './networks';\n\nimport { defineReadOnly } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nexport class InfuraProvider extends JsonRpcProvider {\n readonly apiAccessToken: string;\n\n constructor(network?: Networkish, apiAccessToken?: string) {\n network = getNetwork((network == null) ? 'homestead': network);\n\n var host = null;\n switch(network.name) {\n case 'homestead':\n host = 'mainnet.infura.io';\n break;\n case 'ropsten':\n host = 'ropsten.infura.io';\n break;\n case 'rinkeby':\n host = 'rinkeby.infura.io';\n break;\n case 'kovan':\n host = 'kovan.infura.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n\n super('https://' + host + '/' + (apiAccessToken || ''), network);\n errors.checkNew(this, InfuraProvider);\n\n defineReadOnly(this, 'apiAccessToken', apiAccessToken || null);\n }\n\n _startPending(): void {\n console.log('WARNING: INFURA does not support pending filters');\n }\n\n getSigner(address?: string): JsonRpcSigner {\n errors.throwError(\n 'INFURA does not support signing',\n errors.UNSUPPORTED_OPERATION,\n { operation: 'getSigner' }\n );\n return null;\n }\n\n listAccounts(): Promise> {\n return Promise.resolve([]);\n }\n}\n","'use strict';\n\nimport { Networkish } from './networks';\nimport { JsonRpcProvider } from './json-rpc-provider';\n\nimport { defineReadOnly } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\n/*\n@TODO\nutils.defineProperty(Web3Signer, 'onchange', {\n\n});\n*/\n\nexport type Callback = (error: any, response: any) => void;\n\nexport type AsyncProvider = {\n isMetaMask: boolean;\n host?: string;\n path?: string;\n sendAsync: (request: any, callback: Callback) => void\n}\n\nexport class Web3Provider extends JsonRpcProvider {\n readonly _web3Provider: AsyncProvider;\n\n constructor(web3Provider: AsyncProvider, network?: Networkish) {\n\n if (!web3Provider || !web3Provider.sendAsync) {\n errors.throwError(\n 'invalid web3Provider',\n errors.INVALID_ARGUMENT,\n { arg: 'web3Provider', value: web3Provider }\n );\n }\n\n // HTTP has a host; IPC has a path.\n var url = web3Provider.host || web3Provider.path || 'unknown';\n\n super(url, network);\n errors.checkNew(this, Web3Provider);\n\n defineReadOnly(this, '_web3Provider', web3Provider);\n }\n\n send(method: string, params: any): Promise {\n\n // Metamask complains about eth_sign (and on some versions hangs)\n if (method == 'eth_sign' && this._web3Provider.isMetaMask) {\n // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign\n method = 'personal_sign';\n params = [ params[1], params[0] ];\n }\n\n return new Promise((resolve, reject) => {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n\n this._web3Provider.sendAsync(request, function(error, result) {\n if (error) {\n reject(error);\n return;\n }\n\n if (result.error) {\n // @TODO: not any\n var error: any = new Error(result.error.message);\n error.code = result.error.code;\n error.data = result.error.data;\n reject(error);\n return;\n }\n\n resolve(result.result);\n });\n });\n }\n}\n","'use strict';\n\nimport { Provider, ProviderSigner } from './provider';\n\nimport { Network } from './networks';\n\nimport { EtherscanProvider } from './etherscan-provider';\nimport { FallbackProvider } from './fallback-provider';\nimport { IpcProvider } from './ipc-provider';\nimport { InfuraProvider } from './infura-provider';\nimport { JsonRpcProvider } from './json-rpc-provider';\nimport { Web3Provider } from './web3-provider';\n\nfunction getDefaultProvider(network?: Network | string): FallbackProvider {\n return new FallbackProvider([\n new InfuraProvider(network),\n new EtherscanProvider(network),\n ]);\n}\n\nexport {\n Provider,\n getDefaultProvider,\n\n ProviderSigner,\n\n FallbackProvider,\n\n EtherscanProvider,\n InfuraProvider,\n JsonRpcProvider,\n Web3Provider,\n\n IpcProvider\n};\n","'use strict';\n\nimport { bigNumberify } from './bignumber';\nimport { arrayify, concat, hexlify, padZeros} from './bytes';\nimport { toUtf8Bytes } from './utf8';\n\nimport { keccak256 as hashKeccak256 } from './keccak256';\nimport { sha256 as hashSha256 } from './sha2';\n\nvar regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nvar regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nvar regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\n\nvar Zeros = '0000000000000000000000000000000000000000000000000000000000000000';\n\nfunction _pack(type: string, value: any, isArray?: boolean): Uint8Array {\n switch(type) {\n case 'address':\n if (isArray) { return padZeros(value, 32); }\n return arrayify(value);\n case 'string':\n return toUtf8Bytes(value);\n case 'bytes':\n return arrayify(value);\n case 'bool':\n value = (value ? '0x01': '0x00');\n if (isArray) { return padZeros(value, 32); }\n return arrayify(value);\n }\n\n var match = type.match(regexNumber);\n if (match) {\n //var signed = (match[1] === 'int')\n let size = parseInt(match[2] || \"256\")\n if ((size % 8 != 0) || size === 0 || size > 256) {\n throw new Error('invalid number type - ' + type);\n }\n\n if (isArray) { size = 256; }\n\n value = bigNumberify(value).toTwos(size);\n\n return padZeros(value, size / 8);\n }\n\n match = type.match(regexBytes);\n if (match) {\n let size = parseInt(match[1]);\n if (String(size) != match[1] || size === 0 || size > 32) {\n throw new Error('invalid number type - ' + type);\n }\n if (arrayify(value).byteLength !== size) { throw new Error('invalid value for ' + type); }\n if (isArray) { return arrayify((value + Zeros).substring(0, 66)); }\n return value;\n }\n\n match = type.match(regexArray);\n if (match) {\n var baseType = match[1];\n var count = parseInt(match[2] || value.length);\n if (count != value.length) { throw new Error('invalid value for ' + type); }\n var result = [];\n value.forEach(function(value) {\n value = _pack(baseType, value, true);\n result.push(value);\n });\n return concat(result);\n }\n\n throw new Error('unknown type - ' + type);\n}\n\n// @TODO: Array Enum\n\nexport function pack(types: Array, values: Array) {\n if (types.length != values.length) { throw new Error('type/value count mismatch'); }\n var tight = [];\n types.forEach(function(type, index) {\n tight.push(_pack(type, values[index]));\n });\n return hexlify(concat(tight));\n}\n\nexport function keccak256(types: Array, values: Array) {\n return hashKeccak256(pack(types, values));\n}\n\nexport function sha256(types: Array, values: Array) {\n return hashSha256(pack(types, values));\n}\n","'use strict';\n\nimport { BigNumber, bigNumberify, BigNumberish, ConstantZero, ConstantNegativeOne } from './bignumber';\n\nimport * as errors from './errors';\n\nconst names = [\n 'wei',\n 'kwei',\n 'Mwei',\n 'Gwei',\n 'szabo',\n 'finny',\n 'ether',\n];\n\nvar getUnitInfo = (function() {\n var unitInfos = {};\n\n function getUnitInfo(value) {\n return {\n decimals: value.length - 1,\n tenPower: bigNumberify(value)\n };\n }\n\n // Cache the common units\n var value = '1';\n names.forEach(function(name) {\n var info = getUnitInfo(value);\n unitInfos[name.toLowerCase()] = info;\n unitInfos[String(info.decimals)] = info;\n value += '000';\n });\n\n return function(name) {\n // Try the cache\n var info = unitInfos[String(name).toLowerCase()];\n\n if (!info && typeof(name) === 'number' && Math.trunc(name) == name && name >= 0 && name <= 256) {\n var value = '1';\n for (var i = 0; i < name; i++) { value += '0'; }\n info = getUnitInfo(value);\n }\n\n // Make sure we got something\n if (!info) {\n errors.throwError(\n 'invalid unitType',\n errors.INVALID_ARGUMENT,\n { arg: 'name', value: name }\n );\n }\n\n return info;\n }\n})();\n\nexport function formatUnits(value: BigNumberish, unitType?: string | number, options?: any): string {\n /*\n if (typeof(unitType) === 'object' && !options) {\n options = unitType;\n unitType = undefined;\n }\n if (unitType == null) { unitType = 18; }\n */\n\n if (!options) { options = {}; }\n\n var unitInfo = getUnitInfo(unitType);\n\n // Make sure wei is a big number (convert as necessary)\n value = bigNumberify(value);\n\n var negative = value.lt(ConstantZero);\n if (negative) { value = value.mul(ConstantNegativeOne); }\n\n var fraction = value.mod(unitInfo.tenPower).toString();\n while (fraction.length < unitInfo.decimals) { fraction = '0' + fraction; }\n\n // Strip off trailing zeros (but keep one if would otherwise be bare decimal point)\n if (!options.pad) {\n fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];\n }\n\n var whole = value.div(unitInfo.tenPower).toString();\n\n if (options.commify) {\n whole = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")\n }\n\n value = whole + '.' + fraction;\n\n if (negative) { value = '-' + value; }\n\n return value;\n}\n\nexport function parseUnits(value: string, unitType?: string | number): BigNumber {\n if (unitType == null) { unitType = 18; }\n var unitInfo = getUnitInfo(unitType);\n\n if (typeof(value) !== 'string' || !value.match(/^-?[0-9.,]+$/)) {\n errors.throwError('invalid decimal value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n // Remove commas\n var value = value.replace(/,/g,'');\n\n // Is it negative?\n var negative = (value.substring(0, 1) === '-');\n if (negative) { value = value.substring(1); }\n\n if (value === '.') {\n errors.throwError('missing value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n // Split it into a whole and fractional part\n let comps = value.split('.');\n if (comps.length > 2) {\n errors.throwError('too many decimal points', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n let whole = comps[0], fraction = comps[1];\n if (!whole) { whole = '0'; }\n if (!fraction) { fraction = '0'; }\n\n // Prevent underflow\n if (fraction.length > unitInfo.decimals) {\n errors.throwError(\n 'underflow occurred',\n errors.NUMERIC_FAULT,\n { operation: 'division', fault: \"underflow\" }\n );\n }\n\n // Fully pad the string with zeros to get to wei\n while (fraction.length < unitInfo.decimals) { fraction += '0'; }\n\n let wholeValue = bigNumberify(whole);\n let fractionValue = bigNumberify(fraction);\n\n let wei = (wholeValue.mul(unitInfo.tenPower)).add(fractionValue);\n\n if (negative) { wei = wei.mul(ConstantNegativeOne); }\n\n return wei;\n}\n\nexport function formatEther(wei: BigNumberish, options: any): string {\n return formatUnits(wei, 18, options);\n}\n\nexport function parseEther(ether: string): BigNumber {\n return parseUnits(ether, 18);\n}\n\n","'use strict';\n\n// This is SUPER useful, but adds 140kb (even zipped, adds 40kb)\n//var unorm = require('unorm');\n\nimport { getAddress, getContractAddress, getIcapAddress } from './address';\nimport { AbiCoder, defaultAbiCoder, parseSignature, parseParamType } from './abi-coder';\nimport * as base64 from './base64';\nimport { BigNumber, bigNumberify } from './bignumber';\nimport { arrayify, concat, hexlify, joinSignature, padZeros, splitSignature, stripZeros } from './bytes';\nimport { hashMessage, id, namehash } from './hash';\nimport { keccak256 } from './keccak256';\nimport { sha256 } from './sha2';\nimport { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from './solidity';\nimport { randomBytes } from './random-bytes';\nimport { defineFrozen, defineReadOnly, resolveProperties, shallowCopy } from './properties';\nimport * as RLP from './rlp';\nimport { toUtf8Bytes, toUtf8String } from './utf8';\nimport { formatEther, parseEther, formatUnits, parseUnits } from './units';\nimport { fetchJson } from './web';\nimport { parse as parseTransaction } from './transaction';\n\nimport * as errors from './errors';\n\n// NFKD (decomposed)\n//const etherSymbol = '\\uD835\\uDF63';\n\n// NFKC (composed)\nconst etherSymbol = '\\u039e';\n\nexport {\n AbiCoder,\n defaultAbiCoder,\n parseSignature,\n parseParamType,\n\n RLP,\n\n fetchJson,\n\n defineReadOnly,\n defineFrozen,\n resolveProperties,\n shallowCopy,\n\n etherSymbol,\n\n arrayify,\n\n concat,\n padZeros,\n stripZeros,\n\n base64,\n\n bigNumberify,\n BigNumber,\n\n hexlify,\n\n toUtf8Bytes,\n toUtf8String,\n\n hashMessage,\n namehash,\n id,\n\n getAddress,\n getIcapAddress,\n getContractAddress,\n\n formatEther,\n parseEther,\n\n formatUnits,\n parseUnits,\n\n keccak256,\n sha256,\n\n randomBytes,\n\n solidityPack,\n solidityKeccak256,\n soliditySha256,\n\n splitSignature,\n joinSignature,\n\n parseTransaction,\n\n errors\n}\n","'use strict';\n\nimport { Wallet } from './wallet';\nimport * as HDNode from './hdnode';\nimport { SigningKey } from './signing-key';\n\nexport { HDNode, SigningKey, Wallet };\n\n/*\n\n// Exporting\nexport = {\n HDNode: HDNode,\n Wallet: Wallet,\n\n SigningKey: SigningKey\n};\n\n// Default TypeScript\nexport default exporting;\n\n// Node exports\ndeclare var module: any;\n(module).exports = exporting;\n*/\n","'use strict';\n\nimport { Contract, Interface } from './contracts';\nimport * as providers from './providers';\nimport * as errors from './utils/errors';\nimport { getNetwork } from './providers/networks';\nimport * as utils from './utils';\nimport { HDNode, SigningKey, Wallet } from './wallet';\n\n//import info from '../package.json';\n//console.log(info);\nconsole.log(\"@TODO: Get version\");\nconst version = \"4.0.0\";\n\nexport {\n Wallet,\n\n HDNode,\n SigningKey,\n\n Contract,\n Interface,\n\n getNetwork,\n providers,\n\n errors,\n utils,\n\n version\n};\n\n/*\nexport default {\n Wallet: wallet.Wallet,\n\n HDNode: wallet.HDNode,\n SigningKey: wallet.SigningKey,\n\n// Contract: contracts.Contract,\n// Interface: contracts.Interface,\n\n// networks: providers.networks,\n// providers: providers,\n\n errors: errors,\n utils: utils,\n\n// version: version,\n}\n*/\n","\nimport { register, Wordlist } from './wordlist';\n\nimport * as errors from '../utils/errors';\n\nconst words = \"AbacoAbbaglioAbbinatoAbeteAbissoAbolireAbrasivoAbrogatoAccadereAccennoAccusatoAcetoneAchilleAcidoAcquaAcreAcrilicoAcrobataAcutoAdagioAddebitoAddomeAdeguatoAderireAdipeAdottareAdulareAffabileAffettoAffissoAffrantoAforismaAfosoAfricanoAgaveAgenteAgevoleAggancioAgireAgitareAgonismoAgricoloAgrumetoAguzzoAlabardaAlatoAlbatroAlberatoAlboAlbumeAlceAlcolicoAlettoneAlfaAlgebraAlianteAlibiAlimentoAllagatoAllegroAllievoAllodolaAllusivoAlmenoAlogenoAlpacaAlpestreAltalenaAlternoAlticcioAltroveAlunnoAlveoloAlzareAmalgamaAmanitaAmarenaAmbitoAmbratoAmebaAmericaAmetistaAmicoAmmassoAmmendaAmmirareAmmonitoAmoreAmpioAmpliareAmuletoAnacardoAnagrafeAnalistaAnarchiaAnatraAncaAncellaAncoraAndareAndreaAnelloAngeloAngolareAngustoAnimaAnnegareAnnidatoAnnoAnnuncioAnonimoAnticipoAnziApaticoAperturaApodeApparireAppetitoAppoggioApprodoAppuntoAprileArabicaArachideAragostaAraldicaArancioAraturaArazzoArbitroArchivioArditoArenileArgentoArgineArgutoAriaArmoniaArneseArredatoArringaArrostoArsenicoArsoArteficeArzilloAsciuttoAscoltoAsepsiAsetticoAsfaltoAsinoAsolaAspiratoAsproAssaggioAsseAssolutoAssurdoAstaAstenutoAsticeAstrattoAtavicoAteismoAtomicoAtonoAttesaAttivareAttornoAttritoAttualeAusilioAustriaAutistaAutonomoAutunnoAvanzatoAvereAvvenireAvvisoAvvolgereAzioneAzotoAzzimoAzzurroBabeleBaccanoBacinoBacoBadessaBadilataBagnatoBaitaBalconeBaldoBalenaBallataBalzanoBambinoBandireBaraondaBarbaroBarcaBaritonoBarlumeBaroccoBasilicoBassoBatostaBattutoBauleBavaBavosaBeccoBeffaBelgioBelvaBendaBenevoleBenignoBenzinaBereBerlinaBetaBibitaBiciBidoneBifidoBigaBilanciaBimboBinocoloBiologoBipedeBipolareBirbanteBirraBiscottoBisestoBisnonnoBisonteBisturiBizzarroBlandoBlattaBollitoBonificoBordoBoscoBotanicoBottinoBozzoloBraccioBradipoBramaBrancaBravuraBretellaBrevettoBrezzaBrigliaBrillanteBrindareBroccoloBrodoBronzinaBrulloBrunoBubboneBucaBudinoBuffoneBuioBulboBuonoBurloneBurrascaBussolaBustaCadettoCaducoCalamaroCalcoloCalesseCalibroCalmoCaloriaCambusaCamerataCamiciaCamminoCamolaCampaleCanapaCandelaCaneCaninoCanottoCantinaCapaceCapelloCapitoloCapogiroCapperoCapraCapsulaCarapaceCarcassaCardoCarismaCarovanaCarrettoCartolinaCasaccioCascataCasermaCasoCassoneCastelloCasualeCatastaCatenaCatrameCautoCavilloCedibileCedrataCefaloCelebreCellulareCenaCenoneCentesimoCeramicaCercareCertoCerumeCervelloCesoiaCespoCetoChelaChiaroChiccaChiedereChimeraChinaChirurgoChitarraCiaoCiclismoCifrareCignoCilindroCiottoloCircaCirrosiCitricoCittadinoCiuffoCivettaCivileClassicoClinicaCloroCoccoCodardoCodiceCoerenteCognomeCollareColmatoColoreColposoColtivatoColzaComaCometaCommandoComodoComputerComuneConcisoCondurreConfermaCongelareConiugeConnessoConoscereConsumoContinuoConvegnoCopertoCopioneCoppiaCopricapoCorazzaCordataCoricatoCorniceCorollaCorpoCorredoCorsiaCorteseCosmicoCostanteCotturaCovatoCratereCravattaCreatoCredereCremosoCrescitaCretaCricetoCrinaleCrisiCriticoCroceCronacaCrostataCrucialeCruscaCucireCuculoCuginoCullatoCupolaCuratoreCursoreCurvoCuscinoCustodeDadoDainoDalmataDamerinoDanielaDannosoDanzareDatatoDavantiDavveroDebuttoDecennioDecisoDeclinoDecolloDecretoDedicatoDefinitoDeformeDegnoDelegareDelfinoDelirioDeltaDemenzaDenotatoDentroDepositoDerapataDerivareDerogaDescrittoDesertoDesiderioDesumereDetersivoDevotoDiametroDicembreDiedroDifesoDiffusoDigerireDigitaleDiluvioDinamicoDinnanziDipintoDiplomaDipoloDiradareDireDirottoDirupoDisagioDiscretoDisfareDisgeloDispostoDistanzaDisumanoDitoDivanoDiveltoDividereDivoratoDobloneDocenteDoganaleDogmaDolceDomatoDomenicaDominareDondoloDonoDormireDoteDottoreDovutoDozzinaDragoDruidoDubbioDubitareDucaleDunaDuomoDupliceDuraturoEbanoEccessoEccoEclissiEconomiaEderaEdicolaEdileEditoriaEducareEgemoniaEgliEgoismoEgregioElaboratoElargireEleganteElencatoElettoElevareElficoElicaElmoElsaElusoEmanatoEmblemaEmessoEmiroEmotivoEmozioneEmpiricoEmuloEndemicoEnduroEnergiaEnfasiEnotecaEntrareEnzimaEpatiteEpilogoEpisodioEpocaleEppureEquatoreErarioErbaErbosoEredeEremitaErigereErmeticoEroeErosivoErranteEsagonoEsameEsanimeEsaudireEscaEsempioEsercitoEsibitoEsigenteEsistereEsitoEsofagoEsortatoEsosoEspansoEspressoEssenzaEssoEstesoEstimareEstoniaEstrosoEsultareEtilicoEtnicoEtruscoEttoEuclideoEuropaEvasoEvidenzaEvitatoEvolutoEvvivaFabbricaFaccendaFachiroFalcoFamigliaFanaleFanfaraFangoFantasmaFareFarfallaFarinosoFarmacoFasciaFastosoFasulloFaticareFatoFavolosoFebbreFecolaFedeFegatoFelpaFeltroFemminaFendereFenomenoFermentoFerroFertileFessuraFestivoFettaFeudoFiabaFiduciaFifaFiguratoFiloFinanzaFinestraFinireFioreFiscaleFisicoFiumeFlaconeFlamencoFleboFlemmaFloridoFluenteFluoroFobicoFocacciaFocosoFoderatoFoglioFolataFolcloreFolgoreFondenteFoneticoFoniaFontanaForbitoForchettaForestaFormicaFornaioForoFortezzaForzareFosfatoFossoFracassoFranaFrassinoFratelloFreccettaFrenataFrescoFrigoFrollinoFrondeFrugaleFruttaFucilataFucsiaFuggenteFulmineFulvoFumanteFumettoFumosoFuneFunzioneFuocoFurboFurgoneFuroreFusoFutileGabbianoGaffeGalateoGallinaGaloppoGamberoGammaGaranziaGarboGarofanoGarzoneGasdottoGasolioGastricoGattoGaudioGazeboGazzellaGecoGelatinaGelsoGemelloGemmatoGeneGenitoreGennaioGenotipoGergoGhepardoGhiaccioGhisaGialloGildaGineproGiocareGioielloGiornoGioveGiratoGironeGittataGiudizioGiuratoGiustoGlobuloGlutineGnomoGobbaGolfGomitoGommoneGonfioGonnaGovernoGracileGradoGraficoGrammoGrandeGrattareGravosoGraziaGrecaGreggeGrifoneGrigioGrinzaGrottaGruppoGuadagnoGuaioGuantoGuardareGufoGuidareIbernatoIconaIdenticoIdillioIdoloIdraIdricoIdrogenoIgieneIgnaroIgnoratoIlareIllesoIllogicoIlludereImballoImbevutoImboccoImbutoImmaneImmersoImmolatoImpaccoImpetoImpiegoImportoImprontaInalareInarcareInattivoIncantoIncendioInchinoIncisivoInclusoIncontroIncrocioIncuboIndagineIndiaIndoleIneditoInfattiInfilareInflittoIngaggioIngegnoIngleseIngordoIngrossoInnescoInodoreInoltrareInondatoInsanoInsettoInsiemeInsonniaInsulinaIntasatoInteroIntonacoIntuitoInumidireInvalidoInveceInvitoIperboleIpnoticoIpotesiIppicaIrideIrlandaIronicoIrrigatoIrrorareIsolatoIsotopoIstericoIstitutoIstriceItaliaIterareLabbroLabirintoLaccaLaceratoLacrimaLacunaLaddoveLagoLampoLancettaLanternaLardosoLargaLaringeLastraLatenzaLatinoLattugaLavagnaLavoroLegaleLeggeroLemboLentezzaLenzaLeoneLepreLesivoLessatoLestoLetteraleLevaLevigatoLiberoLidoLievitoLillaLimaturaLimitareLimpidoLineareLinguaLiquidoLiraLiricaLiscaLiteLitigioLivreaLocandaLodeLogicaLombareLondraLongevoLoquaceLorenzoLotoLotteriaLuceLucidatoLumacaLuminosoLungoLupoLuppoloLusingaLussoLuttoMacabroMacchinaMaceroMacinatoMadamaMagicoMagliaMagneteMagroMaiolicaMalafedeMalgradoMalintesoMalsanoMaltoMalumoreManaManciaMandorlaMangiareManifestoMannaroManovraMansardaMantideManubrioMappaMaratonaMarcireMarettaMarmoMarsupioMascheraMassaiaMastinoMaterassoMatricolaMattoneMaturoMazurcaMeandroMeccanicoMecenateMedesimoMeditareMegaMelassaMelisMelodiaMeningeMenoMensolaMercurioMerendaMerloMeschinoMeseMessereMestoloMetalloMetodoMettereMiagolareMicaMicelioMicheleMicroboMidolloMieleMiglioreMilanoMiliteMimosaMineraleMiniMinoreMirinoMirtilloMiscelaMissivaMistoMisurareMitezzaMitigareMitraMittenteMnemonicoModelloModificaModuloMoganoMogioMoleMolossoMonasteroMoncoMondinaMonetarioMonileMonotonoMonsoneMontatoMonvisoMoraMordereMorsicatoMostroMotivatoMotosegaMottoMovenzaMovimentoMozzoMuccaMucosaMuffaMughettoMugnaioMulattoMulinelloMultiploMummiaMuntoMuovereMuraleMusaMuscoloMusicaMutevoleMutoNababboNaftaNanometroNarcisoNariceNarratoNascereNastrareNaturaleNauticaNaviglioNebulosaNecrosiNegativoNegozioNemmenoNeofitaNerettoNervoNessunoNettunoNeutraleNeveNevroticoNicchiaNinfaNitidoNobileNocivoNodoNomeNominaNordicoNormaleNorvegeseNostranoNotareNotiziaNotturnoNovellaNucleoNullaNumeroNuovoNutrireNuvolaNuzialeOasiObbedireObbligoObeliscoOblioOboloObsoletoOccasioneOcchioOccidenteOccorrereOccultareOcraOculatoOdiernoOdorareOffertaOffrireOffuscatoOggettoOggiOgnunoOlandeseOlfattoOliatoOlivaOlogrammaOltreOmaggioOmbelicoOmbraOmegaOmissioneOndosoOnereOniceOnnivoroOnorevoleOntaOperatoOpinioneOppostoOracoloOrafoOrdineOrecchinoOreficeOrfanoOrganicoOrigineOrizzonteOrmaOrmeggioOrnativoOrologioOrrendoOrribileOrtensiaOrticaOrzataOrzoOsareOscurareOsmosiOspedaleOspiteOssaOssidareOstacoloOsteOtiteOtreOttagonoOttimoOttobreOvaleOvestOvinoOviparoOvocitoOvunqueOvviareOzioPacchettoPacePacificoPadellaPadronePaesePagaPaginaPalazzinaPalesarePallidoPaloPaludePandoroPannelloPaoloPaonazzoPapricaParabolaParcellaParerePargoloPariParlatoParolaPartireParvenzaParzialePassivoPasticcaPataccaPatologiaPattumePavonePeccatoPedalarePedonalePeggioPelosoPenarePendicePenisolaPennutoPenombraPensarePentolaPepePepitaPerbenePercorsoPerdonatoPerforarePergamenaPeriodoPermessoPernoPerplessoPersuasoPertugioPervasoPesatorePesistaPesoPestiferoPetaloPettinePetulantePezzoPiacerePiantaPiattinoPiccinoPicozzaPiegaPietraPifferoPigiamaPigolioPigroPilaPiliferoPillolaPilotaPimpantePinetaPinnaPinoloPioggiaPiomboPiramidePireticoPiritePirolisiPitonePizzicoPlaceboPlanarePlasmaPlatanoPlenarioPochezzaPoderosoPodismoPoesiaPoggiarePolentaPoligonoPollicePolmonitePolpettaPolsoPoltronaPolverePomicePomodoroPontePopolosoPorfidoPorosoPorporaPorrePortataPosaPositivoPossessoPostulatoPotassioPoterePranzoPrassiPraticaPreclusoPredicaPrefissoPregiatoPrelievoPremerePrenotarePreparatoPresenzaPretestoPrevalsoPrimaPrincipePrivatoProblemaProcuraProdurreProfumoProgettoProlungaPromessaPronomePropostaProrogaProtesoProvaPrudentePrugnaPruritoPsichePubblicoPudicaPugilatoPugnoPulcePulitoPulsantePuntarePupazzoPupillaPuroQuadroQualcosaQuasiQuerelaQuotaRaccoltoRaddoppioRadicaleRadunatoRafficaRagazzoRagioneRagnoRamarroRamingoRamoRandagioRantolareRapatoRapinaRappresoRasaturaRaschiatoRasenteRassegnaRastrelloRataRavvedutoRealeRecepireRecintoReclutaReconditoRecuperoRedditoRedimereRegalatoRegistroRegolaRegressoRelazioneRemareRemotoRennaReplicaReprimereReputareResaResidenteResponsoRestauroReteRetinaRetoricaRettificaRevocatoRiassuntoRibadireRibelleRibrezzoRicaricaRiccoRicevereRiciclatoRicordoRicredutoRidicoloRidurreRifasareRiflessoRiformaRifugioRigareRigettatoRighelloRilassatoRilevatoRimanereRimbalzoRimedioRimorchioRinascitaRincaroRinforzoRinnovoRinomatoRinsavitoRintoccoRinunciaRinvenireRiparatoRipetutoRipienoRiportareRipresaRipulireRisataRischioRiservaRisibileRisoRispettoRistoroRisultatoRisvoltoRitardoRitegnoRitmicoRitrovoRiunioneRivaRiversoRivincitaRivoltoRizomaRobaRoboticoRobustoRocciaRocoRodaggioRodereRoditoreRogitoRollioRomanticoRompereRonzioRosolareRospoRotanteRotondoRotulaRovescioRubizzoRubricaRugaRullinoRumineRumorosoRuoloRupeRussareRusticoSabatoSabbiareSabotatoSagomaSalassoSaldaturaSalgemmaSalivareSalmoneSaloneSaltareSalutoSalvoSapereSapidoSaporitoSaracenoSarcasmoSartoSassosoSatelliteSatiraSatolloSaturnoSavanaSavioSaziatoSbadiglioSbalzoSbancatoSbarraSbattereSbavareSbendareSbirciareSbloccatoSbocciatoSbrinareSbruffoneSbuffareScabrosoScadenzaScalaScambiareScandaloScapolaScarsoScatenareScavatoSceltoScenicoScettroSchedaSchienaSciarpaScienzaScindereScippoSciroppoScivoloSclerareScodellaScolpitoScompartoSconfortoScoprireScortaScossoneScozzeseScribaScrollareScrutinioScuderiaScultoreScuolaScuroScusareSdebitareSdoganareSeccaturaSecondoSedanoSeggiolaSegnalatoSegregatoSeguitoSelciatoSelettivoSellaSelvaggioSemaforoSembrareSemeSeminatoSempreSensoSentireSepoltoSequenzaSerataSerbatoSerenoSerioSerpenteSerraglioServireSestinaSetolaSettimanaSfaceloSfaldareSfamatoSfarzosoSfaticatoSferaSfidaSfilatoSfingeSfocatoSfoderareSfogoSfoltireSforzatoSfrattoSfruttatoSfuggitoSfumareSfusoSgabelloSgarbatoSgonfiareSgorbioSgrassatoSguardoSibiloSiccomeSierraSiglaSignoreSilenzioSillabaSimboloSimpaticoSimulatoSinfoniaSingoloSinistroSinoSintesiSinusoideSiparioSismaSistoleSituatoSlittaSlogaturaSlovenoSmarritoSmemoratoSmentitoSmeraldoSmilzoSmontareSmottatoSmussatoSnellireSnervatoSnodoSobbalzoSobrioSoccorsoSocialeSodaleSoffittoSognoSoldatoSolenneSolidoSollazzoSoloSolubileSolventeSomaticoSommaSondaSonettoSonniferoSopireSoppesoSopraSorgereSorpassoSorrisoSorsoSorteggioSorvolatoSospiroSostaSottileSpadaSpallaSpargereSpatolaSpaventoSpazzolaSpecieSpedireSpegnereSpelaturaSperanzaSpessoreSpettraleSpezzatoSpiaSpigolosoSpillatoSpinosoSpiraleSplendidoSportivoSposoSprangaSprecareSpronatoSpruzzoSpuntinoSquilloSradicareSrotolatoStabileStaccoStaffaStagnareStampatoStantioStarnutoStaseraStatutoSteloSteppaSterzoStilettoStimaStirpeStivaleStizzosoStonatoStoricoStrappoStregatoStriduloStrozzareStruttoStuccareStufoStupendoSubentroSuccosoSudoreSuggeritoSugoSultanoSuonareSuperboSupportoSurgelatoSurrogatoSussurroSuturaSvagareSvedeseSveglioSvelareSvenutoSveziaSviluppoSvistaSvizzeraSvoltaSvuotareTabaccoTabulatoTacciareTaciturnoTaleTalismanoTamponeTanninoTaraTardivoTargatoTariffaTarpareTartarugaTastoTatticoTavernaTavolataTazzaTecaTecnicoTelefonoTemerarioTempoTemutoTendoneTeneroTensioneTentacoloTeoremaTermeTerrazzoTerzettoTesiTesseratoTestatoTetroTettoiaTifareTigellaTimbroTintoTipicoTipografoTiraggioTiroTitanioTitoloTitubanteTizioTizzoneToccareTollerareToltoTombolaTomoTonfoTonsillaTopazioTopologiaToppaTorbaTornareTorroneTortoraToscanoTossireTostaturaTotanoTraboccoTracheaTrafilaTragediaTralcioTramontoTransitoTrapanoTrarreTraslocoTrattatoTraveTrecciaTremolioTrespoloTributoTrichecoTrifoglioTrilloTrinceaTrioTristezzaTrituratoTrivellaTrombaTronoTroppoTrottolaTrovareTruccatoTubaturaTuffatoTulipanoTumultoTunisiaTurbareTurchinoTutaTutelaUbicatoUccelloUccisoreUdireUditivoUffaUfficioUgualeUlisseUltimatoUmanoUmileUmorismoUncinettoUngereUnghereseUnicornoUnificatoUnisonoUnitarioUnteUovoUpupaUraganoUrgenzaUrloUsanzaUsatoUscitoUsignoloUsuraioUtensileUtilizzoUtopiaVacanteVaccinatoVagabondoVagliatoValangaValgoValicoVallettaValorosoValutareValvolaVampataVangareVanitosoVanoVantaggioVanveraVaporeVaranoVarcatoVarianteVascaVedettaVedovaVedutoVegetaleVeicoloVelcroVelinaVellutoVeloceVenatoVendemmiaVentoVeraceVerbaleVergognaVerificaVeroVerrucaVerticaleVescicaVessilloVestaleVeteranoVetrinaVetustoViandanteVibranteVicendaVichingoVicinanzaVidimareVigiliaVignetoVigoreVileVillanoViminiVincitoreViolaViperaVirgolaVirologoVirulentoViscosoVisioneVispoVissutoVisuraVitaVitelloVittimaVivandaVividoViziareVoceVogaVolatileVolereVolpeVoragineVulcanoZampognaZannaZappatoZatteraZavorraZefiroZelanteZeloZenzeroZerbinoZibettoZincoZirconeZittoZollaZoticoZuccheroZufoloZuluZuppa\";\n\nlet wordlist: Array = null;\n\nfunction loadWords(): void {\n if (wordlist != null) { return; }\n wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' ');\n}\n\nclass LangIt extends Wordlist {\n constructor() {\n super('it');\n }\n\n getWord(index: number): string {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n }\n\n getWordIndex(word: string): number {\n loadWords();\n return wordlist.indexOf(word);\n }\n}\n\nconst langIt = new LangIt();\nregister(langIt);\n\nexport { langIt }\n","\nimport { register, Wordlist } from './wordlist';\n\nimport { toUtf8String } from '../utils/utf8';\n\nimport * as errors from '../utils/errors';\n\nconst data = [\n\n // 4-kana words\n 'AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgBQhBQhCQuFQmXQiDQUFQZDQsFQdRQkHQbRQlOQlmQPDQjDQwXQMBQMDQcFQTBQTHQrDDXQDNFDGBDGQDGRDpFDhFDmXDZXDbRDMYDRdDTRDrXSAhSBCSBrSGQSEQSHBSVRShYShkSyQSuFSiBSdcSoESocSlmSMBSFBSFKSFNSFdSFcCByCaRCKcCSBCSRCCrCGbCEHCYXCpBCpQCIBCIHCeNCgBCgFCVECVcCmkCmwCZXCZFCdRClOClmClFCjDCjdCnXCwBCwXCcRCFQCFjGXhGNhGDEGDMGCDGCHGIFGgBGVXGVEGVRGmXGsXGdYGoSGbRGnXGwXGwDGWRGFNGFLGFOGFdGFkEABEBDEBFEXOEaBEKSENBENDEYXEIgEIkEgBEgQEgHEhFEudEuFEiBEiHEiFEZDEvBEsXEsFEdXEdREkFEbBEbRElFEPCEfkEFNYAEYAhYBNYQdYDXYSRYCEYYoYgQYgRYuRYmCYZTYdBYbEYlXYjQYRbYWRpKXpQopQnpSFpCXpIBpISphNpdBpdRpbRpcZpFBpFNpFD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IJBTFEfXTFLJDrXEJFrEJXMrFZJFWEJdEWYTlm',\n\n // 7-kana words\n 'ABCDEFACNJTRAMBDJdAcNJVXBLNJEBXSIdWRXErNJkXYDJMBXZJCJaXMNJaYKKVJKcKDEJqXKDcNJhKVJrNYKbgJVXKFVJSBNBYBwDNJeQfXNJeEqXNhGJWENJFiJRQlIJbEQJfXxDQqXcfXQFNDEJQFwXUJDYcnUJDJIBgQDIUJTRDJFEqDSJQSJFSJQIJFSOPeZtSJFZJHCJXQfXCTDEqFGJBSJFGJBOfXGJBcqXGJHNJDGJRLiJEJfXEqEJFEJPEFpBEJYJBZJFYBwXUJYiJMEBYJZJyTYTONJXpQMFXFpeGIDdpJFstXpJFcPDLBVSJRLHQJqXLJFZJFIJBNJDIJBUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC',\n\n // 8-kana words\n 'BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD',\n\n // 9-kana words\n 'QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD',\n\n // 10-kana words\n 'IJBEJqXZJ'\n];\n\n// Maps each character into its kana value (the index)\nconst mapping = \"~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt\"\n\nlet words: Array = null;\n\nfunction loadWords() {\n if (words !== null) { return; }\n words = [];\n\n // Transforms for normalizing (sort is a not quite UTF-8)\n var transform = {};\n\n // Delete the diacritic marks\n transform[toUtf8String([227, 130, 154])] = false;\n transform[toUtf8String([227, 130, 153])] = false;\n\n // Some simple transforms that sort out most of the order\n transform[toUtf8String([227, 130, 133])] = toUtf8String([227, 130, 134]);\n transform[toUtf8String([227, 129, 163])] = toUtf8String([227, 129, 164]);\n transform[toUtf8String([227, 130, 131])] = toUtf8String([227, 130, 132]);\n transform[toUtf8String([227, 130, 135])] = toUtf8String([227, 130, 136]);\n\n\n // Normalize words using the transform\n function normalize(word) {\n var result = '';\n for (var i = 0; i < word.length; i++) {\n let kana = word[i];\n var target = transform[kana];\n if (target === false) { continue; }\n if (target) { kana = target; }\n result += kana;\n }\n return result;\n }\n\n // Sort how the Japanese list is sorted\n function sortJapanese(a, b) {\n a = normalize(a);\n b = normalize(b);\n if (a < b) { return -1; }\n if (a > b) { return 1; }\n return 0;\n }\n\n // Load all the words\n for (let length = 3; length <= 9; length++) {\n let d = data[length - 3];\n for (let offset = 0; offset < d.length; offset += length) {\n let word = [];\n for (let i = 0; i < length; i++) {\n let k = mapping.indexOf(d[offset + i]);\n word.push(227);\n word.push((k & 0x40) ? 130: 129);\n word.push((k & 0x3f) + 128);\n }\n words.push(toUtf8String(word));\n }\n }\n words.sort(sortJapanese);\n\n // For some reason kyoku and kiyoku are flipped; we'll just manually fix it\n let kyoku = words[442];\n words[442] = words[443];\n words[443] = kyoku;\n}\n\n/*\nvar fs = require('fs');\nfs.readFileSync('lang-ja.txt').toString().split('\\x0a').forEach(function(d, i) {\n if (d !== words[i]) { console.log(d, words[i], i, toUtf8Bytes(d)); }\n});\n*/\n\n\nclass LangJa extends Wordlist {\n constructor() {\n super('ja');\n }\n\n getWord(index) {\n loadWords();\n return words[index];\n }\n\n getWordIndex(word) {\n loadWords();\n return words.indexOf(word);\n }\n\n split(mnemonic: string): Array {\n if (!mnemonic.normalize) {\n errors.throwError('Japanese is unsupported on this platform; missing String.prototype.normalize', errors.UNSUPPORTED_OPERATION, { operation: 'String.prototype.normalize' });\n }\n return mnemonic.split(/(?:\\u3000| )+/g);\n }\n\n join(words: Array): string {\n return words.join('\\u3000');\n }\n}\n\nconst langJa = new LangJa();\nregister(langJa);\n\nexport { langJa };\n\n","\nimport { register, Wordlist } from './wordlist';\n\nimport { toUtf8String } from '../utils/utf8';\n\nimport * as errors from '../utils/errors';\n\n\nconst data = [\n 'OYAa',\n 'ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeAgrDUAgrJTAhrFnAhrLjAhrQgAjAgoAjJnrAkMX8AkOnoAlCTvAlCV8AlClvAlFg4AlFl6AlFn3AloSnAlrAXAlrAfAlrFUAlrFbAlrGgAlrOXAlvKnAlvMTAl3AbAl3MnAnATrAnAc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UMX8ScoSnMYJT6CTvMgAcrMXoMg8SToAfMlvAXLg3MnFl3AnvOT3AnFl3OUoATHT8OU3RnLXrOXrOXrSnObPbvFn6Og8HgrSnOg8OX8DbPTvAgoJgPU3RYLnrPXrDnJZrPb8CTGgvPlrLTDlvPlvFUJnoQUvFXrQlQeMnoAl3QlrQlrSnRTFTrJUoSTDlLiLXSTFg6HT3STJgoMn4STrFTJTrSTrLZFl3ST4FnMXoSUrDlHUoScvHTvSnSfLkvMXo',\n 'AUoAcrMXoAZ8HboAg8AbOg6ATFgAg8AloMXoAl3AT8JTrAl8MX8MXoCT3SToJU8Cl8Db8MXoDT8HgrATrDboOT8MXoGTOTrATMnGT8LhrAZ8GnvFnGnQXHToGgvAcrHTvAXvLl3HbrAZoMXoHgBlFXLg3HgMnFXrSnHgrSb8JUoHn6HT8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg',\n 'HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb',\n 'AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl'\n]\n\nvar codes = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*'\n\nfunction getHangul(code) {\n if (code >= 40) {\n code = code + 168 - 40;\n } else if (code >= 19) {\n code = code + 97 - 19;\n }\n\n return toUtf8String([ 225, (code >> 6) + 132, (code & 0x3f) + 128]);\n //return '[' + ([ 225, (code >> 6) + 132, (code & 0x3f) + 128]).join(', ') + ']';\n}\n\nlet wordlist: Array = null;\n\nfunction loadWords(): void {\n if (wordlist != null) { return; }\n\n wordlist = [];\n\n data.forEach((data, length) => {\n length += 4;\n for (let i = 0; i < data.length; i += length) {\n let word = '';\n for (let j = 0; j < length; j++) {\n word += getHangul(codes.indexOf(data[i + j]));\n }\n wordlist.push(word)\n }\n });\n\n wordlist.sort();\n}\nloadWords();\n\n\n\nclass LangKo extends Wordlist {\n constructor() {\n super('ko');\n }\n\n getWord(index: number): string {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n }\n\n getWordIndex(word: string): number {\n loadWords();\n return wordlist.indexOf(word);\n }\n}\n\nconst langKo = new LangKo();\nregister(langKo);\n\nexport { langKo }\n","\nimport { register, Wordlist } from './wordlist';\n\nimport { defineReadOnly } from '../utils/properties';\nimport { toUtf8String } from '../utils/utf8';\n\nconst data = \"}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN?\"\n\nlet deltaOffset = 0;\nfor (var i = 0; i < 2048; i++) {\n let s = style.indexOf(data[i * 3]);\n let bytes = [\n 228 + (s >> 2),\n 128 + codes.indexOf(data[i * 3 + 1]),\n 128 + codes.indexOf(data[i * 3 + 2]),\n ];\n words.cn.push(toUtf8String(bytes));\n\n let common = s % 4;\n for (let i = common; i < 3; i++) {\n bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228: 128);\n }\n words.tw.push(toUtf8String(bytes));\n}\n\nclass LangZh extends Wordlist {\n private _country: string\n constructor(country) {\n super('zh_' + country);\n defineReadOnly(this, '_country', country);\n }\n\n getWord(index: number): string {\n return words[this._country][index];\n }\n\n getWordIndex(word: string): number {\n return words[this._country].indexOf(word);\n }\n\n split(mnemonic: string): Array {\n mnemonic = mnemonic.replace(/(?:\\u3000| )+/g, '');\n return mnemonic.split('');\n }\n}\n\nconst langZhCn = new LangZh('cn');\nregister(langZhCn);\n\nconst langZhTw = new LangZh('tw');\nregister(langZhTw);\n\n//var count = 0;\n//var fs = require('fs');\n//fs.readFileSync('wordlists/lang-zh.txt').toString().split('\\x0a').forEach(function(d, i) {\n// let word = langZhCn.getWord(i);\n// if (d !== word) {\n// console.log(d, word, i, toUtf8Bytes(d));\n// count++;\n// }\n//});\n//console.log(count);\n\n//var count = 0;\n//var fs = require('fs');\n//fs.readFileSync('wordlists/lang-zh_tw.txt').toString().split('\\x0a').forEach(function(d, i) {\n// let word = langZhTw.getWord(i);\n// if (d !== word) {\n// console.log(d, word, i, toUtf8Bytes(d));\n// count++;\n// }\n//});\n//console.log(count);\n\nexport { langZhCn, langZhTw };\n"]} \ No newline at end of file +{"version":3,"sources":["src.ts/utils/keccak256.ts","src.ts/utils/properties.ts","src.ts/utils/errors.ts","src.ts/utils/secp256k1.ts","src.ts/utils/bytes.ts","src.ts/utils/bignumber.ts","src.ts/utils/rlp.ts","src.ts/utils/address.ts","src.ts/utils/utf8.ts","src.ts/utils/abi-coder.ts","src.ts/contracts/interface.ts","src.ts/wordlists/wordlist.ts","src.ts/wordlists/lang-en.ts","src.ts/utils/pbkdf2.ts","src.ts/utils/hmac.ts","src.ts/utils/sha2.ts","src.ts/wallet/hdnode.ts","src.ts/utils/random-bytes.ts","src.ts/wallet/signing-key.ts","src.ts/wallet/secret-storage.ts","src.ts/utils/hash.ts","src.ts/utils/transaction.ts","src.ts/wallet/wallet.ts","src.ts/providers/networks.ts","src.ts/providers/provider.ts","src.ts/contracts/contract.ts","src.ts/contracts/index.ts","src.ts/utils/base64.ts","src.ts/utils/web.ts","src.ts/providers/etherscan-provider.ts","src.ts/providers/fallback-provider.ts","src.ts/providers/json-rpc-provider.ts","src.ts/providers/ipc-provider.ts","src.ts/providers/infura-provider.ts","src.ts/providers/web3-provider.ts","src.ts/providers/index.ts","src.ts/utils/solidity.ts","src.ts/utils/units.ts","src.ts/utils/index.ts","src.ts/wallet/index.ts","src.ts/index.ts","src.ts/wordlists/lang-it.ts","src.ts/wordlists/lang-ja.ts","src.ts/wordlists/lang-ko.ts","src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":";IAIA,OAAO,EAAY,QAAQ,EAAE,oBAAgB;IAE7C,MAAM,oBAAoB,MAAM,QAAQ,GAAG,MAAM,CAEhD;;;ICND,MAAM,yBAAyB,QAAQ,GAAG,EAAE,MAAM,MAAM,EAAE,OAAO,GAAG,GAAG,IAAI,CAM1E;IAED,MAAM,uBAAuB,QAAQ,GAAG,EAAE,MAAM,MAAM,EAAE,OAAO,GAAG,GAAG,IAAI,CAMxE;IAED,MAAM,4BAA4B,QAAQ,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAkB3D;IAED,MAAM,sBAAsB,QAAQ,GAAG,GAAG,GAAG,CAI5C;IAED,MAAM,mBAAmB,QAAQ,GAAG,GAAG,GAAG,CAEzC;;;IC3CD,MAAM,CAAC,MAAM,aAAa,kBAAkB,CAAC;IAG7C,MAAM,CAAC,MAAM,eAAe,oBAAoB,CAAC;IAIjD,MAAM,CAAC,MAAM,WAAW,gBAAgB,CAAC;IAGzC,MAAM,CAAC,MAAM,cAAc,mBAAmB,CAAC;IAW/C,MAAM,CAAC,MAAM,gBAAgB,qBAAqB,CAAC;IAMnD,MAAM,CAAC,MAAM,gBAAgB,qBAAqB,CAAC;IAKnD,MAAM,CAAC,MAAM,mBAAmB,wBAAwB,CAAC;IAKzD,MAAM,CAAC,MAAM,aAAa,kBAAkB,CAAC;IAK7C,MAAM,CAAC,MAAM,qBAAqB,0BAA0B,CAAC;IAG7D,MAAM,qBAAqB,SAAS,M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AM;QAQ9B,YAAY,CAAC,MAAM,MAAM,GAAG,MAAM;KAIrC;IAED,MAAM,MAAM,QAAe,CAAC;IAG5B,OAAO,EAAE,MAAM,EAAE,CAAA;;;IC7EjB,OAAO,EAAY,QAAQ,EAAE,2BAAmB;IAiChD,YAAa,SAAQ,QAAQ;QACzB,OAAO,CAAC,QAAQ,CAAQ;oBACZ,OAAO,KAAA;QAKnB,OAAO,CAAC,OAAO,MAAM,GAAG,MAAM;QAI9B,YAAY,CAAC,MAAM,MAAM,GAAG,MAAM;QAIlC,KAAK,CAAC,UAAU,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;KAIzC;IAED,MAAM,QAAQ,QAAmB,CAAC;IAGlC,MAAM,QAAQ,QAAmB,CAAC;IAyBlC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC","file":"ethers.d.ts","sourcesContent":["'use strict';\n\nimport sha3 = require('js-sha3');\n\nimport { arrayify, Arrayish } from './bytes';\n\nexport function keccak256(data: Arrayish): string {\n return '0x' + sha3.keccak_256(arrayify(data));\n}\n\n//export default keccak256;\n","'use strict';\n\nexport function defineReadOnly(object: any, name: string, value: any): void {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n\nexport function defineFrozen(object: any, name: string, value: any): void {\n var frozen = JSON.stringify(value);\n Object.defineProperty(object, name, {\n enumerable: true,\n get: function() { return JSON.parse(frozen); }\n });\n}\n\nexport function resolveProperties(object: any): Promise {\n let result: any = {};\n\n let promises: Array> = [];\n Object.keys(object).forEach((key) => {\n let value = object[key];\n if (value instanceof Promise) {\n promises.push(\n value.then((value) => { result[key] = value; })\n );\n } else {\n result[key] = value;\n }\n });\n\n return Promise.all(promises).then(() => {\n return object;\n });\n}\n\nexport function shallowCopy(object: any): any {\n let result = {};\n for (var key in object) { result[key] = object[key]; }\n return result;\n}\n\nexport function jsonCopy(object: any): any {\n return JSON.parse(JSON.stringify(object));\n}\n","'use strict';\n\n// Unknown Error\nexport const UNKNOWN_ERROR = 'UNKNOWN_ERROR';\n\n// Not implemented\nexport const NOT_IMPLEMENTED = 'NOT_IMPLEMENTED';\n\n// Missing new operator to an object\n// - name: The name of the class\nexport const MISSING_NEW = 'MISSING_NEW';\n\n// Call exception\nexport const CALL_EXCEPTION = 'CALL_EXCEPTION';\n\n// Response from a server was invalid\n// - response: The body of the response\n//'BAD_RESPONSE',\n\n// Invalid argument (e.g. type) to a function:\n// - arg: The argument name that was invalid\n// - value: The value of the argument\n// - type: The type of the argument\n// - expected: What was expected\nexport const INVALID_ARGUMENT = 'INVALID_ARGUMENT';\n\n// Missing argument to a function:\n// - arg: The argument name that is required\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexport const MISSING_ARGUMENT = 'MISSING_ARGUMENT';\n\n// Too many arguments\n// - count: The number of arguments received\n// - expectedCount: The number of arguments expected\nexport const UNEXPECTED_ARGUMENT = 'UNEXPECTED_ARGUMENT';\n\n// Numeric Fault\n// - operation: the operation being executed\n// - fault: the reason this faulted\nexport const NUMERIC_FAULT = 'NUMERIC_FAULT';\n\n\n// Unsupported operation\n// - operation\nexport const UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION';\n\n// @TODO: Enum\nexport function throwError(message: string, code: string, params: any): never {\n if (!code) { code = UNKNOWN_ERROR; }\n if (!params) { params = {}; }\n\n var messageDetails = [];\n Object.keys(params).forEach(function(key) {\n try {\n messageDetails.push(key + '=' + JSON.stringify(params[key]));\n } catch (error) {\n messageDetails.push(key + '=' + JSON.stringify(params[key].toString()));\n }\n });\n var reason = message;\n if (messageDetails.length) {\n message += ' (' + messageDetails.join(', ') + ')';\n }\n\n// @TODO: Any??\n var error: any = new Error(message);\n error.reason = reason;\n error.code = code\n\n Object.keys(params).forEach(function(key) {\n error[key] = params[key];\n });\n\n throw error;\n}\n\nexport function checkNew(self: any, kind: any): void {\n if (!(self instanceof kind)) {\n throwError('missing new', MISSING_NEW, { name: kind.name });\n }\n}\n\n","'use strict';\n\nimport { getAddress } from './address';\nimport { arrayify, Arrayish, hexlify, hexZeroPad } from './bytes';\nimport { keccak256 } from './keccak256';\nimport { defineReadOnly } from './properties';\n\nimport * as errors from './errors';\n\ninterface _BN {\n toString(radix: number): string;\n encode(encoding: string, compact: boolean): Uint8Array;\n toArray(endian: string, width: number): Uint8Array;\n}\n\ninterface _Signature {\n r: _BN,\n s: _BN,\n recoveryParam: number\n}\n\ninterface _KeyPair {\n sign(message: Uint8Array, options: { canonical?: boolean }): _Signature;\n getPublic(compressed: boolean, encoding?: string): string;\n getPublic(): _BN;\n getPrivate(encoding?: string): string;\n encode(encoding: string, compressed: boolean): string;\n priv: _BN;\n}\n\ninterface _EC {\n constructor(curve: string);\n\n n: _BN;\n\n keyFromPublic(publicKey: string | Uint8Array): _KeyPair;\n keyFromPrivate(privateKey: string | Uint8Array): _KeyPair;\n recoverPubKey(data: Uint8Array, signature: { r: Uint8Array, s: Uint8Array }, recoveryParam: number): _KeyPair;\n}\n\nimport * as elliptic from 'elliptic';\n\nconst curve:_EC = new elliptic.ec('secp256k1');\n\n\nexport const N = '0x' + curve.n.toString(16);\n\nexport interface Signature {\n r: string;\n s: string;\n recoveryParam: number;\n v?: number;\n}\n\nexport class KeyPair {\n\n readonly privateKey: string;\n\n readonly publicKey: string;\n readonly compressedPublicKey: string;\n\n readonly publicKeyBytes: Uint8Array;\n\n constructor(privateKey: Arrayish) {\n let keyPair: _KeyPair = curve.keyFromPrivate(arrayify(privateKey));\n\n defineReadOnly(this, 'privateKey', hexlify(keyPair.priv.toArray('be', 32)));\n defineReadOnly(this, 'publicKey', '0x' + keyPair.getPublic(false, 'hex'));\n defineReadOnly(this, 'compressedPublicKey', '0x' + keyPair.getPublic(true, 'hex'));\n defineReadOnly(this, 'publicKeyBytes', keyPair.getPublic().encode(null, true));\n }\n\n sign(digest: Arrayish): Signature {\n let keyPair: _KeyPair = curve.keyFromPrivate(arrayify(this.privateKey));\n let signature = keyPair.sign(arrayify(digest), {canonical: true});\n return {\n recoveryParam: signature.recoveryParam,\n r: hexZeroPad('0x' + signature.r.toString(16), 32),\n s: hexZeroPad('0x' + signature.s.toString(16), 32),\n v: 27 + signature.recoveryParam\n }\n\n }\n}\n\nexport function recoverPublicKey(digest: Arrayish, signature: Signature): string {\n let sig = {\n r: arrayify(signature.r),\n s: arrayify(signature.s)\n };\n return '0x' + curve.recoverPubKey(arrayify(digest), sig, signature.recoveryParam).encode('hex', false);\n}\n\nexport function computePublicKey(key: Arrayish, compressed?: boolean): string {\n\n let bytes = arrayify(key);\n\n if (bytes.length === 32) {\n let keyPair: KeyPair = new KeyPair(bytes);\n if (compressed) {\n return keyPair.compressedPublicKey;\n }\n return keyPair.publicKey;\n\n } else if (bytes.length === 33) {\n if (compressed) { return hexlify(bytes); }\n return '0x' + curve.keyFromPublic(bytes).getPublic(false, 'hex');\n\n } else if (bytes.length === 65) {\n if (!compressed) { return hexlify(bytes); }\n return '0x' + curve.keyFromPublic(bytes).getPublic(true, 'hex');\n }\n\n errors.throwError('invalid public or private key', errors.INVALID_ARGUMENT, { arg: 'key', value: '[REDACTED]' });\n return null;\n}\n\nexport function recoverAddress(digest: Arrayish, signature: Signature): string {\n return computeAddress(recoverPublicKey(digest, signature));\n}\n\nexport function computeAddress(key: string): string {\n // Strip off the leading \"0x04\"\n let publicKey = '0x' + computePublicKey(key).slice(4);\n return getAddress('0x' + keccak256(publicKey).substring(26));\n}\n\n","/**\n * Conversion Utilities\n *\n */\n\nimport { BigNumber } from './bignumber';\nimport { Signature } from './secp256k1';\n\nimport errors = require('./errors');\n\n\n\nexport type Arrayish = string | ArrayLike;\n\n\nfunction isBigNumber(value: any): value is BigNumber {\n return !!value._bn;\n}\n\nfunction addSlice(array: Uint8Array): Uint8Array {\n if (array.slice) { return array; }\n\n array.slice = function() {\n var args = Array.prototype.slice.call(arguments);\n return new Uint8Array(Array.prototype.slice.apply(array, args));\n }\n\n return array;\n}\n\nexport function isArrayish(value: any): boolean {\n if (!value || parseInt(value.length) != value.length || typeof(value) === 'string') {\n return false;\n }\n\n for (var i = 0; i < value.length; i++) {\n var v = value[i];\n if (v < 0 || v >= 256 || parseInt(v) != v) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function arrayify(value: Arrayish | BigNumber): Uint8Array {\n if (value == null) {\n errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (isBigNumber(value)) {\n value = value.toHexString();\n }\n\n if (typeof(value) === 'string') {\n let match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n value = value.substring(2);\n if (value.length % 2) { 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\n return addSlice(new Uint8Array(result));\n\n } else if (typeof(value) === 'string') {\n }\n\n if (isArrayish(value)) {\n return addSlice(new Uint8Array(value));\n }\n\n errors.throwError('invalid arrayify value', null, { arg: 'value', value: value, type: typeof(value) });\n return null;\n}\n\nexport function concat(objects: Array): Uint8Array {\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\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\n return addSlice(result);\n}\n\nexport function stripZeros(value: Arrayish): Uint8Array {\n let result: Uint8Array = arrayify(value);\n\n if (result.length === 0) { return result; }\n\n // Find the first non-zero entry\n var start = 0;\n while (result[start] === 0) { start++ }\n\n // If we started with zeros, strip them\n if (start) {\n result = result.slice(start);\n }\n\n return result;\n}\n\nexport function padZeros(value: Arrayish, length: number): Uint8Array {\n value = arrayify(value);\n\n if (length < value.length) { throw new Error('cannot pad'); }\n\n var result = new Uint8Array(length);\n result.set(value, length - value.length);\n return addSlice(result);\n}\n\n\nexport function isHexString(value: any, length?: number): boolean {\n if (typeof(value) !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false\n }\n if (length && value.length !== 2 + 2 * length) { return false; }\n return true;\n}\n\nconst HexCharacters: string = '0123456789abcdef';\n\nexport function hexlify(value: Arrayish | BigNumber | number): string {\n\n if (isBigNumber(value)) {\n return value.toHexString();\n }\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\n var hex = '';\n while (value) {\n hex = HexCharacters[value & 0x0f] + hex;\n value = Math.trunc(value / 16);\n }\n\n if (hex.length) {\n if (hex.length % 2) { hex = '0' + hex; }\n return '0x' + hex;\n }\n\n return '0x00';\n }\n\n if (typeof(value) === 'string') {\n let match = value.match(/^(0x)?[0-9a-fA-F]*$/);\n\n if (!match) {\n errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (match[1] !== '0x') {\n errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n if (value.length % 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n }\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\n errors.throwError('invalid hexlify value', null, { arg: 'value', value: value });\n return 'never';\n}\n\nexport function hexDataLength(data: string) {\n if (!isHexString(data) || (data.length % 2) !== 0) {\n return null;\n }\n return (data.length - 2) / 2;\n}\n\nexport function hexDataSlice(data: string, offset: number, length?: number): string {\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\n if (length != null) {\n return '0x' + data.substring(offset, offset + 2 * length);\n }\n\n return '0x' + data.substring(offset);\n}\n\nexport function hexStripZeros(value: string): string {\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}\n\nexport function hexZeroPad(value: string, length: number): string {\n if (!isHexString(value)) {\n errors.throwError('invalid hex string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n while (value.length < 2 * length + 2) {\n value = '0x0' + value.substring(2);\n }\n return value;\n}\n\nexport function splitSignature(signature: Arrayish): Signature {\n let bytes: Uint8Array = arrayify(signature);\n if (bytes.length !== 65) {\n throw new Error('invalid signature');\n }\n\n var v = bytes[64];\n if (v !== 27 && v !== 28) {\n v = 27 + (v % 2);\n }\n\n return {\n r: hexlify(bytes.slice(0, 32)),\n s: hexlify(bytes.slice(32, 64)),\n recoveryParam: (v - 27),\n v: v\n }\n}\n\nexport function joinSignature(signature: Signature): string {\n return hexlify(concat([\n hexZeroPad(signature.r, 32),\n hexZeroPad(signature.s, 32),\n (signature.recoveryParam ? '0x1c': '0x1b')\n ]));\n}\n","'use strict';\n\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 */\n\nimport _BN from 'bn.js';\n\nimport { Arrayish, hexlify, isArrayish, isHexString } from './bytes';\nimport { defineReadOnly } from './properties';\nimport * as errors from '../utils/errors';\n\nfunction _isBigNumber(value: any): value is BigNumber {\n return isBigNumber(value);\n}\n\nexport type BigNumberish = BigNumber | string | number | Arrayish;\n\nexport class BigNumber {\n private readonly _bn: _BN.BN;\n constructor(value: BigNumberish) {\n errors.checkNew(this, BigNumber);\n\n if (typeof(value) === 'string') {\n if (isHexString(value)) {\n if (value == '0x') { value = '0x0'; }\n defineReadOnly(this, '_bn', new _BN.BN(value.substring(2), 16));\n\n } else if (value[0] === '-' && isHexString(value.substring(1))) {\n defineReadOnly(this, '_bn', (new _BN.BN(value.substring(3), 16)).mul(ConstantNegativeOne._bn));\n\n } else if (value.match(/^-?[0-9]*$/)) {\n if (value == '') { value = '0'; }\n defineReadOnly(this, '_bn', new _BN.BN(value));\n }\n\n } else if (typeof(value) === 'number') {\n if (Math.trunc(value) !== value) {\n errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: Math.trunc(value) });\n }\n try {\n defineReadOnly(this, '_bn', new _BN.BN(value));\n } catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n\n } else if (_BN.BN.isBN(value)) {\n defineReadOnly(this, '_bn', value);\n\n } else if (_isBigNumber(value)) {\n defineReadOnly(this, '_bn', value._bn);\n\n } else if (isArrayish(value)) {\n defineReadOnly(this, '_bn', new _BN.BN(hexlify(value).substring(2), 16));\n\n } else {\n errors.throwError('invalid BigNumber value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n }\n\n fromTwos(value: BigNumberish): BigNumber {\n return new BigNumber(this._bn.fromTwos(value));\n }\n\n toTwos(value: BigNumberish): BigNumber {\n return new BigNumber(this._bn.toTwos(value));\n }\n\n add(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.add(bigNumberify(other)._bn));\n }\n\n sub(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.sub(bigNumberify(other)._bn));\n }\n\n div(other: BigNumberish): BigNumber {\n let o: BigNumber = bigNumberify(other)._bn;\n if (o.isZero()) {\n errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });\n }\n return new BigNumber(this._bn.div(o));\n }\n\n mul(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.mul(bigNumberify(other)._bn));\n }\n\n mod(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.mod(bigNumberify(other)._bn));\n }\n\n pow(other: BigNumberish): BigNumber {\n return new BigNumber(this._bn.pow(bigNumberify(other)._bn));\n }\n\n maskn(value: BigNumberish): BigNumber {\n return new BigNumber(this._bn.maskn(value));\n }\n\n eq(other: BigNumberish): boolean {\n return this._bn.eq(bigNumberify(other)._bn);\n }\n\n lt(other: BigNumberish): boolean {\n return this._bn.lt(bigNumberify(other)._bn);\n }\n\n lte(other: BigNumberish): boolean {\n return this._bn.lte(bigNumberify(other)._bn);\n }\n\n gt(other: BigNumberish): boolean {\n return this._bn.gt(bigNumberify(other)._bn);\n }\n\n gte(other: BigNumberish): boolean {\n return this._bn.gte(bigNumberify(other)._bn);\n }\n\n isZero(): boolean {\n return this._bn.isZero();\n }\n\n toNumber(): number {\n try {\n return this._bn.toNumber();\n } catch (error) {\n errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });\n }\n return null;\n }\n\n toString(): string {\n return this._bn.toString(10);\n }\n\n toHexString(): string {\n var hex = this._bn.toString(16);\n if (hex.length % 2) { hex = '0' + hex; }\n return '0x' + hex;\n }\n}\n\nexport function isBigNumber(value: any): boolean {\n return (value._bn && value._bn.mod);\n}\n\nexport function bigNumberify(value: BigNumberish): BigNumber {\n if (_isBigNumber(value)) { return value; }\n return new BigNumber(value);\n}\n\nexport const ConstantNegativeOne: BigNumber = bigNumberify(-1);\nexport const ConstantZero: BigNumber = bigNumberify(0);\nexport const ConstantOne: BigNumber = bigNumberify(1);\nexport const ConstantTwo: BigNumber = bigNumberify(2);\nexport const ConstantWeiPerEther: BigNumber = bigNumberify(new _BN.BN('1000000000000000000'));\n","//See: https://github.com/ethereum/wiki/wiki/RLP\n\n\nimport { arrayify, Arrayish, hexlify } from './bytes';\n\nfunction arrayifyInteger(value: number): Array {\n var result = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\n\nfunction unarrayifyInteger(data: Uint8Array, offset: number, length: number): number {\n var result = 0;\n for (var i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\n\nfunction _encode(object: Array | string): Array {\n if (Array.isArray(object)) {\n var payload = [];\n object.forEach(function(child) {\n payload = payload.concat(_encode(child));\n });\n\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length)\n return payload;\n }\n\n var length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n\n return length.concat(payload);\n\n } else {\n let data: Array = Array.prototype.slice.call(arrayify(object));\n\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\n var length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n\n return length.concat(data);\n }\n}\n\nexport function encode(object: any): string {\n return hexlify(_encode(object));\n}\n\nfunction _decodeChildren(data, offset, childOffset, length) {\n var result = [];\n\n while (childOffset < offset + 1 + length) {\n var decoded = _decode(data, childOffset);\n\n result.push(decoded.result);\n\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n throw new Error('invalid rlp');\n }\n }\n\n return {consumed: (1 + length), result: result};\n}\n\n// returns { consumed: number, result: Object }\nfunction _decode(data: Uint8Array, offset: number): { consumed: number, result: any } {\n if (data.length === 0) { 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\n var length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n throw new Error('to short');\n }\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\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\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\n var result = 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\n var result = hexlify(data.slice(offset + 1, offset + 1 + length));\n return { consumed: (1 + length), result: result }\n }\n return { consumed: 1, result: hexlify(data[offset]) };\n}\n\nexport function decode(data: Arrayish): any {\n let bytes = 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}\n\n","'use strict';\n\n// We use this for base 36 maths\nimport BN = require('bn.js');\n\nimport { BigNumber } from './bignumber';\nimport { arrayify, Arrayish, stripZeros, hexlify } from './bytes';\nimport { keccak256 } from './keccak256';\nimport { encode } from './rlp';\n\nimport errors = require('./errors');\n\n\nfunction getChecksumAddress(address: string): string {\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\n address = address.toLowerCase();\n\n let chars = address.substring(2).split('');\n\n let hashed = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n hashed[i] = chars[i].charCodeAt(0);\n }\n hashed = arrayify(keccak256(hashed));\n\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\n return '0x' + chars.join('');\n}\n\n// Shims for environments that are missing some required constants and functions\nvar MAX_SAFE_INTEGER: number = 0x1fffffffffffff;\n\nfunction log10(x: number): number {\n if (Math.log10) { return Math.log10(x); }\n return Math.log(x) / Math.LN10;\n}\n\n\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n\n// Create lookup table\nvar ibanLookup = {};\nfor (var i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); }\nfor (var i = 0; i < 26; i++) { 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));\n\nfunction ibanChecksum(address: string): string {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + '00';\n\n var expanded = '';\n address.split('').forEach(function(c) {\n expanded += ibanLookup[c];\n });\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\n var checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) { checksum = '0' + checksum; }\n\n return checksum;\n};\n\nexport function getAddress(address: string): string {\n var result = null;\n\n if (typeof(address) !== 'string') {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n\n // Missing the 0x prefix\n if (address.substring(0, 2) !== '0x') { address = '0x' + address; }\n\n result = getChecksumAddress(address);\n\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\n // Maybe ICAP? (we only support direct mode)\n } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n\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\n result = (new BN(address.substring(4), 36)).toString(16);\n while (result.length < 40) { result = '0' + result; }\n result = getChecksumAddress('0x' + result);\n\n } else {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, { arg: 'address', value: address });\n }\n\n return result;\n}\n\nexport function getIcapAddress(address: string): string {\n var base36 = (new BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();\n while (base36.length < 30) { base36 = '0' + base36; }\n return 'XE' + ibanChecksum('XE00' + base36) + base36;\n}\n\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\nexport function getContractAddress(transaction: { from: string, nonce: Arrayish | BigNumber | number }) {\n if (!transaction.from) { throw new Error('missing from address'); }\n var nonce = transaction.nonce;\n\n return getAddress('0x' + keccak256(encode([\n getAddress(transaction.from),\n stripZeros(hexlify(nonce))\n ])).substring(26));\n}\n\n","'use strict';\n\nimport { arrayify, Arrayish } from './bytes';\n\nexport enum UnicodeNormalizationForm {\n current = '',\n NFC = 'NFC',\n NFD = 'NFD',\n NFKC = 'NFKC',\n NFKD = 'NFKD'\n};\n\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\nexport function toUtf8Bytes(str: string, form: UnicodeNormalizationForm = UnicodeNormalizationForm.current): Uint8Array {\n\n if (form != UnicodeNormalizationForm.current) {\n str = str.normalize(form);\n }\n\n var result = [];\n var offset = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 128) {\n result[offset++] = c;\n } else if (c < 2048) {\n result[offset++] = (c >> 6) | 192;\n result[offset++] = (c & 63) | 128;\n } else if (((c & 0xFC00) == 0xD800) && (i + 1) < str.length && ((str.charCodeAt(i + 1) & 0xFC00) == 0xDC00)) {\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF);\n result[offset++] = (c >> 18) | 240;\n result[offset++] = ((c >> 12) & 63) | 128;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n } else {\n result[offset++] = (c >> 12) | 224;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n }\n }\n\n return arrayify(result);\n};\n\n\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nexport function toUtf8String(bytes: Arrayish): string {\n bytes = arrayify(bytes);\n\n var result = '';\n var i = 0;\n\n // Invalid bytes are ignored\n while(i < bytes.length) {\n var c = bytes[i++];\n if (c >> 7 == 0) {\n // 0xxx xxxx\n result += String.fromCharCode(c);\n continue;\n }\n\n // Invalid starting byte\n if (c >> 6 == 0x02) { continue; }\n\n // Multibyte; how many bytes left for thus character?\n var extraLength = null;\n if (c >> 5 == 0x06) {\n extraLength = 1;\n } else if (c >> 4 == 0x0e) {\n extraLength = 2;\n } else if (c >> 3 == 0x1e) {\n extraLength = 3;\n } else if (c >> 2 == 0x3e) {\n extraLength = 4;\n } else if (c >> 1 == 0x7e) {\n extraLength = 5;\n } else {\n continue;\n }\n\n // Do we have enough bytes in our data?\n if (i + extraLength > bytes.length) {\n\n // If there is an invalid unprocessed byte, try to continue\n for (; i < bytes.length; i++) {\n if (bytes[i] >> 6 != 0x02) { break; }\n }\n if (i != bytes.length) continue;\n\n // All leftover bytes are valid.\n return result;\n }\n\n // Remove the UTF-8 prefix from the char (res)\n var res = c & ((1 << (8 - extraLength - 1)) - 1);\n\n var count;\n for (count = 0; count < extraLength; count++) {\n var nextChar = bytes[i++];\n\n // Is the char valid multibyte part?\n if (nextChar >> 6 != 0x02) {break;};\n res = (res << 6) | (nextChar & 0x3f);\n }\n\n if (count != extraLength) {\n i--;\n continue;\n }\n\n if (res <= 0xffff) {\n result += String.fromCharCode(res);\n continue;\n }\n\n res -= 0x10000;\n result += String.fromCharCode(((res >> 10) & 0x3ff) + 0xd800, (res & 0x3ff) + 0xdc00);\n }\n\n return result;\n}\n\n","'use strict';\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\nimport { getAddress } from './address';\nimport { bigNumberify, BigNumberish } from './bignumber';\nimport { arrayify, Arrayish, concat, hexlify, padZeros } from './bytes';\nimport { toUtf8Bytes, toUtf8String } from './utf8';\nimport { defineReadOnly, jsonCopy } from './properties';\n\nimport * as errors from './errors';\n\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\nconst paramTypeArray = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\n\n// @TODO: Add enum for param types\nexport type CoerceFunc = (type: string, value: any) => any;\nexport type ParamType = { name?: string, type: string, indexed?: boolean, components?: Array };\n\nexport const defaultCoerceFunc: CoerceFunc = function(type: string, value: any): any {\n var match = type.match(paramTypeNumber)\n if (match && parseInt(match[2]) <= 48) { return value.toNumber(); }\n return value;\n}\n\n\n///////////////////////////////////\n// Parsing for Solidity Signatures\n\nconst regexParen = new RegExp(\"^([^)(]*)\\\\((.*)\\\\)([^)(]*)$\");\nconst regexIdentifier = new RegExp(\"^[A-Za-z_][A-Za-z0-9_]*$\");\n\nfunction verifyType(type: string): string {\n\n // These need to be transformed to their full description\n if (type.match(/^uint($|[^1-9])/)) {\n type = 'uint256' + type.substring(4);\n } else if (type.match(/^int($|[^1-9])/)) {\n type = 'int256' + type.substring(3);\n }\n\n return type;\n}\n\ntype ParseState = {\n allowArray?: boolean,\n allowName?: boolean,\n allowParams?: boolean,\n allowType?: boolean,\n readArray?: boolean,\n};\n\ntype ParseNode = {\n parent?: any,\n type?: string,\n name?: string,\n state?: ParseState,\n indexed?: boolean,\n components?: Array\n};\n\n\nfunction parseParam(param: string, allowIndexed?: boolean): ParamType {\n function throwError(i) {\n throw new Error('unexpected character \"' + param[i] + '\" at position ' + i + ' in \"' + param + '\"');\n }\n\n var parent: ParseNode = { type: '', name: '', state: { allowType: true } };\n var node = parent;\n\n for (var i = 0; i < param.length; i++) {\n var c = param[i];\n switch (c) {\n case '(':\n if (!node.state.allowParams) { throwError(i); }\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\n case ')':\n delete node.state;\n node.type = verifyType(node.type);\n\n var child = node;\n node = node.parent;\n if (!node) { throwError(i); }\n delete child.parent;\n node.state.allowParams = false;\n node.state.allowName = true;\n node.state.allowArray = true;\n break;\n\n case ',':\n delete node.state;\n node.type = verifyType(node.type);\n\n var sibling: ParseNode = { type: '', name: '', parent: node.parent, state: { allowType: true } };\n node.parent.components.push(sibling);\n delete node.parent;\n node = sibling;\n break;\n\n // Hit a space...\n case ' ':\n\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\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 } else {\n node.state.allowName = false;\n }\n }\n }\n\n break;\n\n case '[':\n if (!node.state.allowArray) { throwError(i); }\n\n node.type += c;\n\n node.state.allowArray = false;\n node.state.allowName = false;\n node.state.readArray = true;\n break;\n\n case ']':\n if (!node.state.readArray) { throwError(i); }\n\n node.type += c;\n\n node.state.readArray = false;\n node.state.allowArray = true;\n node.state.allowName = true;\n break;\n\n default:\n if (node.state.allowType) {\n node.type += c;\n node.state.allowParams = true;\n node.state.allowArray = true;\n } else if (node.state.allowName) {\n node.name += c;\n delete node.state.allowArray;\n } else if (node.state.readArray) {\n node.type += c;\n } else {\n throwError(i);\n }\n }\n }\n\n if (node.parent) { throw new Error(\"unexpected eof\"); }\n\n delete parent.state;\n parent.type = verifyType(parent.type);\n\n return (parent);\n}\n\n// @TODO: should this just be a combined Fragment?\n\nexport type EventFragment = {\n type: string\n name: string,\n\n anonymous: boolean,\n\n inputs: Array,\n};\n\nexport type FunctionFragment = {\n type: string\n name: string,\n\n constant: boolean,\n\n inputs: Array,\n outputs: Array,\n\n payable: boolean,\n stateMutability: string,\n};\n\n// @TODO: Better return type\nfunction parseSignatureEvent(fragment: string): EventFragment {\n\n var abi = {\n anonymous: false,\n inputs: [],\n name: '',\n type: 'event'\n }\n\n var match = fragment.match(regexParen);\n if (!match) { throw new Error('invalid event: ' + fragment); }\n\n abi.name = match[1].trim();\n\n splitNesting(match[2]).forEach(function(param) {\n param = parseParam(param, true);\n param.indexed = !!param.indexed;\n abi.inputs.push(param);\n });\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 console.log('unknown modifier: ' + modifier);\n }\n });\n\n if (abi.name && !abi.name.match(regexIdentifier)) {\n throw new Error('invalid identifier: \"' + abi.name + '\"');\n }\n\n return abi;\n}\n\nfunction parseSignatureFunction(fragment: string): FunctionFragment {\n var abi = {\n constant: false,\n inputs: [],\n name: '',\n outputs: [],\n payable: false,\n stateMutability: null,\n type: 'function'\n };\n\n var comps = fragment.split(' returns ');\n var left = comps[0].match(regexParen);\n if (!left) { 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\n splitNesting(left[2]).forEach(function(param) {\n abi.inputs.push(parseParam(param));\n });\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 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 '':\n break;\n default:\n console.log('unknown modifier: ' + modifier);\n }\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\n splitNesting(right[2]).forEach(function(param) {\n abi.outputs.push(parseParam(param));\n });\n }\n\n return abi;\n}\n\nexport function parseParamType(type: string): ParamType {\n return parseParam(type, true);\n}\n\nexport function parseSignature(fragment: string): EventFragment | FunctionFragment {\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(/\\(/g, ' (').replace(/\\)/g, ') ').replace(/\\s+/g, ' ');\n fragment = fragment.trim();\n\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\n throw new Error('unknown signature');\n}\n\n\n///////////////////////////////////\n// Coders\n\ntype DecodedResult = { consumed: number, value: any };\nabstract class Coder {\n readonly coerceFunc: CoerceFunc;\n readonly name: string;\n readonly type: string;\n readonly localName: string;\n readonly dynamic: boolean;\n constructor(coerceFunc: CoerceFunc, name: string, type: string, localName: string, dynamic: boolean) {\n this.coerceFunc = coerceFunc;\n this.name = name;\n this.type = type;\n this.localName = localName;\n this.dynamic = dynamic;\n }\n\n abstract encode(value: any): Uint8Array;\n abstract decode(data: Uint8Array, offset: number): DecodedResult;\n}\n\nclass CoderNull extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'null', '', localName, false);\n }\n\n encode(value: any): Uint8Array {\n return arrayify([]);\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n if (offset > data.length) { throw new Error('invalid null'); }\n return {\n consumed: 0,\n value: this.coerceFunc('null', undefined)\n }\n }\n}\n\nclass CoderNumber extends Coder {\n readonly size: number;\n readonly signed: boolean;\n constructor(coerceFunc, size, signed, localName) {\n const name = ((signed ? 'int': 'uint') + (size * 8));\n super(coerceFunc, name, name, localName, false);\n\n this.size = size;\n this.signed = signed;\n }\n\n encode(value: BigNumberish): Uint8Array {\n try {\n let v = bigNumberify(value);\n v = v.toTwos(this.size * 8).maskn(this.size * 8);\n //value = value.toTwos(size * 8).maskn(size * 8);\n if (this.signed) {\n v = v.fromTwos(this.size * 8).toTwos(256);\n }\n return padZeros(arrayify(v), 32);\n\n } catch (error) {\n errors.throwError('invalid number value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: value\n });\n }\n return null;\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n var junkLength = 32 - this.size;\n var value = bigNumberify(data.slice(offset + junkLength, offset + 32));\n if (this.signed) {\n value = value.fromTwos(this.size * 8);\n } else {\n value = value.maskn(this.size * 8);\n }\n\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, value),\n }\n }\n}\nvar uint256Coder = new CoderNumber(function(type, value) { return value; }, 32, false, 'none');\n\nclass CoderBoolean extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'bool', 'bool', localName, false);\n }\n\n encode(value: boolean): Uint8Array {\n return uint256Coder.encode(!!value ? 1: 0);\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n try {\n var result = uint256Coder.decode(data, offset);\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}\n\nclass CoderFixedBytes extends Coder {\n readonly length: number;\n constructor(coerceFunc, length, localName) {\n const name = ('bytes' + length);\n super(coerceFunc, name, name, localName, false);\n this.length = length;\n }\n\n encode(value: Arrayish): Uint8Array {\n var result = new Uint8Array(32);\n\n try {\n let data = arrayify(value);\n if (data.length > 32) { throw new Error(); }\n result.set(data);\n } catch (error) {\n errors.throwError('invalid ' + this.name + ' value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: (error.value || value)\n });\n }\n\n return result;\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n\n return {\n consumed: 32,\n value: this.coerceFunc(this.name, hexlify(data.slice(offset, offset + this.length)))\n }\n }\n}\n\nclass CoderAddress extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'address', 'address', localName, false);\n }\n encode(value: string): Uint8Array {\n let result = new Uint8Array(32);\n try {\n result.set(arrayify(getAddress(value)), 12);\n } catch (error) {\n errors.throwError('invalid address', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: value\n });\n }\n return result;\n }\n decode(data: Uint8Array, offset: number): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n return {\n consumed: 32,\n value: this.coerceFunc('address', getAddress(hexlify(data.slice(offset + 12, offset + 32))))\n }\n }\n}\n\nfunction _encodeDynamicBytes(value: Uint8Array): Uint8Array {\n var dataLength = Math.trunc(32 * Math.ceil(value.length / 32));\n var padding = new Uint8Array(dataLength - value.length);\n\n return concat([\n uint256Coder.encode(value.length),\n value,\n padding\n ]);\n}\n\nfunction _decodeDynamicBytes(data: Uint8Array, offset: number, localName: string): DecodedResult {\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: hexlify(data.slice(offset, offset + 32))\n });\n }\n\n var length = uint256Coder.decode(data, offset).value;\n try {\n length = length.toNumber();\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\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: hexlify(data.slice(offset, offset + 32 + length))\n });\n }\n\n return {\n consumed: Math.trunc(32 + 32 * Math.ceil(length / 32)),\n value: data.slice(offset + 32, offset + 32 + length),\n }\n}\n\nclass CoderDynamicBytes extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'bytes', 'bytes', localName, true);\n }\n encode(value: Arrayish): Uint8Array {\n try {\n return _encodeDynamicBytes(arrayify(value));\n } catch (error) {\n errors.throwError('invalid bytes value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: error.value\n });\n }\n return null;\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('bytes', hexlify(result.value));\n return result;\n }\n}\n\nclass CoderString extends Coder {\n constructor(coerceFunc, localName) {\n super(coerceFunc, 'string', 'string', localName, true);\n }\n\n encode(value: string): Uint8Array {\n if (typeof(value) !== 'string') {\n errors.throwError('invalid string value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof(value),\n value: value\n });\n }\n return _encodeDynamicBytes(toUtf8Bytes(value));\n }\n\n decode(data: Uint8Array, offset: number): DecodedResult {\n var result = _decodeDynamicBytes(data, offset, this.localName);\n result.value = this.coerceFunc('string', toUtf8String(result.value));\n return result;\n }\n}\n\nfunction alignSize(size: number): number {\n return Math.trunc(32 * Math.ceil(size / 32));\n}\n\nfunction pack(coders: Array, values: Array): Uint8Array {\n\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 type: typeof(values),\n value: values\n });\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\n var parts = [];\n\n coders.forEach(function(coder, index) {\n parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });\n });\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 } else {\n staticSize += alignSize(part.value.length);\n }\n });\n\n var offset = 0, dynamicOffset = staticSize;\n var data = new Uint8Array(staticSize + dynamicSize);\n\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\n //part.value.copy(data, dynamicOffset); @TODO\n data.set(part.value, dynamicOffset);\n dynamicOffset += alignSize(part.value.length);\n } else {\n //part.value.copy(data, offset); @TODO\n data.set(part.value, offset);\n offset += alignSize(part.value.length);\n }\n });\n\n return data;\n}\n\nfunction unpack(coders: Array, data: Uint8Array, offset: number): DecodedResult {\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 } else {\n var result = coder.decode(data, offset);\n }\n\n if (result.value != undefined) {\n value.push(result.value);\n }\n\n offset += result.consumed;\n consumed += result.consumed;\n });\n\n coders.forEach(function(coder: Coder, index: number) {\n let name: string = coder.localName;\n if (!name) { return; }\n\n if (name === 'length') { name = '_length'; }\n\n if (value[name] != null) { return; }\n\n value[name] = value[index];\n });\n\n return {\n value: value,\n consumed: consumed\n }\n}\n\nclass CoderArray extends Coder {\n readonly coder: Coder;\n readonly length: number;\n constructor(coerceFunc, coder, length, localName) {\n const type = (coder.type + '[' + (length >= 0 ? length: '') + ']');\n const dynamic = (length === -1 || coder.dynamic);\n super(coerceFunc, 'array', type, localName, dynamic);\n\n this.coder = coder;\n this.length = length;\n }\n\n encode(value: Array): Uint8Array {\n if (!Array.isArray(value)) {\n errors.throwError('expected array value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n type: typeof(value),\n value: value\n });\n }\n\n var count = this.length;\n\n var result = new Uint8Array(0);\n if (count === -1) {\n count = value.length;\n result = uint256Coder.encode(count);\n }\n\n if (count !== value.length) {\n errors.throwError('array value length mismatch', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n count: value.length,\n expectedCount: count,\n value: value\n });\n }\n\n var coders = [];\n for (var i = 0; i < value.length; i++) { coders.push(this.coder); }\n\n return concat([result, pack(coders, value)]);\n }\n\n decode(data, offset) {\n // @TODO:\n //if (data.length < offset + length * 32) { throw new Error('invalid array'); }\n\n var consumed = 0;\n\n var count = this.length;\n\n if (count === -1) {\n try {\n var decodedLength = uint256Coder.decode(data, offset);\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 } 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\n var coders = [];\n for (var i = 0; i < count; i++) { coders.push(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}\n\nclass CoderTuple extends Coder {\n readonly coders: Array;\n constructor(coerceFunc, coders, localName) {\n var dynamic = false;\n var types = [];\n coders.forEach(function(coder) {\n if (coder.dynamic) { dynamic = true; }\n types.push(coder.type);\n });\n var type = ('tuple(' + types.join(',') + ')');\n\n super(coerceFunc, 'tuple', type, localName, dynamic);\n this.coders = coders;\n }\n encode(value: Array): Uint8Array {\n return pack(this.coders, value);\n }\n decode(data: Uint8Array, offset: number): DecodedResult {\n var result = unpack(this.coders, data, offset);\n result.value = this.coerceFunc(this.type, result.value);\n return result;\n }\n}\n/*\nfunction getTypes(coders) {\n var type = coderTuple(coders).type;\n return type.substring(6, type.length - 1);\n}\n*/\nfunction splitNesting(value: string): Array {\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 } else {\n accum += c;\n if (c === '(') {\n depth++;\n } else if (c === ')') {\n depth--;\n if (depth === -1) {\n throw new Error('unbalanced parenthsis');\n }\n }\n }\n }\n result.push(accum);\n\n return result;\n}\n\nconst paramTypeSimple = {\n address: CoderAddress,\n bool: CoderBoolean,\n string: CoderString,\n bytes: CoderDynamicBytes,\n};\n\nfunction getTupleParamCoder(coerceFunc: CoerceFunc, components: Array, localName: string): CoderTuple {\n if (!components) { components = []; }\n var coders = [];\n components.forEach(function(component) {\n coders.push(getParamCoder(coerceFunc, component));\n });\n\n return new CoderTuple(coerceFunc, coders, localName);\n}\n\nfunction getParamCoder(coerceFunc: CoerceFunc, param: ParamType): Coder {\n var coder = paramTypeSimple[param.type];\n if (coder) { return new coder(coerceFunc, param.name); }\n var match = param.type.match(paramTypeNumber);\n if (match) {\n let 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\n var match = param.type.match(paramTypeBytes);\n if (match) {\n let 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\n var match = param.type.match(paramTypeArray);\n if (match) {\n let size = parseInt(match[2] || \"-1\");\n param.type = match[1];\n return new CoderArray(coerceFunc, getParamCoder(coerceFunc, param), size, param.name);\n }\n\n if (param.type.substring(0, 5) === 'tuple') {\n return getTupleParamCoder(coerceFunc, param.components, param.name);\n }\n\n if (param.type === '') {\n return new CoderNull(coerceFunc, param.name);\n }\n\n errors.throwError('invalid type', errors.INVALID_ARGUMENT, {\n arg: 'type',\n value: param.type\n });\n\n return null;\n}\n\n\nexport class AbiCoder {\n readonly coerceFunc: CoerceFunc;\n constructor(coerceFunc?: CoerceFunc) {\n errors.checkNew(this, AbiCoder);\n\n if (!coerceFunc) { coerceFunc = defaultCoerceFunc; }\n defineReadOnly(this, 'coerceFunc', coerceFunc);\n }\n\n encode(types: Array, values: Array): string {\n\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\n var coders: Array = [];\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\n let typeObject: ParamType = null;\n if (typeof(type) === 'string') {\n typeObject = parseParam(type);\n } else {\n typeObject = jsonCopy(type);\n }\n\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n\n }, this);\n\n return hexlify(new CoderTuple(this.coerceFunc, coders, '_').encode(values));\n }\n\n decode(types: Array, data: Arrayish): any {\n\n var coders = [];\n types.forEach(function(type) {\n\n // See encode for details\n let typeObject: ParamType = null;\n if (typeof(type) === 'string') {\n typeObject = parseParam(type);\n } else {\n typeObject = jsonCopy(type);\n }\n\n coders.push(getParamCoder(this.coerceFunc, typeObject));\n }, this);\n\n return new CoderTuple(this.coerceFunc, coders, '_').decode(arrayify(data), 0).value;\n }\n}\n\nexport const defaultAbiCoder: AbiCoder = new AbiCoder();\n","'use strict';\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\nimport { defaultAbiCoder, ParamType, parseSignature } from '../utils/abi-coder';\nimport { BigNumber, bigNumberify, BigNumberish } from '../utils/bignumber';\nimport { arrayify, concat, isHexString } from '../utils/bytes';\nimport { keccak256 } from '../utils/keccak256';\nimport { toUtf8Bytes } from '../utils/utf8';\nimport { defineReadOnly, defineFrozen } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nfunction parseParams(params: Array): { names: Array, types: Array } {\n var names = [];\n var types = [];\n\n params.forEach(function(param) {\n if (param.components != null) {\n if (param.type.substring(0, 5) !== 'tuple') {\n throw new Error('internal error; report on GitHub');\n }\n var suffix = '';\n var arrayBracket = param.type.indexOf('[');\n if (arrayBracket >= 0) { suffix = param.type.substring(arrayBracket); }\n\n var result = parseParams(param.components);\n names.push({ name: (param.name || null), names: result.names });\n types.push('tuple(' + result.types.join(',') + ')' + suffix)\n } else {\n names.push(param.name || null);\n types.push(param.type);\n }\n });\n\n return {\n names: names,\n types: types\n }\n}\n\nexport class Description {\n readonly type: string;\n constructor(info: any) {\n for (var key in info) {\n let value = info[key];\n if (value != null && typeof(value) === 'object') {\n defineFrozen(this, key, info[key]);\n } else {\n defineReadOnly(this, key, info[key]);\n }\n }\n }\n}\n\n// @TOOD: Make this a description\nexport class Indexed extends Description {\n readonly hash: string;\n}\n\nexport class DeployDescription extends Description {\n readonly inputs: Array;\n readonly payable: boolean;\n\n encode(bytecode: string, params: Array): string {\n if (!isHexString(bytecode)) {\n errors.throwError('invalid contract bytecode', errors.INVALID_ARGUMENT, {\n arg: 'bytecode',\n type: typeof(bytecode),\n value: bytecode\n });\n }\n\n if (params.length < this.inputs.length) {\n errors.throwError('missing constructor argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length\n });\n\n } else if (params.length > this.inputs.length) {\n errors.throwError('too many constructor arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n\n try {\n return (bytecode + defaultAbiCoder.encode(this.inputs, params).substring(2));\n } catch (error) {\n errors.throwError('invalid constructor argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n\n return null;\n }\n}\n\nexport class FunctionDescription extends Description {\n readonly name: string;\n readonly signature: string;\n readonly sighash: string;\n\n readonly inputs: Array;\n readonly outputs: Array;\n readonly payable: boolean;\n\n encode(params: Array): string {\n if (params.length < this.inputs.length) {\n errors.throwError('missing input argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length,\n name: this.name\n });\n } else if (params.length > this.inputs.length) {\n errors.throwError('too many input arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n\n try {\n return this.sighash + defaultAbiCoder.encode(this.inputs, params).substring(2);\n } catch (error) {\n errors.throwError('invalid input argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n\n return null;\n }\n\n decode(data: string): any {\n try {\n return defaultAbiCoder.decode(this.outputs, arrayify(data));\n } catch(error) {\n errors.throwError('invalid data for function output', errors.INVALID_ARGUMENT, {\n arg: 'data',\n errorArg: error.arg,\n errorValue: error.value,\n value: data,\n reason: error.reason\n });\n }\n }\n}\n\nclass Result extends Description {\n [key: string]: any;\n [key: number]: any;\n}\n\nexport class EventDescription extends Description {\n readonly name: string;\n readonly signature: string;\n\n readonly inputs: Array;\n readonly anonymous: boolean;\n readonly topic: string;\n\n decode(data: string, topics?: Array): any {\n // Strip the signature off of non-anonymous topics\n if (topics != null && !this.anonymous) { topics = topics.slice(1); }\n\n let inputIndexed = [], inputNonIndexed = [];\n let inputDynamic = [];\n this.inputs.forEach(function(param, index) {\n\n if (param.indexed) {\n if (param.type === 'string' || param.type === 'bytes' || param.type.indexOf('[') >= 0 || param.type.substring(0, 5) === 'tuple') {\n inputIndexed.push({ type: 'bytes32', name: (param.name || '')});\n inputDynamic.push(true);\n } else {\n inputIndexed.push(param);\n inputDynamic.push(false);\n }\n } else {\n inputNonIndexed.push(param);\n inputDynamic.push(false);\n }\n });\n\n if (topics != null) {\n var resultIndexed = defaultAbiCoder.decode(\n inputIndexed,\n concat(topics)\n );\n }\n\n var resultNonIndexed = defaultAbiCoder.decode(\n inputNonIndexed,\n arrayify(data)\n );\n\n var result = new Result({});\n var nonIndexedIndex = 0, indexedIndex = 0;\n this.inputs.forEach(function(input, index) {\n if (input.indexed) {\n if (topics == null) {\n result[index] = new Indexed({ type: 'indexed', hash: null });\n\n } else if (inputDynamic[index]) {\n result[index] = new Indexed({ type: 'indexed', hash: resultIndexed[indexedIndex++] });\n } else {\n result[index] = resultIndexed[indexedIndex++];\n }\n } else {\n result[index] = resultNonIndexed[nonIndexedIndex++];\n }\n if (input.name) { result[input.name] = result[index]; }\n });\n\n result.length = this.inputs.length;\n\n return result;\n }\n}\n\nclass TransactionDescription extends Description {\n readonly name: string;\n readonly args: Array;\n readonly signature: string;\n readonly sighash: string;\n readonly decode: (data: string) => any;\n readonly value: BigNumber;\n}\n\nclass LogDescription extends Description {\n readonly name: string;\n readonly signature: string;\n readonly topic: string;\n readonly values: Array\n}\n\n\nfunction addMethod(method: any): void {\n switch (method.type) {\n case 'constructor': {\n let description = new DeployDescription({\n inputs: method.inputs,\n payable: (method.payable == null || !!method.payable),\n type: 'deploy'\n });\n\n if (!this.deployFunction) { this.deployFunction = description; }\n\n break;\n }\n\n case 'function': {\n // @TODO: See event\n let signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n\n let sighash = keccak256(toUtf8Bytes(signature)).substring(0, 10);\n\n let description = new FunctionDescription({\n inputs: method.inputs,\n outputs: method.outputs,\n\n payable: (method.payable == null || !!method.payable),\n type: ((method.constant) ? 'call': 'transaction'),\n\n signature: signature,\n sighash: sighash,\n });\n\n // Expose the first (and hopefully unique named function\n if (method.name && this.functions[method.name] == null) {\n defineReadOnly(this.functions, method.name, description);\n }\n\n // Expose all methods by their signature, for overloaded functions\n if (this.functions[description.signature] == null) {\n defineReadOnly(this.functions, description.signature, description);\n }\n\n break;\n }\n\n case 'event': {\n // @TODO: method.params instead? As well? Different fomrat?\n //let inputParams = parseParams(method.inputs);\n\n // @TODO: Don't use parseParams (create new function in ABI, formatSignature)\n let signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n\n let description = new EventDescription({\n name: method.name,\n signature: signature,\n\n inputs: method.inputs,\n topic: keccak256(toUtf8Bytes(signature)),\n anonymous: (!!method.anonymous),\n\n type: 'event'\n });\n\n // Expose the first (and hopefully unique) event name\n if (method.name && this.events[method.name] == null) {\n defineReadOnly(this.events, method.name, description);\n }\n\n // Expose all events by their signature, for overloaded functions\n if (this.events[description.signature] == null) {\n defineReadOnly(this.events, description.signature, description);\n }\n\n break;\n }\n\n\n case 'fallback':\n // Nothing to do for fallback\n break;\n\n default:\n console.log('WARNING: unsupported ABI type - ' + method.type);\n break;\n }\n}\n\nexport class Interface {\n readonly abi: Array;\n readonly functions: Array;\n readonly events: Array;\n readonly deployFunction: DeployDescription;\n\n constructor(abi: Array | string) {\n errors.checkNew(this, Interface);\n\n if (typeof(abi) === 'string') {\n try {\n abi = JSON.parse(abi);\n } catch (error) {\n errors.throwError('could not parse ABI JSON', errors.INVALID_ARGUMENT, {\n arg: 'abi',\n errorMessage: error.message,\n value: abi\n });\n }\n\n if (!Array.isArray(abi)) {\n errors.throwError('invalid abi', errors.INVALID_ARGUMENT, { arg: 'abi', value: abi });\n return null;\n }\n }\n\n defineReadOnly(this, 'functions', { });\n defineReadOnly(this, 'events', { });\n\n // Convert any supported ABI format into a standard ABI format\n let _abi = [];\n abi.forEach((fragment) => {\n if (typeof(fragment) === 'string') {\n fragment = parseSignature(fragment);\n }\n _abi.push(fragment);\n });\n\n defineFrozen(this, 'abi', _abi);\n\n _abi.forEach(addMethod, this);\n\n // If there wasn't a constructor, create the default constructor\n if (!this.deployFunction) {\n addMethod.call(this, {type: 'constructor', inputs: []});\n }\n }\n\n parseTransaction(tx: { data: string, value?: BigNumberish }): TransactionDescription {\n var sighash = tx.data.substring(0, 10).toLowerCase();\n for (var name in this.functions) {\n if (name.indexOf('(') === -1) { continue; }\n var func = this.functions[name];\n if (func.sighash === sighash) {\n var result = defaultAbiCoder.decode(func.inputs, '0x' + tx.data.substring(10));\n return new TransactionDescription({\n args: result,\n decode: func.decode,\n name: name,\n signature: func.signature,\n sighash: func.sighash,\n type: 'transaction',\n value: bigNumberify(tx.value || 0),\n });\n }\n }\n\n return null;\n }\n\n parseLog(log: { topics: Array, data: string}): LogDescription {\n for (var name in this.events) {\n if (name.indexOf('(') === -1) { continue; }\n var event = this.events[name];\n if (event.anonymous) { continue; }\n if (event.topic !== log.topics[0]) { continue; }\n\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse and return it?\n\n return new LogDescription({\n name: event.name,\n signature: event.signature,\n topic: event.topic,\n type: 'log',\n values: event.decode(log.data, log.topics)\n });\n }\n\n return null;\n }\n}\n","\n// This gets overriddenby gulp during bip39-XX\nvar exportWordlist = false;\n\nimport { defineReadOnly } from '../utils/properties';\n\nexport abstract class Wordlist {\n locale: string;\n\n constructor(locale: string) {\n defineReadOnly(this, 'locale', locale);\n }\n\n abstract getWord(index: number): string;\n abstract getWordIndex(word: string): number;\n\n // Subclasses may override this\n split(mnemonic: string): Array {\n return mnemonic.toLowerCase().split(/ +/g)\n }\n\n // Subclasses may override this\n join(words: Array): string {\n return words.join(' ');\n }\n}\n\nexport function register(lang) {\n if (exportWordlist) {\n if (!global['wordlists']) { defineReadOnly(global, 'wordlists', { }); }\n defineReadOnly(global['wordlists'], lang.locale, lang);\n }\n}\n","'use strict';\n\nimport { register, Wordlist } from './wordlist';\n\nimport * as errors from '../utils/errors';\n\n\nconst words = \"AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo\";\n\nlet wordlist: Array = null;\n\n\nfunction loadWords(): void {\n if (wordlist != null) { return; }\n wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' ');\n}\n\nclass LangEn extends Wordlist {\n constructor() {\n super('en');\n }\n\n getWord(index: number): string {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n }\n\n getWordIndex(word: string): number {\n loadWords();\n return wordlist.indexOf(word);\n }\n}\n\nconst langEn = new LangEn();\nregister(langEn);\n\nexport { langEn };\n","'use strict';\n\nimport { pbkdf2Sync as _pbkdf2 } from 'crypto';\n\nimport { arrayify, Arrayish } from './bytes';\n\nfunction bufferify(value: Arrayish): Buffer {\n return new Buffer(arrayify(value));\n}\n\nexport function pbkdf2(password: Arrayish, salt: Arrayish, iterations: number, keylen: number, hashAlgorithm: string): Uint8Array {\n return arrayify(_pbkdf2(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm));\n}\n","'use strict';\n\nimport { createHmac } from 'crypto';\n\nimport { arrayify, Arrayish } from './bytes';\n\nimport * as errors from './errors';\n\nconst supportedAlgorithms = { sha256: true, sha512: true };\nexport function computeHmac(algorithm: string, key: Arrayish, data: Arrayish): Uint8Array {\n if (!supportedAlgorithms[algorithm]) {\n errors.throwError('unsupported algorithm ' + algorithm, errors.UNSUPPORTED_OPERATION, { operation: 'hmac', algorithm: algorithm });\n }\n //return arrayify(_hmac(_hash[algorithm], arrayify(key)).update(arrayify(data)).digest());\n return arrayify(createHmac(algorithm, new Buffer(arrayify(key))).update(new Buffer(arrayify(data))).digest());\n}\n\n","'use strict';\n\nimport * as _hash from 'hash.js';\n\nimport { arrayify, Arrayish } from './bytes';\n\n\ninterface HashFunc {\n (): HashFunc;\n update(chunk: Uint8Array): HashFunc;\n digest(encoding?: string): string;\n}\n\nconst _sha256: HashFunc = _hash['sha256'];\nconst _sha512: HashFunc = _hash['sha512'];\n\n\nexport function sha256(data: Arrayish): string {\n return '0x' + (_sha256().update(arrayify(data)).digest('hex'));\n}\n\nexport function sha512(data: Arrayish): string {\n return '0x' + (_sha512().update(arrayify(data)).digest('hex'));\n}\n","'use strict';\n\n// See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki\n// See: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\n\n// The English language word list.\n// For additional word lists, please see /src.tc/wordlists/\nimport { langEn } from '../wordlists/lang-en';\n\nimport { Wordlist } from '../wordlists/wordlist';\n\nimport { arrayify, Arrayish, hexlify } from '../utils/bytes';\nimport { bigNumberify } from '../utils/bignumber';\nimport { toUtf8Bytes, UnicodeNormalizationForm } from '../utils/utf8';\nimport { pbkdf2 } from '../utils/pbkdf2';\nimport { computeHmac } from '../utils/hmac';\nimport { defineReadOnly } from '../utils/properties';\nimport { KeyPair, N } from '../utils/secp256k1';\nimport { sha256 } from '../utils/sha2';\n\nimport * as errors from '../utils/errors';\n\n// \"Bitcoin seed\"\nvar MasterSecret = toUtf8Bytes('Bitcoin seed');\n\nvar HardenedBit = 0x80000000;\n\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits: number): number {\n return ((1 << bits) - 1) << (8 - bits);\n}\n\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits: number): number {\n return (1 << bits) - 1;\n}\n\nexport const defaultPath = \"m/44'/60'/0'/0/0\";\n\nexport class HDNode {\n private readonly keyPair: KeyPair;\n\n readonly privateKey: string;\n readonly publicKey: string;\n\n readonly mnemonic: string;\n readonly path: string;\n\n readonly chainCode: string;\n\n readonly index: number;\n readonly depth: number;\n\n /**\n * This constructor should not be called directly.\n *\n * Please use:\n * - fromMnemonic\n * - fromSeed\n */\n constructor(privateKey: Arrayish, chainCode: Uint8Array, index: number, depth: number, mnemonic: string, path: string) {\n errors.checkNew(this, HDNode);\n\n defineReadOnly(this, 'keyPair', new KeyPair(privateKey));\n\n defineReadOnly(this, 'privateKey', this.keyPair.privateKey);\n defineReadOnly(this, 'publicKey', this.keyPair.compressedPublicKey);\n\n defineReadOnly(this, 'chainCode', hexlify(chainCode));\n\n defineReadOnly(this, 'index', index);\n defineReadOnly(this, 'depth', depth);\n\n defineReadOnly(this, 'mnemonic', mnemonic);\n defineReadOnly(this, 'path', path);\n }\n\n private _derive(index: number): HDNode {\n\n // Public parent key -> public child key\n if (!this.privateKey) {\n if (index >= HardenedBit) { throw new Error('cannot derive child of neutered node'); }\n throw new Error('not implemented');\n }\n\n var data = new Uint8Array(37);\n\n // Base path\n var mnemonic = this.mnemonic;\n var path = this.path;\n if (path) { path += '/' + index; }\n\n if (index & HardenedBit) {\n // Data = 0x00 || ser_256(k_par)\n data.set(arrayify(this.privateKey), 1);\n\n // Hardened path\n if (path) { path += \"'\"; }\n\n } else {\n // Data = ser_p(point(k_par))\n data.set(this.keyPair.publicKeyBytes);\n }\n\n // Data += ser_32(i)\n for (var i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); }\n\n var I = computeHmac('sha512', this.chainCode, data);\n var IL = bigNumberify(I.slice(0, 32));\n var IR = I.slice(32);\n\n var ki = IL.add(this.keyPair.privateKey).mod(N);\n\n return new HDNode(arrayify(ki), IR, index, this.depth + 1, mnemonic, path);\n }\n\n derivePath(path: string): HDNode {\n var components = path.split('/');\n\n if (components.length === 0 || (components[0] === 'm' && this.depth !== 0)) {\n throw new Error('invalid path');\n }\n\n if (components[0] === 'm') { components.shift(); }\n\n var result: HDNode = this;\n for (var i = 0; i < components.length; i++) {\n var component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n var index = parseInt(component.substring(0, component.length - 1));\n if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); }\n result = result._derive(HardenedBit + index);\n } else if (component.match(/^[0-9]+$/)) {\n var index = parseInt(component);\n if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); }\n result = result._derive(index);\n } else {\n throw new Error('invlaid path component - ' + component);\n }\n }\n\n return result;\n }\n}\n\nfunction _fromSeed(seed: Arrayish, mnemonic: string): HDNode {\n let seedArray: Uint8Array = arrayify(seed);\n if (seedArray.length < 16 || seedArray.length > 64) { throw new Error('invalid seed'); }\n\n var I: Uint8Array = arrayify(computeHmac('sha512', MasterSecret, seedArray));\n\n return new HDNode(I.slice(0, 32), I.slice(32), 0, 0, mnemonic, 'm');\n}\n\nexport function fromMnemonic(mnemonic: string, wordlist?: Wordlist): HDNode {\n // Check that the checksum s valid (will throw an error)\n mnemonicToEntropy(mnemonic, wordlist);\n\n return _fromSeed(mnemonicToSeed(mnemonic), mnemonic);\n}\n\nexport function fromSeed(seed: Arrayish): HDNode {\n return _fromSeed(seed, null);\n}\n\nexport function mnemonicToSeed(mnemonic: string, password?: string): string {\n if (!password) { password = ''; }\n\n var salt = toUtf8Bytes('mnemonic' + password, UnicodeNormalizationForm.NFKD);\n\n return hexlify(pbkdf2(toUtf8Bytes(mnemonic, UnicodeNormalizationForm.NFKD), salt, 2048, 64, 'sha512'));\n}\n\nexport function mnemonicToEntropy(mnemonic: string, wordlist?: Wordlist): string {\n if (!wordlist) { wordlist = langEn; }\n\n var words = wordlist.split(mnemonic);\n if ((words.length % 3) !== 0) { throw new Error('invalid mnemonic'); }\n\n var entropy = arrayify(new Uint8Array(Math.ceil(11 * words.length / 8)));\n\n var offset = 0;\n for (var i = 0; i < words.length; i++) {\n var index = wordlist.getWordIndex(words[i].normalize('NFKD'));\n if (index === -1) { throw new Error('invalid mnemonic'); }\n\n for (var bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n\n var entropyBits = 32 * words.length / 3;\n\n var checksumBits = words.length / 3;\n var checksumMask = getUpperMask(checksumBits);\n\n var checksum = arrayify(sha256(entropy.slice(0, entropyBits / 8)))[0];\n checksum &= checksumMask;\n\n if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {\n throw new Error('invalid checksum');\n }\n\n return hexlify(entropy.slice(0, entropyBits / 8));\n}\n\nexport function entropyToMnemonic(entropy: Arrayish, wordlist?: Wordlist): string {\n entropy = arrayify(entropy);\n\n if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) {\n throw new Error('invalid entropy');\n }\n\n var indices: Array = [ 0 ];\n\n var remainingBits = 11;\n for (var i = 0; i < entropy.length; i++) {\n\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n\n remainingBits -= 8;\n\n // This byte will complete an 11-bit index\n } else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n\n remainingBits += 3;\n }\n }\n\n // Compute the checksum bits\n var checksum = arrayify(sha256(entropy))[0];\n var checksumBits = entropy.length / 4;\n checksum &= getUpperMask(checksumBits);\n\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n\n if (!wordlist) { wordlist = langEn; }\n\n return wordlist.join(indices.map((index) => wordlist.getWord(index)));\n}\n\nexport function isValidMnemonic(mnemonic: string, wordlist?: Wordlist): boolean {\n try {\n mnemonicToEntropy(mnemonic, wordlist);\n return true;\n } catch (error) { }\n return false;\n}\n\n","'use strict';\n\nimport { arrayify } from './bytes';\n\nimport { randomBytes as _randomBytes } from 'crypto';\n\nexport function randomBytes(length: number): Uint8Array {\n return arrayify(_randomBytes(length));\n}\n\n","'use strict';\n\n/**\n * SigningKey\n *\n *\n */\n\nimport { getAddress } from '../utils/address';\nimport { arrayify, Arrayish, hexlify } from '../utils/bytes';\nimport { HDNode } from './hdnode';\nimport { keccak256 } from '../utils/keccak256';\nimport { defineReadOnly } from '../utils/properties';\nimport { computePublicKey, KeyPair, recoverPublicKey, Signature } from '../utils/secp256k1';\n\nimport errors = require('../utils/errors');\n\nexport class SigningKey {\n\n readonly privateKey: string;\n readonly publicKey: string;\n readonly address: string;\n\n readonly mnemonic: string;\n readonly path: string;\n\n private readonly keyPair: KeyPair;\n\n constructor(privateKey: Arrayish | HDNode) {\n errors.checkNew(this, SigningKey);\n\n let privateKeyBytes = null;\n\n if (privateKey instanceof HDNode) {\n defineReadOnly(this, 'mnemonic', privateKey.mnemonic);\n defineReadOnly(this, 'path', privateKey.path);\n privateKeyBytes = arrayify(privateKey.privateKey);\n } else {\n privateKeyBytes = arrayify(privateKey);\n }\n\n try {\n if (privateKeyBytes.length !== 32) {\n errors.throwError('exactly 32 bytes required', errors.INVALID_ARGUMENT, { value: privateKey });\n }\n } catch(error) {\n var params: any = { arg: 'privateKey', reason: error.reason, value: '[REDACTED]' }\n if (error.value) {\n if(typeof(error.value.length) === 'number') {\n params.length = error.value.length;\n }\n params.type = typeof(error.value);\n }\n errors.throwError('invalid private key', error.code, params);\n }\n\n defineReadOnly(this, 'privateKey', hexlify(privateKeyBytes));\n defineReadOnly(this, 'keyPair', new KeyPair(privateKeyBytes));\n defineReadOnly(this, 'publicKey', this.keyPair.publicKey);\n defineReadOnly(this, 'address', computeAddress(this.keyPair.publicKey));\n }\n\n signDigest(digest: Arrayish): Signature {\n return this.keyPair.sign(digest);\n }\n}\n\nexport function recoverAddress(digest: Arrayish, signature: Signature): string {\n return computeAddress(recoverPublicKey(digest, signature));\n}\n\nexport function computeAddress(key: string): string {\n // Strip off the leading \"0x04\"\n let publicKey = '0x' + computePublicKey(key).slice(4);\n return getAddress('0x' + keccak256(publicKey).substring(26));\n}\n","'use strict';\n\nimport aes = require('aes-js');\nimport scrypt = require('scrypt-js');\nimport uuid = require('uuid');\n\nimport { getAddress } from '../utils/address';\nimport { arrayify, Arrayish, concat, hexlify } from '../utils/bytes';\n\nimport { pbkdf2 } from '../utils/pbkdf2';\nimport { keccak256 } from '../utils/keccak256';\nimport { toUtf8Bytes, UnicodeNormalizationForm } from '../utils/utf8';\nimport { randomBytes } from '../utils/random-bytes';\n\nimport { SigningKey } from './signing-key';\nimport * as HDNode from './hdnode';\n\n// @TODO: Maybe move this to HDNode?\nvar defaultPath = \"m/44'/60'/0'/0/0\";\n\nexport interface ProgressCallback {\n (percent: number): void\n}\n\nfunction looseArrayify(hexString: string): Uint8Array {\n if (typeof(hexString) === 'string' && hexString.substring(0, 2) !== '0x') {\n hexString = '0x' + hexString;\n }\n return arrayify(hexString);\n}\n\nfunction zpad(value: String | number, length: number): String {\n value = String(value);\n while (value.length < length) { value = '0' + value; }\n return value;\n}\n\nfunction getPassword(password: Arrayish): Uint8Array {\n if (typeof(password) === 'string') {\n return toUtf8Bytes(password, UnicodeNormalizationForm.NFKC);\n }\n return arrayify(password);\n}\n\n// Search an Object and its children recursively, caselessly.\nfunction searchPath(object: any, path: string): string {\n var currentChild = object;\n\n var comps = path.toLowerCase().split('/');\n for (var i = 0; i < comps.length; i++) {\n\n // Search for a child object with a case-insensitive matching key\n var matchingChild = null;\n for (var key in currentChild) {\n if (key.toLowerCase() === comps[i]) {\n matchingChild = currentChild[key];\n break;\n }\n }\n\n // Didn't find one. :'(\n if (matchingChild === null) {\n return null;\n }\n\n // Now check this child...\n currentChild = matchingChild;\n }\n\n return currentChild;\n}\n\nexport function isCrowdsaleWallet(json: string): boolean {\n try {\n var data = JSON.parse(json);\n } catch (error) { return false; }\n\n return (data.encseed && data.ethaddr);\n}\n\nexport function isValidWallet(json: string): boolean {\n try {\n var data = JSON.parse(json);\n } catch (error) { return false; }\n\n if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) {\n return false;\n }\n\n // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff\n return true;\n}\n\n// @TODO: Make a type for string or arrayish\n// See: https://github.com/ethereum/pyethsaletool\nexport function decryptCrowdsale(json: string, password: Arrayish | string): SigningKey {\n var data = JSON.parse(json);\n\n password = getPassword(password);\n\n // Ethereum Address\n var ethaddr = getAddress(searchPath(data, 'ethaddr'));\n\n // Encrypted Seed\n var encseed = looseArrayify(searchPath(data, 'encseed'));\n if (!encseed || (encseed.length % 16) !== 0) {\n throw new Error('invalid encseed');\n }\n\n let key = pbkdf2(password, password, 2000, 32, 'sha256').slice(0, 16);\n\n var iv = encseed.slice(0, 16);\n var encryptedSeed = encseed.slice(16);\n\n // Decrypt the seed\n var aesCbc = new aes.ModeOfOperation.cbc(key, iv);\n var seed = arrayify(aesCbc.decrypt(encryptedSeed));\n seed = aes.padding.pkcs7.strip(seed);\n\n // This wallet format is weird... Convert the binary encoded hex to a string.\n var seedHex = '';\n for (var i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n\n var seedHexBytes = toUtf8Bytes(seedHex);\n\n var signingKey = new SigningKey(keccak256(seedHexBytes));\n\n if (signingKey.address !== ethaddr) {\n throw new Error('corrupt crowdsale wallet');\n }\n\n return signingKey;\n}\n\n//@TODO: string or arrayish\nexport function decrypt(json: string, password: any, progressCallback?: ProgressCallback): Promise {\n var data = JSON.parse(json);\n\n password = getPassword(password);\n\n var decrypt = function(key, ciphertext) {\n var cipher = searchPath(data, 'crypto/cipher');\n if (cipher === 'aes-128-ctr') {\n var iv = looseArrayify(searchPath(data, 'crypto/cipherparams/iv'))\n var counter = new aes.Counter(iv);\n\n var aesCtr = new aes.ModeOfOperation.ctr(key, counter);\n\n return arrayify(aesCtr.decrypt(ciphertext));\n }\n\n return null;\n };\n\n var computeMAC = function(derivedHalf, ciphertext) {\n return keccak256(concat([derivedHalf, ciphertext]));\n }\n\n var getSigningKey = function(key, reject) {\n var ciphertext = looseArrayify(searchPath(data, 'crypto/ciphertext'));\n\n var computedMAC = hexlify(computeMAC(key.slice(16, 32), ciphertext)).substring(2);\n if (computedMAC !== searchPath(data, 'crypto/mac').toLowerCase()) {\n reject(new Error('invalid password'));\n return null;\n }\n\n var privateKey = decrypt(key.slice(0, 16), ciphertext);\n var mnemonicKey = key.slice(32, 64);\n\n if (!privateKey) {\n reject(new Error('unsupported cipher'));\n return null;\n }\n\n var signingKey = new SigningKey(privateKey);\n if (signingKey.address !== getAddress(data.address)) {\n reject(new Error('address mismatch'));\n return null;\n }\n\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n if (searchPath(data, 'x-ethers/version') === '0.1') {\n var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext'));\n var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter'));\n\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n\n var path = searchPath(data, 'x-ethers/path') || defaultPath;\n\n var entropy = arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext));\n var mnemonic = HDNode.entropyToMnemonic(entropy);\n\n var node = HDNode.fromMnemonic(mnemonic).derivePath(path);\n if (node.privateKey != hexlify(privateKey)) {\n reject(new Error('mnemonic mismatch'));\n return null;\n }\n\n signingKey = new SigningKey(node);\n }\n\n return signingKey;\n }\n\n\n return new Promise(function(resolve, reject) {\n var kdf = searchPath(data, 'crypto/kdf');\n if (kdf && typeof(kdf) === 'string') {\n if (kdf.toLowerCase() === 'scrypt') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n var N = parseInt(searchPath(data, 'crypto/kdfparams/n'));\n var r = parseInt(searchPath(data, 'crypto/kdfparams/r'));\n var p = parseInt(searchPath(data, 'crypto/kdfparams/p'));\n if (!N || !r || !p) {\n reject(new Error('unsupported key-derivation function parameters'));\n return;\n }\n\n // Make sure N is a power of 2\n if ((N & (N - 1)) !== 0) {\n reject(new Error('unsupported key-derivation function parameter value for N'));\n return;\n }\n\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject( new Error('unsupported key-derivation derived-key length'));\n return;\n }\n\n scrypt(password, salt, N, r, p, 64, function(error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n\n } else if (key) {\n key = arrayify(key);\n\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) { return; }\n\n if (progressCallback) { progressCallback(1); }\n resolve(signingKey);\n\n } else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n\n } else if (kdf.toLowerCase() === 'pbkdf2') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n\n var prfFunc = null;\n var prf = searchPath(data, 'crypto/kdfparams/prf');\n if (prf === 'hmac-sha256') {\n prfFunc = 'sha256';\n } else if (prf === 'hmac-sha512') {\n prfFunc = 'sha512';\n } else {\n reject(new Error('unsupported prf'));\n return;\n }\n\n var c = parseInt(searchPath(data, 'crypto/kdfparams/c'));\n\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject( new Error('unsupported key-derivation derived-key length'));\n return;\n }\n\n var key = pbkdf2(password, salt, c, dkLen, prfFunc);\n\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) { return; }\n\n resolve(signingKey);\n\n } else {\n reject(new Error('unsupported key-derivation function'));\n }\n\n } else {\n reject(new Error('unsupported key-derivation function'));\n }\n });\n}\n\n// @TOOD: Options\nexport function encrypt(privateKey: Arrayish | SigningKey, password: Arrayish | string, options?: any, progressCallback?: ProgressCallback): Promise {\n\n // the options are optional, so adjust the call as needed\n if (typeof(options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (!options) { options = {}; }\n\n // Check the private key\n let privateKeyBytes = null;\n if (privateKey instanceof SigningKey) {\n privateKeyBytes = arrayify(privateKey.privateKey);\n } else {\n privateKeyBytes = arrayify(privateKey);\n }\n if (privateKeyBytes.length !== 32) { throw new Error('invalid private key'); }\n\n password = getPassword(password);\n\n var entropy = options.entropy;\n if (options.mnemonic) {\n if (entropy) {\n if (HDNode.entropyToMnemonic(entropy) !== options.mnemonic) {\n throw new Error('entropy and mnemonic mismatch');\n }\n } else {\n entropy = HDNode.mnemonicToEntropy(options.mnemonic);\n }\n }\n if (entropy) {\n entropy = arrayify(entropy);\n }\n\n var path = options.path;\n if (entropy && !path) {\n path = defaultPath;\n }\n\n var client = options.client;\n if (!client) { client = \"ethers.js\"; }\n\n // Check/generate the salt\n var salt = options.salt;\n if (salt) {\n salt = arrayify(salt);\n } else {\n salt = randomBytes(32);;\n }\n\n // Override initialization vector\n var iv = null;\n if (options.iv) {\n iv = arrayify(options.iv);\n if (iv.length !== 16) { throw new Error('invalid iv'); }\n } else {\n iv = randomBytes(16);\n }\n\n // Override the uuid\n var uuidRandom = options.uuid;\n if (uuidRandom) {\n uuidRandom = arrayify(uuidRandom);\n if (uuidRandom.length !== 16) { throw new Error('invalid uuid'); }\n } else {\n uuidRandom = randomBytes(16);\n }\n\n // Override the scrypt password-based key derivation function parameters\n var N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) { N = options.scrypt.N; }\n if (options.scrypt.r) { r = options.scrypt.r; }\n if (options.scrypt.p) { p = options.scrypt.p; }\n }\n\n return new Promise(function(resolve, reject) {\n\n // We take 64 bytes:\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n scrypt(password, salt, N, r, p, 64, function(error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n\n } else if (key) {\n key = arrayify(key);\n\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n var derivedKey = key.slice(0, 16);\n var macPrefix = key.slice(16, 32);\n\n // This will be used to encrypt the mnemonic phrase (if any)\n var mnemonicKey = key.slice(32, 64);\n\n // Get the address for this private key\n var address = (new SigningKey(privateKeyBytes)).address;\n\n // Encrypt the private key\n var counter = new aes.Counter(iv);\n var aesCtr = new aes.ModeOfOperation.ctr(derivedKey, counter);\n var ciphertext = arrayify(aesCtr.encrypt(privateKeyBytes));\n\n // Compute the message authentication code, used to check the password\n var mac = keccak256(concat([macPrefix, ciphertext]))\n\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n var data = {\n address: address.substring(2).toLowerCase(),\n id: uuid.v4({ random: uuidRandom }),\n version: 3,\n Crypto: {\n cipher: 'aes-128-ctr',\n cipherparams: {\n iv: hexlify(iv).substring(2),\n },\n ciphertext: hexlify(ciphertext).substring(2),\n kdf: 'scrypt',\n kdfparams: {\n salt: hexlify(salt).substring(2),\n n: N,\n dklen: 32,\n p: p,\n r: r\n },\n mac: mac.substring(2)\n }\n };\n\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (entropy) {\n var mnemonicIv = randomBytes(16);\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n var mnemonicCiphertext = arrayify(mnemonicAesCtr.encrypt(entropy));\n var now = new Date();\n var timestamp = (now.getUTCFullYear() + '-' +\n zpad(now.getUTCMonth() + 1, 2) + '-' +\n zpad(now.getUTCDate(), 2) + 'T' +\n zpad(now.getUTCHours(), 2) + '-' +\n zpad(now.getUTCMinutes(), 2) + '-' +\n zpad(now.getUTCSeconds(), 2) + '.0Z'\n );\n data['x-ethers'] = {\n client: client,\n gethFilename: ('UTC--' + timestamp + '--' + data.address),\n mnemonicCounter: hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\"\n };\n }\n\n if (progressCallback) { progressCallback(1); }\n resolve(JSON.stringify(data));\n\n } else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n}\n\n","'use strict';\n\nimport { Arrayish, concat, hexlify } from './bytes';\nimport { toUtf8Bytes } from './utf8';\nimport { keccak256 } from './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.-]*$\");\n\nexport function namehash(name: string): string {\n name = name.toLowerCase();\n\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 throw new Error('contains invalid UseSTD3ASCIIRules characters');\n }\n\n var result: string | Uint8Array = Zeros;\n while (name.length) {\n var partition = name.match(Partition);\n var label = toUtf8Bytes(partition[3]);\n result = keccak256(concat([result, keccak256(label)]));\n\n name = partition[2] || '';\n }\n\n return hexlify(result);\n}\n\n\nexport function id(text: string): string {\n return keccak256(toUtf8Bytes(text));\n}\n\nexport function hashMessage(message: Arrayish | string): string {\n var payload = concat([\n toUtf8Bytes('\\x19Ethereum Signed Message:\\n'),\n toUtf8Bytes(String(message.length)),\n ((typeof(message) === 'string') ? toUtf8Bytes(message): message)\n ]);\n return keccak256(payload);\n}\n\n","\nimport { getAddress } from './address';\nimport { BigNumber, bigNumberify, BigNumberish,ConstantZero } from './bignumber';\nimport { arrayify, Arrayish, hexlify, hexZeroPad, stripZeros, } from './bytes';\nimport { keccak256 } from './keccak256';\nimport { recoverAddress, Signature } from './secp256k1';\nimport * as RLP from './rlp';\n\nexport type UnsignedTransaction = {\n to?: string;\n nonce?: number;\n\n gasLimit?: BigNumberish;\n gasPrice?: BigNumberish;\n\n data?: Arrayish;\n value?: BigNumberish;\n chainId?: number;\n}\n\n\nexport interface Transaction {\n hash?: string;\n\n to?: string;\n from?: string;\n nonce: number;\n\n gasLimit: BigNumber;\n gasPrice: BigNumber;\n\n data: string;\n value: BigNumber;\n chainId: number;\n\n r?: string;\n s?: string;\n v?: number;\n}\n\n\nfunction handleAddress(value: string): string {\n if (value === '0x') { return null; }\n return getAddress(value);\n}\n\nfunction handleNumber(value: string): BigNumber {\n if (value === '0x') { return ConstantZero; }\n return bigNumberify(value);\n}\n\nvar transactionFields = [\n {name: 'nonce', maxLength: 32 },\n {name: 'gasPrice', maxLength: 32 },\n {name: 'gasLimit', maxLength: 32 },\n {name: 'to', length: 20 },\n {name: 'value', maxLength: 32 },\n {name: 'data' },\n];\n\n\nexport type SignDigestFunc = (digest: Arrayish) => Signature;\n\nexport function sign(transaction: UnsignedTransaction, signDigest: SignDigestFunc): string {\n\n var raw = [];\n\n transactionFields.forEach(function(fieldInfo) {\n let value = transaction[fieldInfo.name] || ([]);\n value = arrayify(hexlify(value));\n\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n let error: any = new Error('invalid ' + fieldInfo.name);\n error.reason = 'wrong length';\n error.value = value;\n throw error;\n }\n\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = stripZeros(value);\n if (value.length > fieldInfo.maxLength) {\n let error: any = new Error('invalid ' + fieldInfo.name);\n error.reason = 'too long';\n error.value = value;\n throw error;\n }\n }\n\n raw.push(hexlify(value));\n });\n\n // @TOOD:\n /*\n // Requesting an unsigned transation\n if (!signDigest) {\n let v = 27 + signature.recoveryParam\n if (transaction.chainId) {\n v += transaction.chainId * 2 + 8;\n }\n //raw.push(hexlify(transaction.chainId));\n raw.push(hexlify(v));\n raw.push('0x');\n raw.push('0x');\n }\n */\n\n if (transaction.chainId) {\n raw.push(hexlify(transaction.chainId));\n raw.push('0x');\n raw.push('0x');\n }\n\n var digest = keccak256(RLP.encode(raw));\n\n var signature = signDigest(digest);\n\n var v = 27 + signature.recoveryParam\n if (transaction.chainId) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += transaction.chainId * 2 + 8;\n }\n\n raw.push(hexlify(v));\n raw.push(stripZeros(arrayify(signature.r)));\n raw.push(stripZeros(arrayify(signature.s)));\n\n return RLP.encode(raw);\n}\n\nexport function parse(rawTransaction: Arrayish): Transaction {\n var signedTransaction = RLP.decode(rawTransaction);\n if (signedTransaction.length !== 9) { throw new Error('invalid transaction'); }\n\n let tx: Transaction = {\n nonce: handleNumber(signedTransaction[0]).toNumber(),\n gasPrice: handleNumber(signedTransaction[1]),\n gasLimit: handleNumber(signedTransaction[2]),\n to: handleAddress(signedTransaction[3]),\n value: handleNumber(signedTransaction[4]),\n data: signedTransaction[5],\n chainId: 0\n };\n\n var v = arrayify(signedTransaction[6]);\n var r = arrayify(signedTransaction[7]);\n var s = arrayify(signedTransaction[8]);\n\n if (v.length >= 1 && r.length >= 1 && r.length <= 32 && s.length >= 1 && s.length <= 32) {\n tx.v = bigNumberify(v).toNumber();\n tx.r = hexZeroPad(signedTransaction[7], 32);\n tx.s = hexZeroPad(signedTransaction[8], 32);\n\n var chainId = (tx.v - 35) / 2;\n if (chainId < 0) { chainId = 0; }\n chainId = Math.trunc(chainId);\n\n tx.chainId = chainId;\n\n var recoveryParam = tx.v - 27;\n\n let raw = signedTransaction.slice(0, 6);\n\n if (chainId) {\n raw.push(hexlify(chainId));\n raw.push('0x');\n raw.push('0x');\n recoveryParam -= chainId * 2 + 8;\n }\n\n var digest = keccak256(RLP.encode(raw));\n try {\n tx.from = recoverAddress(digest, { r: hexlify(r), s: hexlify(s), recoveryParam: recoveryParam });\n } catch (error) {\n console.log(error);\n }\n\n tx.hash = keccak256(rawTransaction);\n }\n\n return tx;\n}\n","'use strict';\n\nimport scrypt from 'scrypt-js';\n\nimport { defaultPath, entropyToMnemonic, fromMnemonic, HDNode } from './hdnode';\nimport * as secretStorage from './secret-storage';\nimport { ProgressCallback } from './secret-storage';\nimport { recoverAddress, SigningKey } from './signing-key';\n\nimport { BlockTag, Provider, TransactionRequest, TransactionResponse } from '../providers/provider';\nimport { Wordlist } from '../wordlists/wordlist';\n\nimport { BigNumber, BigNumberish } from '../utils/bignumber';\nimport { arrayify, Arrayish, concat, hexlify, joinSignature } from '../utils/bytes';\nimport { hashMessage } from '../utils/hash';\nimport { keccak256 } from '../utils/keccak256';\nimport { defineReadOnly, resolveProperties, shallowCopy } from '../utils/properties';\nimport { randomBytes } from '../utils/random-bytes';\nimport { sign as signTransaction } from '../utils/transaction';\nimport { toUtf8Bytes, UnicodeNormalizationForm } from '../utils/utf8';\n\nimport * as errors from '../utils/errors';\n\n\n// This ensures we inject a setImmediate into the global space, which\n// dramatically improves the performance of the scrypt PBKDF.\nconsole.log(\"Fix this! Setimmediate\");\n//import _setimmediate = require('setimmediate');\n\nexport abstract class Signer {\n provider?: Provider;\n\n abstract getAddress(): Promise\n\n abstract signMessage(transaction: Arrayish | string): Promise;\n abstract sendTransaction(transaction: TransactionRequest): Promise;\n}\n\n\nexport class Wallet extends Signer {\n\n readonly provider: Provider;\n\n private readonly signingKey: SigningKey;\n\n constructor(privateKey: SigningKey | HDNode | Arrayish, provider?: Provider) {\n super();\n errors.checkNew(this, Wallet);\n\n // Make sure we have a valid signing key\n if (privateKey instanceof SigningKey) {\n defineReadOnly(this, 'signingKey', privateKey);\n } else {\n defineReadOnly(this, 'signingKey', new SigningKey(privateKey));\n }\n\n defineReadOnly(this, 'provider', provider);\n }\n\n get address(): string { return this.signingKey.address; }\n\n get mnemonic(): string { return this.signingKey.mnemonic; }\n get path(): string { return this.signingKey.mnemonic; }\n\n get privateKey(): string { return this.signingKey.privateKey; }\n\n\n /**\n * Create a new instance of this Wallet connected to provider.\n */\n connect(provider: Provider): Wallet {\n return new Wallet(this.signingKey, provider);\n }\n\n\n getAddress(): Promise {\n return Promise.resolve(this.address);\n }\n\n sign(transaction: TransactionRequest): Promise {\n return resolveProperties(transaction).then((tx) => {\n return signTransaction(tx, this.signingKey.signDigest.bind(this.signingKey));\n });\n }\n\n signMessage(message: Arrayish | string): Promise {\n return Promise.resolve(joinSignature(this.signingKey.signDigest(hashMessage(message))));\n }\n\n\n getBalance(blockTag?: BlockTag): Promise {\n if (!this.provider) { throw new Error('missing provider'); }\n return this.provider.getBalance(this.address, blockTag);\n }\n\n getTransactionCount(blockTag?: BlockTag): Promise {\n if (!this.provider) { throw new Error('missing provider'); }\n return this.provider.getTransactionCount(this.address, blockTag);\n }\n\n sendTransaction(transaction: TransactionRequest): Promise {\n if (!this.provider) { throw new Error('missing provider'); }\n\n if (!transaction || typeof(transaction) !== 'object') {\n throw new Error('invalid transaction object');\n }\n\n var tx = shallowCopy(transaction);\n\n if (tx.to != null) {\n tx.to = this.provider.resolveName(tx.to);\n }\n\n if (tx.gasLimit == null) {\n tx.gasLimit = this.provider.estimateGas(tx);\n }\n\n if (tx.gasPrice == null) {\n tx.gasPrice = this.provider.getGasPrice();\n }\n\n if (tx.nonce == null) {\n tx.nonce = this.getTransactionCount();\n }\n\n if (tx.chainId == null) {\n tx.chainId = this.provider.getNetwork().then((network) => network.chainId);\n }\n\n return resolveProperties(tx).then((tx) => {\n console.log('To Sign', tx);\n return this.provider.sendTransaction(this.sign(tx));\n });\n\n }\n\n send(addressOrName: string, amountWei: BigNumberish, options: any): Promise {\n if (!options) { options = {}; }\n\n return this.sendTransaction({\n to: addressOrName,\n gasLimit: options.gasLimit,\n gasPrice: options.gasPrice,\n nonce: options.nonce,\n value: amountWei,\n });\n }\n\n\n encrypt(password: Arrayish | string, options: any, progressCallback: ProgressCallback): Promise {\n if (typeof(options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n\n if (progressCallback && typeof(progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n\n if (!options) { options = {}; }\n\n if (this.mnemonic) {\n // Make sure we don't accidentally bubble the mnemonic up the call-stack\n var safeOptions = {};\n for (var key in options) { safeOptions[key] = options[key]; }\n options = safeOptions;\n\n // Set the mnemonic and path\n options.mnemonic = this.mnemonic;\n options.path = this.path\n }\n\n return secretStorage.encrypt(this.privateKey, password, options, progressCallback);\n }\n\n\n /**\n * Static methods to create Wallet instances.\n */\n static createRandom(options: any): Wallet {\n var entropy: Uint8Array = randomBytes(16);\n\n if (!options) { options = { }; }\n\n if (options.extraEntropy) {\n entropy = arrayify(keccak256(concat([entropy, options.extraEntropy])).substring(0, 34));\n }\n\n var mnemonic = entropyToMnemonic(entropy, options.locale);\n return Wallet.fromMnemonic(mnemonic, options.path, options.locale);\n }\n\n static fromEncryptedWallet(json: string, password: Arrayish, progressCallback: ProgressCallback): Promise {\n if (progressCallback && typeof(progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n\n return new Promise(function(resolve, reject) {\n\n if (secretStorage.isCrowdsaleWallet(json)) {\n try {\n var privateKey = secretStorage.decryptCrowdsale(json, password);\n resolve(new Wallet(privateKey));\n } catch (error) {\n reject(error);\n }\n\n } else if (secretStorage.isValidWallet(json)) {\n\n secretStorage.decrypt(json, password, progressCallback).then(function(signingKey) {\n var wallet = new Wallet(signingKey);\n /*\n if (signingKey.mnemonic && signingKey.path) {\n wallet.mnemonic = signingKey.mnemonic;\n wallet.path = signingKey.path;\n }\n */\n resolve(wallet);\n }, function(error) {\n reject(error);\n });\n\n } else {\n reject('invalid wallet JSON');\n }\n });\n }\n\n static fromMnemonic(mnemonic: string, path?: string, wordlist?: Wordlist): Wallet {\n if (!path) { path = defaultPath; }\n return new Wallet(fromMnemonic(mnemonic, wordlist).derivePath(path));\n }\n\n\n static fromBrainWallet(username: Arrayish | string, password: Arrayish | string, progressCallback: ProgressCallback): Promise {\n if (progressCallback && typeof(progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n\n if (typeof(username) === 'string') {\n username = toUtf8Bytes(username, UnicodeNormalizationForm.NFKC);\n } else {\n username = arrayify(username);\n }\n\n if (typeof(password) === 'string') {\n password = toUtf8Bytes(password, UnicodeNormalizationForm.NFKC);\n } else {\n password = arrayify(password);\n }\n\n return new Promise(function(resolve, reject) {\n scrypt(password, username, (1 << 18), 8, 1, 32, function(error, progress, key) {\n if (error) {\n reject(error);\n\n } else if (key) {\n resolve(new Wallet(hexlify(key)));\n\n } else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n }\n\n\n /**\n * Determine if this is an encryped JSON wallet.\n */\n static isEncryptedWallet(json: string): boolean {\n return (secretStorage.isValidWallet(json) || secretStorage.isCrowdsaleWallet(json));\n }\n\n\n /**\n * Verify a signed message, returning the address of the signer.\n */\n static verifyMessage(message: Arrayish | string, signature: string): string {\n signature = hexlify(signature);\n if (signature.length != 132) { throw new Error('invalid signature'); }\n var digest = hashMessage(message);\n\n var recoveryParam = parseInt(signature.substring(130), 16);\n if (recoveryParam >= 27) { recoveryParam -= 27; }\n if (recoveryParam < 0) { throw new Error('invalid signature'); }\n\n return recoverAddress(\n digest,\n {\n r: signature.substring(0, 66),\n s: '0x' + signature.substring(66, 130),\n recoveryParam: recoveryParam\n }\n );\n }\n}\n","'use strict';\n\nimport * as errors from '../utils/errors';\n\nexport type Network = {\n name: string,\n chainId: number,\n ensAddress?: string,\n}\n\nexport type Networkish = Network | string | number;\n\n\nconst homestead = {\n chainId: 1,\n ensAddress: \"0x314159265dd8dbb310642f98f50c066173c1259b\",\n name: \"homestead\"\n};\n\nconst ropsten = {\n chainId: 3,\n ensAddress: \"0x112234455c3a32fd11230c42e7bccd4a84e02010\",\n name: \"ropsten\"\n};\n\nconst networks = {\n unspecified: {\n chainId: 0\n },\n\n homestead: homestead,\n mainnet: homestead,\n\n morden: {\n chainId: 2\n },\n\n ropsten: ropsten,\n testnet: ropsten,\n\n rinkeby: {\n chainId: 4,\n ensAddress: \"0xe7410170f87102DF0055eB195163A03B7F2Bff4A\"\n },\n\n kovan: {\n chainId: 42\n },\n\n classic: {\n chainId: 61\n }\n}\n\n/**\n * getNetwork\n *\n * Converts a named common networks or chain ID (network ID) to a Network\n * and verifies a network is a valid Network..\n */\nexport function getNetwork(network: Networkish): Network {\n // No network (null) or unspecified (chainId = 0)\n if (!network) { return null; }\n\n if (typeof(network) === 'number') {\n for (var name in networks) {\n let n = networks[name];\n if (n.chainId === network) {\n return {\n name: name,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n }\n }\n\n return {\n chainId: network,\n name: 'unknown'\n };\n }\n\n if (typeof(network) === 'string') {\n let n = networks[network];\n if (n == null) { return null; }\n return {\n name: network,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n }\n\n let n = networks[network.name];\n\n // Not a standard network; check that it is a valid network in general\n if (!n) {\n if (typeof(n.chainId) !== 'number') {\n errors.throwError('invalid network chainId', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n return network;\n }\n\n // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155)\n if (network.chainId !== 0 && network.chainId !== n.chainId) {\n errors.throwError('network chainId mismatch', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n\n // Standard Network\n return {\n name: network.name,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n}\n","'use strict';\n\n//import inherits = require('inherits');\n\nimport { Signer } from '../wallet/wallet';\n\nimport { getAddress, getContractAddress } from '../utils/address';\nimport { BigNumber, bigNumberify, BigNumberish } from '../utils/bignumber';\nimport { Arrayish, hexDataLength, hexDataSlice, hexlify, hexStripZeros, isHexString, joinSignature, stripZeros } from '../utils/bytes';\nimport { toUtf8String } from '../utils/utf8';\nimport { decode as rlpDecode, encode as rlpEncode } from '../utils/rlp';\nimport { hashMessage, namehash } from '../utils/hash';\nimport { getNetwork, Network, Networkish } from './networks';\nimport { defineReadOnly, resolveProperties, shallowCopy } from '../utils/properties';\nimport { parse as parseTransaction, sign as signTransaction, SignDigestFunc, Transaction } from '../utils/transaction';\n\nimport * as errors from '../utils/errors';\n\nfunction copyObject(obj) {\n var result = {};\n for (var key in obj) { result[key] = obj[key]; }\n return result;\n}\n\n//////////////////////////////\n// Exported Types\n\nexport type BlockTag = string | number;\n\nexport interface Block {\n hash: string;\n parentHash: string;\n number: number;\n\n timestamp: number;\n nonce: string;\n difficulty: number;\n\n gasLimit: BigNumber;\n gasUsed: BigNumber;\n\n miner: string;\n extraData: string;\n\n transactions: Array;\n}\n\nexport type TransactionRequest = {\n to?: string | Promise,\n from?: string | Promise,\n nonce?: number | string | Promise,\n\n gasLimit?: BigNumberish | Promise,\n gasPrice?: BigNumberish | Promise,\n\n data?: Arrayish | Promise,\n value?: BigNumberish | Promise,\n chainId?: number | Promise,\n}\n\nexport interface TransactionResponse extends Transaction {\n // Only if a transaction has been mined\n blockNumber?: number,\n blockHash?: string,\n timestamp?: number,\n\n // Not optional (as it is in Transaction)\n from: string;\n\n // This function waits until the transaction has been mined\n wait: (timeout?: number) => Promise\n};\n\nexport interface TransactionReceipt {\n contractAddress?: string,\n transactionIndex?: number,\n root?: string,\n gasUsed?: BigNumber,\n logsBloom?: string,\n blockHash?: string,\n transactionHash?: string,\n logs?: Array,\n blockNumber?: number,\n cumulativeGasUsed?: BigNumber,\n status?: number // @TOOD: Check 0 or 1?\n};\n\nexport type Filter = {\n fromBlock?: BlockTag,\n toBlock?: BlockTag,\n address?: string,\n topics?: Array\n}\n\n// @TODO: Some of these are not options; force them?\nexport interface Log {\n blockNumber?: number;\n blockHash?: string;\n transactionIndex?: number;\n\n removed?: boolean;\n\n address: string;\n data?: string;\n\n topics?: Array;\n\n transactionHash?: string;\n logIndex?: number;\n}\n\n//////////////////////////////\n// Request and Response Checking\n\n// @TODO: not any?\nfunction check(format: any, object: any): any {\n var result = {};\n for (var key in format) {\n try {\n var value = format[key](object[key]);\n if (value !== undefined) { result[key] = value; }\n } catch (error) {\n error.checkKey = key;\n error.checkValue = object[key];\n throw error;\n }\n }\n return result;\n}\n\ntype CheckFunc = (value: any) => any;\n\nfunction allowNull(check: CheckFunc, nullValue?: any): CheckFunc {\n return (function(value: any) {\n if (value == null) { return nullValue; }\n return check(value);\n });\n}\n\nfunction allowFalsish(check: CheckFunc, replaceValue): CheckFunc {\n return (function(value) {\n if (!value) { return replaceValue; }\n return check(value);\n });\n}\n\nfunction arrayOf(check: CheckFunc): CheckFunc {\n return (function(array: any): Array {\n if (!Array.isArray(array)) { throw new Error('not an array'); }\n\n var result = [];\n\n array.forEach(function(value) {\n result.push(check(value));\n });\n\n return result;\n });\n}\n\nfunction checkHash(hash: any): string {\n if (typeof(hash) === 'string' && hexDataLength(hash) === 32) {\n return hash;\n }\n errors.throwError('invalid hash', errors.INVALID_ARGUMENT, { arg: 'hash', value: hash });\n return null;\n}\n\nfunction checkNumber(number): number {\n return bigNumberify(number).toNumber();\n}\n\n// Returns the difficulty as a number, or if too large (i.e. PoA network) null\nfunction checkDifficulty(value: BigNumberish): number {\n let v = bigNumberify(value);\n\n try {\n return v.toNumber();\n } catch (error) { }\n\n return null;\n}\n\nfunction checkBoolean(value): boolean {\n if (typeof(value) === 'boolean') { return value; }\n if (typeof(value) === 'string') {\n if (value === 'true') { return true; }\n if (value === 'false') { return false; }\n }\n throw new Error('invaid boolean - ' + value);\n}\n\nfunction checkUint256(uint256: string): string {\n if (!isHexString(uint256)) {\n throw new Error('invalid uint256');\n }\n while (uint256.length < 66) {\n uint256 = '0x0' + uint256.substring(2);\n }\n return uint256;\n}\n\n/*\nfunction checkString(string) {\n if (typeof(string) !== 'string') { throw new Error('invalid string'); }\n return string;\n}\n*/\n\nfunction checkBlockTag(blockTag: BlockTag): string {\n if (blockTag == null) { return 'latest'; }\n\n if (blockTag === 'earliest') { return '0x0'; }\n\n if (blockTag === 'latest' || blockTag === 'pending') {\n return blockTag;\n }\n\n if (typeof(blockTag) === 'number') {\n return hexStripZeros(hexlify(blockTag));\n }\n\n if (isHexString(blockTag)) { return hexStripZeros(blockTag); }\n\n throw new Error('invalid blockTag');\n}\n\nvar formatBlock = {\n hash: checkHash,\n parentHash: checkHash,\n number: checkNumber,\n\n timestamp: checkNumber,\n nonce: allowNull(hexlify),\n difficulty: checkDifficulty,\n\n gasLimit: bigNumberify,\n gasUsed: bigNumberify,\n\n miner: getAddress,\n extraData: hexlify,\n\n //transactions: allowNull(arrayOf(checkTransaction)),\n transactions: allowNull(arrayOf(checkHash)),\n\n //transactionRoot: checkHash,\n //stateRoot: checkHash,\n //sha3Uncles: checkHash,\n\n //logsBloom: hexlify,\n};\n\nfunction checkBlock(block) {\n if (block.author != null && block.miner == null) {\n block.miner = block.author;\n }\n return check(formatBlock, block);\n}\n\n\nvar formatTransaction = {\n hash: checkHash,\n\n blockHash: allowNull(checkHash, null),\n blockNumber: allowNull(checkNumber, null),\n transactionIndex: allowNull(checkNumber, null),\n\n from: getAddress,\n\n gasPrice: bigNumberify,\n gasLimit: bigNumberify,\n to: allowNull(getAddress, null),\n value: bigNumberify,\n nonce: checkNumber,\n data: hexlify,\n\n r: allowNull(checkUint256),\n s: allowNull(checkUint256),\n v: allowNull(checkNumber),\n\n creates: allowNull(getAddress, null),\n\n raw: allowNull(hexlify),\n};\n\nexport function checkTransactionResponse(transaction: any): TransactionResponse {\n\n // Rename gas to gasLimit\n if (transaction.gas != null && transaction.gasLimit == null) {\n transaction.gasLimit = transaction.gas;\n }\n\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (transaction.to && bigNumberify(transaction.to).isZero()) {\n transaction.to = '0x0000000000000000000000000000000000000000';\n }\n\n // Rename input to data\n if (transaction.input != null && transaction.data == null) {\n transaction.data = transaction.input;\n }\n\n // If to and creates are empty, populate the creates from the transaction\n if (transaction.to == null && transaction.creates == null) {\n transaction.creates = getContractAddress(transaction);\n }\n\n if (!transaction.raw) {\n // Very loose providers (e.g. TestRPC) don't provide a signature or raw\n if (transaction.v && transaction.r && transaction.s) {\n var raw = [\n stripZeros(hexlify(transaction.nonce)),\n stripZeros(hexlify(transaction.gasPrice)),\n stripZeros(hexlify(transaction.gasLimit)),\n (transaction.to || \"0x\"),\n stripZeros(hexlify(transaction.value || '0x')),\n hexlify(transaction.data || '0x'),\n stripZeros(hexlify(transaction.v || '0x')),\n stripZeros(hexlify(transaction.r)),\n stripZeros(hexlify(transaction.s)),\n ];\n\n transaction.raw = rlpEncode(raw);\n }\n }\n\n\n var result = check(formatTransaction, transaction);\n\n var networkId = transaction.networkId;\n\n if (isHexString(networkId)) {\n networkId = bigNumberify(networkId).toNumber();\n }\n\n if (typeof(networkId) !== 'number' && result.v != null) {\n networkId = (result.v - 35) / 2;\n if (networkId < 0) { networkId = 0; }\n networkId = parseInt(networkId);\n }\n\n if (typeof(networkId) !== 'number') { networkId = 0; }\n\n result.networkId = networkId;\n \n // 0x0000... should actually be null\n if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {\n result.blockHash = null;\n }\n\n return result;\n}\n\nvar formatTransactionRequest = {\n from: allowNull(getAddress),\n nonce: allowNull(checkNumber),\n gasLimit: allowNull(bigNumberify),\n gasPrice: allowNull(bigNumberify),\n to: allowNull(getAddress),\n value: allowNull(bigNumberify),\n data: allowNull(hexlify),\n};\n\nfunction checkTransactionRequest(transaction) {\n return check(formatTransactionRequest, transaction);\n}\n\nvar formatTransactionReceiptLog = {\n transactionLogIndex: allowNull(checkNumber),\n transactionIndex: checkNumber,\n blockNumber: checkNumber,\n transactionHash: checkHash,\n address: getAddress,\n topics: arrayOf(checkHash),\n data: hexlify,\n logIndex: checkNumber,\n blockHash: checkHash,\n};\n\nfunction checkTransactionReceiptLog(log) {\n return check(formatTransactionReceiptLog, log);\n}\n\nvar formatTransactionReceipt = {\n contractAddress: allowNull(getAddress, null),\n transactionIndex: checkNumber,\n root: allowNull(checkHash),\n gasUsed: bigNumberify,\n logsBloom: allowNull(hexlify),\n blockHash: checkHash,\n transactionHash: checkHash,\n logs: arrayOf(checkTransactionReceiptLog),\n blockNumber: checkNumber,\n cumulativeGasUsed: bigNumberify,\n status: allowNull(checkNumber)\n};\n\nfunction checkTransactionReceipt(transactionReceipt) {\n //var status = transactionReceipt.status;\n //var root = transactionReceipt.root;\n\n var result = check(formatTransactionReceipt, transactionReceipt);\n result.logs.forEach(function(entry, index) {\n if (entry.transactionLogIndex == null) {\n entry.transactionLogIndex = index;\n }\n });\n if (transactionReceipt.status != null) {\n result.byzantium = true;\n }\n return result;\n}\n\nfunction checkTopics(topics) {\n if (Array.isArray(topics)) {\n topics.forEach(function(topic) {\n checkTopics(topic);\n });\n\n } else if (topics != null) {\n checkHash(topics);\n }\n\n return topics;\n}\n\nvar formatFilter = {\n fromBlock: allowNull(checkBlockTag, undefined),\n toBlock: allowNull(checkBlockTag, undefined),\n address: allowNull(getAddress, undefined),\n topics: allowNull(checkTopics, undefined),\n};\n\nfunction checkFilter(filter) {\n return check(formatFilter, filter);\n}\n\nvar formatLog = {\n blockNumber: allowNull(checkNumber),\n blockHash: allowNull(checkHash),\n transactionIndex: checkNumber,\n\n removed: allowNull(checkBoolean),\n\n address: getAddress,\n data: allowFalsish(hexlify, '0x'),\n\n topics: arrayOf(checkHash),\n\n transactionHash: checkHash,\n logIndex: checkNumber,\n}\n\nfunction checkLog(log) {\n return check(formatLog, log);\n}\n\n//////////////////////////////\n// Defer Promises\n\ntype AllowNullFunc = () => boolean;\ntype ExecuteFunc = () => Promise\nfunction stallPromise(allowNullFunc: AllowNullFunc, executeFunc: ExecuteFunc): Promise {\n return new Promise(function(resolve, reject) {\n var attempt = 0;\n function check() {\n executeFunc().then(function(result) {\n // If we have a result, or are allowed null then we're done\n if (result || allowNullFunc()) {\n resolve(result);\n\n // Otherwise, exponential back-off (up to 10s) our next request\n } else {\n attempt++;\n var timeout = 500 + 250 * Math.trunc(Math.random() * (1 << attempt));\n if (timeout > 10000) { timeout = 10000; }\n setTimeout(check, timeout);\n }\n }, function(error) {\n reject(error);\n });\n }\n check();\n });\n}\n\n//////////////////////////////\n// Event Serializeing\n\nfunction recurse(object, convertFunc) {\n if (Array.isArray(object)) {\n var result = [];\n object.forEach(function(object) {\n result.push(recurse(object, convertFunc));\n });\n return result;\n }\n return convertFunc(object);\n}\n\nfunction getEventString(object) {\n try {\n return 'address:' + getAddress(object);\n } catch (error) { }\n\n if (object === 'block') {\n return 'block';\n\n } else if (object === 'pending') {\n return 'pending';\n\n } else if (hexDataLength(object) === 32) {\n return 'tx:' + object;\n\n } else if (Array.isArray(object)) {\n object = recurse(object, function(object) {\n if (object == null) { object = '0x'; }\n return object;\n });\n\n try {\n return 'topic:' + rlpEncode(object);\n } catch (error) {\n console.log(error);\n }\n }\n try {\n throw new Error();\n } catch(e) {\n console.log(e.stack);\n }\n\n throw new Error('invalid event - ' + object);\n}\n\nfunction parseEventString(string) {\n if (string.substring(0, 3) === 'tx:') {\n return {type: 'transaction', hash: string.substring(3)};\n\n } else if (string === 'block') {\n return {type: 'block'};\n\n } else if (string === 'pending') {\n return {type: 'pending'};\n\n } else if (string.substring(0, 8) === 'address:') {\n return {type: 'address', address: string.substring(8)};\n\n } else if (string.substring(0, 6) === 'topic:') {\n try {\n var object = rlpDecode(string.substring(6));\n object = recurse(object, function(object) {\n if (object === '0x') { object = null; }\n return object;\n });\n return {type: 'topic', topic: object};\n } catch (error) {\n console.log(error);\n }\n }\n\n throw new Error('invalid event string');\n}\n//////////////////////////////\n// Provider Object\n\n\n/* @TODO:\ntype Event = {\n eventName: string,\n listener: any, // @TODO: Function any: any\n type: string,\n}\n*/\n\n// @TODO: Perhaps allow a SignDigestAsyncFunc?\n\n// Enable a simple signing function and provider to provide a full Signer\nexport class ProviderSigner extends Signer {\n readonly provider: Provider;\n readonly signDigest: SignDigestFunc;\n\n private _addressPromise: Promise;\n\n constructor(address: string | Promise, signDigest: SignDigestFunc, provider: Provider) {\n super();\n errors.checkNew(this, ProviderSigner);\n defineReadOnly(this, '_addressPromise', Promise.resolve(address));\n defineReadOnly(this, 'signDigest', signDigest);\n defineReadOnly(this, 'provider', provider);\n }\n\n getAddress(): Promise {\n return this._addressPromise;\n }\n\n signMessage(message: Arrayish | string): Promise {\n return Promise.resolve(joinSignature(this.signDigest(hashMessage(message))));\n }\n\n sendTransaction(transaction: TransactionRequest): Promise {\n transaction = shallowCopy(transaction);\n\n if (transaction.chainId == null) {\n transaction.chainId = this.provider.getNetwork().then((network) => {\n return network.chainId;\n });\n }\n\n if (transaction.from == null) {\n transaction.from = this.getAddress();\n }\n\n if (transaction.gasLimit == null) {\n transaction.gasLimit = this.provider.estimateGas(transaction);\n }\n\n if (transaction.gasPrice == null) {\n transaction.gasPrice = this.provider.getGasPrice();\n }\n\n return resolveProperties(transaction).then((tx) => {\n let signedTx = signTransaction(tx, this.signDigest);\n return this._addressPromise.then((address) => {\n if (parseTransaction(signedTx).from !== address) {\n errors.throwError('signing address does not match expected address', errors.UNKNOWN_ERROR, { address: parseTransaction(signedTx).from, expectedAddress: address, signedTransaction: signedTx });\n }\n return this.provider.sendTransaction(signedTx);\n });\n });\n }\n}\n\nexport class Provider {\n private _network: Network;\n\n // string => Event\n private _events: any;\n protected _emitted: any;\n\n private _pollingInterval: number;\n private _poller: any; // @TODO: what does TypeScript thing setInterval returns?\n\n private _lastBlockNumber: number;\n\n // string => BigNumber\n private _balances: any;\n\n\n /**\n * ready\n *\n * A Promise that resolves only once the provider is ready.\n *\n * Sub-classes that call the super with a network without a chainId\n * MUST set this. Standard named networks have a known chainId.\n *\n */\n protected ready: Promise;\n\n constructor(network: Networkish | Promise) {\n errors.checkNew(this, Provider);\n\n if (network instanceof Promise) {\n defineReadOnly(this, 'ready', network.then((network) => {\n defineReadOnly(this, '_network', network);\n return network;\n }));\n\n } else {\n let knownNetwork = getNetwork((network == null) ? 'homestead': network);\n if (knownNetwork) {\n defineReadOnly(this, '_network', knownNetwork);\n defineReadOnly(this, 'ready', Promise.resolve(this._network));\n\n } else {\n errors.throwError('invalid network', errors.INVALID_ARGUMENT, { arg: 'network', value: network });\n }\n }\n\n this._lastBlockNumber = -2;\n\n // Balances being watched for changes\n this._balances = {};\n\n // Events being listened to\n this._events = {};\n\n this._pollingInterval = 4000;\n\n // We use this to track recent emitted events; for example, if we emit a \"block\" of 100\n // and we get a `getBlock(100)` request which would result in null, we should retry\n // until we get a response. This provides devs with a consistent view. Similarly for\n // transaction hashes.\n this._emitted = { block: this._lastBlockNumber };\n }\n\n private _doPoll(): void {\n this.getBlockNumber().then((blockNumber) => {\n\n // If the block hasn't changed, meh.\n if (blockNumber === this._lastBlockNumber) { return; }\n\n if (this._lastBlockNumber === -2) { this._lastBlockNumber = blockNumber - 1; }\n\n // Notify all listener for each block that has passed\n for (var i = this._lastBlockNumber + 1; i <= blockNumber; i++) {\n if (this._emitted.block < i) {\n this._emitted.block = i;\n\n // Evict any transaction hashes or block hashes over 12 blocks\n // old, since they should not return null anyways\n Object.keys(this._emitted).forEach((key) => {\n if (key === 'block') { return; }\n\n if (this._emitted[key] > i + 12) {\n delete this._emitted[key];\n }\n });\n }\n this.emit('block', i);\n }\n\n // Sweep balances and remove addresses we no longer have events for\n var newBalances: any = {};\n\n // Find all transaction hashes we are waiting on\n Object.keys(this._events).forEach((eventName) => {\n var event = parseEventString(eventName);\n\n if (event.type === 'transaction') {\n this.getTransaction(event.hash).then((transaction) => {\n if (!transaction || transaction.blockNumber == null) { return; }\n this._emitted['t:' + transaction.hash.toLowerCase()] = transaction.blockNumber;\n this.emit(event.hash, transaction);\n });\n\n } else if (event.type === 'address') {\n if (this._balances[event.address]) {\n newBalances[event.address] = this._balances[event.address];\n }\n this.getBalance(event.address, 'latest').then(function(balance) {\n var lastBalance = this._balances[event.address];\n if (lastBalance && balance.eq(lastBalance)) { return; }\n this._balances[event.address] = balance;\n this.emit(event.address, balance);\n });\n\n } else if (event.type === 'topic') {\n this.getLogs({\n fromBlock: this._lastBlockNumber + 1,\n toBlock: blockNumber,\n topics: event.topic\n }).then((logs) => {\n if (logs.length === 0) { return; }\n logs.forEach((log) => {\n this._emitted['b:' + log.blockHash.toLowerCase()] = log.blockNumber;\n this._emitted['t:' + log.transactionHash.toLowerCase()] = log.blockNumber;\n this.emit(event.topic, log);\n });\n });\n }\n });\n\n this._lastBlockNumber = blockNumber;\n\n this._balances = newBalances;\n });\n this.doPoll();\n }\n\n resetEventsBlock(blockNumber: number): void {\n this._lastBlockNumber = this.blockNumber;\n this._doPoll();\n }\n\n get network(): Network {\n return this._network;\n }\n\n getNetwork(): Promise {\n return this.ready;\n }\n\n get blockNumber(): number {\n if (this._lastBlockNumber < 0) { return null; }\n return this._lastBlockNumber;\n }\n\n get polling(): boolean {\n return (this._poller != null);\n }\n\n set polling(value: boolean) {\n setTimeout(() => {\n if (value && !this._poller) {\n this._poller = setInterval(this._doPoll.bind(this), this.pollingInterval);\n\n } else if (!value && this._poller) {\n clearInterval(this._poller);\n this._poller = null;\n }\n }, 0);\n }\n\n get pollingInterval(): number {\n return this._pollingInterval;\n }\n\n set pollingInterval(value: number) {\n if (typeof(value) !== 'number' || value <= 0 || Math.trunc(value) != value) {\n throw new Error('invalid polling interval');\n }\n\n this._pollingInterval = value;\n\n if (this._poller) {\n clearInterval(this._poller);\n this._poller = setInterval(() => { this._doPoll() }, this._pollingInterval);\n }\n }\n\n // @TODO: Add .poller which must be an event emitter with a 'start', 'stop' and 'block' event;\n // this will be used once we move to the WebSocket or other alternatives to polling\n\n waitForTransaction(transactionHash: string, timeout?: number): Promise {\n var self = this;\n return new Promise(function(resolve, reject) {\n var timer = null;\n\n function complete(transaction) {\n if (timer) { clearTimeout(timer); }\n resolve(transaction);\n }\n\n self.once(transactionHash, complete);\n\n if (typeof(timeout) === 'number' && timeout > 0) {\n timer = setTimeout(function() {\n self.removeListener(transactionHash, complete);\n reject(new Error('timeout'));\n }, timeout);\n }\n });\n }\n\n getBlockNumber(): Promise {\n return this.ready.then(() => {\n return this.perform('getBlockNumber', { }).then((result) => {\n var value = Math.trunc(result);\n if (value != result) { throw new Error('invalid response - getBlockNumber'); }\n return value;\n });\n });\n }\n\n getGasPrice(): Promise {\n return this.ready.then(() => {\n return this.perform('getGasPrice', { }).then((result) => {\n return bigNumberify(result);\n });\n });\n }\n\n\n getBalance(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return this.perform('getBalance', params).then((result) => {\n return bigNumberify(result);\n });\n });\n });\n });\n }\n\n getTransactionCount(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return this.perform('getTransactionCount', params).then((result) => {\n var value = parseInt(result);\n if (value != result) { throw new Error('invalid response - getTransactionCount'); }\n return value;\n });\n });\n });\n });\n }\n\n getCode(addressOrName: string | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = {address: address, blockTag: checkBlockTag(blockTag)};\n return this.perform('getCode', params).then((result) => {\n return hexlify(result);\n });\n });\n });\n });\n }\n\n getStorageAt(addressOrName: string | Promise, position: BigNumberish | Promise, blockTag?: BlockTag | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(({ addressOrName, position, blockTag }) => {\n return this.resolveName(addressOrName).then((address) => {\n var params = {\n address: address,\n blockTag: checkBlockTag(blockTag),\n position: hexStripZeros(hexlify(position)),\n };\n return this.perform('getStorageAt', params).then((result) => {\n return hexlify(result);\n });\n });\n });\n });\n }\n\n sendTransaction(signedTransaction: string | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ signedTransaction: signedTransaction }).then(({ signedTransaction }) => {\n var params = { signedTransaction: hexlify(signedTransaction) };\n return this.perform('sendTransaction', params).then((hash) => {\n if (hexDataLength(hash) !== 32) { throw new Error('invalid response - sendTransaction'); }\n\n // A signed transaction always has a from (and we add wait below)\n var tx = parseTransaction(signedTransaction);\n\n // Check the hash we expect is the same as the hash the server reported\n if (tx.hash !== hash) {\n errors.throwError('Transaction hash mismatch from Proivder.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n this._emitted['t:' + tx.hash.toLowerCase()] = 'pending';\n tx.wait = (timeout?: number) => {\n return this.waitForTransaction(hash, timeout);\n };\n\n return tx;\n });\n });\n });\n }\n\n\n call(transaction: TransactionRequest): Promise {\n return this.ready.then(() => {\n return resolveProperties(transaction).then((transaction) => {\n return this._resolveNames(transaction, [ 'to', 'from' ]).then((transaction) => {\n var params = { transaction: checkTransactionRequest(transaction) };\n return this.perform('call', params).then((result) => {\n return hexlify(result);\n });\n });\n });\n });\n }\n\n estimateGas(transaction: TransactionRequest) {\n return this.ready.then(() => {\n return resolveProperties(transaction).then((transaction) => {\n return this._resolveNames(transaction, [ 'to', 'from' ]).then((transaction) => {\n var params = {transaction: checkTransactionRequest(transaction)};\n return this.perform('estimateGas', params).then((result) => {\n return bigNumberify(result);\n });\n });\n });\n });\n }\n\n getBlock(blockHashOrBlockTag: BlockTag | string | Promise): Promise {\n return this.ready.then(() => {\n return resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(({ blockHashOrBlockTag }) => {\n try {\n var blockHash = hexlify(blockHashOrBlockTag);\n if (hexDataLength(blockHash) === 32) {\n return stallPromise(() => {\n return (this._emitted['b:' + blockHash.toLowerCase()] == null);\n }, () => {\n return this.perform('getBlock', {blockHash: blockHash}).then((block) => {\n if (block == null) { return null; }\n return checkBlock(block);\n });\n });\n }\n } catch (error) { }\n\n try {\n var blockTag = checkBlockTag(blockHashOrBlockTag);\n return stallPromise(() => {\n if (isHexString(blockTag)) {\n var blockNumber = parseInt(blockTag.substring(2), 16);\n return blockNumber > this._emitted.block;\n }\n return true;\n }, () => {\n return this.perform('getBlock', { blockTag: blockTag }).then((block) => {\n if (block == null) { return null; }\n return checkBlock(block);\n });\n });\n } catch (error) { }\n\n throw new Error('invalid block hash or block tag');\n });\n });\n }\n\n getTransaction(transactionHash: string): Promise {\n return this.ready.then(() => {\n return resolveProperties({ transactionHash: transactionHash }).then(({ transactionHash }) => {\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(() => {\n return (this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, () => {\n return this.perform('getTransaction', params).then((result) => {\n if (result != null) { result = checkTransactionResponse(result); }\n return result;\n });\n });\n });\n });\n }\n\n getTransactionReceipt(transactionHash: string): Promise {\n return this.ready.then(() => {\n return resolveProperties({ transactionHash: transactionHash }).then(({ transactionHash }) => {\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(() => {\n return (this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, () => {\n return this.perform('getTransactionReceipt', params).then((result) => {\n if (result != null) { result = checkTransactionReceipt(result); }\n return result;\n });\n });\n });\n });\n }\n\n getLogs(filter: Filter): Promise>{\n return this.ready.then(() => {\n return resolveProperties(filter).then((filter) => {\n return this._resolveNames(filter, ['address']).then((filter) => {\n var params = { filter: checkFilter(filter) };\n return this.perform('getLogs', params).then((result) => {\n return arrayOf(checkLog)(result);\n });\n });\n });\n });\n }\n\n getEtherPrice(): Promise {\n return this.ready.then(() => {\n return this.perform('getEtherPrice', {}).then((result) => {\n // @TODO: Check valid float\n return result;\n });\n });\n }\n\n _resolveNames(object: any, keys: Array): Promise {\n var promises = [];\n\n var result = copyObject(object);\n\n keys.forEach(function(key) {\n if (result[key] === undefined) { return; }\n promises.push(this.resolveName(result[key]).then(function(address) {\n result[key] = address;\n }));\n }, this);\n\n return Promise.all(promises).then(function() { return result; });\n }\n\n _getResolver(name: string): Promise {\n // Get the resolver from the blockchain\n return this.getNetwork().then((network) => {\n\n // No ENS...\n if (!network.ensAddress) {\n errors.throwError(\n 'network does support ENS',\n errors.UNSUPPORTED_OPERATION,\n { operation: 'ENS', network: network.name }\n );\n }\n\n // keccak256('resolver(bytes32)')\n var data = '0x0178b8bf' + namehash(name).substring(2);\n var transaction = { to: network.ensAddress, data: data };\n\n return this.call(transaction).then((data) => {\n\n // extract the address from the data\n if (hexDataLength(data) !== 32) { return null; }\n return getAddress(hexDataSlice(data, 12));\n });\n });\n }\n\n resolveName(name: string | Promise): Promise {\n\n // If it is a promise, resolve it then recurse\n if (name instanceof Promise) {\n return name.then((addressOrName) => {\n return this.resolveName(addressOrName);\n });\n }\n\n // If it is already an address, nothing to resolve\n try {\n return Promise.resolve(getAddress(name));\n } catch (error) { }\n\n var self = this;\n\n var nodeHash = namehash(name);\n\n // Get the addr from the resovler\n return this._getResolver(name).then(function(resolverAddress) {\n\n // keccak256('addr(bytes32)')\n var data = '0x3b3b57de' + nodeHash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n\n // extract the address from the data\n }).then(function(data) {\n if (hexDataLength(data) !== 32) { return null; }\n var address = getAddress(hexDataSlice(data, 12));\n if (address === '0x0000000000000000000000000000000000000000') { return null; }\n return address;\n });\n }\n\n lookupAddress(address: string | Promise): Promise {\n if (address instanceof Promise) {\n return address.then((address) => {\n return this.lookupAddress(address);\n });\n }\n\n address = getAddress(address);\n\n var name = address.substring(2) + '.addr.reverse'\n var nodehash = namehash(name);\n\n var self = this;\n\n return this._getResolver(name).then(function(resolverAddress) {\n if (!resolverAddress) { return null; }\n\n // keccak('name(bytes32)')\n var data = '0x691f3431' + nodehash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n\n }).then(function(data) {\n // Strip off the \"0x\"\n data = data.substring(2);\n\n // Strip off the dynamic string pointer (0x20)\n if (data.length < 64) { return null; }\n data = data.substring(64);\n\n if (data.length < 64) { return null; }\n var length = bigNumberify('0x' + data.substring(0, 64)).toNumber();\n data = data.substring(64);\n\n if (2 * length > data.length) { return null; }\n\n var name = toUtf8String('0x' + data.substring(0, 2 * length));\n\n // Make sure the reverse record matches the foward record\n return self.resolveName(name).then(function(addr) {\n if (addr != address) { return null; }\n return name;\n });\n\n });\n }\n\n doPoll(): void {\n }\n\n perform(method: string, params: any): Promise {\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n }\n\n _startPending(): void {\n console.log('WARNING: this provider does not support pending events');\n }\n\n _stopPending(): void {\n }\n\n on(eventName, listener): Provider {\n var key = getEventString(eventName);\n if (!this._events[key]) { this._events[key] = []; }\n this._events[key].push({eventName: eventName, listener: listener, type: 'on'});\n if (key === 'pending') { this._startPending(); }\n this.polling = true;\n\n return this;\n }\n\n once(eventName, listener): Provider {\n var key = getEventString(eventName);\n if (!this._events[key]) { this._events[key] = []; }\n this._events[key].push({eventName: eventName, listener: listener, type: 'once'});\n if (key === 'pending') { this._startPending(); }\n this.polling = true;\n\n return this;\n }\n\n emit(eventName, ...args): boolean {\n let result = false;\n\n var key = getEventString(eventName);\n\n //var args = Array.prototype.slice.call(arguments, 1);\n var listeners = this._events[key];\n if (!listeners) { return result; }\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n if (listener.type === 'once') {\n listeners.splice(i, 1);\n i--;\n }\n\n try {\n listener.listener.apply(this, args);\n result = true;\n } catch (error) {\n console.log('Event Listener Error: ' + error.message);\n }\n }\n\n if (listeners.length === 0) {\n delete this._events[key];\n if (key === 'pending') { this._stopPending(); }\n }\n\n if (this.listenerCount() === 0) { this.polling = false; }\n\n return result;\n }\n\n // @TODO: type EventName\n listenerCount(eventName?: any): number {\n if (!eventName) {\n var result = 0;\n for (var key in this._events) {\n result += this._events[key].length;\n }\n return result;\n }\n\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) { return 0; }\n return listeners.length;\n }\n\n // @TODO: func\n listeners(eventName): Array {\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) { return []; }\n var result = [];\n for (var i = 0; i < listeners.length; i++) {\n result.push(listeners[i].listener);\n }\n return result;\n }\n\n removeAllListeners(eventName): Provider {\n delete this._events[getEventString(eventName)];\n if (this.listenerCount() === 0) { this.polling = false; }\n\n return this;\n }\n\n removeListener(eventName, listener): Provider {\n var eventNameString = getEventString(eventName);\n var listeners = this._events[eventNameString];\n if (!listeners) { return this; }\n\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].listener === listener) {\n listeners.splice(i, 1);\n break;\n }\n }\n\n if (listeners.length === 0) {\n this.removeAllListeners(eventName);\n }\n\n return this;\n }\n}\n\n/*\nfunction inheritable(parent) {\n return function(child) {\n inherits(child, parent);\n defineProperty(child, 'inherits', inheritable(child));\n }\n}\n\ndefineProperty(Provider, 'inherits', inheritable(Provider));\n*/\n/*\nfunction(child) {\n inherits(child, Provider);\n child.inherits = function(grandchild) {\n inherits(grandchild, child)\n }\n});\n*/\n","'use strict';\n\nimport { Interface } from './interface';\n\nimport { Provider, TransactionResponse } from '../providers/provider';\nimport { Signer } from '../wallet/wallet';\n\nimport { getContractAddress } from '../utils/address';\nimport { isHexString } from '../utils/bytes';\nimport { ParamType } from '../utils/abi-coder';\nimport { BigNumber, ConstantZero } from '../utils/bignumber';\nimport { defineReadOnly, shallowCopy } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nvar allowedTransactionKeys = {\n data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true\n}\n\n// Recursively replaces ENS names with promises to resolve the name and\n// stalls until all promises have returned\n// @TODO: Expand this to resolve any promises too\nfunction resolveAddresses(provider, value, paramType): Promise {\n if (Array.isArray(paramType)) {\n var promises = [];\n paramType.forEach((paramType, index) => {\n var v = null;\n if (Array.isArray(value)) {\n v = value[index];\n } else {\n v = value[paramType.name];\n }\n promises.push(resolveAddresses(provider, v, paramType));\n });\n return Promise.all(promises);\n }\n\n if (paramType.type === 'address') {\n return provider.resolveName(value);\n }\n\n if (paramType.components) {\n return resolveAddresses(provider, value, paramType.components);\n }\n\n return Promise.resolve(value);\n}\n\n\ntype RunFunction = (...params: Array) => Promise;\n\nfunction runMethod(contract: Contract, functionName: string, estimateOnly: boolean): RunFunction {\n let method = contract.interface.functions[functionName];\n return function(...params): Promise {\n var tx: any = {}\n\n // If 1 extra parameter was passed in, it contains overrides\n if (params.length === method.inputs.length + 1 && typeof(params[params.length - 1]) === 'object') {\n tx = shallowCopy(params.pop());\n\n // Check for unexpected keys (e.g. using \"gas\" instead of \"gasLimit\")\n for (var key in tx) {\n if (!allowedTransactionKeys[key]) {\n throw new Error('unknown transaction override ' + key);\n }\n }\n }\n\n if (params.length != method.inputs.length) {\n throw new Error('incorrect number of arguments');\n }\n\n // Check overrides make sense\n ['data', 'to'].forEach(function(key) {\n if (tx[key] != null) {\n errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key })\n }\n });\n\n // Send to the contract address\n tx.to = contract.addressPromise;\n\n return resolveAddresses(contract.provider, params, method.inputs).then((params) => {\n tx.data = method.encode(params);\n if (method.type === 'call') {\n\n // Call (constant functions) always cost 0 ether\n if (estimateOnly) {\n return Promise.resolve(ConstantZero);\n }\n\n if (!contract.provider) {\n errors.throwError('call (constant functions) require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'call' })\n }\n\n // Check overrides make sense\n ['gasLimit', 'gasPrice', 'value'].forEach(function(key) {\n if (tx[key] != null) {\n throw new Error('call cannot override ' + key) ;\n }\n });\n\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress()\n }\n\n return contract.provider.call(tx).then((value) => {\n try {\n let result = method.decode(value);\n if (method.outputs.length === 1) {\n result = result[0];\n }\n return result;\n\n } catch (error) {\n if (value === '0x' && method.outputs.length > 0) {\n errors.throwError('call exception', errors.CALL_EXCEPTION, {\n address: contract.address,\n method: method.signature,\n value: params\n });\n }\n throw error;\n }\n });\n\n } else if (method.type === 'transaction') {\n\n // Only computing the transaction estimate\n if (estimateOnly) {\n if (!contract.provider) {\n errors.throwError('estimate gas require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'estimateGas' })\n }\n\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress()\n }\n\n return contract.provider.estimateGas(tx);\n }\n\n if (!contract.signer) {\n errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })\n }\n\n // Make sure they aren't overriding something they shouldn't\n if (tx.from != null) {\n errors.throwError('cannot override from in a transaction', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })\n }\n\n return contract.signer.sendTransaction(tx);\n }\n\n throw new Error('invalid type - ' + method.type);\n return null;\n });\n }\n}\n\nexport type ContractEstimate = (...params: Array) => Promise;\nexport type ContractFunction = (...params: Array) => Promise;\nexport type ContractEvent = (...params: Array) => void;\n\ninterface Bucket {\n [name: string]: T;\n}\n\nexport type Contractish = Array | Interface | string;\nexport class Contract {\n readonly address: string;\n readonly interface: Interface;\n\n readonly signer: Signer;\n readonly provider: Provider;\n\n readonly estimate: Bucket;\n readonly functions: Bucket;\n readonly events: Bucket;\n\n readonly addressPromise: Promise;\n\n // This is only set if the contract was created with a call to deploy\n readonly deployTransaction: TransactionResponse;\n\n // https://github.com/Microsoft/TypeScript/issues/5453\n // Once this issue is resolved (there are open PR) we can do this nicer\n // by making addressOrName default to null for 2 operand calls. :)\n\n constructor(addressOrName: string, contractInterface: Contractish, signerOrProvider: Signer | Provider) {\n errors.checkNew(this, Contract);\n\n // @TODO: Maybe still check the addressOrName looks like a valid address or name?\n //address = getAddress(address);\n if (contractInterface instanceof Interface) {\n defineReadOnly(this, 'interface', contractInterface);\n } else {\n defineReadOnly(this, 'interface', new Interface(contractInterface));\n }\n\n if (signerOrProvider instanceof Signer) {\n defineReadOnly(this, 'provider', signerOrProvider.provider);\n defineReadOnly(this, 'signer', signerOrProvider);\n } else if (signerOrProvider instanceof Provider) {\n defineReadOnly(this, 'provider', signerOrProvider);\n defineReadOnly(this, 'signer', null);\n } else {\n errors.throwError('invalid signer or provider', errors.INVALID_ARGUMENT, { arg: 'signerOrProvider', value: signerOrProvider });\n }\n\n defineReadOnly(this, 'estimate', { });\n defineReadOnly(this, 'events', { });\n defineReadOnly(this, 'functions', { });\n\n // Not connected to an on-chain instance, so do not connect functions and events\n if (!addressOrName) {\n defineReadOnly(this, 'address', null);\n defineReadOnly(this, 'addressPromise', Promise.resolve(null));\n return;\n }\n\n defineReadOnly(this, 'address', addressOrName);\n defineReadOnly(this, 'addressPromise', this.provider.resolveName(addressOrName));\n\n Object.keys(this.interface.functions).forEach((name) => {\n var run = runMethod(this, name, false);\n\n if (this[name] == null) {\n defineReadOnly(this, name, run);\n } else {\n console.log('WARNING: Multiple definitions for ' + name);\n }\n\n if (this.functions[name] == null) {\n defineReadOnly(this.functions, name, run);\n defineReadOnly(this.estimate, name, runMethod(this, name, true));\n }\n });\n\n Object.keys(this.interface.events).forEach((eventName) => {\n let eventInfo = this.interface.events[eventName];\n\n let eventCallback = null;\n\n let contract = this;\n function handleEvent(log) {\n contract.addressPromise.then((address) => {\n // Not meant for us (the topics just has the same name)\n if (address != log.address) { return; }\n\n try {\n let result = eventInfo.decode(log.data, log.topics);\n\n // Some useful things to have with the log\n log.args = result;\n log.event = eventName;\n log.parse = eventInfo.parse;\n log.removeListener = function() {\n contract.provider.removeListener([ eventInfo.topic ], handleEvent);\n }\n\n log.getBlock = function() { return contract.provider.getBlock(log.blockHash);; }\n log.getTransaction = function() { return contract.provider.getTransaction(log.transactionHash); }\n log.getTransactionReceipt = function() { return contract.provider.getTransactionReceipt(log.transactionHash); }\n log.eventSignature = eventInfo.signature;\n\n eventCallback.apply(log, Array.prototype.slice.call(result));\n } catch (error) {\n console.log(error);\n }\n });\n }\n\n var property = {\n enumerable: true,\n get: function() {\n return eventCallback;\n },\n set: function(value) {\n if (!value) { value = null; }\n\n if (!contract.provider) {\n errors.throwError('events require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'events' })\n }\n\n if (!value && eventCallback) {\n contract.provider.removeListener([ eventInfo.topic ], handleEvent);\n\n } else if (value && !eventCallback) {\n contract.provider.on([ eventInfo.topic ], handleEvent);\n }\n\n eventCallback = value;\n }\n };\n\n var propertyName = 'on' + eventName.toLowerCase();\n if (this[propertyName] == null) {\n Object.defineProperty(this, propertyName, property);\n }\n\n Object.defineProperty(this.events, eventName, property);\n\n }, this);\n }\n\n // Reconnect to a different signer or provider\n connect(signerOrProvider: Signer | Provider): Contract {\n return new Contract(this.address, this.interface, signerOrProvider);\n }\n\n // Deploy the contract with the bytecode, resolving to the deployed address.\n // Use contract.deployTransaction.wait() to wait until the contract has\n // been mined.\n deploy(bytecode: string, ...args: Array): Promise {\n if (this.signer == null) {\n throw new Error('missing signer'); // @TODO: errors.throwError\n }\n\n if (!isHexString(bytecode)) {\n errors.throwError('bytecode must be a valid hex string', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n\n if ((bytecode.length % 2) !== 0) {\n errors.throwError('bytecode must be valid data (even length)', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n\n // @TODO: overrides of args.length = this.interface.deployFunction.inputs.length + 1\n return this.signer.sendTransaction({\n data: this.interface.deployFunction.encode(bytecode, args)\n }).then((tx) => {\n let contract = new Contract(getContractAddress(tx), this.interface, this.signer || this.provider);\n defineReadOnly(contract, 'deployTransaction', tx);\n return contract;\n });\n }\n}\n","'use strict';\n\nimport { Contract } from './contract';\nimport { Interface } from './interface';\n\nexport {\n Contract,\n Interface\n}\n\n","'use strict';\n\nimport { arrayify, Arrayish } from './bytes';\n\ndeclare class Buffer implements ArrayLike {\n constructor(data: any, encoding?: string);\n toString(encoding?: string): any;\n [key: number]: number;\n length: number;\n}\n\nexport function decode(textData: string): Uint8Array {\n return arrayify(new Uint8Array(new Buffer(textData, 'base64')));\n};\n\nexport function encode(data: Arrayish): string {\n return new Buffer(arrayify(data)).toString('base64');\n}\n","\nimport { XMLHttpRequest } from 'xmlhttprequest';\nimport { toUtf8Bytes } from './utf8';\nimport { encode as base64Encode } from './base64';\n\nexport type ConnectionInfo = {\n url: string,\n user?: string,\n password?: string,\n allowInsecure?: boolean\n};\n\nimport * as errors from './errors';\n\nexport type ProcessFunc = (value: any) => any;\n\ntype Header = { key: string, value: string };\n\nexport function fetchJson(url: string | ConnectionInfo, json: string, processFunc: ProcessFunc): Promise {\n let headers: Array
= [ ];\n\n if (typeof(url) === 'object' && url.url != null) {\n if (url.url == null) {\n errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });\n }\n if (url.user != null && url.password != null) {\n if (url.url.substring(0, 6) !== 'https:' && url.allowInsecure !== true) {\n errors.throwError(\n 'basic authentication requires a secure https url', \n errors.INVALID_ARGUMENT,\n { arg: 'url', url: url.url, user: url.user, password: '[REDACTED]' }\n );\n }\n\n var authorization = url.user + ':' + url.password;\n headers.push({\n key: 'Authorization',\n value: 'Basic ' + base64Encode(toUtf8Bytes(authorization))\n });\n }\n\n url = url.url;\n }\n\n return new Promise(function(resolve, reject) {\n var request = new XMLHttpRequest();\n\n if (json) {\n request.open('POST', url, true);\n headers.push({ key: 'Content-Type', value: 'application/json' });\n } else {\n request.open('GET', url, true);\n }\n\n headers.forEach(function(header) {\n request.setRequestHeader(header.key, header.value);\n });\n\n request.onreadystatechange = function() {\n if (request.readyState !== 4) { return; }\n\n try {\n var result = JSON.parse(request.responseText);\n } catch (error) {\n // @TODO: not any!\n var jsonError: any = new Error('invalid json response');\n jsonError.orginialError = error;\n jsonError.responseText = request.responseText;\n jsonError.url = url;\n reject(jsonError);\n return;\n }\n\n if (processFunc) {\n try {\n result = processFunc(result);\n } catch (error) {\n error.url = url;\n error.body = json;\n error.responseText = request.responseText;\n reject(error);\n return;\n }\n }\n\n if (request.status != 200) {\n // @TODO: not any!\n var error: any = new Error('invalid response - ' + request.status);\n error.statusCode = request.statusCode;\n reject(error);\n return;\n }\n\n resolve(result);\n };\n\n request.onerror = function(error) {\n reject(error);\n }\n\n try {\n if (json) {\n request.send(json);\n } else {\n request.send();\n }\n\n } catch (error) {\n // @TODO: not any!\n var connectionError: any = new Error('connection error');\n connectionError.error = error;\n reject(connectionError);\n }\n });\n}\n\n","\nimport { BlockTag, checkTransactionResponse, Provider, TransactionRequest, TransactionResponse } from './provider';\nimport { Networkish } from './networks';\n\nimport { hexlify, hexStripZeros } from '../utils/bytes';\nimport { defineReadOnly } from '../utils/properties';\nimport { fetchJson } from '../utils/web';\n\nimport * as errors from '../utils/errors';\n\n// The transaction has already been sanitized by the calls in Provider\nfunction getTransactionString(transaction: TransactionRequest): string {\n var result = [];\n for (var key in transaction) {\n if (transaction[key] == null) { continue; }\n var value = hexlify(transaction[key]);\n if ({ gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) {\n value = hexStripZeros(value);\n }\n result.push(key + '=' + value);\n }\n return result.join('&');\n}\n\nfunction getResult(result) {\n // getLogs, getHistory have weird success responses\n if (result.status == 0 && (result.message === 'No records found' || result.message === 'No transactions found')) {\n return result.result;\n }\n\n if (result.status != 1 || result.message != 'OK') {\n // @TODO: not any\n var error: any = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n\n return result.result;\n}\n\nfunction getJsonResult(result) {\n if (result.jsonrpc != '2.0') {\n // @TODO: not any\n let error: any = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n\n if (result.error) {\n // @TODO: not any\n let error: any = new Error(result.error.message || 'unknown error');\n if (result.error.code) { error.code = result.error.code; }\n if (result.error.data) { error.data = result.error.data; }\n throw error;\n }\n\n return result.result;\n}\n\n// The blockTag was normalized as a string by the Provider pre-perform operations\nfunction checkLogTag(blockTag: string): number | \"latest\" {\n if (blockTag === 'pending') { throw new Error('pending not supported'); }\n if (blockTag === 'latest') { return blockTag; }\n\n return parseInt(blockTag.substring(2), 16);\n}\n\n\nexport class EtherscanProvider extends Provider{\n readonly baseUrl: string;\n readonly apiKey: string;\n constructor(network?: Networkish, apiKey?: string) {\n super(network);\n errors.checkNew(this, EtherscanProvider);\n\n let name = 'invalid';\n if (this.network) { name = this.network.name; }\n\n let baseUrl = null;\n switch(name) {\n case 'homestead':\n baseUrl = 'https://api.etherscan.io';\n break;\n case 'ropsten':\n baseUrl = 'https://api-ropsten.etherscan.io';\n break;\n case 'rinkeby':\n baseUrl = 'https://api-rinkeby.etherscan.io';\n break;\n case 'kovan':\n baseUrl = 'https://api-kovan.etherscan.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n\n defineReadOnly(this, 'baseUrl', baseUrl);\n defineReadOnly(this, 'apiKey', apiKey);\n }\n\n\n perform(method: string, params: any) {\n //if (!params) { params = {}; }\n\n var url = this.baseUrl;\n\n let apiKey = '';\n if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; }\n\n switch (method) {\n case 'getBlockNumber':\n url += '/api?module=proxy&action=eth_blockNumber' + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getGasPrice':\n url += '/api?module=proxy&action=eth_gasPrice' + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getBalance':\n // Returns base-10 result\n url += '/api?module=account&action=balance&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getResult);\n\n case 'getTransactionCount':\n url += '/api?module=proxy&action=eth_getTransactionCount&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'getCode':\n url += '/api?module=proxy&action=eth_getCode&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getStorageAt':\n url += '/api?module=proxy&action=eth_getStorageAt&address=' + params.address;\n url += '&position=' + params.position;\n url += '&tag=' + params.blockTag + apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'sendTransaction':\n url += '/api?module=proxy&action=eth_sendRawTransaction&hex=' + params.signedTransaction;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'getBlock':\n if (params.blockTag) {\n url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;\n url += '&boolean=false';\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n }\n throw new Error('getBlock by blockHash not implmeneted');\n\n case 'getTransaction':\n url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getTransactionReceipt':\n url += '/api?module=proxy&action=eth_getTransactionReceipt&txhash=' + params.transactionHash;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n\n case 'call':\n var transaction = getTransactionString(params.transaction);\n if (transaction) { transaction = '&' + transaction; }\n url += '/api?module=proxy&action=eth_call' + transaction;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'estimateGas':\n var transaction = getTransactionString(params.transaction);\n if (transaction) { transaction = '&' + transaction; }\n url += '/api?module=proxy&action=eth_estimateGas&' + transaction;\n url += apiKey;\n return fetchJson(url, null, getJsonResult);\n\n case 'getLogs':\n url += '/api?module=logs&action=getLogs';\n try {\n if (params.filter.fromBlock) {\n url += '&fromBlock=' + checkLogTag(params.filter.fromBlock);\n }\n\n if (params.filter.toBlock) {\n url += '&toBlock=' + checkLogTag(params.filter.toBlock);\n }\n\n if (params.filter.address) {\n url += '&address=' + params.filter.address;\n }\n\n // @TODO: We can handle slightly more complicated logs using the logs API\n if (params.filter.topics && params.filter.topics.length > 0) {\n if (params.filter.topics.length > 1) {\n throw new Error('unsupported topic format');\n }\n var topic0 = params.filter.topics[0];\n if (typeof(topic0) !== 'string' || topic0.length !== 66) {\n throw new Error('unsupported topic0 format');\n }\n url += '&topic0=' + topic0;\n }\n } catch (error) {\n return Promise.reject(error);\n }\n\n url += apiKey;\n\n var self = this;\n return fetchJson(url, null, getResult).then(function(logs) {\n var txs = {};\n\n var seq = Promise.resolve();\n logs.forEach(function(log) {\n seq = seq.then(function() {\n if (log.blockHash != null) { return null; }\n log.blockHash = txs[log.transactionHash];\n if (log.blockHash == null) {\n return self.getTransaction(log.transactionHash).then(function(tx) {\n txs[log.transactionHash] = tx.blockHash;\n log.blockHash = tx.blockHash;\n });\n }\n return null;\n });\n });\n\n return seq.then(function() {\n return logs;\n });\n });\n\n case 'getEtherPrice':\n if (this.network.name !== 'homestead') { return Promise.resolve(0.0); }\n url += '/api?module=stats&action=ethprice';\n url += apiKey;\n return fetchJson(url, null, getResult).then(function(result) {\n return parseFloat(result.ethusd);\n });\n\n default:\n break;\n }\n\n return super.perform(method, params);\n }\n\n // @TODO: Allow startBlock and endBlock to be Promises\n getHistory(addressOrName: string | Promise, startBlock?: BlockTag, endBlock?: BlockTag): Promise> {\n\n let url = this.baseUrl;\n\n let apiKey = '';\n if (this.apiKey) { apiKey += '&apikey=' + this.apiKey; }\n\n if (startBlock == null) { startBlock = 0; }\n if (endBlock == null) { endBlock = 99999999; }\n\n return this.resolveName(addressOrName).then((address) => {\n url += '/api?module=account&action=txlist&address=' + address;\n url += '&startblock=' + startBlock;\n url += '&endblock=' + endBlock;\n url += '&sort=asc' + apiKey;\n\n return fetchJson(url, null, getResult).then((result) => {\n var output: Array = [];\n result.forEach((tx) => {\n ['contractAddress', 'to'].forEach(function(key) {\n if (tx[key] == '') { delete tx[key]; }\n });\n if (tx.creates == null && tx.contractAddress != null) {\n tx.creates = tx.contractAddress;\n }\n let item = checkTransactionResponse(tx);\n if (tx.timeStamp) { item.timestamp = parseInt(tx.timeStamp); }\n output.push(item);\n });\n return output;\n });\n });\n }\n}\n","'use strict';\n\nimport { Network } from './networks';\nimport { Provider } from './provider';\n\nimport * as errors from '../utils/errors';\n\n// Returns:\n// - true is all networks match\n// - false if any network is null\n// - throws if any 2 networks do not match\nfunction checkNetworks(networks: Array): boolean {\n var result = true;\n\n let check = null;\n networks.forEach((network) => {\n\n // Null\n if (network == null) {\n result = false;\n return;\n }\n\n // Have nothing to compre to yet\n if (check == null) {\n check = network;\n return;\n }\n\n // Matches!\n if (check.name === network.name &&\n check.chainId === network.chainId &&\n check.ensAddress === network.ensAddress) { return; }\n\n errors.throwError(\n 'provider mismatch',\n errors.INVALID_ARGUMENT,\n { arg: 'providers', networks: networks }\n );\n });\n\n return result;\n}\n\nexport class FallbackProvider extends Provider {\n private _providers: Array;\n\n constructor(providers: Array) {\n\n if (providers.length === 0) { throw new Error('no providers'); }\n\n // All networks are ready, we can know the network for certain\n let ready = checkNetworks(providers.map((p) => p.network));\n if (ready) {\n super(providers[0].network);\n\n } else {\n // The network won't be known until all child providers know\n let ready = Promise.all(providers.map((p) => p.getNetwork())).then((networks) => {\n if (!checkNetworks(networks)) {\n errors.throwError('getNetwork returned null', errors.UNKNOWN_ERROR, { })\n }\n return networks[0];\n });\n\n super(ready);\n }\n errors.checkNew(this, FallbackProvider);\n\n // Preserve a copy, so we don't get mutated\n this._providers = providers.slice(0);\n }\n\n get providers(): Array {\n // Return a copy, so we don't get mutated\n return this._providers.slice(0);\n }\n\n perform(method: string, params: any): any {\n // Creates a copy of the providers array\n var providers = this.providers;\n\n return new Promise((resolve, reject) => {\n var firstError = null;\n function next() {\n if (!providers.length) {\n reject(firstError);\n return;\n }\n\n var provider = providers.shift();\n provider.perform(method, params).then(function(result) {\n resolve(result);\n }, function (error) {\n if (!firstError) { firstError = error; }\n next();\n });\n }\n next();\n });\n }\n}\n\n","'use strict';\n\n// See: https://github.com/ethereum/wiki/wiki/JSON-RPC\n\nimport { getNetwork, Network, Networkish } from './networks';\nimport { BlockTag, Provider, TransactionRequest, TransactionResponse } from './provider';\nimport { Signer } from '../wallet/wallet';\n\nimport { getAddress } from '../utils/address';\nimport { BigNumber } from '../utils/bignumber';\nimport { Arrayish, hexlify, hexStripZeros } from '../utils/bytes';\nimport { defineReadOnly, resolveProperties } from '../utils/properties';\nimport { toUtf8Bytes } from '../utils/utf8';\nimport { ConnectionInfo, fetchJson } from '../utils/web';\n\nimport * as errors from '../utils/errors';\n\nfunction timer(timeout: number): Promise {\n return new Promise(function(resolve) {\n setTimeout(function() {\n resolve();\n }, timeout);\n });\n}\n\nfunction getResult(payload) {\n if (payload.error) {\n // @TODO: not any\n var error: any = new Error(payload.error.message);\n error.code = payload.error.code;\n error.data = payload.error.data;\n throw error;\n }\n\n return payload.result;\n}\n\n// Convert an ethers.js transaction into a JSON-RPC transaction\n// - gasLimit => gas\n// - All values hexlified\n// - All numeric values zero-striped\nexport function hexlifyTransaction(transaction: TransactionRequest) {\n var result: any = {};\n\n // Some nodes (INFURA ropsten; INFURA mainnet is fine) don't like extra zeros.\n ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(function(key) {\n if (transaction[key] == null) { return; }\n let value = hexStripZeros(hexlify(transaction[key]));\n if (key === 'gasLimit') { key = 'gas'; }\n result[key] = value;\n });\n\n ['from', 'to', 'data'].forEach(function(key) {\n if (transaction[key] == null) { return; }\n result[key] = hexlify(transaction[key]);\n });\n\n return result;\n}\n\nfunction getLowerCase(value: string): string {\n if (value) { return value.toLowerCase(); }\n return value;\n}\n\nexport class JsonRpcSigner extends Signer {\n readonly provider: JsonRpcProvider;\n private _address: string;\n\n constructor(provider: JsonRpcProvider, address?: string) {\n super();\n errors.checkNew(this, JsonRpcSigner);\n\n defineReadOnly(this, 'provider', provider);\n\n // Statically attach to a given address\n if (address) {\n defineReadOnly(this, '_address', address);\n }\n }\n\n get address(): string {\n if (!this._address) {\n errors.throwError('no sync sync address available; use getAddress', errors.UNSUPPORTED_OPERATION, { operation: 'address' });\n }\n return this._address\n }\n\n getAddress(): Promise {\n if (this._address) {\n return Promise.resolve(this._address);\n }\n\n return this.provider.send('eth_accounts', []).then((accounts) => {\n if (accounts.length === 0) {\n errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });\n }\n return getAddress(accounts[0]);\n });\n }\n\n getBalance(blockTag?: BlockTag): Promise {\n return this.provider.getBalance(this.getAddress(), blockTag);\n }\n\n getTransactionCount(blockTag): Promise {\n return this.provider.getTransactionCount(this.getAddress(), blockTag);\n }\n\n sendTransaction(transaction: TransactionRequest): Promise {\n let tx = hexlifyTransaction(transaction);\n\n if (tx.from == null) {\n tx.from = this.getAddress().then((address) => {\n if (!address) { return null; }\n return address.toLowerCase();\n });\n }\n\n return resolveProperties(tx).then((tx) => {\n return this.provider.send('eth_sendTransaction', [ transaction ]);\n });\n }\n\n signMessage(message: Arrayish | string): Promise {\n var data = ((typeof(message) === 'string') ? toUtf8Bytes(message): message);\n return this.getAddress().then((address) => {\n\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n return this.provider.send('eth_sign', [ address.toLowerCase(), hexlify(data) ]);\n });\n }\n\n unlock(password): Promise {\n var provider = this.provider;\n\n return this.getAddress().then(function(address) {\n return provider.send('personal_unlockAccount', [ address.toLowerCase(), password, null ]);\n });\n }\n}\n\nexport class JsonRpcProvider extends Provider {\n readonly connection: ConnectionInfo;\n\n private _pendingFilter: Promise;\n\n constructor(url?: ConnectionInfo | string, network?: Networkish) {\n\n // One parameter, but it is a network name, so swap it with the URL\n if (typeof(url) === 'string') {\n if (network === null && getNetwork(url)) {\n network = url;\n url = null;\n }\n }\n\n if (network) {\n // The network has been specified explicitly, we can use it\n super(network);\n\n } else {\n\n // The network is unknown, query the JSON-RPC for it\n let ready: Promise = new Promise((resolve, reject) => {\n setTimeout(() => {\n this.send('net_version', [ ]).then((result) => {\n let chainId = parseInt(result);\n\n resolve(getNetwork(chainId));\n });\n });\n });\n super(ready);\n }\n\n errors.checkNew(this, JsonRpcProvider);\n\n // Default URL\n if (!url) { url = 'http://localhost:8545'; }\n\n if (typeof(url) === 'string') {\n this.connection = {\n url: url\n };\n } else {\n this.connection = url;\n }\n\n }\n\n getSigner(address: string): JsonRpcSigner {\n return new JsonRpcSigner(this, address);\n }\n\n listAccounts(): Promise> {\n return this.send('eth_accounts', []).then((accounts) => {\n return accounts.map((a) => getAddress(a));\n });\n }\n\n send(method: string, params: any): Promise {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n\n return fetchJson(this.connection, JSON.stringify(request), getResult);\n }\n\n perform(method: string, params: any): Promise {\n switch (method) {\n case 'getBlockNumber':\n return this.send('eth_blockNumber', []);\n\n case 'getGasPrice':\n return this.send('eth_gasPrice', []);\n\n case 'getBalance':\n return this.send('eth_getBalance', [ getLowerCase(params.address), params.blockTag ]);\n\n case 'getTransactionCount':\n return this.send('eth_getTransactionCount', [ getLowerCase(params.address), params.blockTag ]);\n\n case 'getCode':\n return this.send('eth_getCode', [ getLowerCase(params.address), params.blockTag ]);\n\n case 'getStorageAt':\n return this.send('eth_getStorageAt', [ getLowerCase(params.address), params.position, params.blockTag ]);\n\n case 'sendTransaction':\n return this.send('eth_sendRawTransaction', [ params.signedTransaction ]);\n\n case 'getBlock':\n if (params.blockTag) {\n return this.send('eth_getBlockByNumber', [ params.blockTag, false ]);\n } else if (params.blockHash) {\n return this.send('eth_getBlockByHash', [ params.blockHash, false ]);\n }\n return Promise.reject(new Error('invalid block tag or block hash'));\n\n case 'getTransaction':\n return this.send('eth_getTransactionByHash', [ params.transactionHash ]);\n\n case 'getTransactionReceipt':\n return this.send('eth_getTransactionReceipt', [ params.transactionHash ]);\n\n case 'call':\n return this.send('eth_call', [ hexlifyTransaction(params.transaction), 'latest' ]);\n\n case 'estimateGas':\n return this.send('eth_estimateGas', [ hexlifyTransaction(params.transaction) ]);\n\n case 'getLogs':\n if (params.filter && params.filter.address != null) {\n params.filter.address = getLowerCase(params.filter.address);\n }\n return this.send('eth_getLogs', [ params.filter ]);\n\n default:\n break;\n }\n\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n }\n\n _startPending(): void {\n if (this._pendingFilter != null) { return; }\n var self = this;\n\n var pendingFilter: Promise = this.send('eth_newPendingTransactionFilter', []);\n this._pendingFilter = pendingFilter;\n\n pendingFilter.then(function(filterId) {\n function poll() {\n self.send('eth_getFilterChanges', [ filterId ]).then(function(hashes) {\n if (self._pendingFilter != pendingFilter) { return null; }\n\n var seq = Promise.resolve();\n hashes.forEach(function(hash) {\n self._emitted['t:' + hash.toLowerCase()] = 'pending';\n seq = seq.then(function() {\n return self.getTransaction(hash).then(function(tx) {\n self.emit('pending', tx);\n });\n });\n });\n\n return seq.then(function() {\n return timer(1000);\n });\n }).then(function() {\n if (self._pendingFilter != pendingFilter) {\n self.send('eth_uninstallFilter', [ filterId ]);\n return;\n }\n setTimeout(function() { poll(); }, 0);\n });\n }\n poll();\n\n return filterId;\n });\n }\n\n _stopPending(): void {\n this._pendingFilter = null;\n }\n}\n","\nimport net from 'net';\n\nimport { JsonRpcProvider } from './json-rpc-provider';\nimport { Networkish } from './networks';\n\nimport { defineReadOnly } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nexport class IpcProvider extends JsonRpcProvider {\n readonly path: string;\n\n constructor(path: string, network?: Networkish) {\n if (path == null) {\n errors.throwError('missing path', errors.MISSING_ARGUMENT, { arg: 'path' });\n }\n\n super('ipc://' + path, network);\n errors.checkNew(this, IpcProvider);\n\n defineReadOnly(this, 'path', path);\n }\n\n // @TODO: Create a connection to the IPC path and use filters instead of polling for block\n\n send(method: string, params: any): Promise {\n // This method is very simple right now. We create a new socket\n // connection each time, which may be slower, but the main\n // advantage we are aiming for now is security. This simplifies\n // multiplexing requests (since we do not need to multiplex).\n\n var payload = JSON.stringify({\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n });\n\n return new Promise((resolve, reject) => {\n var stream = net.connect(this.path);\n stream.on('data', function(data) {\n try {\n resolve(JSON.parse(data.toString('utf8')).result);\n // @TODO: Better pull apart the error\n stream.destroy();\n } catch (error) {\n reject(error);\n stream.destroy();\n }\n });\n\n stream.on('end', function() {\n stream.destroy();\n });\n\n stream.on('error', function(error) {\n reject(error);\n stream.destroy();\n });\n stream.write(payload);\n stream.end();\n });\n }\n}\n","'use strict';\n\nimport { JsonRpcProvider, JsonRpcSigner } from './json-rpc-provider';\nimport { getNetwork, Networkish } from './networks';\n\nimport { defineReadOnly } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\nexport class InfuraProvider extends JsonRpcProvider {\n readonly apiAccessToken: string;\n\n constructor(network?: Networkish, apiAccessToken?: string) {\n network = getNetwork((network == null) ? 'homestead': network);\n\n var host = null;\n switch(network.name) {\n case 'homestead':\n host = 'mainnet.infura.io';\n break;\n case 'ropsten':\n host = 'ropsten.infura.io';\n break;\n case 'rinkeby':\n host = 'rinkeby.infura.io';\n break;\n case 'kovan':\n host = 'kovan.infura.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n\n super('https://' + host + '/' + (apiAccessToken || ''), network);\n errors.checkNew(this, InfuraProvider);\n\n defineReadOnly(this, 'apiAccessToken', apiAccessToken || null);\n }\n\n _startPending(): void {\n console.log('WARNING: INFURA does not support pending filters');\n }\n\n getSigner(address?: string): JsonRpcSigner {\n errors.throwError(\n 'INFURA does not support signing',\n errors.UNSUPPORTED_OPERATION,\n { operation: 'getSigner' }\n );\n return null;\n }\n\n listAccounts(): Promise> {\n return Promise.resolve([]);\n }\n}\n","'use strict';\n\nimport { Networkish } from './networks';\nimport { JsonRpcProvider } from './json-rpc-provider';\n\nimport { defineReadOnly } from '../utils/properties';\n\nimport * as errors from '../utils/errors';\n\n/*\n@TODO\nutils.defineProperty(Web3Signer, 'onchange', {\n\n});\n*/\n\nexport type Callback = (error: any, response: any) => void;\n\nexport type AsyncProvider = {\n isMetaMask: boolean;\n host?: string;\n path?: string;\n sendAsync: (request: any, callback: Callback) => void\n}\n\nexport class Web3Provider extends JsonRpcProvider {\n readonly _web3Provider: AsyncProvider;\n\n constructor(web3Provider: AsyncProvider, network?: Networkish) {\n\n if (!web3Provider || !web3Provider.sendAsync) {\n errors.throwError(\n 'invalid web3Provider',\n errors.INVALID_ARGUMENT,\n { arg: 'web3Provider', value: web3Provider }\n );\n }\n\n // HTTP has a host; IPC has a path.\n var url = web3Provider.host || web3Provider.path || 'unknown';\n\n super(url, network);\n errors.checkNew(this, Web3Provider);\n\n defineReadOnly(this, '_web3Provider', web3Provider);\n }\n\n send(method: string, params: any): Promise {\n\n // Metamask complains about eth_sign (and on some versions hangs)\n if (method == 'eth_sign' && this._web3Provider.isMetaMask) {\n // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign\n method = 'personal_sign';\n params = [ params[1], params[0] ];\n }\n\n return new Promise((resolve, reject) => {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n\n this._web3Provider.sendAsync(request, function(error, result) {\n if (error) {\n reject(error);\n return;\n }\n\n if (result.error) {\n // @TODO: not any\n var error: any = new Error(result.error.message);\n error.code = result.error.code;\n error.data = result.error.data;\n reject(error);\n return;\n }\n\n resolve(result.result);\n });\n });\n }\n}\n","'use strict';\n\nimport { Provider, ProviderSigner } from './provider';\n\nimport { Network } from './networks';\n\nimport { EtherscanProvider } from './etherscan-provider';\nimport { FallbackProvider } from './fallback-provider';\nimport { IpcProvider } from './ipc-provider';\nimport { InfuraProvider } from './infura-provider';\nimport { JsonRpcProvider } from './json-rpc-provider';\nimport { Web3Provider } from './web3-provider';\n\nfunction getDefaultProvider(network?: Network | string): FallbackProvider {\n return new FallbackProvider([\n new InfuraProvider(network),\n new EtherscanProvider(network),\n ]);\n}\n\nexport {\n Provider,\n getDefaultProvider,\n\n ProviderSigner,\n\n FallbackProvider,\n\n EtherscanProvider,\n InfuraProvider,\n JsonRpcProvider,\n Web3Provider,\n\n IpcProvider\n};\n","'use strict';\n\nimport { bigNumberify } from './bignumber';\nimport { arrayify, concat, hexlify, padZeros} from './bytes';\nimport { toUtf8Bytes } from './utf8';\n\nimport { keccak256 as hashKeccak256 } from './keccak256';\nimport { sha256 as hashSha256 } from './sha2';\n\nvar regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nvar regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nvar regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\n\nvar Zeros = '0000000000000000000000000000000000000000000000000000000000000000';\n\nfunction _pack(type: string, value: any, isArray?: boolean): Uint8Array {\n switch(type) {\n case 'address':\n if (isArray) { return padZeros(value, 32); }\n return arrayify(value);\n case 'string':\n return toUtf8Bytes(value);\n case 'bytes':\n return arrayify(value);\n case 'bool':\n value = (value ? '0x01': '0x00');\n if (isArray) { return padZeros(value, 32); }\n return arrayify(value);\n }\n\n var match = type.match(regexNumber);\n if (match) {\n //var signed = (match[1] === 'int')\n let size = parseInt(match[2] || \"256\")\n if ((size % 8 != 0) || size === 0 || size > 256) {\n throw new Error('invalid number type - ' + type);\n }\n\n if (isArray) { size = 256; }\n\n value = bigNumberify(value).toTwos(size);\n\n return padZeros(value, size / 8);\n }\n\n match = type.match(regexBytes);\n if (match) {\n let size = parseInt(match[1]);\n if (String(size) != match[1] || size === 0 || size > 32) {\n throw new Error('invalid number type - ' + type);\n }\n if (arrayify(value).byteLength !== size) { throw new Error('invalid value for ' + type); }\n if (isArray) { return arrayify((value + Zeros).substring(0, 66)); }\n return value;\n }\n\n match = type.match(regexArray);\n if (match) {\n var baseType = match[1];\n var count = parseInt(match[2] || value.length);\n if (count != value.length) { throw new Error('invalid value for ' + type); }\n var result = [];\n value.forEach(function(value) {\n value = _pack(baseType, value, true);\n result.push(value);\n });\n return concat(result);\n }\n\n throw new Error('unknown type - ' + type);\n}\n\n// @TODO: Array Enum\n\nexport function pack(types: Array, values: Array) {\n if (types.length != values.length) { throw new Error('type/value count mismatch'); }\n var tight = [];\n types.forEach(function(type, index) {\n tight.push(_pack(type, values[index]));\n });\n return hexlify(concat(tight));\n}\n\nexport function keccak256(types: Array, values: Array) {\n return hashKeccak256(pack(types, values));\n}\n\nexport function sha256(types: Array, values: Array) {\n return hashSha256(pack(types, values));\n}\n","'use strict';\n\nimport { BigNumber, bigNumberify, BigNumberish, ConstantZero, ConstantNegativeOne } from './bignumber';\n\nimport * as errors from './errors';\n\nconst names = [\n 'wei',\n 'kwei',\n 'Mwei',\n 'Gwei',\n 'szabo',\n 'finny',\n 'ether',\n];\n\nvar getUnitInfo = (function() {\n var unitInfos = {};\n\n function getUnitInfo(value) {\n return {\n decimals: value.length - 1,\n tenPower: bigNumberify(value)\n };\n }\n\n // Cache the common units\n var value = '1';\n names.forEach(function(name) {\n var info = getUnitInfo(value);\n unitInfos[name.toLowerCase()] = info;\n unitInfos[String(info.decimals)] = info;\n value += '000';\n });\n\n return function(name) {\n // Try the cache\n var info = unitInfos[String(name).toLowerCase()];\n\n if (!info && typeof(name) === 'number' && Math.trunc(name) == name && name >= 0 && name <= 256) {\n var value = '1';\n for (var i = 0; i < name; i++) { value += '0'; }\n info = getUnitInfo(value);\n }\n\n // Make sure we got something\n if (!info) {\n errors.throwError(\n 'invalid unitType',\n errors.INVALID_ARGUMENT,\n { arg: 'name', value: name }\n );\n }\n\n return info;\n }\n})();\n\nexport function formatUnits(value: BigNumberish, unitType?: string | number, options?: any): string {\n /*\n if (typeof(unitType) === 'object' && !options) {\n options = unitType;\n unitType = undefined;\n }\n if (unitType == null) { unitType = 18; }\n */\n\n if (!options) { options = {}; }\n\n var unitInfo = getUnitInfo(unitType);\n\n // Make sure wei is a big number (convert as necessary)\n value = bigNumberify(value);\n\n var negative = value.lt(ConstantZero);\n if (negative) { value = value.mul(ConstantNegativeOne); }\n\n var fraction = value.mod(unitInfo.tenPower).toString();\n while (fraction.length < unitInfo.decimals) { fraction = '0' + fraction; }\n\n // Strip off trailing zeros (but keep one if would otherwise be bare decimal point)\n if (!options.pad) {\n fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];\n }\n\n var whole = value.div(unitInfo.tenPower).toString();\n\n if (options.commify) {\n whole = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")\n }\n\n value = whole + '.' + fraction;\n\n if (negative) { value = '-' + value; }\n\n return value;\n}\n\nexport function parseUnits(value: string, unitType?: string | number): BigNumber {\n if (unitType == null) { unitType = 18; }\n var unitInfo = getUnitInfo(unitType);\n\n if (typeof(value) !== 'string' || !value.match(/^-?[0-9.,]+$/)) {\n errors.throwError('invalid decimal value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n // Remove commas\n var value = value.replace(/,/g,'');\n\n // Is it negative?\n var negative = (value.substring(0, 1) === '-');\n if (negative) { value = value.substring(1); }\n\n if (value === '.') {\n errors.throwError('missing value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n // Split it into a whole and fractional part\n let comps = value.split('.');\n if (comps.length > 2) {\n errors.throwError('too many decimal points', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n\n let whole = comps[0], fraction = comps[1];\n if (!whole) { whole = '0'; }\n if (!fraction) { fraction = '0'; }\n\n // Prevent underflow\n if (fraction.length > unitInfo.decimals) {\n errors.throwError(\n 'underflow occurred',\n errors.NUMERIC_FAULT,\n { operation: 'division', fault: \"underflow\" }\n );\n }\n\n // Fully pad the string with zeros to get to wei\n while (fraction.length < unitInfo.decimals) { fraction += '0'; }\n\n let wholeValue = bigNumberify(whole);\n let fractionValue = bigNumberify(fraction);\n\n let wei = (wholeValue.mul(unitInfo.tenPower)).add(fractionValue);\n\n if (negative) { wei = wei.mul(ConstantNegativeOne); }\n\n return wei;\n}\n\nexport function formatEther(wei: BigNumberish, options: any): string {\n return formatUnits(wei, 18, options);\n}\n\nexport function parseEther(ether: string): BigNumber {\n return parseUnits(ether, 18);\n}\n\n","'use strict';\n\n// This is SUPER useful, but adds 140kb (even zipped, adds 40kb)\n//var unorm = require('unorm');\n\nimport { getAddress, getContractAddress, getIcapAddress } from './address';\nimport { AbiCoder, defaultAbiCoder, parseSignature, parseParamType } from './abi-coder';\nimport * as base64 from './base64';\nimport { BigNumber, bigNumberify } from './bignumber';\nimport { arrayify, concat, hexlify, joinSignature, padZeros, splitSignature, stripZeros } from './bytes';\nimport { hashMessage, id, namehash } from './hash';\nimport { keccak256 } from './keccak256';\nimport { sha256 } from './sha2';\nimport { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from './solidity';\nimport { randomBytes } from './random-bytes';\nimport { defineFrozen, defineReadOnly, resolveProperties, shallowCopy } from './properties';\nimport * as RLP from './rlp';\nimport { toUtf8Bytes, toUtf8String } from './utf8';\nimport { formatEther, parseEther, formatUnits, parseUnits } from './units';\nimport { fetchJson } from './web';\nimport { parse as parseTransaction } from './transaction';\n\nimport * as errors from './errors';\n\n// NFKD (decomposed)\n//const etherSymbol = '\\uD835\\uDF63';\n\n// NFKC (composed)\nconst etherSymbol = '\\u039e';\n\nexport {\n AbiCoder,\n defaultAbiCoder,\n parseSignature,\n parseParamType,\n\n RLP,\n\n fetchJson,\n\n defineReadOnly,\n defineFrozen,\n resolveProperties,\n shallowCopy,\n\n etherSymbol,\n\n arrayify,\n\n concat,\n padZeros,\n stripZeros,\n\n base64,\n\n bigNumberify,\n BigNumber,\n\n hexlify,\n\n toUtf8Bytes,\n toUtf8String,\n\n hashMessage,\n namehash,\n id,\n\n getAddress,\n getIcapAddress,\n getContractAddress,\n\n formatEther,\n parseEther,\n\n formatUnits,\n parseUnits,\n\n keccak256,\n sha256,\n\n randomBytes,\n\n solidityPack,\n solidityKeccak256,\n soliditySha256,\n\n splitSignature,\n joinSignature,\n\n parseTransaction,\n\n errors\n}\n","'use strict';\n\nimport { Wallet } from './wallet';\nimport * as HDNode from './hdnode';\nimport { SigningKey } from './signing-key';\n\nexport { HDNode, SigningKey, Wallet };\n\n/*\n\n// Exporting\nexport = {\n HDNode: HDNode,\n Wallet: Wallet,\n\n SigningKey: SigningKey\n};\n\n// Default TypeScript\nexport default exporting;\n\n// Node exports\ndeclare var module: any;\n(module).exports = exporting;\n*/\n","'use strict';\n\nimport { Contract, Interface } from './contracts';\nimport * as providers from './providers';\nimport * as errors from './utils/errors';\nimport { getNetwork } from './providers/networks';\nimport * as utils from './utils';\nimport { HDNode, SigningKey, Wallet } from './wallet';\n\n//import info from '../package.json';\n//console.log(info);\nconsole.log(\"@TODO: Get version\");\nconst version = \"4.0.0\";\n\nexport {\n Wallet,\n\n HDNode,\n SigningKey,\n\n Contract,\n Interface,\n\n getNetwork,\n providers,\n\n errors,\n utils,\n\n version\n};\n\n/*\nexport default {\n Wallet: wallet.Wallet,\n\n HDNode: wallet.HDNode,\n SigningKey: wallet.SigningKey,\n\n// Contract: contracts.Contract,\n// Interface: contracts.Interface,\n\n// networks: providers.networks,\n// providers: providers,\n\n errors: errors,\n utils: utils,\n\n// version: version,\n}\n*/\n","\nimport { register, Wordlist } from './wordlist';\n\nimport * as errors from '../utils/errors';\n\nconst words = \"AbacoAbbaglioAbbinatoAbeteAbissoAbolireAbrasivoAbrogatoAccadereAccennoAccusatoAcetoneAchilleAcidoAcquaAcreAcrilicoAcrobataAcutoAdagioAddebitoAddomeAdeguatoAderireAdipeAdottareAdulareAffabileAffettoAffissoAffrantoAforismaAfosoAfricanoAgaveAgenteAgevoleAggancioAgireAgitareAgonismoAgricoloAgrumetoAguzzoAlabardaAlatoAlbatroAlberatoAlboAlbumeAlceAlcolicoAlettoneAlfaAlgebraAlianteAlibiAlimentoAllagatoAllegroAllievoAllodolaAllusivoAlmenoAlogenoAlpacaAlpestreAltalenaAlternoAlticcioAltroveAlunnoAlveoloAlzareAmalgamaAmanitaAmarenaAmbitoAmbratoAmebaAmericaAmetistaAmicoAmmassoAmmendaAmmirareAmmonitoAmoreAmpioAmpliareAmuletoAnacardoAnagrafeAnalistaAnarchiaAnatraAncaAncellaAncoraAndareAndreaAnelloAngeloAngolareAngustoAnimaAnnegareAnnidatoAnnoAnnuncioAnonimoAnticipoAnziApaticoAperturaApodeApparireAppetitoAppoggioApprodoAppuntoAprileArabicaArachideAragostaAraldicaArancioAraturaArazzoArbitroArchivioArditoArenileArgentoArgineArgutoAriaArmoniaArneseArredatoArringaArrostoArsenicoArsoArteficeArzilloAsciuttoAscoltoAsepsiAsetticoAsfaltoAsinoAsolaAspiratoAsproAssaggioAsseAssolutoAssurdoAstaAstenutoAsticeAstrattoAtavicoAteismoAtomicoAtonoAttesaAttivareAttornoAttritoAttualeAusilioAustriaAutistaAutonomoAutunnoAvanzatoAvereAvvenireAvvisoAvvolgereAzioneAzotoAzzimoAzzurroBabeleBaccanoBacinoBacoBadessaBadilataBagnatoBaitaBalconeBaldoBalenaBallataBalzanoBambinoBandireBaraondaBarbaroBarcaBaritonoBarlumeBaroccoBasilicoBassoBatostaBattutoBauleBavaBavosaBeccoBeffaBelgioBelvaBendaBenevoleBenignoBenzinaBereBerlinaBetaBibitaBiciBidoneBifidoBigaBilanciaBimboBinocoloBiologoBipedeBipolareBirbanteBirraBiscottoBisestoBisnonnoBisonteBisturiBizzarroBlandoBlattaBollitoBonificoBordoBoscoBotanicoBottinoBozzoloBraccioBradipoBramaBrancaBravuraBretellaBrevettoBrezzaBrigliaBrillanteBrindareBroccoloBrodoBronzinaBrulloBrunoBubboneBucaBudinoBuffoneBuioBulboBuonoBurloneBurrascaBussolaBustaCadettoCaducoCalamaroCalcoloCalesseCalibroCalmoCaloriaCambusaCamerataCamiciaCamminoCamolaCampaleCanapaCandelaCaneCaninoCanottoCantinaCapaceCapelloCapitoloCapogiroCapperoCapraCapsulaCarapaceCarcassaCardoCarismaCarovanaCarrettoCartolinaCasaccioCascataCasermaCasoCassoneCastelloCasualeCatastaCatenaCatrameCautoCavilloCedibileCedrataCefaloCelebreCellulareCenaCenoneCentesimoCeramicaCercareCertoCerumeCervelloCesoiaCespoCetoChelaChiaroChiccaChiedereChimeraChinaChirurgoChitarraCiaoCiclismoCifrareCignoCilindroCiottoloCircaCirrosiCitricoCittadinoCiuffoCivettaCivileClassicoClinicaCloroCoccoCodardoCodiceCoerenteCognomeCollareColmatoColoreColposoColtivatoColzaComaCometaCommandoComodoComputerComuneConcisoCondurreConfermaCongelareConiugeConnessoConoscereConsumoContinuoConvegnoCopertoCopioneCoppiaCopricapoCorazzaCordataCoricatoCorniceCorollaCorpoCorredoCorsiaCorteseCosmicoCostanteCotturaCovatoCratereCravattaCreatoCredereCremosoCrescitaCretaCricetoCrinaleCrisiCriticoCroceCronacaCrostataCrucialeCruscaCucireCuculoCuginoCullatoCupolaCuratoreCursoreCurvoCuscinoCustodeDadoDainoDalmataDamerinoDanielaDannosoDanzareDatatoDavantiDavveroDebuttoDecennioDecisoDeclinoDecolloDecretoDedicatoDefinitoDeformeDegnoDelegareDelfinoDelirioDeltaDemenzaDenotatoDentroDepositoDerapataDerivareDerogaDescrittoDesertoDesiderioDesumereDetersivoDevotoDiametroDicembreDiedroDifesoDiffusoDigerireDigitaleDiluvioDinamicoDinnanziDipintoDiplomaDipoloDiradareDireDirottoDirupoDisagioDiscretoDisfareDisgeloDispostoDistanzaDisumanoDitoDivanoDiveltoDividereDivoratoDobloneDocenteDoganaleDogmaDolceDomatoDomenicaDominareDondoloDonoDormireDoteDottoreDovutoDozzinaDragoDruidoDubbioDubitareDucaleDunaDuomoDupliceDuraturoEbanoEccessoEccoEclissiEconomiaEderaEdicolaEdileEditoriaEducareEgemoniaEgliEgoismoEgregioElaboratoElargireEleganteElencatoElettoElevareElficoElicaElmoElsaElusoEmanatoEmblemaEmessoEmiroEmotivoEmozioneEmpiricoEmuloEndemicoEnduroEnergiaEnfasiEnotecaEntrareEnzimaEpatiteEpilogoEpisodioEpocaleEppureEquatoreErarioErbaErbosoEredeEremitaErigereErmeticoEroeErosivoErranteEsagonoEsameEsanimeEsaudireEscaEsempioEsercitoEsibitoEsigenteEsistereEsitoEsofagoEsortatoEsosoEspansoEspressoEssenzaEssoEstesoEstimareEstoniaEstrosoEsultareEtilicoEtnicoEtruscoEttoEuclideoEuropaEvasoEvidenzaEvitatoEvolutoEvvivaFabbricaFaccendaFachiroFalcoFamigliaFanaleFanfaraFangoFantasmaFareFarfallaFarinosoFarmacoFasciaFastosoFasulloFaticareFatoFavolosoFebbreFecolaFedeFegatoFelpaFeltroFemminaFendereFenomenoFermentoFerroFertileFessuraFestivoFettaFeudoFiabaFiduciaFifaFiguratoFiloFinanzaFinestraFinireFioreFiscaleFisicoFiumeFlaconeFlamencoFleboFlemmaFloridoFluenteFluoroFobicoFocacciaFocosoFoderatoFoglioFolataFolcloreFolgoreFondenteFoneticoFoniaFontanaForbitoForchettaForestaFormicaFornaioForoFortezzaForzareFosfatoFossoFracassoFranaFrassinoFratelloFreccettaFrenataFrescoFrigoFrollinoFrondeFrugaleFruttaFucilataFucsiaFuggenteFulmineFulvoFumanteFumettoFumosoFuneFunzioneFuocoFurboFurgoneFuroreFusoFutileGabbianoGaffeGalateoGallinaGaloppoGamberoGammaGaranziaGarboGarofanoGarzoneGasdottoGasolioGastricoGattoGaudioGazeboGazzellaGecoGelatinaGelsoGemelloGemmatoGeneGenitoreGennaioGenotipoGergoGhepardoGhiaccioGhisaGialloGildaGineproGiocareGioielloGiornoGioveGiratoGironeGittataGiudizioGiuratoGiustoGlobuloGlutineGnomoGobbaGolfGomitoGommoneGonfioGonnaGovernoGracileGradoGraficoGrammoGrandeGrattareGravosoGraziaGrecaGreggeGrifoneGrigioGrinzaGrottaGruppoGuadagnoGuaioGuantoGuardareGufoGuidareIbernatoIconaIdenticoIdillioIdoloIdraIdricoIdrogenoIgieneIgnaroIgnoratoIlareIllesoIllogicoIlludereImballoImbevutoImboccoImbutoImmaneImmersoImmolatoImpaccoImpetoImpiegoImportoImprontaInalareInarcareInattivoIncantoIncendioInchinoIncisivoInclusoIncontroIncrocioIncuboIndagineIndiaIndoleIneditoInfattiInfilareInflittoIngaggioIngegnoIngleseIngordoIngrossoInnescoInodoreInoltrareInondatoInsanoInsettoInsiemeInsonniaInsulinaIntasatoInteroIntonacoIntuitoInumidireInvalidoInveceInvitoIperboleIpnoticoIpotesiIppicaIrideIrlandaIronicoIrrigatoIrrorareIsolatoIsotopoIstericoIstitutoIstriceItaliaIterareLabbroLabirintoLaccaLaceratoLacrimaLacunaLaddoveLagoLampoLancettaLanternaLardosoLargaLaringeLastraLatenzaLatinoLattugaLavagnaLavoroLegaleLeggeroLemboLentezzaLenzaLeoneLepreLesivoLessatoLestoLetteraleLevaLevigatoLiberoLidoLievitoLillaLimaturaLimitareLimpidoLineareLinguaLiquidoLiraLiricaLiscaLiteLitigioLivreaLocandaLodeLogicaLombareLondraLongevoLoquaceLorenzoLotoLotteriaLuceLucidatoLumacaLuminosoLungoLupoLuppoloLusingaLussoLuttoMacabroMacchinaMaceroMacinatoMadamaMagicoMagliaMagneteMagroMaiolicaMalafedeMalgradoMalintesoMalsanoMaltoMalumoreManaManciaMandorlaMangiareManifestoMannaroManovraMansardaMantideManubrioMappaMaratonaMarcireMarettaMarmoMarsupioMascheraMassaiaMastinoMaterassoMatricolaMattoneMaturoMazurcaMeandroMeccanicoMecenateMedesimoMeditareMegaMelassaMelisMelodiaMeningeMenoMensolaMercurioMerendaMerloMeschinoMeseMessereMestoloMetalloMetodoMettereMiagolareMicaMicelioMicheleMicroboMidolloMieleMiglioreMilanoMiliteMimosaMineraleMiniMinoreMirinoMirtilloMiscelaMissivaMistoMisurareMitezzaMitigareMitraMittenteMnemonicoModelloModificaModuloMoganoMogioMoleMolossoMonasteroMoncoMondinaMonetarioMonileMonotonoMonsoneMontatoMonvisoMoraMordereMorsicatoMostroMotivatoMotosegaMottoMovenzaMovimentoMozzoMuccaMucosaMuffaMughettoMugnaioMulattoMulinelloMultiploMummiaMuntoMuovereMuraleMusaMuscoloMusicaMutevoleMutoNababboNaftaNanometroNarcisoNariceNarratoNascereNastrareNaturaleNauticaNaviglioNebulosaNecrosiNegativoNegozioNemmenoNeofitaNerettoNervoNessunoNettunoNeutraleNeveNevroticoNicchiaNinfaNitidoNobileNocivoNodoNomeNominaNordicoNormaleNorvegeseNostranoNotareNotiziaNotturnoNovellaNucleoNullaNumeroNuovoNutrireNuvolaNuzialeOasiObbedireObbligoObeliscoOblioOboloObsoletoOccasioneOcchioOccidenteOccorrereOccultareOcraOculatoOdiernoOdorareOffertaOffrireOffuscatoOggettoOggiOgnunoOlandeseOlfattoOliatoOlivaOlogrammaOltreOmaggioOmbelicoOmbraOmegaOmissioneOndosoOnereOniceOnnivoroOnorevoleOntaOperatoOpinioneOppostoOracoloOrafoOrdineOrecchinoOreficeOrfanoOrganicoOrigineOrizzonteOrmaOrmeggioOrnativoOrologioOrrendoOrribileOrtensiaOrticaOrzataOrzoOsareOscurareOsmosiOspedaleOspiteOssaOssidareOstacoloOsteOtiteOtreOttagonoOttimoOttobreOvaleOvestOvinoOviparoOvocitoOvunqueOvviareOzioPacchettoPacePacificoPadellaPadronePaesePagaPaginaPalazzinaPalesarePallidoPaloPaludePandoroPannelloPaoloPaonazzoPapricaParabolaParcellaParerePargoloPariParlatoParolaPartireParvenzaParzialePassivoPasticcaPataccaPatologiaPattumePavonePeccatoPedalarePedonalePeggioPelosoPenarePendicePenisolaPennutoPenombraPensarePentolaPepePepitaPerbenePercorsoPerdonatoPerforarePergamenaPeriodoPermessoPernoPerplessoPersuasoPertugioPervasoPesatorePesistaPesoPestiferoPetaloPettinePetulantePezzoPiacerePiantaPiattinoPiccinoPicozzaPiegaPietraPifferoPigiamaPigolioPigroPilaPiliferoPillolaPilotaPimpantePinetaPinnaPinoloPioggiaPiomboPiramidePireticoPiritePirolisiPitonePizzicoPlaceboPlanarePlasmaPlatanoPlenarioPochezzaPoderosoPodismoPoesiaPoggiarePolentaPoligonoPollicePolmonitePolpettaPolsoPoltronaPolverePomicePomodoroPontePopolosoPorfidoPorosoPorporaPorrePortataPosaPositivoPossessoPostulatoPotassioPoterePranzoPrassiPraticaPreclusoPredicaPrefissoPregiatoPrelievoPremerePrenotarePreparatoPresenzaPretestoPrevalsoPrimaPrincipePrivatoProblemaProcuraProdurreProfumoProgettoProlungaPromessaPronomePropostaProrogaProtesoProvaPrudentePrugnaPruritoPsichePubblicoPudicaPugilatoPugnoPulcePulitoPulsantePuntarePupazzoPupillaPuroQuadroQualcosaQuasiQuerelaQuotaRaccoltoRaddoppioRadicaleRadunatoRafficaRagazzoRagioneRagnoRamarroRamingoRamoRandagioRantolareRapatoRapinaRappresoRasaturaRaschiatoRasenteRassegnaRastrelloRataRavvedutoRealeRecepireRecintoReclutaReconditoRecuperoRedditoRedimereRegalatoRegistroRegolaRegressoRelazioneRemareRemotoRennaReplicaReprimereReputareResaResidenteResponsoRestauroReteRetinaRetoricaRettificaRevocatoRiassuntoRibadireRibelleRibrezzoRicaricaRiccoRicevereRiciclatoRicordoRicredutoRidicoloRidurreRifasareRiflessoRiformaRifugioRigareRigettatoRighelloRilassatoRilevatoRimanereRimbalzoRimedioRimorchioRinascitaRincaroRinforzoRinnovoRinomatoRinsavitoRintoccoRinunciaRinvenireRiparatoRipetutoRipienoRiportareRipresaRipulireRisataRischioRiservaRisibileRisoRispettoRistoroRisultatoRisvoltoRitardoRitegnoRitmicoRitrovoRiunioneRivaRiversoRivincitaRivoltoRizomaRobaRoboticoRobustoRocciaRocoRodaggioRodereRoditoreRogitoRollioRomanticoRompereRonzioRosolareRospoRotanteRotondoRotulaRovescioRubizzoRubricaRugaRullinoRumineRumorosoRuoloRupeRussareRusticoSabatoSabbiareSabotatoSagomaSalassoSaldaturaSalgemmaSalivareSalmoneSaloneSaltareSalutoSalvoSapereSapidoSaporitoSaracenoSarcasmoSartoSassosoSatelliteSatiraSatolloSaturnoSavanaSavioSaziatoSbadiglioSbalzoSbancatoSbarraSbattereSbavareSbendareSbirciareSbloccatoSbocciatoSbrinareSbruffoneSbuffareScabrosoScadenzaScalaScambiareScandaloScapolaScarsoScatenareScavatoSceltoScenicoScettroSchedaSchienaSciarpaScienzaScindereScippoSciroppoScivoloSclerareScodellaScolpitoScompartoSconfortoScoprireScortaScossoneScozzeseScribaScrollareScrutinioScuderiaScultoreScuolaScuroScusareSdebitareSdoganareSeccaturaSecondoSedanoSeggiolaSegnalatoSegregatoSeguitoSelciatoSelettivoSellaSelvaggioSemaforoSembrareSemeSeminatoSempreSensoSentireSepoltoSequenzaSerataSerbatoSerenoSerioSerpenteSerraglioServireSestinaSetolaSettimanaSfaceloSfaldareSfamatoSfarzosoSfaticatoSferaSfidaSfilatoSfingeSfocatoSfoderareSfogoSfoltireSforzatoSfrattoSfruttatoSfuggitoSfumareSfusoSgabelloSgarbatoSgonfiareSgorbioSgrassatoSguardoSibiloSiccomeSierraSiglaSignoreSilenzioSillabaSimboloSimpaticoSimulatoSinfoniaSingoloSinistroSinoSintesiSinusoideSiparioSismaSistoleSituatoSlittaSlogaturaSlovenoSmarritoSmemoratoSmentitoSmeraldoSmilzoSmontareSmottatoSmussatoSnellireSnervatoSnodoSobbalzoSobrioSoccorsoSocialeSodaleSoffittoSognoSoldatoSolenneSolidoSollazzoSoloSolubileSolventeSomaticoSommaSondaSonettoSonniferoSopireSoppesoSopraSorgereSorpassoSorrisoSorsoSorteggioSorvolatoSospiroSostaSottileSpadaSpallaSpargereSpatolaSpaventoSpazzolaSpecieSpedireSpegnereSpelaturaSperanzaSpessoreSpettraleSpezzatoSpiaSpigolosoSpillatoSpinosoSpiraleSplendidoSportivoSposoSprangaSprecareSpronatoSpruzzoSpuntinoSquilloSradicareSrotolatoStabileStaccoStaffaStagnareStampatoStantioStarnutoStaseraStatutoSteloSteppaSterzoStilettoStimaStirpeStivaleStizzosoStonatoStoricoStrappoStregatoStriduloStrozzareStruttoStuccareStufoStupendoSubentroSuccosoSudoreSuggeritoSugoSultanoSuonareSuperboSupportoSurgelatoSurrogatoSussurroSuturaSvagareSvedeseSveglioSvelareSvenutoSveziaSviluppoSvistaSvizzeraSvoltaSvuotareTabaccoTabulatoTacciareTaciturnoTaleTalismanoTamponeTanninoTaraTardivoTargatoTariffaTarpareTartarugaTastoTatticoTavernaTavolataTazzaTecaTecnicoTelefonoTemerarioTempoTemutoTendoneTeneroTensioneTentacoloTeoremaTermeTerrazzoTerzettoTesiTesseratoTestatoTetroTettoiaTifareTigellaTimbroTintoTipicoTipografoTiraggioTiroTitanioTitoloTitubanteTizioTizzoneToccareTollerareToltoTombolaTomoTonfoTonsillaTopazioTopologiaToppaTorbaTornareTorroneTortoraToscanoTossireTostaturaTotanoTraboccoTracheaTrafilaTragediaTralcioTramontoTransitoTrapanoTrarreTraslocoTrattatoTraveTrecciaTremolioTrespoloTributoTrichecoTrifoglioTrilloTrinceaTrioTristezzaTrituratoTrivellaTrombaTronoTroppoTrottolaTrovareTruccatoTubaturaTuffatoTulipanoTumultoTunisiaTurbareTurchinoTutaTutelaUbicatoUccelloUccisoreUdireUditivoUffaUfficioUgualeUlisseUltimatoUmanoUmileUmorismoUncinettoUngereUnghereseUnicornoUnificatoUnisonoUnitarioUnteUovoUpupaUraganoUrgenzaUrloUsanzaUsatoUscitoUsignoloUsuraioUtensileUtilizzoUtopiaVacanteVaccinatoVagabondoVagliatoValangaValgoValicoVallettaValorosoValutareValvolaVampataVangareVanitosoVanoVantaggioVanveraVaporeVaranoVarcatoVarianteVascaVedettaVedovaVedutoVegetaleVeicoloVelcroVelinaVellutoVeloceVenatoVendemmiaVentoVeraceVerbaleVergognaVerificaVeroVerrucaVerticaleVescicaVessilloVestaleVeteranoVetrinaVetustoViandanteVibranteVicendaVichingoVicinanzaVidimareVigiliaVignetoVigoreVileVillanoViminiVincitoreViolaViperaVirgolaVirologoVirulentoViscosoVisioneVispoVissutoVisuraVitaVitelloVittimaVivandaVividoViziareVoceVogaVolatileVolereVolpeVoragineVulcanoZampognaZannaZappatoZatteraZavorraZefiroZelanteZeloZenzeroZerbinoZibettoZincoZirconeZittoZollaZoticoZuccheroZufoloZuluZuppa\";\n\nlet wordlist: Array = null;\n\nfunction loadWords(): void {\n if (wordlist != null) { return; }\n wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' ');\n}\n\nclass LangIt extends Wordlist {\n constructor() {\n super('it');\n }\n\n getWord(index: number): string {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n }\n\n getWordIndex(word: string): number {\n loadWords();\n return wordlist.indexOf(word);\n }\n}\n\nconst langIt = new LangIt();\nregister(langIt);\n\nexport { langIt }\n","\nimport { register, Wordlist } from './wordlist';\n\nimport { toUtf8String } from '../utils/utf8';\n\nimport * as errors from '../utils/errors';\n\nconst data = [\n\n // 4-kana words\n 'AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXB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RDJFEqDSJQSJFSJQIJFSOPeZtSJFZJHCJXQfXCTDEqFGJBSJFGJBOfXGJBcqXGJHNJDGJRLiJEJfXEqEJFEJPEFpBEJYJBZJFYBwXUJYiJMEBYJZJyTYTONJXpQMFXFpeGIDdpJFstXpJFcPDLBVSJRLHQJqXLJFZJFIJBNJDIJBUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC',\n\n // 8-kana words\n 'BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD',\n\n // 9-kana words\n 'QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD',\n\n // 10-kana words\n 'IJBEJqXZJ'\n];\n\n// Maps each character into its kana value (the index)\nconst mapping = \"~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt\"\n\nlet words: Array = null;\n\nfunction loadWords() {\n if (words !== null) { return; }\n words = [];\n\n // Transforms for normalizing (sort is a not quite UTF-8)\n var transform = {};\n\n // Delete the diacritic marks\n transform[toUtf8String([227, 130, 154])] = false;\n transform[toUtf8String([227, 130, 153])] = false;\n\n // Some simple transforms that sort out most of the order\n transform[toUtf8String([227, 130, 133])] = toUtf8String([227, 130, 134]);\n transform[toUtf8String([227, 129, 163])] = toUtf8String([227, 129, 164]);\n transform[toUtf8String([227, 130, 131])] = toUtf8String([227, 130, 132]);\n transform[toUtf8String([227, 130, 135])] = toUtf8String([227, 130, 136]);\n\n\n // Normalize words using the transform\n function normalize(word) {\n var result = '';\n for (var i = 0; i < word.length; i++) {\n let kana = word[i];\n var target = transform[kana];\n if (target === false) { continue; }\n if (target) { kana = target; }\n result += kana;\n }\n return result;\n }\n\n // Sort how the Japanese list is sorted\n function sortJapanese(a, b) {\n a = normalize(a);\n b = normalize(b);\n if (a < b) { return -1; }\n if (a > b) { return 1; }\n return 0;\n }\n\n // Load all the words\n for (let length = 3; length <= 9; length++) {\n let d = data[length - 3];\n for (let offset = 0; offset < d.length; offset += length) {\n let word = [];\n for (let i = 0; i < length; i++) {\n let k = mapping.indexOf(d[offset + i]);\n word.push(227);\n word.push((k & 0x40) ? 130: 129);\n word.push((k & 0x3f) + 128);\n }\n words.push(toUtf8String(word));\n }\n }\n words.sort(sortJapanese);\n\n // For some reason kyoku and kiyoku are flipped; we'll just manually fix it\n let kyoku = words[442];\n words[442] = words[443];\n words[443] = kyoku;\n}\n\n/*\nvar fs = require('fs');\nfs.readFileSync('lang-ja.txt').toString().split('\\x0a').forEach(function(d, i) {\n if (d !== words[i]) { console.log(d, words[i], i, toUtf8Bytes(d)); }\n});\n*/\n\n\nclass LangJa extends Wordlist {\n constructor() {\n super('ja');\n }\n\n getWord(index) {\n loadWords();\n return words[index];\n }\n\n getWordIndex(word) {\n loadWords();\n return words.indexOf(word);\n }\n\n split(mnemonic: string): Array {\n if (!mnemonic.normalize) {\n errors.throwError('Japanese is unsupported on this platform; missing String.prototype.normalize', errors.UNSUPPORTED_OPERATION, { operation: 'String.prototype.normalize' });\n }\n return mnemonic.split(/(?:\\u3000| )+/g);\n }\n\n join(words: Array): string {\n return words.join('\\u3000');\n }\n}\n\nconst langJa = new LangJa();\nregister(langJa);\n\nexport { langJa };\n\n","\nimport { register, Wordlist } from './wordlist';\n\nimport { toUtf8String } from '../utils/utf8';\n\nimport * as errors from '../utils/errors';\n\n\nconst data = [\n 'OYAa',\n 'ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeAgrDUAgrJTAhrFnAhrLjAhrQgAjAgoAjJnrAkMX8AkOnoAlCTvAlCV8AlClvAlFg4AlFl6AlFn3AloSnAlrAXAlrAfAlrFUAlrFbAlrGgAlrOXAlvKnAlvMTAl3AbAl3MnAnATrAnAcrAnCZ3AnCl8AnDg8AnFboAnFl3AnHX4AnHbrAnHgrAnIl3AnJgvAnLXoAnLX4AnLbrAnLgrAnLhrAnMXoAnMgrAnOn3AnSbrAnSeoAnvLnAn3OnCTGgvCTSlvCTvAUCTvKnCTvNTCT3CZCT3GUCT3MTCT8HnCUCZrCULf8CULnvCU3HnCU3JUCY6NUCbDb8CbFZoCbLnrCboOTCboScCbrFnCbvLnCb8AgCb8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nMXoSUrDlHUoScvHTvSnSfLkvMXo',\n 'AUoAcrMXoAZ8HboAg8AbOg6ATFgAg8AloMXoAl3AT8JTrAl8MX8MXoCT3SToJU8Cl8Db8MXoDT8HgrATrDboOT8MXoGTOTrATMnGT8LhrAZ8GnvFnGnQXHToGgvAcrHTvAXvLl3HbrAZoMXoHgBlFXLg3HgMnFXrSnHgrSb8JUoHn6HT8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg',\n 'HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb',\n 'AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl'\n]\n\nvar codes = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*'\n\nfunction getHangul(code) {\n if (code >= 40) {\n code = code + 168 - 40;\n } else if (code >= 19) {\n code = code + 97 - 19;\n }\n\n return toUtf8String([ 225, (code >> 6) + 132, (code & 0x3f) + 128]);\n //return '[' + ([ 225, (code >> 6) + 132, (code & 0x3f) + 128]).join(', ') + ']';\n}\n\nlet wordlist: Array = null;\n\nfunction loadWords(): void {\n if (wordlist != null) { return; }\n\n wordlist = [];\n\n data.forEach((data, length) => {\n length += 4;\n for (let i = 0; i < data.length; i += length) {\n let word = '';\n for (let j = 0; j < length; j++) {\n word += getHangul(codes.indexOf(data[i + j]));\n }\n wordlist.push(word)\n }\n });\n\n wordlist.sort();\n}\nloadWords();\n\n\n\nclass LangKo extends Wordlist {\n constructor() {\n super('ko');\n }\n\n getWord(index: number): string {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n }\n\n getWordIndex(word: string): number {\n loadWords();\n return wordlist.indexOf(word);\n }\n}\n\nconst langKo = new LangKo();\nregister(langKo);\n\nexport { langKo }\n","\nimport { register, Wordlist } from './wordlist';\n\nimport { defineReadOnly } from '../utils/properties';\nimport { toUtf8String } from '../utils/utf8';\n\nconst data = \"}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN?\"\n\nlet deltaOffset = 0;\nfor (var i = 0; i < 2048; i++) {\n let s = style.indexOf(data[i * 3]);\n let bytes = [\n 228 + (s >> 2),\n 128 + codes.indexOf(data[i * 3 + 1]),\n 128 + codes.indexOf(data[i * 3 + 2]),\n ];\n words.cn.push(toUtf8String(bytes));\n\n let common = s % 4;\n for (let i = common; i < 3; i++) {\n bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228: 128);\n }\n words.tw.push(toUtf8String(bytes));\n}\n\nclass LangZh extends Wordlist {\n private _country: string\n constructor(country) {\n super('zh_' + country);\n defineReadOnly(this, '_country', country);\n }\n\n getWord(index: number): string {\n return words[this._country][index];\n }\n\n getWordIndex(word: string): number {\n return words[this._country].indexOf(word);\n }\n\n split(mnemonic: string): Array {\n mnemonic = mnemonic.replace(/(?:\\u3000| )+/g, '');\n return mnemonic.split('');\n }\n}\n\nconst langZhCn = new LangZh('cn');\nregister(langZhCn);\n\nconst langZhTw = new LangZh('tw');\nregister(langZhTw);\n\n//var count = 0;\n//var fs = require('fs');\n//fs.readFileSync('wordlists/lang-zh.txt').toString().split('\\x0a').forEach(function(d, i) {\n// let word = langZhCn.getWord(i);\n// if (d !== word) {\n// console.log(d, word, i, toUtf8Bytes(d));\n// count++;\n// }\n//});\n//console.log(count);\n\n//var count = 0;\n//var fs = require('fs');\n//fs.readFileSync('wordlists/lang-zh_tw.txt').toString().split('\\x0a').forEach(function(d, i) {\n// let word = langZhTw.getWord(i);\n// if (d !== word) {\n// console.log(d, word, i, toUtf8Bytes(d));\n// count++;\n// }\n//});\n//console.log(count);\n\nexport { langZhCn, langZhTw };\n"]} \ No newline at end of file diff --git a/dist/ethers.js b/dist/ethers.js index 879041900..bca96dedb 100644 --- a/dist/ethers.js +++ b/dist/ethers.js @@ -13710,18 +13710,19 @@ function sign(transaction, signDigest) { raw.push(bytes_1.hexlify(value)); }); // @TOOD: - throw new Error('implement'); + /* // Requesting an unsigned transation if (!signDigest) { - var v_1 = 27 + signature.recoveryParam; + let v = 27 + signature.recoveryParam if (transaction.chainId) { - v_1 += transaction.chainId * 2 + 8; + v += transaction.chainId * 2 + 8; } //raw.push(hexlify(transaction.chainId)); - raw.push(bytes_1.hexlify(v_1)); + raw.push(hexlify(v)); raw.push('0x'); raw.push('0x'); } + */ if (transaction.chainId) { raw.push(bytes_1.hexlify(transaction.chainId)); raw.push('0x'); diff --git a/dist/ethers.min.js b/dist/ethers.min.js index 59fdb0137..0c254ab53 100644 --- a/dist/ethers.min.js +++ b/dist/ethers.min.js @@ -1,2 +1,2 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ethers=t()}}(function(){return function o(s,a,u){function h(e,t){if(!a[e]){if(!s[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(l)return l(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[e]={exports:{}};s[e][0].call(i.exports,function(t){return h(s[e][1][t]||t)},i,i.exports,o,s,a,u)}return a[e].exports}for(var l="function"==typeof require&&require,t=0;t>4]+i[15&n])}return e.join("")}}),f={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],l=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],v=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],y=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],m=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],g=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],b=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],M=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],A=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],k=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(t){for(var e=[],r=0;r>2,this._Ke[r][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var s,a=0,u=i;u>16&255]<<24^d[s>>8&255]<<16^d[255&s]<<8^d[s>>24&255]^c[a]<<24,a+=1,8!=i)for(e=1;e>8&255]<<8^d[s>>16&255]<<16^d[s>>24&255]<<24;for(e=i/2+1;e>2,l=u%4,this._Ke[h][l]=o[e],this._Kd[t-h][l]=o[e++],u++}for(var h=1;h>24&255]^M[s>>16&255]^A[s>>8&255]^k[255&s]},E.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o>24&255]^p[n[(i+1)%4]>>16&255]^v[n[(i+2)%4]>>8&255]^y[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var s,a=u(16);for(i=0;i<4;i++)s=this._Ke[e][i],a[4*i]=255&(d[n[i]>>24&255]^s>>24),a[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^s>>16),a[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^s>>8),a[4*i+3]=255&(d[255&n[(i+3)%4]]^s);return a},E.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o>24&255]^g[n[(i+3)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^w[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var s,a=u(16);for(i=0;i<4;i++)s=this._Kd[e][i],a[4*i]=255&(h[n[i]>>24&255]^s>>24),a[4*i+1]=255&(h[n[(i+3)%4]>>16&255]^s>>16),a[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^s>>8),a[4*i+3]=255&(h[255&n[(i+1)%4]]^s);return a};var P=function(t){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new E(t)};P.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=u(t.length),r=u(16),n=0;n>=8},R.prototype.setBytes=function(t){if(16!=(t=o(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},R.prototype.increment=function(){for(var t=15;0<=t;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var T=function(t,e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",e instanceof R||(e=new R(e)),this._counter=e,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new E(t)};T.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=n=0;n>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);return this.strip()},m.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},m.prototype._parseBase=function(t,e,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h"};var c=["","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"],d=[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],p=[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 i(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;n=(r.length=n)-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,f=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|l}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}m.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?c[6-a.length]+a+r:a+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&2<=t&&t<=36){var u=d[t],h=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var f=l.modn(h).toString(t);r=(l=l.idivn(h)).isZero()?f+r:c[u-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}y(!1,"Base should be between 2 and 36")},m.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]:2>>=13),64<=e&&(r+=7,e>>>=7),8<=e&&(r+=4,e>>>=4),2<=e&&(r+=2,e>>>=2),r+e},m.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},m.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},m.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},m.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},m.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},m.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},m.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},m.prototype.inotn=function(t){y("number"==typeof t&&0<=t);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),0>26-r),this.strip()},m.prototype.notn=function(t){return this.clone().inotn(t)},m.prototype.setn=function(t,e){y("number"==typeof t&&0<=t);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},m.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;0>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,v=d>>>13,y=0|s[2],m=8191&y,g=y>>>13,b=0|s[3],w=8191&b,_=b>>>13,M=0|s[4],A=8191&M,k=M>>>13,S=0|s[5],E=8191&S,P=S>>>13,N=0|s[6],x=8191&N,I=N>>>13,R=0|s[7],T=8191&R,O=R>>>13,C=0|s[8],B=8191&C,L=C>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],G=8191&F,z=F>>>13,H=0|a[1],V=8191&H,q=H>>>13,K=0|a[2],W=8191&K,J=K>>>13,Z=0|a[3],X=8191&Z,$=Z>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],pt=8191&dt,vt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(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)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,G),i=(i=Math.imul(p,z))+Math.imul(v,G)|0,o=Math.imul(v,z);var mt=(h+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(c,V)|0))<<13)|0;h=((o=o+Math.imul(c,q)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,G),i=(i=Math.imul(m,z))+Math.imul(g,G)|0,o=Math.imul(g,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,q)|0;var gt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(c,W)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(w,G),i=(i=Math.imul(w,z))+Math.imul(_,G)|0,o=Math.imul(_,z),n=n+Math.imul(m,V)|0,i=(i=i+Math.imul(m,q)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,q)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,J)|0;var bt=(h+(n=n+Math.imul(f,X)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(c,X)|0))<<13)|0;h=((o=o+Math.imul(c,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,G),i=(i=Math.imul(A,z))+Math.imul(k,G)|0,o=Math.imul(k,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,J)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,J)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,$)|0;var wt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,G),i=(i=Math.imul(E,z))+Math.imul(P,G)|0,o=Math.imul(P,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,q)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,q)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(m,X)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(g,X)|0,o=o+Math.imul(g,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0;var _t=(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)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,G),i=(i=Math.imul(x,z))+Math.imul(I,G)|0,o=Math.imul(I,z),n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,J)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(g,Q)|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(v,rt)|0,o=o+Math.imul(v,nt)|0;var Mt=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(T,G),i=(i=Math.imul(T,z))+Math.imul(O,G)|0,o=Math.imul(O,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,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,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0;var At=(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)+(At>>>26)|0,At&=67108863,n=Math.imul(B,G),i=(i=Math.imul(B,z))+Math.imul(L,G)|0,o=Math.imul(L,z),n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ht)|0;var kt=(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)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,z))+Math.imul(j,G)|0,o=Math.imul(j,z),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,q)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,q)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(m,ut)|0,i=(i=i+Math.imul(m,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(v,ft)|0,o=o+Math.imul(v,ct)|0;var St=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,vt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,vt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),n=n+Math.imul(B,W)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,$)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(m,ft)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,ct)|0;var Et=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,vt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((o=o+Math.imul(v,vt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(U,W),i=(i=Math.imul(U,J))+Math.imul(j,W)|0,o=Math.imul(j,J),n=n+Math.imul(B,X)|0,i=(i=i+Math.imul(B,$)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,$)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ct)|0;var Pt=(h+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,vt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,vt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(U,X),i=(i=Math.imul(U,$))+Math.imul(j,X)|0,o=Math.imul(j,$),n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var Nt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,vt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,vt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,tt))+Math.imul(j,Q)|0,o=Math.imul(j,tt),n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var xt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,vt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,vt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,ct)|0;var It=(h+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,vt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((o=o+Math.imul(P,vt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var Rt=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,vt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,vt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(B,ft)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,ct)|0;var Tt=(h+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,vt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,vt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ft),i=(i=Math.imul(U,ct))+Math.imul(j,ft)|0,o=Math.imul(j,ct);var Ot=(h+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,vt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,vt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,vt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,vt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=yt,u[1]=mt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Mt,u[7]=At,u[8]=kt,u[9]=St,u[10]=Et,u[11]=Pt,u[12]=Nt,u[13]=xt,u[14]=It,u[15]=Rt,u[16]=Tt,u[17]=Ot,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function a(t,e,r){return(new u).mulp(t,e,r)}function u(t,e){this.x=t,this.y=e}Math.imul||(o=i),m.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?o(this,t,e):r<63?i(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):a(this,t,e)},u.prototype.makeRBT=function(t){for(var e=new Array(t),r=m.prototype._countBits(t)-1,n=0;n>=1;return n},u.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=e,this.length++),this},m.prototype.muln=function(t){return this.clone().imuln(t)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new m(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;0<=e;e--)this.words[e+n]=this.words[e];for(e=0;e>>i<o)for(this.length-=o,u=0;u>>i,h=l&s}return a&&0!==h&&(a.words[a.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(t,e,r){return y(0===this.negative),this.iushrn(t,e,r)},m.prototype.shln=function(t){return this.clone().ishln(t)},m.prototype.ushln=function(t){return this.clone().iushln(t)},m.prototype.shrn=function(t){return this.clone().ishrn(t)},m.prototype.ushrn=function(t){return this.clone().iushrn(t)},m.prototype.testn=function(t){y("number"==typeof t&&0<=t);var e=t%26,r=(t-e)/26,n=1<>>e<>26)-(a/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===s)return this.strip();for(y(-1===s),n=s=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},m.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,a=n.length-i.length;if("mod"!==e){(s=new m(null)).length=a+1,s.words=new Array(s.length);for(var u=0;uthis.length||this.cmp(t)<0?{div:new m(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new m(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new m(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,i,o},m.prototype.div=function(t){return this.divmod(t,"div",!1).div},m.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},m.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},m.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 o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},m.prototype.modn=function(t){y(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;0<=n;n--)r=(e*r+(0|this.words[n]))%t;return r},m.prototype.idivn=function(t){y(t<=67108863);for(var e=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},m.prototype.divn=function(t){return this.clone().idivn(t)},m.prototype.egcd=function(t){y(0===t.negative),y(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new m(1),i=new m(0),o=new m(0),s=new m(1),a=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++a;for(var u=r.clone(),h=e.clone();!e.isZero();){for(var l=0,f=1;0==(e.words[0]&f)&&l<26;++l,f<<=1);if(0>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1t.length)return 1;if(this.lengththis.n;);var n=e>>22,i=o}i>>>=22,0===(t.words[n-10]=i)&&10>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},m._prime=function(t){if(h[t])return h[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new g;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return h[t]=e},_.prototype._verify1=function(t){y(0===t.negative,"red works only with positives"),y(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){y(0==(t.negative|e.negative),"red works only with positives"),y(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 r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<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(y(e%2==1),3===e){var r=this.m.add(new m(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);y(!n.isZero());var o=new m(1).toRed(this),s=o.redNeg(),a=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new m(2*u*u).toRed(this);0!==this.pow(u,a).cmp(s);)u.redIAdd(s);for(var h=this.pow(u,n),l=this.pow(t,n.addn(1).iushrn(1)),f=this.pow(t,n),c=i;0!==f.cmp(o);){for(var d=f,p=0;0!==d.cmp(o);p++)d=d.redSqr();y(p>h&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===n&&0===h)&&(i=this.mul(i,r[o]),o=s=0)):s=0}a=26}return i},_.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},m.mont=function(t){return new M(t)},r(M,_),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.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)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new m(0)._forceRed(this);var r=t.mul(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)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:4}],3:[function(t,e,r){var n=t("../../src.ts/utils").randomBytes;e.exports=function(t){return n(t)}},{"../../src.ts/utils":63}],4:[function(t,e,r){},{}],5:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.hmacDRBG=t("./elliptic/hmac-drbg"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":19,"./elliptic/curve":8,"./elliptic/curves":11,"./elliptic/ec":12,"./elliptic/eddsa":15,"./elliptic/hmac-drbg":16,"./elliptic/utils":18,brorand:3}],6:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../../elliptic").utils,S=i.getNAF,E=i.getJSF,f=i.assert;function o(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||0>1]):s.mixedAdd(i[-u-1>>1].neg()):0>1]):s.add(i[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},o.prototype._wnafMulAdd=function(t,e,r,n,i){for(var o=this._wnafT1,s=this._wnafT2,a=this._wnafT3,u=0,h=0;h>1]:k<0&&(A=s[y][-k-1>>1].neg()),b="affine"===A.type?b.mixedAdd(A):b.add(A))}}for(h=0;h=Math.ceil((t.bitLength()+1)/e.step)},s.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new _(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},h.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new l(this,t,e,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),l=h.redMul(a),f=n.redMul(h),c=u.redSqr().redIAdd(l).redISub(f).redISub(f),d=u.redMul(f.redISub(c)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,p)},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),l=r.redMul(u),f=a.redSqr().redIAdd(h).redISub(l).redISub(l),c=a.redMul(l.redISub(f)).redISub(i.redMul(h)),d=this.z.redMul(s);return this.curve.jpoint(f,c,d)},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":5,"../curve":8,"bn.js":2,inherits:32}],11:[function(t,e,r){"use strict";var n,i=r,o=t("hash.js"),s=t("../elliptic"),a=s.utils.assert;function u(t){"short"===t.type?this.curve=new s.curve.short(t):"edwards"===t.type?this.curve=new s.curve.edwards(t):this.curve=new s.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(e,r){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var t=new u(r);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:t}),t}})}i.PresetCurve=u,h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":5,"./precomputed/secp256k1":17,"hash.js":20}],12:[function(t,e,r){"use strict";var y=t("bn.js"),m=t("../../elliptic"),d=m.utils.assert,n=t("./key"),g=t("./signature");function i(t){if(!(this instanceof i))return new i(t);"string"==typeof t&&(d(m.curves.hasOwnProperty(t),"Unknown curve "+t),t=m.curves[t]),t instanceof m.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}(e.exports=i).prototype.keyPair=function(t){return new n(this,t)},i.prototype.keyFromPrivate=function(t,e){return n.fromPrivate(this,t,e)},i.prototype.keyFromPublic=function(t,e){return n.fromPublic(this,t,e)},i.prototype.genKeyPair=function(t){t||(t={});for(var e=new m.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||m.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new y(2));;){var i=new y(e.generate(r));if(!(0>1;if(0<=s.cmp(this.curve.p.umod(this.curve.n))&&h)throw new Error("Unable to find sencond key candinate");s=h?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var l=e.r.invm(i),f=i.sub(o).mul(l).umod(i),c=a.mul(l).umod(i);return this.g.mulAdd(f,s,c)},i.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new g(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":5,"./key":13,"./signature":14,"bn.js":2}],13:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../../elliptic").utils.assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}(e.exports=o).fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":5,"bn.js":2}],14:[function(t,e,r){"use strict";var a=t("bn.js"),u=t("../../elliptic").utils,n=u.assert;function i(t,e){if(t instanceof i)return t;this._importDER(t,e)||(n(t.r&&t.s,"Signature without r or s"),this.r=new a(t.r,16),this.s=new a(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function h(){this.place=0}function l(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=e.place;o>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}(e.exports=i).prototype._importDER=function(t,e){t=u.toArray(t,e);var r=new h;if(48!==t[r.place++])return!1;if(l(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=l(t,r),i=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var o=l(t,r);if(t.length!==o+r.place)return!1;var s=t.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===s[0]&&128&s[1]&&(s=s.slice(1)),this.r=new a(i),this.s=new a(s),!(this.recoveryParam=null)},i.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=s(e),r=s(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,e.length),(n=n.concat(e)).push(2),f(n,r.length);var i=n.concat(r),o=[48];return f(o,i.length),o=o.concat(i),u.encode(o,t)}},{"../../elliptic":5,"bn.js":2}],15:[function(t,e,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],16:[function(t,e,r){"use strict";var n=t("hash.js"),s=t("../elliptic").utils,i=s.assert;function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=s.toArray(t.entropy,t.entropyEnc),r=s.toArray(t.nonce,t.nonceEnc),n=s.toArray(t.pers,t.persEnc);i(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}(e.exports=o).prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this.reseed=1},o.prototype.generate=function(t,e,r,n){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=s.toArray(r,n),this._update(r));for(var i=[];i.length>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=o,n.toHex=s,n.encode=function(t,e){return"hex"===e?s(t):t},n.getNAF=function(t,e){for(var r=[],n=1<>1)-1>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,u=1;u=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":31}],31:[function(t,e,r){"use strict";var h=t("minimalistic-assert"),n=t("inherits");function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function i(t){return 1===t.length?"0"+t:t}function s(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}r.inherits=n,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>8,s=255&i;o?r.push(o,s):r.push(s)}else for(n=0;n>>0}return o},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,h=e;return u+=(h=h+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,h){var l=0,f=e;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,h){return e+n+o+a+h>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:32,"minimalistic-assert":34}],32:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],33:[function(t,_,e){(function(b,w){!function(){"use strict";var t="object"==typeof window?window:{};!t.JS_SHA3_NO_NODE_JS&&"object"==typeof b&&b.versions&&b.versions.node&&(t=w);for(var e=!t.JS_SHA3_NO_COMMON_JS&&"object"==typeof _&&_.exports,u="0123456789abcdef".split(""),l=[0,8,16,24],lt=[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],r=[224,256,384,512],o=["hex","buffer","arrayBuffer","array"],s=function(e,r,n){return function(t){return new m(e,r,e).update(t)[n]()}},a=function(r,n,i){return function(t,e){return new m(r,n,e).update(t)[i]()}},n=function(t,e){var r=s(t,e,"hex");r.create=function(){return new m(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}m.prototype.update=function(t){var e="string"!=typeof t;e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));for(var r,n,i=t.length,o=this.blocks,s=this.byteCount,a=this.blockCount,u=0,h=this.s;u>2]|=t[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];s%e==0&&(g(r),o=0)}return i&&(t=r[o],0>4&15]+u[15&t]),1>12&15]+u[t>>8&15]),2>20&15]+u[t>>16&15])),a},m.prototype.buffer=m.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&g(n)}return o&&(t=a<<2,e=n[s],0>8&255),2>16&255)),u};var g=function(t){var e,r,n,i,o,s,a,u,h,l,f,c,d,p,v,y,m,g,b,w,_,M,A,k,S,E,P,N,x,I,R,T,O,C,B,L,D,U,j,F,G,z,H,V,q,K,W,J,Z,X,$,Y,Q,tt,et,rt,nt,it,ot,st,at,ut,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,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,e=i^(u<<1|h>>>31),r=o^(h<<1|u>>>31),t[2]^=e,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,e=s^(l<<1|f>>>31),r=a^(f<<1|l>>>31),t[4]^=e,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,e=u^(c<<1|d>>>31),r=h^(d<<1|c>>>31),t[6]^=e,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,e=l^(i<<1|o>>>31),r=f^(o<<1|i>>>31),t[8]^=e,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,p=t[0],v=t[1],K=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,N=t[20]<<3|t[21]>>>29,x=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,at=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,C=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,m=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,I=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ut=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,tt=t[5]<<30|t[4]>>>2,et=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,$=t[35]<<15|t[34]>>>17,T=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,k=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,j=t[27]<<25|t[26]>>>7,w=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,Y=t[47]<<24|t[46]>>>8,Q=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,q=t[9]<<27|t[8]>>>5,E=t[18]<<20|t[19]>>>12,P=t[19]<<20|t[18]>>>12,it=t[29]<<7|t[28]>>>25,ot=t[28]<<7|t[29]>>>25,F=t[38]<<8|t[39]>>>24,G=t[39]<<8|t[38]>>>24,M=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~y&g,t[1]=v^~m&b,t[10]=k^~E&N,t[11]=S^~P&x,t[20]=C^~L&U,t[21]=B^~D&j,t[30]=V^~K&J,t[31]=q^~W&Z,t[40]=tt^~rt&it,t[41]=et^~nt&ot,t[2]=y^~g&w,t[3]=m^~b&_,t[12]=E^~N&I,t[13]=P^~x&R,t[22]=L^~U&F,t[23]=D^~j&G,t[32]=K^~J&X,t[33]=W^~Z&$,t[42]=rt^~it&st,t[43]=nt^~ot&at,t[4]=g^~w&M,t[5]=b^~_&A,t[14]=N^~I&T,t[15]=x^~R&O,t[24]=U^~F&z,t[25]=j^~G&H,t[34]=J^~X&Y,t[35]=Z^~$&Q,t[44]=it^~st&ut,t[45]=ot^~at&ht,t[6]=w^~M&p,t[7]=_^~A&v,t[16]=I^~T&k,t[17]=R^~O&S,t[26]=F^~z&C,t[27]=G^~H&B,t[36]=X^~Y&V,t[37]=$^~Q&q,t[46]=st^~ut&tt,t[47]=at^~ht&et,t[8]=M^~p&y,t[9]=A^~v&m,t[18]=T^~k&E,t[19]=O^~S&P,t[28]=z^~C&L,t[29]=H^~B&D,t[38]=Y^~V&K,t[39]=Q^~q&W,t[48]=ut^~tt&rt,t[49]=ht^~et&nt,t[0]^=lt[n],t[1]^=lt[n+1]};if(e)_.exports=h;else for(c=0;c>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=((n=S[i-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,S[i]=(s+S[i-7]|0)+(a+S[i-16]|0)|0;for(i=0;i<64;i++)s=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&d^~c&p)|0)+(v+(y[i]+S[i]|0)|0)|0,a=((u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10))+(u&h^u&l^h&l)|0,v=p,p=d,d=c,c=f+s|0,f=l,l=h,h=u,u=s+a|0;m=m+u|0,g=g+h|0,b=b+l|0,w=w+f|0,_=_+c|0,M=M+d|0,A=A+p|0,k=k+v|0,e+=64,r-=64}}e(t);var r,n=t.length%64,i=t.length/536870912|0,o=t.length<<3,s=n<56?56:120,a=t.slice(t.length-n,t.length);for(a.push(128),r=n+1;r>>24&255),a.push(i>>>16&255),a.push(i>>>8&255),a.push(i>>>0&255),a.push(o>>>24&255),a.push(o>>>16&255),a.push(o>>>8&255),a.push(o>>>0&255),e(a),[m>>>24&255,m>>>16&255,m>>>8&255,m>>>0&255,g>>>24&255,g>>>16&255,g>>>8&255,g>>>0&255,b>>>24&255,b>>>16&255,b>>>8&255,b>>>0&255,w>>>24&255,w>>>16&255,w>>>8&255,w>>>0&255,_>>>24&255,_>>>16&255,_>>>8&255,_>>>0&255,M>>>24&255,M>>>16&255,M>>>8&255,M>>>0&255,A>>>24&255,A>>>16&255,A>>>8&255,A>>>0&255,k>>>24&255,k>>>16&255,k>>>8&255,k>>>0&255]}function x(t,e,r){var n;t=t.length<=64?t:h(t);var i=64+e.length+4,o=new Array(i),s=new Array(64),a=[];for(n=0;n<64;n++)o[n]=54;for(n=0;n>>32-e}function s(t,e){T(t,0,e,0,16);for(var r=8;0>0&255),f.push(c[t]>>8&255),f.push(c[t]>>16&255),f.push(c[t]>>24&255);var i=x(o,f,h);return l(null,1,i)}P(N)};N()}void 0!==o?r.exports=e:t&&(t.scrypt&&(t._scrypt=t.scrypt),t.scrypt=e)}(this)}).call(this,t("timers").setImmediate)},{timers:37}],37:[function(t,e,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],38:[function(t,i,e){(function(t){var e;if(t.crypto&&crypto.getRandomValues){var r=new Uint8Array(16);e=function(){return crypto.getRandomValues(r),r}}if(!e){var n=new Array(16);e=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),n[e]=t>>>((3&e)<<3)&255;return n}}i.exports=e}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],39:[function(t,e,r){for(var s=t("./rng"),i=[],o={},n=0;n<256;n++)i[n]=(n+256).toString(16).substr(1),o[i[n]]=n;function d(t,e){var r=e||0,n=i;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}var a=s(),p=[1|a[0],a[1],a[2],a[3],a[4],a[5]],v=16383&(a[6]<<8|a[7]),y=0,m=0;function u(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null);var i=(t=t||{}).random||(t.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var o=0;o<16;o++)e[n+o]=i[o];return e||d(i)}var h=u;h.v1=function(t,e,r){var n=e&&r||0,i=e||[],o=void 0!==(t=t||{}).clockseq?t.clockseq:v,s=void 0!==t.msecs?t.msecs:(new Date).getTime(),a=void 0!==t.nsecs?t.nsecs:m+1,u=s-y+(a-m)/1e4;if(u<0&&void 0===t.clockseq&&(o=o+1&16383),(u<0||y>>24&255,i[n++]=h>>>16&255,i[n++]=h>>>8&255,i[n++]=255&h;var l=s/4294967296*1e4&268435455;i[n++]=l>>>8&255,i[n++]=255&l,i[n++]=l>>>24&15|16,i[n++]=l>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var f=t.node||p,c=0;c<6;c++)i[n+c]=f[c];return e||d(i)},h.v4=u,h.parse=function(t,e,r){var n=e&&r||0,i=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){i<16&&(e[n+i++]=o[t])});i<16;)e[n+i++]=0;return e},h.unparse=d,e.exports=h},{"./rng":38}],40:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../src.ts/utils/bytes");e.exports={decode:function(t){t=atob(t);for(var e=[],r=0;r>24&255,l[e.length+1]=f>>16&255,l[e.length+2]=f>>8&255,l[e.length+3]=255&f;var c=g.computeHmac(i,t,l);o||(o=c.length,a=new Uint8Array(o),s=n-((u=Math.ceil(n/o))-1)*o),a.set(c);for(var d=1;dthis.inputs.length&&l.throwError("too many constructor arguments",l.UNEXPECTED_ARGUMENT,{count:e.length,expectedCount:this.inputs.length});try{return t+f.defaultAbiCoder.encode(this.inputs,e).substring(2)}catch(t){l.throwError("invalid constructor argument",l.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},e}(p);r.DeployDescription=y;var m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.encode=function(t){t.lengththis.inputs.length&&l.throwError("too many input arguments",l.UNEXPECTED_ARGUMENT,{count:t.length,expectedCount:this.inputs.length});try{return this.sighash+f.defaultAbiCoder.encode(this.inputs,t).substring(2)}catch(t){l.throwError("invalid input argument",l.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},e.prototype.decode=function(e){try{return f.defaultAbiCoder.decode(this.outputs,c.arrayify(e))}catch(t){l.throwError("invalid data for function output",l.INVALID_ARGUMENT,{arg:"data",errorArg:t.arg,errorValue:t.value,value:e,reason:t.reason})}},e}(p);r.FunctionDescription=m;var g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(p),b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.decode=function(t,r){null==r||this.anonymous||(r=r.slice(1));var n=[],i=[],o=[];if(this.inputs.forEach(function(t,e){t.indexed?"string"===t.type||"bytes"===t.type||0<=t.type.indexOf("[")||"tuple"===t.type.substring(0,5)?(n.push({type:"bytes32",name:t.name||""}),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))}),null!=r)var s=f.defaultAbiCoder.decode(n,c.concat(r));var a=f.defaultAbiCoder.decode(i,c.arrayify(t)),u=new g({}),h=0,l=0;return this.inputs.forEach(function(t,e){t.indexed?null==r?u[e]=new v({type:"indexed",hash:null}):o[e]?u[e]=new v({type:"indexed",hash:s[l++]}):u[e]=s[l++]:u[e]=a[h++],t.name&&(u[t.name]=u[e])}),u.length=this.inputs.length,u},e}(p);r.EventDescription=b;var w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(p),_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(p);function M(t){switch(t.type){case"constructor":var e=new y({inputs:t.inputs,payable:null==t.payable||!!t.payable,type:"deploy"});this.deployFunction||(this.deployFunction=e);break;case"function":n=(n="("+d(t.inputs).types.join(",")+")").replace(/tuple/g,""),n=t.name+n;var r=a.keccak256(u.toUtf8Bytes(n)).substring(0,10);e=new m({inputs:t.inputs,outputs:t.outputs,payable:null==t.payable||!!t.payable,type:t.constant?"call":"transaction",signature:n,sighash:r});t.name&&null==this.functions[t.name]&&h.defineReadOnly(this.functions,t.name,e),null==this.functions[e.signature]&&h.defineReadOnly(this.functions,e.signature,e);break;case"event":var n;n=(n="("+d(t.inputs).types.join(",")+")").replace(/tuple/g,""),n=t.name+n;e=new b({name:t.name,signature:n,inputs:t.inputs,topic:a.keccak256(u.toUtf8Bytes(n)),anonymous:!!t.anonymous,type:"event"});t.name&&null==this.events[t.name]&&h.defineReadOnly(this.events,t.name,e),null==this.events[e.signature]&&h.defineReadOnly(this.events,e.signature,e);break;case"fallback":break;default:console.log("WARNING: unsupported ABI type - "+t.type)}}var A=function(){function t(e){if(l.checkNew(this,t),"string"==typeof e){try{e=JSON.parse(e)}catch(t){l.throwError("could not parse ABI JSON",l.INVALID_ARGUMENT,{arg:"abi",errorMessage:t.message,value:e})}if(!Array.isArray(e))return l.throwError("invalid abi",l.INVALID_ARGUMENT,{arg:"abi",value:e}),null}h.defineReadOnly(this,"functions",{}),h.defineReadOnly(this,"events",{});var r=[];e.forEach(function(t){"string"==typeof t&&(t=f.parseSignature(t)),r.push(t)}),h.defineFrozen(this,"abi",r),r.forEach(M,this),this.deployFunction||M.call(this,{type:"constructor",inputs:[]})}return t.prototype.parseTransaction=function(t){var e=t.data.substring(0,10).toLowerCase();for(var r in this.functions)if(-1!==r.indexOf("(")){var n=this.functions[r];if(n.sighash===e){var i=f.defaultAbiCoder.decode(n.inputs,"0x"+t.data.substring(10));return new w({args:i,decode:n.decode,name:r,signature:n.signature,sighash:n.sighash,type:"transaction",value:s.bigNumberify(t.value||0)})}}return null},t.prototype.parseLog=function(t){for(var e in this.events)if(-1!==e.indexOf("(")){var r=this.events[e];if(!r.anonymous&&r.topic===t.topics[0])return new _({name:r.name,signature:r.signature,topic:r.topic,type:"log",values:r.decode(t.data,t.topics)})}return null},t}();r.Interface=A},{"../utils/abi-coder":57,"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/keccak256":64,"../utils/properties":65,"../utils/utf8":72}],49:[function(t,e,r){"use strict";var n,i=this&&this.__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)}),o=this&&this.__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=t("./provider"),a=t("../utils/bytes"),u=t("../utils/properties"),h=t("../utils/web"),l=o(t("../utils/errors"));function f(t){var e=[];for(var r in t)if(null!=t[r]){var n=a.hexlify(t[r]);({gasLimit:!0,gasPrice:!0,nonce:!0,value:!0})[r]&&(n=a.hexStripZeros(n)),e.push(r+"="+n)}return e.join("&")}function c(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1!=t.status||"OK"!=t.message){var e=new Error("invalid response");throw e.result=JSON.stringify(t),e}return t.result}function d(t){if("2.0"!=t.jsonrpc)throw(e=new Error("invalid response")).result=JSON.stringify(t),e;if(t.error){var e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function p(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}var v=function(a){function o(t,e){var r=a.call(this,t)||this;l.checkNew(r,o);var n="invalid";r.network&&(n=r.network.name);var i=null;switch(n){case"homestead":i="https://api.etherscan.io";break;case"ropsten":i="https://api-ropsten.etherscan.io";break;case"rinkeby":i="https://api-rinkeby.etherscan.io";break;case"kovan":i="https://api-kovan.etherscan.io";break;default:throw new Error("unsupported network")}return u.defineReadOnly(r,"baseUrl",i),u.defineReadOnly(r,"apiKey",e),r}return i(o,a),o.prototype.perform=function(t,e){var r=this.baseUrl,n="";switch(this.apiKey&&(n+="&apikey="+this.apiKey),t){case"getBlockNumber":return r+="/api?module=proxy&action=eth_blockNumber"+n,h.fetchJson(r,null,d);case"getGasPrice":return r+="/api?module=proxy&action=eth_gasPrice"+n,h.fetchJson(r,null,d);case"getBalance":return r+="/api?module=account&action=balance&address="+e.address,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,c);case"getTransactionCount":return r+="/api?module=proxy&action=eth_getTransactionCount&address="+e.address,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,d);case"getCode":return r+="/api?module=proxy&action=eth_getCode&address="+e.address,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,d);case"getStorageAt":return r+="/api?module=proxy&action=eth_getStorageAt&address="+e.address,r+="&position="+e.position,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,d);case"sendTransaction":return r+="/api?module=proxy&action=eth_sendRawTransaction&hex="+e.signedTransaction,r+=n,h.fetchJson(r,null,d);case"getBlock":if(e.blockTag)return r+="/api?module=proxy&action=eth_getBlockByNumber&tag="+e.blockTag,r+="&boolean=false",r+=n,h.fetchJson(r,null,d);throw new Error("getBlock by blockHash not implmeneted");case"getTransaction":return r+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+e.transactionHash,r+=n,h.fetchJson(r,null,d);case"getTransactionReceipt":return r+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+e.transactionHash,r+=n,h.fetchJson(r,null,d);case"call":return(i=f(e.transaction))&&(i="&"+i),r+="/api?module=proxy&action=eth_call"+i,r+=n,h.fetchJson(r,null,d);case"estimateGas":var i;return(i=f(e.transaction))&&(i="&"+i),r+="/api?module=proxy&action=eth_estimateGas&"+i,r+=n,h.fetchJson(r,null,d);case"getLogs":r+="/api?module=logs&action=getLogs";try{if(e.filter.fromBlock&&(r+="&fromBlock="+p(e.filter.fromBlock)),e.filter.toBlock&&(r+="&toBlock="+p(e.filter.toBlock)),e.filter.address&&(r+="&address="+e.filter.address),e.filter.topics&&0r+12&&delete i._emitted[t]})),i.emit("block",r);var n={};Object.keys(i._events).forEach(function(t){var r=function(t){if("tx:"===t.substring(0,3))return{type:"transaction",hash:t.substring(3)};if("block"===t)return{type:"block"};if("pending"===t)return{type:"pending"};if("address:"===t.substring(0,8))return{type:"address",address:t.substring(8)};if("topic:"===t.substring(0,6))try{var e=f.decode(t.substring(6));return{type:"topic",topic:e=U(e,function(t){return"0x"===t&&(t=null),t})}}catch(t){console.log(t)}throw new Error("invalid event string")}(t);"transaction"===r.type?i.getTransaction(r.hash).then(function(t){t&&null!=t.blockNumber&&(i._emitted["t:"+t.hash.toLowerCase()]=t.blockNumber,i.emit(r.hash,t))}):"address"===r.type?(i._balances[r.address]&&(n[r.address]=i._balances[r.address]),i.getBalance(r.address,"latest").then(function(t){var e=this._balances[r.address];e&&t.eq(e)||(this._balances[r.address]=t,this.emit(r.address,t))})):"topic"===r.type&&i.getLogs({fromBlock:i._lastBlockNumber+1,toBlock:e,topics:r.topic}).then(function(t){0!==t.length&&t.forEach(function(t){i._emitted["b:"+t.blockHash.toLowerCase()]=t.blockNumber,i._emitted["t:"+t.transactionHash.toLowerCase()]=t.blockNumber,i.emit(r.topic,t)})})}),i._lastBlockNumber=e,i._balances=n}}),this.doPoll()},n.prototype.resetEventsBlock=function(t){this._lastBlockNumber=this.blockNumber,this._doPoll()},Object.defineProperty(n.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),n.prototype.getNetwork=function(){return this.ready},Object.defineProperty(n.prototype,"blockNumber",{get:function(){return this._lastBlockNumber<0?null:this._lastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"polling",{get:function(){return null!=this._poller},set:function(t){var e=this;setTimeout(function(){t&&!e._poller?e._poller=setInterval(e._doPoll.bind(e),e.pollingInterval):!t&&e._poller&&(clearInterval(e._poller),e._poller=null)},0)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(t){var e=this;if("number"!=typeof t||t<=0||Math.trunc(t)!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(function(){e._doPoll()},this._pollingInterval))},enumerable:!0,configurable:!0}),n.prototype.waitForTransaction=function(i,o){var s=this;return new Promise(function(e,t){var r=null;function n(t){r&&clearTimeout(r),e(t)}s.once(i,n),"number"==typeof o&&0i._emitted.block},function(){return i.perform("getBlock",{blockTag:n}).then(function(t){return null==t?null:S(t)})})}catch(t){}throw new Error("invalid block hash or block tag")})})},n.prototype.getTransaction=function(t){var n=this;return this.ready.then(function(){return p.resolveProperties({transactionHash:t}).then(function(t){var e=t.transactionHash,r={transactionHash:w(e)};return D(function(){return null==n._emitted["t:"+e.toLowerCase()]},function(){return n.perform("getTransaction",r).then(function(t){return null!=t&&(t=P(t)),t})})})})},n.prototype.getTransactionReceipt=function(t){var n=this;return this.ready.then(function(){return p.resolveProperties({transactionHash:t}).then(function(t){var e=t.transactionHash,r={transactionHash:w(e)};return D(function(){return null==n._emitted["t:"+e.toLowerCase()]},function(){return n.perform("getTransactionReceipt",r).then(function(t){var e,r;return null!=t&&((r=m(R,e=t)).logs.forEach(function(t,e){null==t.transactionLogIndex&&(t.transactionLogIndex=e)}),null!=e.status&&(r.byzantium=!0),t=r),t})})})})},n.prototype.getLogs=function(t){var n=this;return this.ready.then(function(){return p.resolveProperties(t).then(function(t){return n._resolveNames(t,["address"]).then(function(t){var e,r={filter:(e=t,m(T,e))};return n.perform("getLogs",r).then(function(t){return b(L)(t)})})})})},n.prototype.getEtherPrice=function(){var t=this;return this.ready.then(function(){return t.perform("getEtherPrice",{}).then(function(t){return t})})},n.prototype._resolveNames=function(t,e){var r=[],n=function(t){var e={};for(var r in t)e[r]=t[r];return e}(t);return e.forEach(function(e){void 0!==n[e]&&r.push(this.resolveName(n[e]).then(function(t){n[e]=t}))},this),Promise.all(r).then(function(){return n})},n.prototype._getResolver=function(n){var i=this;return this.getNetwork().then(function(t){t.ensAddress||y.throwError("network does support ENS",y.UNSUPPORTED_OPERATION,{operation:"ENS",network:t.name});var e="0x0178b8bf"+c.namehash(n).substring(2),r={to:t.ensAddress,data:e};return i.call(r).then(function(t){return 32!==h.hexDataLength(t)?null:a.getAddress(h.hexDataSlice(t,12))})})},n.prototype.resolveName=function(t){var e=this;if(t instanceof Promise)return t.then(function(t){return e.resolveName(t)});try{return Promise.resolve(a.getAddress(t))}catch(t){}var r=this,n=c.namehash(t);return this._getResolver(t).then(function(t){var e={to:t,data:"0x3b3b57de"+n.substring(2)};return r.call(e)}).then(function(t){if(32!==h.hexDataLength(t))return null;var e=a.getAddress(h.hexDataSlice(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e})},n.prototype.lookupAddress=function(n){var e=this;if(n instanceof Promise)return n.then(function(t){return e.lookupAddress(t)});var t=(n=a.getAddress(n)).substring(2)+".addr.reverse",r=c.namehash(t),i=this;return this._getResolver(t).then(function(t){if(!t)return null;var e={to:t,data:"0x691f3431"+r.substring(2)};return i.call(e)}).then(function(t){if((t=t.substring(2)).length<64)return null;if((t=t.substring(64)).length<64)return null;var e=u.bigNumberify("0x"+t.substring(0,64)).toNumber();if(2*e>(t=t.substring(64)).length)return null;var r=l.toUtf8String("0x"+t.substring(0,2*e));return i.resolveName(r).then(function(t){return t!=n?null:r})})},n.prototype.doPoll=function(){},n.prototype.perform=function(t,e){return y.throwError(t+" not implemented",y.NOT_IMPLEMENTED,{operation:t}),null},n.prototype._startPending=function(){console.log("WARNING: this provider does not support pending events")},n.prototype._stopPending=function(){},n.prototype.on=function(t,e){var r=j(t);return this._events[r]||(this._events[r]=[]),this._events[r].push({eventName:t,listener:e,type:"on"}),"pending"===r&&this._startPending(),this.polling=!0,this},n.prototype.once=function(t,e){var r=j(t);return this._events[r]||(this._events[r]=[]),this._events[r].push({eventName:t,listener:e,type:"once"}),"pending"===r&&this._startPending(),this.polling=!0,this},n.prototype.emit=function(t){for(var e=[],r=1;rt.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},t}(b),_=function(s){function t(t,e,r,n){var i=this,o=(r?"int":"uint")+8*e;return(i=s.call(this,t,o,o,n,!1)||this).size=e,i.signed=r,i}return i(t,s),t.prototype.encode=function(e){try{var t=a.bigNumberify(e);return t=t.toTwos(8*this.size).maskn(8*this.size),this.signed&&(t=t.fromTwos(8*this.size).toTwos(256)),u.padZeros(u.arrayify(t),32)}catch(t){f.throwError("invalid number value",f.INVALID_ARGUMENT,{arg:this.localName,type:typeof e,value:e})}return null},t.prototype.decode=function(t,e){t.length>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 h={},l=0;l<10;l++)h[String(l)]=String(l);for(l=0;l<26;l++)h[String.fromCharCode(65+l)]=String(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=String(98-parseInt(e,10)%97);n.length<2;)n="0"+n;return n}function p(t){var e=null;if("string"!=typeof t&&a.throwError("invalid address",a.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=u(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&a.throwError("bad address checksum",a.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)&&a.throwError("bad icap checksum",a.INVALID_ARGUMENT,{arg:"address",value:t}),e=new n(t.substring(4),36).toString(16);e.length<40;)e="0"+e;e=u("0x"+e)}else a.throwError("invalid address",a.INVALID_ARGUMENT,{arg:"address",value:t});return e}r.getAddress=p,r.getIcapAddress=function(t){for(var e=new n(p(t).substring(2),16).toString(36).toUpperCase();e.length<30;)e="0"+e;return"XE"+d("XE00"+e)+e},r.getContractAddress=function(t){if(!t.from)throw new Error("missing from address");var e=t.nonce;return p("0x"+s.keccak256(i.encode([p(t.from),o.stripZeros(o.hexlify(e))])).substring(26))}},{"./bytes":60,"./errors":61,"./keccak256":64,"./rlp":66,"bn.js":2}],59:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__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(n,"__esModule",{value:!0});var o=r(t("bn.js")),s=t("./bytes"),a=t("./properties"),u=i(t("../utils/errors"));function h(t){return f(t)}var l=function(){function r(t){if(u.checkNew(this,r),"string"==typeof t)s.isHexString(t)?("0x"==t&&(t="0x0"),a.defineReadOnly(this,"_bn",new o.default.BN(t.substring(2),16))):"-"===t[0]&&s.isHexString(t.substring(1))?a.defineReadOnly(this,"_bn",new o.default.BN(t.substring(3),16).mul(n.ConstantNegativeOne._bn)):t.match(/^-?[0-9]*$/)&&(""==t&&(t="0"),a.defineReadOnly(this,"_bn",new o.default.BN(t)));else if("number"==typeof t){Math.trunc(t)!==t&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:t,outputValue:Math.trunc(t)});try{a.defineReadOnly(this,"_bn",new o.default.BN(t))}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}}else o.default.BN.isBN(t)?a.defineReadOnly(this,"_bn",t):h(t)?a.defineReadOnly(this,"_bn",t._bn):s.isArrayish(t)?a.defineReadOnly(this,"_bn",new o.default.BN(s.hexlify(t).substring(2),16)):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:t})}return r.prototype.fromTwos=function(t){return new r(this._bn.fromTwos(t))},r.prototype.toTwos=function(t){return new r(this._bn.toTwos(t))},r.prototype.add=function(t){return new r(this._bn.add(c(t)._bn))},r.prototype.sub=function(t){return new r(this._bn.sub(c(t)._bn))},r.prototype.div=function(t){var e=c(t)._bn;return e.isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),new r(this._bn.div(e))},r.prototype.mul=function(t){return new r(this._bn.mul(c(t)._bn))},r.prototype.mod=function(t){return new r(this._bn.mod(c(t)._bn))},r.prototype.pow=function(t){return new r(this._bn.pow(c(t)._bn))},r.prototype.maskn=function(t){return new r(this._bn.maskn(t))},r.prototype.eq=function(t){return this._bn.eq(c(t)._bn)},r.prototype.lt=function(t){return this._bn.lt(c(t)._bn)},r.prototype.lte=function(t){return this._bn.lte(c(t)._bn)},r.prototype.gt=function(t){return this._bn.gt(c(t)._bn)},r.prototype.gte=function(t){return this._bn.gte(c(t)._bn)},r.prototype.isZero=function(){return this._bn.isZero()},r.prototype.toNumber=function(){try{return this._bn.toNumber()}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},r.prototype.toString=function(){return this._bn.toString(10)},r.prototype.toHexString=function(){var t=this._bn.toString(16);return t.length%2&&(t="0"+t),"0x"+t},r}();function f(t){return t._bn&&t._bn.mod}function c(t){return h(t)?t:new l(t)}n.BigNumber=l,n.isBigNumber=f,n.bigNumberify=c,n.ConstantNegativeOne=c(-1),n.ConstantZero=c(0),n.ConstantOne=c(1),n.ConstantTwo=c(2),n.ConstantWeiPerEther=c(new o.default.BN("1000000000000000000"))},{"../utils/errors":61,"./bytes":60,"./properties":65,"bn.js":2}],60:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s=t("./errors");function a(t){return!!t._bn}function u(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return new Uint8Array(Array.prototype.slice.apply(e,t))}),e}function h(t){if(!t||parseInt(t.length)!=t.length||"string"==typeof t)return!1;for(var e=0;e>4]+f[15&o])}return"0x"+n.join("")}return s.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function c(t,e){for(i(t)||s.throwError("invalid hex string",s.INVALID_ARGUMENT,{arg:"value",value:t});t.length<2*e+2;)t="0x0"+t.substring(2);return t}r.hexlify=o,r.hexDataLength=function(t){return i(t)&&t.length%2==0?(t.length-2)/2:null},r.hexDataSlice=function(t,e,r){return i(t)||s.throwError("invalid hex data",s.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&s.throwError("hex data length must be even",s.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,e+2*r):"0x"+t.substring(e)},r.hexStripZeros=function(t){for(i(t)||s.throwError("invalid hex string",s.INVALID_ARGUMENT,{arg:"value",value:t});3>=8;return e}function i(t,e,r){for(var n=0,i=0;it.length)throw new Error("too short");if(e+1+r+(n=i(t,e+1,r))>t.length)throw new Error("to short");return a(t,e,e+1+r,r+n)}if(192<=t[e]){if(e+1+(n=t[e]-192)>t.length)throw new Error("invalid rlp data");return a(t,e,e+1,n)}if(184<=t[e]){var r;if(e+1+(r=t[e]-183)>t.length)throw new Error("invalid rlp data");if(e+1+r+(n=i(t,e+1,r))>t.length)throw new Error("invalid rlp data");return{consumed:1+r+n,result:o.hexlify(t.slice(e+1+r,e+1+r+n))}}if(128<=t[e]){var n;if(e+1+(n=t[e]-128)>t.length)throw new Error("invlaid rlp data");return{consumed:1+n,result:o.hexlify(t.slice(e+1,e+1+n))}}return{consumed:1,result:o.hexlify(t[e])}}r.encode=function(t){return o.hexlify(function e(t){if(Array.isArray(t)){var r=[];return t.forEach(function(t){r=r.concat(e(t))}),r.length<=55?(r.unshift(192+r.length),r):((n=s(r.length)).unshift(247+n.length),n.concat(r))}var n,i=Array.prototype.slice.call(o.arrayify(t));return 1===i.length&&i[0]<=127?i:i.length<=55?(i.unshift(128+i.length),i):((n=s(i.length)).unshift(183+n.length),n.concat(i))}(t))},r.decode=function(t){var e=o.arrayify(t),r=u(e,0);if(r.consumed!==e.length)throw new Error("invalid rlp data");return r.result}},{"./bytes":60}],67:[function(t,e,r){"use strict";var n=this&&this.__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=t("./address"),o=t("./bytes"),s=t("./keccak256"),a=t("./properties"),u=n(t("./errors")),h=new(n(t("elliptic")).ec)("secp256k1");r.N="0x"+h.n.toString(16);var l=function(){function t(t){var e=h.keyFromPrivate(o.arrayify(t));a.defineReadOnly(this,"privateKey",o.hexlify(e.priv.toArray("be",32))),a.defineReadOnly(this,"publicKey","0x"+e.getPublic(!1,"hex")),a.defineReadOnly(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),a.defineReadOnly(this,"publicKeyBytes",e.getPublic().encode(null,!0))}return t.prototype.sign=function(t){var e=h.keyFromPrivate(o.arrayify(this.privateKey)).sign(o.arrayify(t),{canonical:!0});return{recoveryParam:e.recoveryParam,r:o.hexZeroPad("0x"+e.r.toString(16),32),s:o.hexZeroPad("0x"+e.s.toString(16),32),v:27+e.recoveryParam}},t}();function f(t,e){var r={r:o.arrayify(e.r),s:o.arrayify(e.s)};return"0x"+h.recoverPubKey(o.arrayify(t),r,e.recoveryParam).encode("hex",!1)}function c(t,e){var r=o.arrayify(t);if(32===r.length){var n=new l(r);return e?n.compressedPublicKey:n.publicKey}return 33===r.length?e?o.hexlify(r):"0x"+h.keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+h.keyFromPublic(r).getPublic(!0,"hex"):o.hexlify(r):(u.throwError("invalid public or private key",u.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null)}function d(t){var e="0x"+c(t).slice(4);return i.getAddress("0x"+s.keccak256(e).substring(26))}r.KeyPair=l,r.recoverPublicKey=f,r.computePublicKey=c,r.recoverAddress=function(t,e){return d(f(t,e))},r.computeAddress=d},{"./address":58,"./bytes":60,"./errors":61,"./keccak256":64,"./properties":65,elliptic:5}],68:[function(t,e,r){"use strict";var n=this&&this.__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(t("hash.js")),o=t("./bytes"),s=i.sha256,a=i.sha512;r.sha256=function(t){return"0x"+s().update(o.arrayify(t)).digest("hex")},r.sha512=function(t){return"0x"+a().update(o.arrayify(t)).digest("hex")}},{"./bytes":60,"hash.js":20}],69:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var u=t("./bignumber"),h=t("./bytes"),l=t("./utf8"),n=t("./keccak256"),i=t("./sha2"),f=new RegExp("^bytes([0-9]+)$"),c=new RegExp("^(u?int)([0-9]*)$"),d=new RegExp("^(.*)\\[([0-9]*)\\]$"),p="0000000000000000000000000000000000000000000000000000000000000000";function o(t,r){if(t.length!=r.length)throw new Error("type/value count mismatch");var n=[];return t.forEach(function(t,e){n.push(function e(t,r,n){switch(t){case"address":return n?h.padZeros(r,32):h.arrayify(r);case"string":return l.toUtf8Bytes(r);case"bytes":return h.arrayify(r);case"bool":return r=r?"0x01":"0x00",n?h.padZeros(r,32):h.arrayify(r)}var i=t.match(c);if(i){if((o=parseInt(i[2]||"256"))%8!=0||0===o||256t.maxLength)throw(e=new Error("invalid "+t.name)).reason="too long",e.value=r,e;i.push(d.hexlify(r))}),new Error("implement")},r.parse=function(t){var e=y.decode(t);if(9!==e.length)throw new Error("invalid transaction");var r,n={nonce:m(e[0]).toNumber(),gasPrice:m(e[1]),gasLimit:m(e[2]),to:(r=e[3],"0x"===r?null:f.getAddress(r)),value:m(e[4]),data:e[5],chainId:0},i=d.arrayify(e[6]),o=d.arrayify(e[7]),s=d.arrayify(e[8]);if(1<=i.length&&1<=o.length&&o.length<=32&&1<=s.length&&s.length<=32){n.v=c.bigNumberify(i).toNumber(),n.r=d.hexZeroPad(e[7],32),n.s=d.hexZeroPad(e[8],32);var a=(n.v-35)/2;a<0&&(a=0),a=Math.trunc(a),n.chainId=a;var u=n.v-27,h=e.slice(0,6);a&&(h.push(d.hexlify(a)),h.push("0x"),h.push("0x"),u-=2*a+8);var l=p.keccak256(y.encode(h));try{n.from=v.recoverAddress(l,{r:d.hexlify(o),s:d.hexlify(s),recoveryParam:u})}catch(t){console.log(t)}n.hash=p.keccak256(t)}return n}},{"./address":58,"./bignumber":59,"./bytes":60,"./keccak256":64,"./rlp":66,"./secp256k1":67}],71:[function(t,e,r){"use strict";var n=this&&this.__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 l=t("./bignumber"),f=n(t("./errors")),s=["wei","kwei","Mwei","Gwei","szabo","finny","ether"],c=function(){var i={};function o(t){return{decimals:t.length-1,tenPower:l.bigNumberify(t)}}var r="1";return s.forEach(function(t){var e=o(r);i[t.toLowerCase()]=e,i[String(e.decimals)]=e,r+="000"}),function(t){var e=i[String(t).toLowerCase()];if(!e&&"number"==typeof t&&Math.trunc(t)==t&&0<=t&&t<=256){for(var r="1",n=0;nr.decimals&&f.throwError("underflow occurred",f.NUMERIC_FAULT,{operation:"division",fault:"underflow"});s.length>6|192:(55296==(64512&o)&&i+1>18|240,r[n++]=o>>12&63|128):r[n++]=o>>12|224,r[n++]=o>>6&63|128),r[n++]=63&o|128)}return u.arrayify(r)},r.toUtf8String=function(t){t=u.arrayify(t);for(var e="",r=0;r>7!=0){if(n>>6!=2){var i=null;if(n>>5==6)i=1;else if(n>>4==14)i=2;else if(n>>3==30)i=3;else if(n>>2==62)i=4;else{if(n>>1!=126)continue;i=5}if(r+i>t.length){for(;r>6==2;r++);if(r!=t.length)continue;return e}var o,s=n&(1<<8-i-1)-1;for(o=0;o>6!=2)break;s=s<<6|63&a}o==i?s<=65535?e+=String.fromCharCode(s):(s-=65536,e+=String.fromCharCode(55296+(s>>10&1023),56320+(1023&s))):r--}}else e+=String.fromCharCode(n)}return e}},{"./bytes":60}],73:[function(t,e,r){"use strict";var n=this&&this.__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 h=t("xmlhttprequest"),i=t("./utf8"),o=t("./base64"),l=n(t("./errors"));r.fetchJson=function(s,a,u){var t=[];if("object"==typeof s&&null!=s.url){if(null==s.url&&l.throwError("missing URL",l.MISSING_ARGUMENT,{arg:"url"}),null!=s.user&&null!=s.password){"https:"!==s.url.substring(0,6)&&!0!==s.allowInsecure&&l.throwError("basic authentication requires a secure https url",l.INVALID_ARGUMENT,{arg:"url",url:s.url,user:s.user,password:"[REDACTED]"});var e=s.user+":"+s.password;t.push({key:"Authorization",value:"Basic "+o.encode(i.toUtf8Bytes(e))})}s=s.url}return new Promise(function(n,i){var o=new h.XMLHttpRequest;a?(o.open("POST",s,!0),t.push({key:"Content-Type",value:"application/json"})):o.open("GET",s,!0),t.forEach(function(t){o.setRequestHeader(t.key,t.value)}),o.onreadystatechange=function(){if(4===o.readyState){try{var t=JSON.parse(o.responseText)}catch(r){var e=new Error("invalid json response");return e.orginialError=r,e.responseText=o.responseText,e.url=s,void i(e)}if(u)try{t=u(t)}catch(r){return r.url=s,r.body=a,r.responseText=o.responseText,void i(r)}if(200!=o.status){var r=new Error("invalid response - "+o.status);return r.statusCode=o.statusCode,void i(r)}n(t)}},o.onerror=function(t){i(t)};try{a?o.send(a):o.send()}catch(t){var e=new Error("connection error");e.error=t,i(e)}})}},{"./base64":40,"./errors":61,"./utf8":72,xmlhttprequest:45}],74:[function(t,e,r){"use strict";var n=this&&this.__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 f=t("../wordlists/lang-en"),c=t("../utils/bytes"),l=t("../utils/bignumber"),i=t("../utils/utf8"),o=t("../utils/pbkdf2"),d=t("../utils/hmac"),s=t("../utils/properties"),p=t("../utils/secp256k1"),v=t("../utils/sha2"),a=n(t("../utils/errors")),u=i.toUtf8Bytes("Bitcoin seed"),y=2147483648;function m(t){return(1<>3)]=t>>24-i&255;var o=d.computeHmac("sha512",this.chainCode,e),s=l.bigNumberify(o.slice(0,32)),a=o.slice(32),u=s.add(this.keyPair.privateKey).mod(p.N);return new h(c.arrayify(u),a,t,this.depth+1,r,n)},h.prototype.derivePath=function(t){var e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path");"m"===e[0]&&e.shift();for(var r=this,n=0;n>3]|=1<<7-i%8),i++}var u=32*r.length/3,h=m(r.length/3),l=c.arrayify(v.sha256(n.slice(0,u/8)))[0];if((l&=h)!==(n[n.length-1]&h))throw new Error("invalid checksum");return c.hexlify(n.slice(0,u/8))}r.HDNode=h,r.fromMnemonic=function(t,e){return w(t,e),g(b(t),t)},r.fromSeed=function(t){return g(t,null)},r.mnemonicToSeed=b,r.mnemonicToEntropy=w,r.entropyToMnemonic=function(t,e){if((t=c.arrayify(t)).length%4!=0||t.length<16||32>8-n,r.push(t[i]&(1<<8-n)-1),n+=3);var o=c.arrayify(v.sha256(t))[0],s=t.length/4;return o&=m(s),r[r.length-1]<<=s,r[r.length-1]|=o>>8-s,e||(e=f.langEn),e.join(r.map(function(t){return e.getWord(t)}))},r.isValidMnemonic=function(t,e){try{return w(t,e),!0}catch(t){}return!1}},{"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/hmac":42,"../utils/pbkdf2":43,"../utils/properties":65,"../utils/secp256k1":67,"../utils/sha2":68,"../utils/utf8":72,"../wordlists/lang-en":79}],75:[function(t,e,r){"use strict";var n=this&&this.__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=t("./wallet");r.Wallet=i.Wallet;var o=n(t("./hdnode"));r.HDNode=o;var s=t("./signing-key");r.SigningKey=s.SigningKey},{"./hdnode":74,"./signing-key":77,"./wallet":78}],76:[function(t,e,r){"use strict";var n=this&&this.__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=t("aes-js"),m=t("scrypt-js"),R=t("uuid"),g=t("../utils/address"),T=t("../utils/bytes"),b=t("../utils/pbkdf2"),O=t("../utils/keccak256"),p=t("../utils/utf8"),C=t("../utils/random-bytes"),B=t("./signing-key"),L=n(t("./hdnode")),D="m/44'/60'/0'/0/0";function w(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),T.arrayify(t)}function U(t,e){for(t=String(t);t.length=h.length||Math.trunc(t)!=t)&&a.throwError("invalid wordlist index",a.INVALID_ARGUMENT,{arg:"index",value:t}),h[t]},e.prototype.getWordIndex=function(t){return l(),h.indexOf(t)},e}(s.Wordlist));r.langEn=f,s.register(f)},{"../utils/errors":61,"./wordlist":80}],80:[function(i,t,o){(function(e){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var r=!1,n=i("../utils/properties"),t=function(){function t(t){n.defineReadOnly(this,"locale",t)}return t.prototype.split=function(t){return t.toLowerCase().split(/ +/g)},t.prototype.join=function(t){return t.join(" ")},t}();o.Wordlist=t,o.register=function(t){r&&(e.wordlists||n.defineReadOnly(e,"wordlists",{}),n.defineReadOnly(e.wordlists,t.locale,t))},r=!0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/properties":65}],81:[function(t,e,r){"use strict";var n=this&&this.__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=t("./contracts");r.Contract=i.Contract,r.Interface=i.Interface;var o=n(t("./providers"));r.providers=o;var s=n(t("./utils/errors"));r.errors=s;var a=t("./providers/networks");r.getNetwork=a.getNetwork;var u=n(t("./utils"));r.utils=u;var h=t("./wallet");r.HDNode=h.HDNode,r.SigningKey=h.SigningKey,r.Wallet=h.Wallet,console.log("@TODO: Get version");r.version="4.0.0"},{"./contracts":47,"./providers":51,"./providers/networks":54,"./utils":63,"./utils/errors":61,"./wallet":75}]},{},[81])(81)}); +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ethers=t()}}(function(){return function o(s,a,u){function h(e,t){if(!a[e]){if(!s[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(l)return l(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[e]={exports:{}};s[e][0].call(i.exports,function(t){return h(s[e][1][t]||t)},i,i.exports,o,s,a,u)}return a[e].exports}for(var l="function"==typeof require&&require,t=0;t>4]+i[15&n])}return e.join("")}}),f={16:10,24:12,32:14},c=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],l=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],v=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],y=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],m=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],g=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],b=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],_=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],M=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],A=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],k=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(t){for(var e=[],r=0;r>2,this._Ke[r][e%4]=o[e],this._Kd[t-r][e%4]=o[e];for(var s,a=0,u=i;u>16&255]<<24^d[s>>8&255]<<16^d[255&s]<<8^d[s>>24&255]^c[a]<<24,a+=1,8!=i)for(e=1;e>8&255]<<8^d[s>>16&255]<<16^d[s>>24&255]<<24;for(e=i/2+1;e>2,l=u%4,this._Ke[h][l]=o[e],this._Kd[t-h][l]=o[e++],u++}for(var h=1;h>24&255]^M[s>>16&255]^A[s>>8&255]^k[255&s]},E.prototype.encrypt=function(t){if(16!=t.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var e=this._Ke.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o>24&255]^p[n[(i+1)%4]>>16&255]^v[n[(i+2)%4]>>8&255]^y[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var s,a=u(16);for(i=0;i<4;i++)s=this._Ke[e][i],a[4*i]=255&(d[n[i]>>24&255]^s>>24),a[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^s>>16),a[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^s>>8),a[4*i+3]=255&(d[255&n[(i+3)%4]]^s);return a},E.prototype.decrypt=function(t){if(16!=t.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var e=this._Kd.length-1,r=[0,0,0,0],n=S(t),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o>24&255]^g[n[(i+3)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^w[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var s,a=u(16);for(i=0;i<4;i++)s=this._Kd[e][i],a[4*i]=255&(h[n[i]>>24&255]^s>>24),a[4*i+1]=255&(h[n[(i+3)%4]>>16&255]^s>>16),a[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^s>>8),a[4*i+3]=255&(h[255&n[(i+1)%4]]^s);return a};var P=function(t){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new E(t)};P.prototype.encrypt=function(t){if((t=o(t)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var e=u(t.length),r=u(16),n=0;n>=8},R.prototype.setBytes=function(t){if(16!=(t=o(t,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=t},R.prototype.increment=function(){for(var t=15;0<=t;t--){if(255!==this._counter[t]){this._counter[t]++;break}this._counter[t]=0}};var T=function(t,e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",e instanceof R||(e=new R(e)),this._counter=e,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new E(t)};T.prototype.encrypt=function(t){for(var e=o(t,!0),r=0;r>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=n=0;n>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);return this.strip()},m.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},m.prototype._parseBase=function(t,e,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h"};var c=["","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"],d=[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],p=[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 i(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;n=(r.length=n)-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,f=67108863&u,c=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=c;d++){var p=h-d|0;l+=(s=(i=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[h]=0|f,u=0|l}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}m.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?c[6-a.length]+a+r:a+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&2<=t&&t<=36){var u=d[t],h=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var f=l.modn(h).toString(t);r=(l=l.idivn(h)).isZero()?f+r:c[u-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}y(!1,"Base should be between 2 and 36")},m.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]:2>>=13),64<=e&&(r+=7,e>>>=7),8<=e&&(r+=4,e>>>=4),2<=e&&(r+=2,e>>>=2),r+e},m.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},m.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},m.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},m.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},m.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},m.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},m.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},m.prototype.inotn=function(t){y("number"==typeof t&&0<=t);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),0>26-r),this.strip()},m.prototype.notn=function(t){return this.clone().inotn(t)},m.prototype.setn=function(t,e){y("number"==typeof t&&0<=t);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},m.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;0>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,v=d>>>13,y=0|s[2],m=8191&y,g=y>>>13,b=0|s[3],w=8191&b,_=b>>>13,M=0|s[4],A=8191&M,k=M>>>13,S=0|s[5],E=8191&S,P=S>>>13,N=0|s[6],x=8191&N,I=N>>>13,R=0|s[7],T=8191&R,O=R>>>13,C=0|s[8],B=8191&C,L=C>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],G=8191&F,z=F>>>13,H=0|a[1],V=8191&H,q=H>>>13,K=0|a[2],W=8191&K,J=K>>>13,Z=0|a[3],X=8191&Z,$=Z>>>13,Y=0|a[4],Q=8191&Y,tt=Y>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,lt=0|a[8],ft=8191<,ct=lt>>>13,dt=0|a[9],pt=8191&dt,vt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(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)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,G),i=(i=Math.imul(p,z))+Math.imul(v,G)|0,o=Math.imul(v,z);var mt=(h+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(c,V)|0))<<13)|0;h=((o=o+Math.imul(c,q)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,G),i=(i=Math.imul(m,z))+Math.imul(g,G)|0,o=Math.imul(g,z),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,q)|0;var gt=(h+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(c,W)|0))<<13)|0;h=((o=o+Math.imul(c,J)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(w,G),i=(i=Math.imul(w,z))+Math.imul(_,G)|0,o=Math.imul(_,z),n=n+Math.imul(m,V)|0,i=(i=i+Math.imul(m,q)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,q)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,J)|0;var bt=(h+(n=n+Math.imul(f,X)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(c,X)|0))<<13)|0;h=((o=o+Math.imul(c,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,G),i=(i=Math.imul(A,z))+Math.imul(k,G)|0,o=Math.imul(k,z),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,J)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,J)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,$)|0;var wt=(h+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(c,Q)|0))<<13)|0;h=((o=o+Math.imul(c,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,G),i=(i=Math.imul(E,z))+Math.imul(P,G)|0,o=Math.imul(P,z),n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,q)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,q)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,J)|0,n=n+Math.imul(m,X)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(g,X)|0,o=o+Math.imul(g,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0;var _t=(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)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,G),i=(i=Math.imul(x,z))+Math.imul(I,G)|0,o=Math.imul(I,z),n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,J)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(g,Q)|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(v,rt)|0,o=o+Math.imul(v,nt)|0;var Mt=(h+(n=n+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;h=((o=o+Math.imul(c,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(T,G),i=(i=Math.imul(T,z))+Math.imul(O,G)|0,o=Math.imul(O,z),n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,J)|0,n=n+Math.imul(A,X)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,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,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0;var At=(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)+(At>>>26)|0,At&=67108863,n=Math.imul(B,G),i=(i=Math.imul(B,z))+Math.imul(L,G)|0,o=Math.imul(L,z),n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,J)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(m,ot)|0,i=(i=i+Math.imul(m,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ht)|0;var kt=(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)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,z))+Math.imul(j,G)|0,o=Math.imul(j,z),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,q)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,q)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,J)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(m,ut)|0,i=(i=i+Math.imul(m,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(v,ft)|0,o=o+Math.imul(v,ct)|0;var St=(h+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,vt)|0)+Math.imul(c,pt)|0))<<13)|0;h=((o=o+Math.imul(c,vt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,q))+Math.imul(j,V)|0,o=Math.imul(j,q),n=n+Math.imul(B,W)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(L,W)|0,o=o+Math.imul(L,J)|0,n=n+Math.imul(T,X)|0,i=(i=i+Math.imul(T,$)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(m,ft)|0,i=(i=i+Math.imul(m,ct)|0)+Math.imul(g,ft)|0,o=o+Math.imul(g,ct)|0;var Et=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,vt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((o=o+Math.imul(v,vt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(U,W),i=(i=Math.imul(U,J))+Math.imul(j,W)|0,o=Math.imul(j,J),n=n+Math.imul(B,X)|0,i=(i=i+Math.imul(B,$)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,$)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,st)|0,n=n+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ht)|0,n=n+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ct)|0;var Pt=(h+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,vt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,vt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(U,X),i=(i=Math.imul(U,$))+Math.imul(j,X)|0,o=Math.imul(j,$),n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,tt)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ht)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var Nt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,vt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,vt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,tt))+Math.imul(j,Q)|0,o=Math.imul(j,tt),n=n+Math.imul(B,rt)|0,i=(i=i+Math.imul(B,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ht)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(P,ft)|0,o=o+Math.imul(P,ct)|0;var xt=(h+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,vt)|0)+Math.imul(k,pt)|0))<<13)|0;h=((o=o+Math.imul(k,vt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(B,ot)|0,i=(i=i+Math.imul(B,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(I,ft)|0,o=o+Math.imul(I,ct)|0;var It=(h+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,vt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((o=o+Math.imul(P,vt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(B,ut)|0,i=(i=i+Math.imul(B,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var Rt=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,vt)|0)+Math.imul(I,pt)|0))<<13)|0;h=((o=o+Math.imul(I,vt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(B,ft)|0,i=(i=i+Math.imul(B,ct)|0)+Math.imul(L,ft)|0,o=o+Math.imul(L,ct)|0;var Tt=(h+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,vt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,vt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ft),i=(i=Math.imul(U,ct))+Math.imul(j,ft)|0,o=Math.imul(j,ct);var Ot=(h+(n=n+Math.imul(B,pt)|0)|0)+((8191&(i=(i=i+Math.imul(B,vt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,vt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ct=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,vt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,vt))+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,u[0]=yt,u[1]=mt,u[2]=gt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=Mt,u[7]=At,u[8]=kt,u[9]=St,u[10]=Et,u[11]=Pt,u[12]=Nt,u[13]=xt,u[14]=It,u[15]=Rt,u[16]=Tt,u[17]=Ot,u[18]=Ct,0!==h&&(u[19]=h,r.length++),r};function a(t,e,r){return(new u).mulp(t,e,r)}function u(t,e){this.x=t,this.y=e}Math.imul||(o=i),m.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?o(this,t,e):r<63?i(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):a(this,t,e)},u.prototype.makeRBT=function(t){for(var e=new Array(t),r=m.prototype._countBits(t)-1,n=0;n>=1;return n},u.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=e,this.length++),this},m.prototype.muln=function(t){return this.clone().imuln(t)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new m(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;0<=e;e--)this.words[e+n]=this.words[e];for(e=0;e>>i<o)for(this.length-=o,u=0;u>>i,h=l&s}return a&&0!==h&&(a.words[a.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(t,e,r){return y(0===this.negative),this.iushrn(t,e,r)},m.prototype.shln=function(t){return this.clone().ishln(t)},m.prototype.ushln=function(t){return this.clone().iushln(t)},m.prototype.shrn=function(t){return this.clone().ishrn(t)},m.prototype.ushrn=function(t){return this.clone().iushrn(t)},m.prototype.testn=function(t){y("number"==typeof t&&0<=t);var e=t%26,r=(t-e)/26,n=1<>>e<>26)-(a/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===s)return this.strip();for(y(-1===s),n=s=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},m.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,a=n.length-i.length;if("mod"!==e){(s=new m(null)).length=a+1,s.words=new Array(s.length);for(var u=0;uthis.length||this.cmp(t)<0?{div:new m(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new m(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new m(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,i,o},m.prototype.div=function(t){return this.divmod(t,"div",!1).div},m.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},m.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},m.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 o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},m.prototype.modn=function(t){y(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;0<=n;n--)r=(e*r+(0|this.words[n]))%t;return r},m.prototype.idivn=function(t){y(t<=67108863);for(var e=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},m.prototype.divn=function(t){return this.clone().idivn(t)},m.prototype.egcd=function(t){y(0===t.negative),y(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new m(1),i=new m(0),o=new m(0),s=new m(1),a=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++a;for(var u=r.clone(),h=e.clone();!e.isZero();){for(var l=0,f=1;0==(e.words[0]&f)&&l<26;++l,f<<=1);if(0>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1t.length)return 1;if(this.lengththis.n;);var n=e>>22,i=o}i>>>=22,0===(t.words[n-10]=i)&&10>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},m._prime=function(t){if(h[t])return h[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new g;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return h[t]=e},_.prototype._verify1=function(t){y(0===t.negative,"red works only with positives"),y(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){y(0==(t.negative|e.negative),"red works only with positives"),y(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 r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<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(y(e%2==1),3===e){var r=this.m.add(new m(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);y(!n.isZero());var o=new m(1).toRed(this),s=o.redNeg(),a=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new m(2*u*u).toRed(this);0!==this.pow(u,a).cmp(s);)u.redIAdd(s);for(var h=this.pow(u,n),l=this.pow(t,n.addn(1).iushrn(1)),f=this.pow(t,n),c=i;0!==f.cmp(o);){for(var d=f,p=0;0!==d.cmp(o);p++)d=d.redSqr();y(p>h&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===n&&0===h)&&(i=this.mul(i,r[o]),o=s=0)):s=0}a=26}return i},_.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},m.mont=function(t){return new M(t)},r(M,_),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.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)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new m(0)._forceRed(this);var r=t.mul(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)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:4}],3:[function(t,e,r){var n=t("../../src.ts/utils").randomBytes;e.exports=function(t){return n(t)}},{"../../src.ts/utils":63}],4:[function(t,e,r){},{}],5:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.hmacDRBG=t("./elliptic/hmac-drbg"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":19,"./elliptic/curve":8,"./elliptic/curves":11,"./elliptic/ec":12,"./elliptic/eddsa":15,"./elliptic/hmac-drbg":16,"./elliptic/utils":18,brorand:3}],6:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../../elliptic").utils,S=i.getNAF,E=i.getJSF,f=i.assert;function o(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||0>1]):s.mixedAdd(i[-u-1>>1].neg()):0>1]):s.add(i[-u-1>>1].neg())}return"affine"===t.type?s.toP():s},o.prototype._wnafMulAdd=function(t,e,r,n,i){for(var o=this._wnafT1,s=this._wnafT2,a=this._wnafT3,u=0,h=0;h>1]:k<0&&(A=s[y][-k-1>>1].neg()),b="affine"===A.type?b.mixedAdd(A):b.add(A))}}for(h=0;h=Math.ceil((t.bitLength()+1)/e.step)},s.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new _(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},h.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new l(this,t,e,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),l=h.redMul(a),f=n.redMul(h),c=u.redSqr().redIAdd(l).redISub(f).redISub(f),d=u.redMul(f.redISub(c)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(c,d,p)},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),l=r.redMul(u),f=a.redSqr().redIAdd(h).redISub(l).redISub(l),c=a.redMul(l.redISub(f)).redISub(i.redMul(h)),d=this.z.redMul(s);return this.curve.jpoint(f,c,d)},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":5,"../curve":8,"bn.js":2,inherits:32}],11:[function(t,e,r){"use strict";var n,i=r,o=t("hash.js"),s=t("../elliptic"),a=s.utils.assert;function u(t){"short"===t.type?this.curve=new s.curve.short(t):"edwards"===t.type?this.curve=new s.curve.edwards(t):this.curve=new s.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(e,r){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var t=new u(r);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:t}),t}})}i.PresetCurve=u,h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":5,"./precomputed/secp256k1":17,"hash.js":20}],12:[function(t,e,r){"use strict";var y=t("bn.js"),m=t("../../elliptic"),d=m.utils.assert,n=t("./key"),g=t("./signature");function i(t){if(!(this instanceof i))return new i(t);"string"==typeof t&&(d(m.curves.hasOwnProperty(t),"Unknown curve "+t),t=m.curves[t]),t instanceof m.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}(e.exports=i).prototype.keyPair=function(t){return new n(this,t)},i.prototype.keyFromPrivate=function(t,e){return n.fromPrivate(this,t,e)},i.prototype.keyFromPublic=function(t,e){return n.fromPublic(this,t,e)},i.prototype.genKeyPair=function(t){t||(t={});for(var e=new m.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||m.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new y(2));;){var i=new y(e.generate(r));if(!(0>1;if(0<=s.cmp(this.curve.p.umod(this.curve.n))&&h)throw new Error("Unable to find sencond key candinate");s=h?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var l=e.r.invm(i),f=i.sub(o).mul(l).umod(i),c=a.mul(l).umod(i);return this.g.mulAdd(f,s,c)},i.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new g(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":5,"./key":13,"./signature":14,"bn.js":2}],13:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("../../elliptic").utils.assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}(e.exports=o).fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":5,"bn.js":2}],14:[function(t,e,r){"use strict";var a=t("bn.js"),u=t("../../elliptic").utils,n=u.assert;function i(t,e){if(t instanceof i)return t;this._importDER(t,e)||(n(t.r&&t.s,"Signature without r or s"),this.r=new a(t.r,16),this.s=new a(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function h(){this.place=0}function l(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=e.place;o>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}(e.exports=i).prototype._importDER=function(t,e){t=u.toArray(t,e);var r=new h;if(48!==t[r.place++])return!1;if(l(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var n=l(t,r),i=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var o=l(t,r);if(t.length!==o+r.place)return!1;var s=t.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===s[0]&&128&s[1]&&(s=s.slice(1)),this.r=new a(i),this.s=new a(s),!(this.recoveryParam=null)},i.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=s(e),r=s(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,e.length),(n=n.concat(e)).push(2),f(n,r.length);var i=n.concat(r),o=[48];return f(o,i.length),o=o.concat(i),u.encode(o,t)}},{"../../elliptic":5,"bn.js":2}],15:[function(t,e,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],16:[function(t,e,r){"use strict";var n=t("hash.js"),s=t("../elliptic").utils,i=s.assert;function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this.reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=s.toArray(t.entropy,t.entropyEnc),r=s.toArray(t.nonce,t.nonceEnc),n=s.toArray(t.pers,t.persEnc);i(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}(e.exports=o).prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this.reseed=1},o.prototype.generate=function(t,e,r,n){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=s.toArray(r,n),this._update(r));for(var i=[];i.length>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=o,n.toHex=s,n.encode=function(t,e){return"hex"===e?s(t):t},n.getNAF=function(t,e){for(var r=[],n=1<>1)-1>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,u=1;u=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":31}],31:[function(t,e,r){"use strict";var h=t("minimalistic-assert"),n=t("inherits");function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function i(t){return 1===t.length?"0"+t:t}function s(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}r.inherits=n,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>8,s=255&i;o?r.push(o,s):r.push(s)}else for(n=0;n>>0}return o},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,h=e;return u+=(h=h+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,h){var l=0,f=e;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,h){return e+n+o+a+h>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:32,"minimalistic-assert":34}],32:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],33:[function(t,_,e){(function(b,w){!function(){"use strict";var t="object"==typeof window?window:{};!t.JS_SHA3_NO_NODE_JS&&"object"==typeof b&&b.versions&&b.versions.node&&(t=w);for(var e=!t.JS_SHA3_NO_COMMON_JS&&"object"==typeof _&&_.exports,u="0123456789abcdef".split(""),l=[0,8,16,24],lt=[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],r=[224,256,384,512],o=["hex","buffer","arrayBuffer","array"],s=function(e,r,n){return function(t){return new m(e,r,e).update(t)[n]()}},a=function(r,n,i){return function(t,e){return new m(r,n,e).update(t)[i]()}},n=function(t,e){var r=s(t,e,"hex");r.create=function(){return new m(t,e,t)},r.update=function(t){return r.create().update(t)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}m.prototype.update=function(t){var e="string"!=typeof t;e&&t.constructor===ArrayBuffer&&(t=new Uint8Array(t));for(var r,n,i=t.length,o=this.blocks,s=this.byteCount,a=this.blockCount,u=0,h=this.s;u>2]|=t[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];s%e==0&&(g(r),o=0)}return i&&(t=r[o],0>4&15]+u[15&t]),1>12&15]+u[t>>8&15]),2>20&15]+u[t>>16&15])),a},m.prototype.buffer=m.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&g(n)}return o&&(t=a<<2,e=n[s],0>8&255),2>16&255)),u};var g=function(t){var e,r,n,i,o,s,a,u,h,l,f,c,d,p,v,y,m,g,b,w,_,M,A,k,S,E,P,N,x,I,R,T,O,C,B,L,D,U,j,F,G,z,H,V,q,K,W,J,Z,X,$,Y,Q,tt,et,rt,nt,it,ot,st,at,ut,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],h=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(c=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,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,e=i^(u<<1|h>>>31),r=o^(h<<1|u>>>31),t[2]^=e,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,e=s^(l<<1|f>>>31),r=a^(f<<1|l>>>31),t[4]^=e,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,e=u^(c<<1|d>>>31),r=h^(d<<1|c>>>31),t[6]^=e,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,e=l^(i<<1|o>>>31),r=f^(o<<1|i>>>31),t[8]^=e,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,p=t[0],v=t[1],K=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,N=t[20]<<3|t[21]>>>29,x=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,at=t[30]<<9|t[31]>>>23,z=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,C=t[2]<<1|t[3]>>>31,B=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,m=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,I=t[33]<<13|t[32]>>>19,R=t[32]<<13|t[33]>>>19,ut=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,tt=t[5]<<30|t[4]>>>2,et=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,D=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,$=t[35]<<15|t[34]>>>17,T=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,k=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,j=t[27]<<25|t[26]>>>7,w=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,Y=t[47]<<24|t[46]>>>8,Q=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,q=t[9]<<27|t[8]>>>5,E=t[18]<<20|t[19]>>>12,P=t[19]<<20|t[18]>>>12,it=t[29]<<7|t[28]>>>25,ot=t[28]<<7|t[29]>>>25,F=t[38]<<8|t[39]>>>24,G=t[39]<<8|t[38]>>>24,M=t[48]<<14|t[49]>>>18,A=t[49]<<14|t[48]>>>18,t[0]=p^~y&g,t[1]=v^~m&b,t[10]=k^~E&N,t[11]=S^~P&x,t[20]=C^~L&U,t[21]=B^~D&j,t[30]=V^~K&J,t[31]=q^~W&Z,t[40]=tt^~rt&it,t[41]=et^~nt&ot,t[2]=y^~g&w,t[3]=m^~b&_,t[12]=E^~N&I,t[13]=P^~x&R,t[22]=L^~U&F,t[23]=D^~j&G,t[32]=K^~J&X,t[33]=W^~Z&$,t[42]=rt^~it&st,t[43]=nt^~ot&at,t[4]=g^~w&M,t[5]=b^~_&A,t[14]=N^~I&T,t[15]=x^~R&O,t[24]=U^~F&z,t[25]=j^~G&H,t[34]=J^~X&Y,t[35]=Z^~$&Q,t[44]=it^~st&ut,t[45]=ot^~at&ht,t[6]=w^~M&p,t[7]=_^~A&v,t[16]=I^~T&k,t[17]=R^~O&S,t[26]=F^~z&C,t[27]=G^~H&B,t[36]=X^~Y&V,t[37]=$^~Q&q,t[46]=st^~ut&tt,t[47]=at^~ht&et,t[8]=M^~p&y,t[9]=A^~v&m,t[18]=T^~k&E,t[19]=O^~S&P,t[28]=z^~C&L,t[29]=H^~B&D,t[38]=Y^~V&K,t[39]=Q^~q&W,t[48]=ut^~tt&rt,t[49]=ht^~et&nt,t[0]^=lt[n],t[1]^=lt[n+1]};if(e)_.exports=h;else for(c=0;c>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=((n=S[i-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,S[i]=(s+S[i-7]|0)+(a+S[i-16]|0)|0;for(i=0;i<64;i++)s=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&d^~c&p)|0)+(v+(y[i]+S[i]|0)|0)|0,a=((u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10))+(u&h^u&l^h&l)|0,v=p,p=d,d=c,c=f+s|0,f=l,l=h,h=u,u=s+a|0;m=m+u|0,g=g+h|0,b=b+l|0,w=w+f|0,_=_+c|0,M=M+d|0,A=A+p|0,k=k+v|0,e+=64,r-=64}}e(t);var r,n=t.length%64,i=t.length/536870912|0,o=t.length<<3,s=n<56?56:120,a=t.slice(t.length-n,t.length);for(a.push(128),r=n+1;r>>24&255),a.push(i>>>16&255),a.push(i>>>8&255),a.push(i>>>0&255),a.push(o>>>24&255),a.push(o>>>16&255),a.push(o>>>8&255),a.push(o>>>0&255),e(a),[m>>>24&255,m>>>16&255,m>>>8&255,m>>>0&255,g>>>24&255,g>>>16&255,g>>>8&255,g>>>0&255,b>>>24&255,b>>>16&255,b>>>8&255,b>>>0&255,w>>>24&255,w>>>16&255,w>>>8&255,w>>>0&255,_>>>24&255,_>>>16&255,_>>>8&255,_>>>0&255,M>>>24&255,M>>>16&255,M>>>8&255,M>>>0&255,A>>>24&255,A>>>16&255,A>>>8&255,A>>>0&255,k>>>24&255,k>>>16&255,k>>>8&255,k>>>0&255]}function x(t,e,r){var n;t=t.length<=64?t:h(t);var i=64+e.length+4,o=new Array(i),s=new Array(64),a=[];for(n=0;n<64;n++)o[n]=54;for(n=0;n>>32-e}function s(t,e){T(t,0,e,0,16);for(var r=8;0>0&255),f.push(c[t]>>8&255),f.push(c[t]>>16&255),f.push(c[t]>>24&255);var i=x(o,f,h);return l(null,1,i)}P(N)};N()}void 0!==o?r.exports=e:t&&(t.scrypt&&(t._scrypt=t.scrypt),t.scrypt=e)}(this)}).call(this,t("timers").setImmediate)},{timers:37}],37:[function(t,e,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],38:[function(t,i,e){(function(t){var e;if(t.crypto&&crypto.getRandomValues){var r=new Uint8Array(16);e=function(){return crypto.getRandomValues(r),r}}if(!e){var n=new Array(16);e=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),n[e]=t>>>((3&e)<<3)&255;return n}}i.exports=e}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],39:[function(t,e,r){for(var s=t("./rng"),i=[],o={},n=0;n<256;n++)i[n]=(n+256).toString(16).substr(1),o[i[n]]=n;function d(t,e){var r=e||0,n=i;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}var a=s(),p=[1|a[0],a[1],a[2],a[3],a[4],a[5]],v=16383&(a[6]<<8|a[7]),y=0,m=0;function u(t,e,r){var n=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null);var i=(t=t||{}).random||(t.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var o=0;o<16;o++)e[n+o]=i[o];return e||d(i)}var h=u;h.v1=function(t,e,r){var n=e&&r||0,i=e||[],o=void 0!==(t=t||{}).clockseq?t.clockseq:v,s=void 0!==t.msecs?t.msecs:(new Date).getTime(),a=void 0!==t.nsecs?t.nsecs:m+1,u=s-y+(a-m)/1e4;if(u<0&&void 0===t.clockseq&&(o=o+1&16383),(u<0||y>>24&255,i[n++]=h>>>16&255,i[n++]=h>>>8&255,i[n++]=255&h;var l=s/4294967296*1e4&268435455;i[n++]=l>>>8&255,i[n++]=255&l,i[n++]=l>>>24&15|16,i[n++]=l>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var f=t.node||p,c=0;c<6;c++)i[n+c]=f[c];return e||d(i)},h.v4=u,h.parse=function(t,e,r){var n=e&&r||0,i=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){i<16&&(e[n+i++]=o[t])});i<16;)e[n+i++]=0;return e},h.unparse=d,e.exports=h},{"./rng":38}],40:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../src.ts/utils/bytes");e.exports={decode:function(t){t=atob(t);for(var e=[],r=0;r>24&255,l[e.length+1]=f>>16&255,l[e.length+2]=f>>8&255,l[e.length+3]=255&f;var c=g.computeHmac(i,t,l);o||(o=c.length,a=new Uint8Array(o),s=n-((u=Math.ceil(n/o))-1)*o),a.set(c);for(var d=1;dthis.inputs.length&&l.throwError("too many constructor arguments",l.UNEXPECTED_ARGUMENT,{count:e.length,expectedCount:this.inputs.length});try{return t+f.defaultAbiCoder.encode(this.inputs,e).substring(2)}catch(t){l.throwError("invalid constructor argument",l.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},e}(p);r.DeployDescription=y;var m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.encode=function(t){t.lengththis.inputs.length&&l.throwError("too many input arguments",l.UNEXPECTED_ARGUMENT,{count:t.length,expectedCount:this.inputs.length});try{return this.sighash+f.defaultAbiCoder.encode(this.inputs,t).substring(2)}catch(t){l.throwError("invalid input argument",l.INVALID_ARGUMENT,{arg:t.arg,reason:t.reason,value:t.value})}return null},e.prototype.decode=function(e){try{return f.defaultAbiCoder.decode(this.outputs,c.arrayify(e))}catch(t){l.throwError("invalid data for function output",l.INVALID_ARGUMENT,{arg:"data",errorArg:t.arg,errorValue:t.value,value:e,reason:t.reason})}},e}(p);r.FunctionDescription=m;var g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(p),b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.decode=function(t,r){null==r||this.anonymous||(r=r.slice(1));var n=[],i=[],o=[];if(this.inputs.forEach(function(t,e){t.indexed?"string"===t.type||"bytes"===t.type||0<=t.type.indexOf("[")||"tuple"===t.type.substring(0,5)?(n.push({type:"bytes32",name:t.name||""}),o.push(!0)):(n.push(t),o.push(!1)):(i.push(t),o.push(!1))}),null!=r)var s=f.defaultAbiCoder.decode(n,c.concat(r));var a=f.defaultAbiCoder.decode(i,c.arrayify(t)),u=new g({}),h=0,l=0;return this.inputs.forEach(function(t,e){t.indexed?null==r?u[e]=new v({type:"indexed",hash:null}):o[e]?u[e]=new v({type:"indexed",hash:s[l++]}):u[e]=s[l++]:u[e]=a[h++],t.name&&(u[t.name]=u[e])}),u.length=this.inputs.length,u},e}(p);r.EventDescription=b;var w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(p),_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(p);function M(t){switch(t.type){case"constructor":var e=new y({inputs:t.inputs,payable:null==t.payable||!!t.payable,type:"deploy"});this.deployFunction||(this.deployFunction=e);break;case"function":n=(n="("+d(t.inputs).types.join(",")+")").replace(/tuple/g,""),n=t.name+n;var r=a.keccak256(u.toUtf8Bytes(n)).substring(0,10);e=new m({inputs:t.inputs,outputs:t.outputs,payable:null==t.payable||!!t.payable,type:t.constant?"call":"transaction",signature:n,sighash:r});t.name&&null==this.functions[t.name]&&h.defineReadOnly(this.functions,t.name,e),null==this.functions[e.signature]&&h.defineReadOnly(this.functions,e.signature,e);break;case"event":var n;n=(n="("+d(t.inputs).types.join(",")+")").replace(/tuple/g,""),n=t.name+n;e=new b({name:t.name,signature:n,inputs:t.inputs,topic:a.keccak256(u.toUtf8Bytes(n)),anonymous:!!t.anonymous,type:"event"});t.name&&null==this.events[t.name]&&h.defineReadOnly(this.events,t.name,e),null==this.events[e.signature]&&h.defineReadOnly(this.events,e.signature,e);break;case"fallback":break;default:console.log("WARNING: unsupported ABI type - "+t.type)}}var A=function(){function t(e){if(l.checkNew(this,t),"string"==typeof e){try{e=JSON.parse(e)}catch(t){l.throwError("could not parse ABI JSON",l.INVALID_ARGUMENT,{arg:"abi",errorMessage:t.message,value:e})}if(!Array.isArray(e))return l.throwError("invalid abi",l.INVALID_ARGUMENT,{arg:"abi",value:e}),null}h.defineReadOnly(this,"functions",{}),h.defineReadOnly(this,"events",{});var r=[];e.forEach(function(t){"string"==typeof t&&(t=f.parseSignature(t)),r.push(t)}),h.defineFrozen(this,"abi",r),r.forEach(M,this),this.deployFunction||M.call(this,{type:"constructor",inputs:[]})}return t.prototype.parseTransaction=function(t){var e=t.data.substring(0,10).toLowerCase();for(var r in this.functions)if(-1!==r.indexOf("(")){var n=this.functions[r];if(n.sighash===e){var i=f.defaultAbiCoder.decode(n.inputs,"0x"+t.data.substring(10));return new w({args:i,decode:n.decode,name:r,signature:n.signature,sighash:n.sighash,type:"transaction",value:s.bigNumberify(t.value||0)})}}return null},t.prototype.parseLog=function(t){for(var e in this.events)if(-1!==e.indexOf("(")){var r=this.events[e];if(!r.anonymous&&r.topic===t.topics[0])return new _({name:r.name,signature:r.signature,topic:r.topic,type:"log",values:r.decode(t.data,t.topics)})}return null},t}();r.Interface=A},{"../utils/abi-coder":57,"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/keccak256":64,"../utils/properties":65,"../utils/utf8":72}],49:[function(t,e,r){"use strict";var n,i=this&&this.__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)}),o=this&&this.__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=t("./provider"),a=t("../utils/bytes"),u=t("../utils/properties"),h=t("../utils/web"),l=o(t("../utils/errors"));function f(t){var e=[];for(var r in t)if(null!=t[r]){var n=a.hexlify(t[r]);({gasLimit:!0,gasPrice:!0,nonce:!0,value:!0})[r]&&(n=a.hexStripZeros(n)),e.push(r+"="+n)}return e.join("&")}function c(t){if(0==t.status&&("No records found"===t.message||"No transactions found"===t.message))return t.result;if(1!=t.status||"OK"!=t.message){var e=new Error("invalid response");throw e.result=JSON.stringify(t),e}return t.result}function d(t){if("2.0"!=t.jsonrpc)throw(e=new Error("invalid response")).result=JSON.stringify(t),e;if(t.error){var e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function p(t){if("pending"===t)throw new Error("pending not supported");return"latest"===t?t:parseInt(t.substring(2),16)}var v=function(a){function o(t,e){var r=a.call(this,t)||this;l.checkNew(r,o);var n="invalid";r.network&&(n=r.network.name);var i=null;switch(n){case"homestead":i="https://api.etherscan.io";break;case"ropsten":i="https://api-ropsten.etherscan.io";break;case"rinkeby":i="https://api-rinkeby.etherscan.io";break;case"kovan":i="https://api-kovan.etherscan.io";break;default:throw new Error("unsupported network")}return u.defineReadOnly(r,"baseUrl",i),u.defineReadOnly(r,"apiKey",e),r}return i(o,a),o.prototype.perform=function(t,e){var r=this.baseUrl,n="";switch(this.apiKey&&(n+="&apikey="+this.apiKey),t){case"getBlockNumber":return r+="/api?module=proxy&action=eth_blockNumber"+n,h.fetchJson(r,null,d);case"getGasPrice":return r+="/api?module=proxy&action=eth_gasPrice"+n,h.fetchJson(r,null,d);case"getBalance":return r+="/api?module=account&action=balance&address="+e.address,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,c);case"getTransactionCount":return r+="/api?module=proxy&action=eth_getTransactionCount&address="+e.address,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,d);case"getCode":return r+="/api?module=proxy&action=eth_getCode&address="+e.address,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,d);case"getStorageAt":return r+="/api?module=proxy&action=eth_getStorageAt&address="+e.address,r+="&position="+e.position,r+="&tag="+e.blockTag+n,h.fetchJson(r,null,d);case"sendTransaction":return r+="/api?module=proxy&action=eth_sendRawTransaction&hex="+e.signedTransaction,r+=n,h.fetchJson(r,null,d);case"getBlock":if(e.blockTag)return r+="/api?module=proxy&action=eth_getBlockByNumber&tag="+e.blockTag,r+="&boolean=false",r+=n,h.fetchJson(r,null,d);throw new Error("getBlock by blockHash not implmeneted");case"getTransaction":return r+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+e.transactionHash,r+=n,h.fetchJson(r,null,d);case"getTransactionReceipt":return r+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+e.transactionHash,r+=n,h.fetchJson(r,null,d);case"call":return(i=f(e.transaction))&&(i="&"+i),r+="/api?module=proxy&action=eth_call"+i,r+=n,h.fetchJson(r,null,d);case"estimateGas":var i;return(i=f(e.transaction))&&(i="&"+i),r+="/api?module=proxy&action=eth_estimateGas&"+i,r+=n,h.fetchJson(r,null,d);case"getLogs":r+="/api?module=logs&action=getLogs";try{if(e.filter.fromBlock&&(r+="&fromBlock="+p(e.filter.fromBlock)),e.filter.toBlock&&(r+="&toBlock="+p(e.filter.toBlock)),e.filter.address&&(r+="&address="+e.filter.address),e.filter.topics&&0r+12&&delete i._emitted[t]})),i.emit("block",r);var n={};Object.keys(i._events).forEach(function(t){var r=function(t){if("tx:"===t.substring(0,3))return{type:"transaction",hash:t.substring(3)};if("block"===t)return{type:"block"};if("pending"===t)return{type:"pending"};if("address:"===t.substring(0,8))return{type:"address",address:t.substring(8)};if("topic:"===t.substring(0,6))try{var e=f.decode(t.substring(6));return{type:"topic",topic:e=U(e,function(t){return"0x"===t&&(t=null),t})}}catch(t){console.log(t)}throw new Error("invalid event string")}(t);"transaction"===r.type?i.getTransaction(r.hash).then(function(t){t&&null!=t.blockNumber&&(i._emitted["t:"+t.hash.toLowerCase()]=t.blockNumber,i.emit(r.hash,t))}):"address"===r.type?(i._balances[r.address]&&(n[r.address]=i._balances[r.address]),i.getBalance(r.address,"latest").then(function(t){var e=this._balances[r.address];e&&t.eq(e)||(this._balances[r.address]=t,this.emit(r.address,t))})):"topic"===r.type&&i.getLogs({fromBlock:i._lastBlockNumber+1,toBlock:e,topics:r.topic}).then(function(t){0!==t.length&&t.forEach(function(t){i._emitted["b:"+t.blockHash.toLowerCase()]=t.blockNumber,i._emitted["t:"+t.transactionHash.toLowerCase()]=t.blockNumber,i.emit(r.topic,t)})})}),i._lastBlockNumber=e,i._balances=n}}),this.doPoll()},n.prototype.resetEventsBlock=function(t){this._lastBlockNumber=this.blockNumber,this._doPoll()},Object.defineProperty(n.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),n.prototype.getNetwork=function(){return this.ready},Object.defineProperty(n.prototype,"blockNumber",{get:function(){return this._lastBlockNumber<0?null:this._lastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"polling",{get:function(){return null!=this._poller},set:function(t){var e=this;setTimeout(function(){t&&!e._poller?e._poller=setInterval(e._doPoll.bind(e),e.pollingInterval):!t&&e._poller&&(clearInterval(e._poller),e._poller=null)},0)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(t){var e=this;if("number"!=typeof t||t<=0||Math.trunc(t)!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(function(){e._doPoll()},this._pollingInterval))},enumerable:!0,configurable:!0}),n.prototype.waitForTransaction=function(i,o){var s=this;return new Promise(function(e,t){var r=null;function n(t){r&&clearTimeout(r),e(t)}s.once(i,n),"number"==typeof o&&0i._emitted.block},function(){return i.perform("getBlock",{blockTag:n}).then(function(t){return null==t?null:S(t)})})}catch(t){}throw new Error("invalid block hash or block tag")})})},n.prototype.getTransaction=function(t){var n=this;return this.ready.then(function(){return p.resolveProperties({transactionHash:t}).then(function(t){var e=t.transactionHash,r={transactionHash:w(e)};return D(function(){return null==n._emitted["t:"+e.toLowerCase()]},function(){return n.perform("getTransaction",r).then(function(t){return null!=t&&(t=P(t)),t})})})})},n.prototype.getTransactionReceipt=function(t){var n=this;return this.ready.then(function(){return p.resolveProperties({transactionHash:t}).then(function(t){var e=t.transactionHash,r={transactionHash:w(e)};return D(function(){return null==n._emitted["t:"+e.toLowerCase()]},function(){return n.perform("getTransactionReceipt",r).then(function(t){var e,r;return null!=t&&((r=m(R,e=t)).logs.forEach(function(t,e){null==t.transactionLogIndex&&(t.transactionLogIndex=e)}),null!=e.status&&(r.byzantium=!0),t=r),t})})})})},n.prototype.getLogs=function(t){var n=this;return this.ready.then(function(){return p.resolveProperties(t).then(function(t){return n._resolveNames(t,["address"]).then(function(t){var e,r={filter:(e=t,m(T,e))};return n.perform("getLogs",r).then(function(t){return b(L)(t)})})})})},n.prototype.getEtherPrice=function(){var t=this;return this.ready.then(function(){return t.perform("getEtherPrice",{}).then(function(t){return t})})},n.prototype._resolveNames=function(t,e){var r=[],n=function(t){var e={};for(var r in t)e[r]=t[r];return e}(t);return e.forEach(function(e){void 0!==n[e]&&r.push(this.resolveName(n[e]).then(function(t){n[e]=t}))},this),Promise.all(r).then(function(){return n})},n.prototype._getResolver=function(n){var i=this;return this.getNetwork().then(function(t){t.ensAddress||y.throwError("network does support ENS",y.UNSUPPORTED_OPERATION,{operation:"ENS",network:t.name});var e="0x0178b8bf"+c.namehash(n).substring(2),r={to:t.ensAddress,data:e};return i.call(r).then(function(t){return 32!==h.hexDataLength(t)?null:a.getAddress(h.hexDataSlice(t,12))})})},n.prototype.resolveName=function(t){var e=this;if(t instanceof Promise)return t.then(function(t){return e.resolveName(t)});try{return Promise.resolve(a.getAddress(t))}catch(t){}var r=this,n=c.namehash(t);return this._getResolver(t).then(function(t){var e={to:t,data:"0x3b3b57de"+n.substring(2)};return r.call(e)}).then(function(t){if(32!==h.hexDataLength(t))return null;var e=a.getAddress(h.hexDataSlice(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e})},n.prototype.lookupAddress=function(n){var e=this;if(n instanceof Promise)return n.then(function(t){return e.lookupAddress(t)});var t=(n=a.getAddress(n)).substring(2)+".addr.reverse",r=c.namehash(t),i=this;return this._getResolver(t).then(function(t){if(!t)return null;var e={to:t,data:"0x691f3431"+r.substring(2)};return i.call(e)}).then(function(t){if((t=t.substring(2)).length<64)return null;if((t=t.substring(64)).length<64)return null;var e=u.bigNumberify("0x"+t.substring(0,64)).toNumber();if(2*e>(t=t.substring(64)).length)return null;var r=l.toUtf8String("0x"+t.substring(0,2*e));return i.resolveName(r).then(function(t){return t!=n?null:r})})},n.prototype.doPoll=function(){},n.prototype.perform=function(t,e){return y.throwError(t+" not implemented",y.NOT_IMPLEMENTED,{operation:t}),null},n.prototype._startPending=function(){console.log("WARNING: this provider does not support pending events")},n.prototype._stopPending=function(){},n.prototype.on=function(t,e){var r=j(t);return this._events[r]||(this._events[r]=[]),this._events[r].push({eventName:t,listener:e,type:"on"}),"pending"===r&&this._startPending(),this.polling=!0,this},n.prototype.once=function(t,e){var r=j(t);return this._events[r]||(this._events[r]=[]),this._events[r].push({eventName:t,listener:e,type:"once"}),"pending"===r&&this._startPending(),this.polling=!0,this},n.prototype.emit=function(t){for(var e=[],r=1;rt.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},t}(b),_=function(s){function t(t,e,r,n){var i=this,o=(r?"int":"uint")+8*e;return(i=s.call(this,t,o,o,n,!1)||this).size=e,i.signed=r,i}return i(t,s),t.prototype.encode=function(e){try{var t=a.bigNumberify(e);return t=t.toTwos(8*this.size).maskn(8*this.size),this.signed&&(t=t.fromTwos(8*this.size).toTwos(256)),u.padZeros(u.arrayify(t),32)}catch(t){f.throwError("invalid number value",f.INVALID_ARGUMENT,{arg:this.localName,type:typeof e,value:e})}return null},t.prototype.decode=function(t,e){t.length>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 h={},l=0;l<10;l++)h[String(l)]=String(l);for(l=0;l<26;l++)h[String.fromCharCode(65+l)]=String(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=String(98-parseInt(e,10)%97);n.length<2;)n="0"+n;return n}function p(t){var e=null;if("string"!=typeof t&&a.throwError("invalid address",a.INVALID_ARGUMENT,{arg:"address",value:t}),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=u(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&a.throwError("bad address checksum",a.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)&&a.throwError("bad icap checksum",a.INVALID_ARGUMENT,{arg:"address",value:t}),e=new n(t.substring(4),36).toString(16);e.length<40;)e="0"+e;e=u("0x"+e)}else a.throwError("invalid address",a.INVALID_ARGUMENT,{arg:"address",value:t});return e}r.getAddress=p,r.getIcapAddress=function(t){for(var e=new n(p(t).substring(2),16).toString(36).toUpperCase();e.length<30;)e="0"+e;return"XE"+d("XE00"+e)+e},r.getContractAddress=function(t){if(!t.from)throw new Error("missing from address");var e=t.nonce;return p("0x"+s.keccak256(i.encode([p(t.from),o.stripZeros(o.hexlify(e))])).substring(26))}},{"./bytes":60,"./errors":61,"./keccak256":64,"./rlp":66,"bn.js":2}],59:[function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=this&&this.__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(n,"__esModule",{value:!0});var o=r(t("bn.js")),s=t("./bytes"),a=t("./properties"),u=i(t("../utils/errors"));function h(t){return f(t)}var l=function(){function r(t){if(u.checkNew(this,r),"string"==typeof t)s.isHexString(t)?("0x"==t&&(t="0x0"),a.defineReadOnly(this,"_bn",new o.default.BN(t.substring(2),16))):"-"===t[0]&&s.isHexString(t.substring(1))?a.defineReadOnly(this,"_bn",new o.default.BN(t.substring(3),16).mul(n.ConstantNegativeOne._bn)):t.match(/^-?[0-9]*$/)&&(""==t&&(t="0"),a.defineReadOnly(this,"_bn",new o.default.BN(t)));else if("number"==typeof t){Math.trunc(t)!==t&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:t,outputValue:Math.trunc(t)});try{a.defineReadOnly(this,"_bn",new o.default.BN(t))}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}}else o.default.BN.isBN(t)?a.defineReadOnly(this,"_bn",t):h(t)?a.defineReadOnly(this,"_bn",t._bn):s.isArrayish(t)?a.defineReadOnly(this,"_bn",new o.default.BN(s.hexlify(t).substring(2),16)):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:t})}return r.prototype.fromTwos=function(t){return new r(this._bn.fromTwos(t))},r.prototype.toTwos=function(t){return new r(this._bn.toTwos(t))},r.prototype.add=function(t){return new r(this._bn.add(c(t)._bn))},r.prototype.sub=function(t){return new r(this._bn.sub(c(t)._bn))},r.prototype.div=function(t){var e=c(t)._bn;return e.isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),new r(this._bn.div(e))},r.prototype.mul=function(t){return new r(this._bn.mul(c(t)._bn))},r.prototype.mod=function(t){return new r(this._bn.mod(c(t)._bn))},r.prototype.pow=function(t){return new r(this._bn.pow(c(t)._bn))},r.prototype.maskn=function(t){return new r(this._bn.maskn(t))},r.prototype.eq=function(t){return this._bn.eq(c(t)._bn)},r.prototype.lt=function(t){return this._bn.lt(c(t)._bn)},r.prototype.lte=function(t){return this._bn.lte(c(t)._bn)},r.prototype.gt=function(t){return this._bn.gt(c(t)._bn)},r.prototype.gte=function(t){return this._bn.gte(c(t)._bn)},r.prototype.isZero=function(){return this._bn.isZero()},r.prototype.toNumber=function(){try{return this._bn.toNumber()}catch(t){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:t.message})}return null},r.prototype.toString=function(){return this._bn.toString(10)},r.prototype.toHexString=function(){var t=this._bn.toString(16);return t.length%2&&(t="0"+t),"0x"+t},r}();function f(t){return t._bn&&t._bn.mod}function c(t){return h(t)?t:new l(t)}n.BigNumber=l,n.isBigNumber=f,n.bigNumberify=c,n.ConstantNegativeOne=c(-1),n.ConstantZero=c(0),n.ConstantOne=c(1),n.ConstantTwo=c(2),n.ConstantWeiPerEther=c(new o.default.BN("1000000000000000000"))},{"../utils/errors":61,"./bytes":60,"./properties":65,"bn.js":2}],60:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s=t("./errors");function a(t){return!!t._bn}function u(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return new Uint8Array(Array.prototype.slice.apply(e,t))}),e}function h(t){if(!t||parseInt(t.length)!=t.length||"string"==typeof t)return!1;for(var e=0;e>4]+f[15&o])}return"0x"+n.join("")}return s.throwError("invalid hexlify value",null,{arg:"value",value:t}),"never"}function c(t,e){for(i(t)||s.throwError("invalid hex string",s.INVALID_ARGUMENT,{arg:"value",value:t});t.length<2*e+2;)t="0x0"+t.substring(2);return t}r.hexlify=o,r.hexDataLength=function(t){return i(t)&&t.length%2==0?(t.length-2)/2:null},r.hexDataSlice=function(t,e,r){return i(t)||s.throwError("invalid hex data",s.INVALID_ARGUMENT,{arg:"value",value:t}),t.length%2!=0&&s.throwError("hex data length must be even",s.INVALID_ARGUMENT,{arg:"value",value:t}),e=2+2*e,null!=r?"0x"+t.substring(e,e+2*r):"0x"+t.substring(e)},r.hexStripZeros=function(t){for(i(t)||s.throwError("invalid hex string",s.INVALID_ARGUMENT,{arg:"value",value:t});3>=8;return e}function i(t,e,r){for(var n=0,i=0;it.length)throw new Error("too short");if(e+1+r+(n=i(t,e+1,r))>t.length)throw new Error("to short");return a(t,e,e+1+r,r+n)}if(192<=t[e]){if(e+1+(n=t[e]-192)>t.length)throw new Error("invalid rlp data");return a(t,e,e+1,n)}if(184<=t[e]){var r;if(e+1+(r=t[e]-183)>t.length)throw new Error("invalid rlp data");if(e+1+r+(n=i(t,e+1,r))>t.length)throw new Error("invalid rlp data");return{consumed:1+r+n,result:o.hexlify(t.slice(e+1+r,e+1+r+n))}}if(128<=t[e]){var n;if(e+1+(n=t[e]-128)>t.length)throw new Error("invlaid rlp data");return{consumed:1+n,result:o.hexlify(t.slice(e+1,e+1+n))}}return{consumed:1,result:o.hexlify(t[e])}}r.encode=function(t){return o.hexlify(function e(t){if(Array.isArray(t)){var r=[];return t.forEach(function(t){r=r.concat(e(t))}),r.length<=55?(r.unshift(192+r.length),r):((n=s(r.length)).unshift(247+n.length),n.concat(r))}var n,i=Array.prototype.slice.call(o.arrayify(t));return 1===i.length&&i[0]<=127?i:i.length<=55?(i.unshift(128+i.length),i):((n=s(i.length)).unshift(183+n.length),n.concat(i))}(t))},r.decode=function(t){var e=o.arrayify(t),r=u(e,0);if(r.consumed!==e.length)throw new Error("invalid rlp data");return r.result}},{"./bytes":60}],67:[function(t,e,r){"use strict";var n=this&&this.__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=t("./address"),o=t("./bytes"),s=t("./keccak256"),a=t("./properties"),u=n(t("./errors")),h=new(n(t("elliptic")).ec)("secp256k1");r.N="0x"+h.n.toString(16);var l=function(){function t(t){var e=h.keyFromPrivate(o.arrayify(t));a.defineReadOnly(this,"privateKey",o.hexlify(e.priv.toArray("be",32))),a.defineReadOnly(this,"publicKey","0x"+e.getPublic(!1,"hex")),a.defineReadOnly(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),a.defineReadOnly(this,"publicKeyBytes",e.getPublic().encode(null,!0))}return t.prototype.sign=function(t){var e=h.keyFromPrivate(o.arrayify(this.privateKey)).sign(o.arrayify(t),{canonical:!0});return{recoveryParam:e.recoveryParam,r:o.hexZeroPad("0x"+e.r.toString(16),32),s:o.hexZeroPad("0x"+e.s.toString(16),32),v:27+e.recoveryParam}},t}();function f(t,e){var r={r:o.arrayify(e.r),s:o.arrayify(e.s)};return"0x"+h.recoverPubKey(o.arrayify(t),r,e.recoveryParam).encode("hex",!1)}function c(t,e){var r=o.arrayify(t);if(32===r.length){var n=new l(r);return e?n.compressedPublicKey:n.publicKey}return 33===r.length?e?o.hexlify(r):"0x"+h.keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+h.keyFromPublic(r).getPublic(!0,"hex"):o.hexlify(r):(u.throwError("invalid public or private key",u.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null)}function d(t){var e="0x"+c(t).slice(4);return i.getAddress("0x"+s.keccak256(e).substring(26))}r.KeyPair=l,r.recoverPublicKey=f,r.computePublicKey=c,r.recoverAddress=function(t,e){return d(f(t,e))},r.computeAddress=d},{"./address":58,"./bytes":60,"./errors":61,"./keccak256":64,"./properties":65,elliptic:5}],68:[function(t,e,r){"use strict";var n=this&&this.__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(t("hash.js")),o=t("./bytes"),s=i.sha256,a=i.sha512;r.sha256=function(t){return"0x"+s().update(o.arrayify(t)).digest("hex")},r.sha512=function(t){return"0x"+a().update(o.arrayify(t)).digest("hex")}},{"./bytes":60,"hash.js":20}],69:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var u=t("./bignumber"),h=t("./bytes"),l=t("./utf8"),n=t("./keccak256"),i=t("./sha2"),f=new RegExp("^bytes([0-9]+)$"),c=new RegExp("^(u?int)([0-9]*)$"),d=new RegExp("^(.*)\\[([0-9]*)\\]$"),p="0000000000000000000000000000000000000000000000000000000000000000";function o(t,r){if(t.length!=r.length)throw new Error("type/value count mismatch");var n=[];return t.forEach(function(t,e){n.push(function e(t,r,n){switch(t){case"address":return n?h.padZeros(r,32):h.arrayify(r);case"string":return l.toUtf8Bytes(r);case"bytes":return h.arrayify(r);case"bool":return r=r?"0x01":"0x00",n?h.padZeros(r,32):h.arrayify(r)}var i=t.match(c);if(i){if((o=parseInt(i[2]||"256"))%8!=0||0===o||256t.maxLength)throw(e=new Error("invalid "+t.name)).reason="too long",e.value=r,e;i.push(d.hexlify(r))}),n.chainId&&(i.push(d.hexlify(n.chainId)),i.push("0x"),i.push("0x"));var e=t(p.keccak256(y.encode(i))),r=27+e.recoveryParam;return n.chainId&&(i.pop(),i.pop(),i.pop(),r+=2*n.chainId+8),i.push(d.hexlify(r)),i.push(d.stripZeros(d.arrayify(e.r))),i.push(d.stripZeros(d.arrayify(e.s))),y.encode(i)},r.parse=function(t){var e=y.decode(t);if(9!==e.length)throw new Error("invalid transaction");var r,n={nonce:m(e[0]).toNumber(),gasPrice:m(e[1]),gasLimit:m(e[2]),to:(r=e[3],"0x"===r?null:f.getAddress(r)),value:m(e[4]),data:e[5],chainId:0},i=d.arrayify(e[6]),o=d.arrayify(e[7]),s=d.arrayify(e[8]);if(1<=i.length&&1<=o.length&&o.length<=32&&1<=s.length&&s.length<=32){n.v=c.bigNumberify(i).toNumber(),n.r=d.hexZeroPad(e[7],32),n.s=d.hexZeroPad(e[8],32);var a=(n.v-35)/2;a<0&&(a=0),a=Math.trunc(a),n.chainId=a;var u=n.v-27,h=e.slice(0,6);a&&(h.push(d.hexlify(a)),h.push("0x"),h.push("0x"),u-=2*a+8);var l=p.keccak256(y.encode(h));try{n.from=v.recoverAddress(l,{r:d.hexlify(o),s:d.hexlify(s),recoveryParam:u})}catch(t){console.log(t)}n.hash=p.keccak256(t)}return n}},{"./address":58,"./bignumber":59,"./bytes":60,"./keccak256":64,"./rlp":66,"./secp256k1":67}],71:[function(t,e,r){"use strict";var n=this&&this.__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 l=t("./bignumber"),f=n(t("./errors")),s=["wei","kwei","Mwei","Gwei","szabo","finny","ether"],c=function(){var i={};function o(t){return{decimals:t.length-1,tenPower:l.bigNumberify(t)}}var r="1";return s.forEach(function(t){var e=o(r);i[t.toLowerCase()]=e,i[String(e.decimals)]=e,r+="000"}),function(t){var e=i[String(t).toLowerCase()];if(!e&&"number"==typeof t&&Math.trunc(t)==t&&0<=t&&t<=256){for(var r="1",n=0;nr.decimals&&f.throwError("underflow occurred",f.NUMERIC_FAULT,{operation:"division",fault:"underflow"});s.length>6|192:(55296==(64512&o)&&i+1>18|240,r[n++]=o>>12&63|128):r[n++]=o>>12|224,r[n++]=o>>6&63|128),r[n++]=63&o|128)}return u.arrayify(r)},r.toUtf8String=function(t){t=u.arrayify(t);for(var e="",r=0;r>7!=0){if(n>>6!=2){var i=null;if(n>>5==6)i=1;else if(n>>4==14)i=2;else if(n>>3==30)i=3;else if(n>>2==62)i=4;else{if(n>>1!=126)continue;i=5}if(r+i>t.length){for(;r>6==2;r++);if(r!=t.length)continue;return e}var o,s=n&(1<<8-i-1)-1;for(o=0;o>6!=2)break;s=s<<6|63&a}o==i?s<=65535?e+=String.fromCharCode(s):(s-=65536,e+=String.fromCharCode(55296+(s>>10&1023),56320+(1023&s))):r--}}else e+=String.fromCharCode(n)}return e}},{"./bytes":60}],73:[function(t,e,r){"use strict";var n=this&&this.__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 h=t("xmlhttprequest"),i=t("./utf8"),o=t("./base64"),l=n(t("./errors"));r.fetchJson=function(s,a,u){var t=[];if("object"==typeof s&&null!=s.url){if(null==s.url&&l.throwError("missing URL",l.MISSING_ARGUMENT,{arg:"url"}),null!=s.user&&null!=s.password){"https:"!==s.url.substring(0,6)&&!0!==s.allowInsecure&&l.throwError("basic authentication requires a secure https url",l.INVALID_ARGUMENT,{arg:"url",url:s.url,user:s.user,password:"[REDACTED]"});var e=s.user+":"+s.password;t.push({key:"Authorization",value:"Basic "+o.encode(i.toUtf8Bytes(e))})}s=s.url}return new Promise(function(n,i){var o=new h.XMLHttpRequest;a?(o.open("POST",s,!0),t.push({key:"Content-Type",value:"application/json"})):o.open("GET",s,!0),t.forEach(function(t){o.setRequestHeader(t.key,t.value)}),o.onreadystatechange=function(){if(4===o.readyState){try{var t=JSON.parse(o.responseText)}catch(r){var e=new Error("invalid json response");return e.orginialError=r,e.responseText=o.responseText,e.url=s,void i(e)}if(u)try{t=u(t)}catch(r){return r.url=s,r.body=a,r.responseText=o.responseText,void i(r)}if(200!=o.status){var r=new Error("invalid response - "+o.status);return r.statusCode=o.statusCode,void i(r)}n(t)}},o.onerror=function(t){i(t)};try{a?o.send(a):o.send()}catch(t){var e=new Error("connection error");e.error=t,i(e)}})}},{"./base64":40,"./errors":61,"./utf8":72,xmlhttprequest:45}],74:[function(t,e,r){"use strict";var n=this&&this.__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 f=t("../wordlists/lang-en"),c=t("../utils/bytes"),l=t("../utils/bignumber"),i=t("../utils/utf8"),o=t("../utils/pbkdf2"),d=t("../utils/hmac"),s=t("../utils/properties"),p=t("../utils/secp256k1"),v=t("../utils/sha2"),a=n(t("../utils/errors")),u=i.toUtf8Bytes("Bitcoin seed"),y=2147483648;function m(t){return(1<>3)]=t>>24-i&255;var o=d.computeHmac("sha512",this.chainCode,e),s=l.bigNumberify(o.slice(0,32)),a=o.slice(32),u=s.add(this.keyPair.privateKey).mod(p.N);return new h(c.arrayify(u),a,t,this.depth+1,r,n)},h.prototype.derivePath=function(t){var e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path");"m"===e[0]&&e.shift();for(var r=this,n=0;n>3]|=1<<7-i%8),i++}var u=32*r.length/3,h=m(r.length/3),l=c.arrayify(v.sha256(n.slice(0,u/8)))[0];if((l&=h)!==(n[n.length-1]&h))throw new Error("invalid checksum");return c.hexlify(n.slice(0,u/8))}r.HDNode=h,r.fromMnemonic=function(t,e){return w(t,e),g(b(t),t)},r.fromSeed=function(t){return g(t,null)},r.mnemonicToSeed=b,r.mnemonicToEntropy=w,r.entropyToMnemonic=function(t,e){if((t=c.arrayify(t)).length%4!=0||t.length<16||32>8-n,r.push(t[i]&(1<<8-n)-1),n+=3);var o=c.arrayify(v.sha256(t))[0],s=t.length/4;return o&=m(s),r[r.length-1]<<=s,r[r.length-1]|=o>>8-s,e||(e=f.langEn),e.join(r.map(function(t){return e.getWord(t)}))},r.isValidMnemonic=function(t,e){try{return w(t,e),!0}catch(t){}return!1}},{"../utils/bignumber":59,"../utils/bytes":60,"../utils/errors":61,"../utils/hmac":42,"../utils/pbkdf2":43,"../utils/properties":65,"../utils/secp256k1":67,"../utils/sha2":68,"../utils/utf8":72,"../wordlists/lang-en":79}],75:[function(t,e,r){"use strict";var n=this&&this.__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=t("./wallet");r.Wallet=i.Wallet;var o=n(t("./hdnode"));r.HDNode=o;var s=t("./signing-key");r.SigningKey=s.SigningKey},{"./hdnode":74,"./signing-key":77,"./wallet":78}],76:[function(t,e,r){"use strict";var n=this&&this.__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=t("aes-js"),m=t("scrypt-js"),R=t("uuid"),g=t("../utils/address"),T=t("../utils/bytes"),b=t("../utils/pbkdf2"),O=t("../utils/keccak256"),p=t("../utils/utf8"),C=t("../utils/random-bytes"),B=t("./signing-key"),L=n(t("./hdnode")),D="m/44'/60'/0'/0/0";function w(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),T.arrayify(t)}function U(t,e){for(t=String(t);t.length=h.length||Math.trunc(t)!=t)&&a.throwError("invalid wordlist index",a.INVALID_ARGUMENT,{arg:"index",value:t}),h[t]},e.prototype.getWordIndex=function(t){return l(),h.indexOf(t)},e}(s.Wordlist));r.langEn=f,s.register(f)},{"../utils/errors":61,"./wordlist":80}],80:[function(i,t,o){(function(e){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var r=!1,n=i("../utils/properties"),t=function(){function t(t){n.defineReadOnly(this,"locale",t)}return t.prototype.split=function(t){return t.toLowerCase().split(/ +/g)},t.prototype.join=function(t){return t.join(" ")},t}();o.Wordlist=t,o.register=function(t){r&&(e.wordlists||n.defineReadOnly(e,"wordlists",{}),n.defineReadOnly(e.wordlists,t.locale,t))},r=!0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/properties":65}],81:[function(t,e,r){"use strict";var n=this&&this.__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=t("./contracts");r.Contract=i.Contract,r.Interface=i.Interface;var o=n(t("./providers"));r.providers=o;var s=n(t("./utils/errors"));r.errors=s;var a=t("./providers/networks");r.getNetwork=a.getNetwork;var u=n(t("./utils"));r.utils=u;var h=t("./wallet");r.HDNode=h.HDNode,r.SigningKey=h.SigningKey,r.Wallet=h.Wallet,console.log("@TODO: Get version");r.version="4.0.0"},{"./contracts":47,"./providers":51,"./providers/networks":54,"./utils":63,"./utils/errors":61,"./wallet":75}]},{},[81])(81)}); //# sourceMappingURL=ethers.min.js.map diff --git a/dist/ethers.min.js.map b/dist/ethers.min.js.map index 55830d020..ec62720fb 100644 --- a/dist/ethers.min.js.map +++ b/dist/ethers.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["ethers.min.js"],"names":["f","exports","module","define","amd","window","global","self","this","ethers","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","root","checkInt","value","parseInt","checkInts","arrayish","coerceArray","arg","copy","buffer","ArrayBuffer","isView","name","slice","Array","prototype","isArray","Uint8Array","createArray","copyArray","sourceArray","targetArray","targetStart","sourceStart","sourceEnd","set","Hex","convertUtf8","toBytes","text","result","encodeURI","charCodeAt","push","substr","fromBytes","bytes","String","fromCharCode","join","convertHex","v","numberOfRounds","16","24","32","rcon","S","Si","T1","T2","T3","T4","T5","T6","T7","T8","U1","U2","U3","U4","convertToInt32","AES","key","Object","defineProperty","_prepare","rounds","_Ke","_Kd","index","roundKeyCount","KC","tk","tt","rconpointer","encrypt","plaintext","decrypt","ciphertext","ModeOfOperationECB","description","_aes","block","ModeOfOperationCBC","iv","_lastCipherblock","j","ModeOfOperationCFB","segmentSize","_shiftRegister","xorSegment","encrypted","ModeOfOperationOFB","_lastPrecipher","_lastPrecipherIndex","Counter","initialValue","_counter","setValue","setBytes","increment","ModeOfOperationCTR","counter","_remainingCounter","_remainingCounterIndex","aesjs","ModeOfOperation","ecb","cbc","cfb","ofb","ctr","utils","hex","utf8","padding","pkcs7","pad","data","padder","strip","_arrayTest","_aesjs","2","assert","val","msg","inherits","ctor","superCtor","super_","TempCtor","constructor","BN","number","base","endian","isBN","negative","words","red","_init","Buffer","wordSize","parseHex","str","start","end","len","Math","min","parseBase","mul","num","max","left","right","cmp","_initNumber","_initArray","toString","replace","_parseHex","_parseBase","toArray","ceil","w","off","limbLen","limbPow","total","mod","word","imuln","_iaddn","pow","dest","clone","_expand","size","_normSign","inspect","zeros","groupSizes","groupBases","smallMulTo","out","b","lo","carry","k","ncarry","rword","maxJ","groupSize","groupBase","isZero","modn","idivn","toNumber","ret","toJSON","toBuffer","toArrayLike","ArrayType","byteLength","reqLength","littleEndian","res","q","andln","iushrn","_countBits","clz32","_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","mid","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","s","rtwdf","cos","PI","itwdf","sin","rtwdf_","itwdf_","re","ie","ro","io","rx","guessLen13b","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","3","randomBytes","../../src.ts/utils","4","5","elliptic","version","rand","hmacDRBG","curve","curves","ec","eddsa","../package.json","./elliptic/curve","./elliptic/curves","./elliptic/ec","./elliptic/eddsa","./elliptic/hmac-drbg","./elliptic/utils","brorand","6","getNAF","getJSF","BaseCurve","type","conf","zero","two","pointFromJSON","gRed","_wnafT1","_wnafT2","_wnafT3","_wnafT4","adjustCount","redN","_maxwellTrick","BasePoint","precomputed","point","validate","_fixedNafMul","doubles","_getDoubles","naf","I","step","repr","nafW","jpoint","mixedAdd","points","toP","_wnafMul","nafPoints","_getNAFPoints","dblp","_wnafMulAdd","defW","coeffs","jacobianResult","wndWidth","comb","toJ","jsf","ja","jb","decodePoint","enc","pointFromX","encodeCompressed","encode","_encode","compact","getX","getY","concat","precompute","power","beta","_getBeta","_hasDoubles","dbl","../../elliptic","bn.js","7","8","short","edwards","./base","./edwards","./mont","./short","9","arguments","apply","dup","10","Base","ShortCurve","tinv","zeroA","threeA","endo","_getEndomorphism","_endoWnafT1","_endoWnafT2","Point","isRed","inf","JPoint","zOne","lambda","betas","_getEndoRoots","lambdas","basis","map","vec","_getEndoBasis","ntinv","prevR","aprxSqrt","floor","y1","y2","len1","_endoSplit","v1","v2","c1","c2","p1","p2","q1","q2","k1","k2","ax","rhs","_endoWnafMulAdd","npoints","ncoeffs","obj","fromJSON","pre","endoMul","JSON","parse","obj2point","isInfinity","nx","ny","ys1","dyinv","mulAdd","jmulAdd","_precompute","negate","zinv","zinv2","ay","pz2","z2","u1","u2","s1","s2","h2","h3","nz","jx","jy","jz","jz4","jyd","jx2","jyd2","jyd4","t1","t2","dny","_zeroDbl","_threeDbl","_dbl","xx","yy","yyyy","yyyy8","d","c8","gamma","alpha","beta4","beta8","ggamma8","jy2","jxd4","jyd8","trpl","zz","mm","ee","yyu4","kbase","z3","pz3","eqXToP","zs","xc","../curve","11","hash","PresetCurve","options","defineCurve","configurable","enumerable","get","sha256","sha384","sha512","undefined","../elliptic","./precomputed/secp256k1","hash.js","12","KeyPair","Signature","EC","hasOwnProperty","nh","keyPair","keyFromPrivate","priv","fromPrivate","keyFromPublic","pub","fromPublic","genKeyPair","drbg","pers","entropy","hmacStrength","nonce","ns2","generate","_truncateToN","truncOnly","sign","bkey","getPrivate","persEnc","ns1","iter","kp","kpX","recoveryParam","canonical","verify","signature","sinv","getPublic","recoverPubKey","isYOdd","isSecondKey","rInv","getKeyRecoveryParam","Q","Qprime","./key","./signature","13","_importPrivate","privEnc","_importPublic","pubEnc","reason","derive","14","_importDER","Position","place","getLength","buf","initial","octetLen","rmPadding","constructLength","arr","octets","log","LN2","slen","toDER","backHalf","15","HmacDRBG","predResist","outSize","minEntropy","reseed","reseedInterval","K","V","entropyEnc","nonceEnc","seed","_update","_hmac","hmac","kmac","update","digest","addEnc","temp","17","18","zero2","toHex","d1","d2","m8","m14","m24","cachedProperty","computer","parseBytes","intFromLE","19","20","common","sha","ripemd","sha1","sha224","ripemd160","./hash/common","./hash/hmac","./hash/ripemd","./hash/sha","./hash/utils","21","BlockHash","pending","pendingTotal","blockSize","padLength","_delta8","_delta32","join32","_pad","_digest","./utils","minimalistic-assert","22","Hmac","Hash","inner","outer","23","./sha/1","./sha/224","./sha/256","./sha/384","./sha/512","25","26","27","shaCommon","sum32","sum32_4","sum32_5","ch32","maj32","s0_256","s1_256","g0_256","g1_256","sha256_K","SHA256","W","toHex32","split32","../common","../utils","./common","28","29","rotr64_hi","rotr64_lo","shr64_hi","shr64_lo","sum64","sum64_hi","sum64_lo","sum64_4_hi","sum64_4_lo","sum64_5_hi","sum64_5_lo","sha512_K","SHA512","ch64_hi","xh","xl","yh","yl","zh","ch64_lo","zl","maj64_hi","maj64_lo","s0_512_hi","s0_512_lo","s1_512_hi","s1_512_lo","g0_512_hi","g0_512_lo","g1_512_hi","g1_512_lo","_prepareBlock","c0_hi","c0_lo","c1_hi","c1_lo","c2_hi","c2_lo","c3_hi","c3_lo","ah","al","bh","bl","ch","cl","dh","dl","eh","el","fh","fl","gh","gl","hh","hl","c4_hi","c4_lo","T1_hi","T1_lo","T2_hi","T2_lo","30","rotr32","p32","ft_1","31","htonl","zero8","rotl32","sum32_3","pos","create","writable","33","process","JS_SHA3_NO_NODE_JS","versions","node","COMMON_JS","JS_SHA3_NO_COMMON_JS","HEX_CHARS","SHIFT","RC","BITS","OUTPUT_TYPES","createOutputMethod","outputType","message","Keccak","createShakeOutputMethod","outputBits","createMethod","method","algorithms","methods","methodNames","algorithm","methodName","blocks","reset","blockCount","byteCount","outputBlocks","extraBytes","notString","lastByteIndex","finalize","arrayBuffer","array","Uint32Array","offset","c0","c3","c4","c5","c6","c7","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","_process","34","equal","35","setImmediate","setImmedaite","setTimeout","36","MAX_VALUE","h0","h1","h4","h5","h6","h7","bytesLeft","bitLenHi","bitLenLo","numZeros","PBKDF2_HMAC_SHA256_OneIter","password","salt","dkLen","innerLen","outerKey","dk","incrementCounter","blockmix_salsa8","BY","Yi","_X","arraycopy","blockxor","salsa20_8","R","src","srcPos","destPos","checkBufferish","ensureInteger","intValue","scrypt","callback","i1","Bi","XY","totalOps","currentOp","lastPercent10","stop","state","i0","limit","nextTick","incrementalSMix","steps","percent10","derivedKey","_scrypt","timers","37","38","rng","crypto","getRandomValues","_rnds8","_rnds","random","39","_rng","_byteToHex","_hexToByte","unparse","bth","_seedBytes","_nodeId","_clockseq","_lastMSecs","_lastNSecs","v4","rnds","ii","uuid","clockseq","msecs","Date","getTime","nsecs","dt","tl","tmh","toLowerCase","oct","./rng","40","bytes_1","decode","textData","atob","arrayify","btoa","../src.ts/utils/bytes","41","42","__importStar","__esModule","errors","supportedAlgorithms","computeHmac","throwError","UNSUPPORTED_OPERATION","operation","../src.ts/utils/errors","43","hmac_1","pbkdf2","iterations","keylen","hashAlgorithm","hLen","T","DK","block1","U","../src.ts/utils/hmac","44","properties_1","console","trunc","_weakCrypto","defineReadOnly","../src.ts/utils/properties","45","XMLHttpRequest","error","46","interface_1","provider_1","wallet_1","address_1","bignumber_1","allowedTransactionKeys","from","gasLimit","gasPrice","to","runMethod","contract","functionName","estimateOnly","interface","functions","params","_i","tx","inputs","shallowCopy","pop","forEach","addressPromise","resolveAddresses","provider","paramType","promises","Promise","all","resolveName","components","resolve","then","ConstantZero","signer","getAddress","outputs","CALL_EXCEPTION","address","estimateGas","sendTransaction","Contract","addressOrName","contractInterface","signerOrProvider","_this","checkNew","Interface","Signer","Provider","INVALID_ARGUMENT","keys","run","estimate","events","eventName","eventInfo","eventCallback","handleEvent","topics","args","event","removeListener","topic","getBlock","blockHash","getTransaction","transactionHash","getTransactionReceipt","eventSignature","property","on","propertyName","connect","deploy","bytecode","isHexString","deployFunction","getContractAddress","../providers/provider","../utils/address","../utils/bignumber","../utils/bytes","../utils/errors","../utils/properties","../wallet/wallet","./interface","47","contract_1","./contract","48","extendStatics","__extends","setPrototypeOf","__proto__","__","abi_coder_1","keccak256_1","utf8_1","parseParams","names","types","param","substring","suffix","arrayBracket","indexOf","Description","info","defineFrozen","Indexed","_super","DeployDescription","MISSING_ARGUMENT","count","expectedCount","UNEXPECTED_ARGUMENT","defaultAbiCoder","FunctionDescription","sighash","errorArg","errorValue","Result","EventDescription","anonymous","inputIndexed","inputNonIndexed","inputDynamic","indexed","resultIndexed","resultNonIndexed","nonIndexedIndex","indexedIndex","TransactionDescription","LogDescription","addMethod","payable","keccak256","toUtf8Bytes","abi","errorMessage","_abi","fragment","parseSignature","parseTransaction","func","bigNumberify","parseLog","values","../utils/abi-coder","../utils/keccak256","../utils/utf8","49","web_1","getTransactionString","transaction","hexlify","hexStripZeros","getResult","status","stringify","getJsonResult","jsonrpc","checkLogTag","blockTag","EtherscanProvider","network","apiKey","baseUrl","perform","url","fetchJson","position","signedTransaction","filter","fromBlock","toBlock","topic0","reject","logs","txs","seq","parseFloat","ethusd","getHistory","startBlock","endBlock","creates","contractAddress","item","checkTransactionResponse","timeStamp","timestamp","../utils/web","./provider","50","checkNetworks","networks","check","chainId","ensAddress","FallbackProvider","providers","ready_1","getNetwork","UNKNOWN_ERROR","_providers","firstError","51","ProviderSigner","etherscan_provider_1","fallback_provider_1","ipc_provider_1","IpcProvider","infura_provider_1","InfuraProvider","json_rpc_provider_1","JsonRpcProvider","web3_provider_1","Web3Provider","getDefaultProvider","./etherscan-provider","./fallback-provider","./infura-provider","./ipc-provider","./json-rpc-provider","./web3-provider","52","networks_1","apiAccessToken","host","_startPending","getSigner","listAccounts","./networks","53","payload","hexlifyTransaction","getLowerCase","JsonRpcSigner","_address","send","accounts","getBalance","getTransactionCount","resolveProperties","signMessage","unlock","ready","connection","request","id","NOT_IMPLEMENTED","_pendingFilter","pendingFilter","filterId","poll","hashes","_emitted","emit","timeout","_stopPending","54","homestead","ropsten","unspecified","mainnet","morden","testnet","rinkeby","kovan","classic","n_1","n_2","55","rlp_1","hash_1","transaction_1","format","object","checkKey","checkValue","allowNull","nullValue","arrayOf","checkHash","hexDataLength","checkNumber","checkUint256","uint256","checkBlockTag","formatBlock","parentHash","difficulty","gasUsed","miner","extraData","transactions","checkBlock","author","formatTransaction","blockNumber","transactionIndex","raw","gas","stripZeros","networkId","formatTransactionRequest","checkTransactionRequest","formatTransactionReceiptLog","transactionLogIndex","logIndex","formatTransactionReceipt","logsBloom","cumulativeGasUsed","formatFilter","checkTopics","replaceValue","formatLog","removed","checkLog","stallPromise","allowNullFunc","executeFunc","attempt","recurse","convertFunc","getEventString","stack","signDigest","_addressPromise","joinSignature","hashMessage","getGasPrice","signedTx","expectedAddress","knownNetwork","_network","_lastBlockNumber","_balances","_events","_pollingInterval","_doPoll","getBlockNumber","newBalances","string","parseEventString","balance","lastBalance","getLogs","doPoll","resetEventsBlock","_poller","setInterval","bind","pollingInterval","clearInterval","waitForTransaction","timer","complete","clearTimeout","once","_a","getCode","getStorageAt","expectedHash","returnedHash","wait","_resolveNames","blockHashOrBlockTag","transactionReceipt","entry","byzantium","getEtherPrice","copyObject","_getResolver","namehash","hexDataSlice","nodeHash","resolverAddress","lookupAddress","nodehash","toUtf8String","addr","listener","polling","listeners","splice","listenerCount","removeAllListeners","eventNameString","../utils/hash","../utils/rlp","../utils/transaction","56","web3Provider","sendAsync","path","_web3Provider","isMetaMask","57","paramTypeBytes","RegExp","paramTypeNumber","paramTypeArray","defaultCoerceFunc","match","regexParen","regexIdentifier","verifyType","parseParam","allowIndexed","parent","allowType","allowParams","child","allowName","allowArray","sibling","readArray","parseParamType","trim","splitNesting","modifier","parseSignatureEvent","constant","stateMutability","comps","parseSignatureFunction","Coder","coerceFunc","localName","dynamic","CoderNull","consumed","CoderNumber","signed","padZeros","coderType","junkLength","uint256Coder","CoderBoolean","CoderFixedBytes","CoderAddress","_encodeDynamicBytes","dataLength","_decodeDynamicBytes","CoderDynamicBytes","CoderString","alignSize","pack","coders","arrayValues","coder","parts","staticSize","dynamicSize","part","dynamicOffset","unpack","baseOffset","CoderArray","decodedLength","CoderTuple","accum","depth","paramTypeSimple","bool","getParamCoder","component","getTupleParamCoder","AbiCoder","typeObject","jsonCopy","./address","./bignumber","./bytes","./errors","./properties","./utf8","58","getChecksumAddress","chars","hashed","i_1","toUpperCase","ibanLookup","safeDigits","log10","LN10","ibanChecksum","expanded","checksum","getIcapAddress","base36","./keccak256","./rlp","59","__importDefault","default","bn_js_1","_isBigNumber","isBigNumber","BigNumber","ConstantNegativeOne","_bn","NUMERIC_FAULT","fault","outputValue","details","isArrayish","other","toHexString","ConstantOne","ConstantTwo","ConstantWeiPerEther","60","addSlice","objects","arrays","HexCharacters","hexZeroPad","splitSignature","61","messageDetails","MISSING_NEW","kind","62","Zeros","Partition","UseSTD3ASCIIRules","partition","label","63","base64","sha2_1","solidity_1","solidityKeccak256","solidityPack","soliditySha256","random_bytes_1","RLP","units_1","formatEther","parseEther","formatUnits","parseUnits","etherSymbol","./abi-coder","./base64","./hash","./random-bytes","./sha2","./solidity","./transaction","./units","./web","64","sha3","keccak_256","js-sha3","65","frozen","66","arrayifyInteger","unshift","unarrayifyInteger","_decodeChildren","childOffset","decoded","_decode","lengthLength","67","privateKey","recoverPublicKey","sig","computePublicKey","compressed","compressedPublicKey","publicKey","computeAddress","recoverAddress","68","_hash","_sha256","_sha512","69","regexBytes","regexNumber","regexArray","tight","_pack","baseType","70","secp256k1_1","handleNumber","transactionFields","maxLength","fieldInfo","rawTransaction","./secp256k1","71","getUnitInfo","unitInfos","decimals","tenPower","unitType","unitInfo","fraction","whole","commify","wholeValue","fractionValue","wei","ether","72","UnicodeNormalizationForm","form","normalize","extraLength","nextChar","73","xmlhttprequest_1","base64_1","json","processFunc","headers","user","allowInsecure","authorization","open","header","setRequestHeader","onreadystatechange","readyState","responseText","jsonError","orginialError","body","statusCode","onerror","connectionError","xmlhttprequest","74","lang_en_1","pbkdf2_1","MasterSecret","HardenedBit","getUpperMask","defaultPath","HDNode","chainCode","mnemonic","_derive","publicKeyBytes","IL","IR","ki","derivePath","_fromSeed","seedArray","mnemonicToSeed","NFKD","mnemonicToEntropy","wordlist","langEn","getWordIndex","entropyBits","checksumMask","fromMnemonic","fromSeed","entropyToMnemonic","indices","remainingBits","checksumBits","getWord","isValidMnemonic","../utils/hmac","../utils/pbkdf2","../utils/secp256k1","../utils/sha2","../wordlists/lang-en","75","Wallet","signing_key_1","SigningKey","./hdnode","./signing-key","./wallet","76","aes","looseArrayify","hexString","zpad","getPassword","NFKC","searchPath","currentChild","matchingChild","isCrowdsaleWallet","encseed","ethaddr","isValidWallet","decryptCrowdsale","encryptedSeed","aesCbc","seedHex","seedHexBytes","signingKey","progressCallback","getSigningKey","derivedHalf","aesCtr","mnemonicKey","mnemonicCiphertext","mnemonicIv","mnemonicCounter","mnemonicAesCtr","kdf","progress","prfFunc","prf","privateKeyBytes","client","uuidRandom","macPrefix","mac","Crypto","cipher","cipherparams","kdfparams","dklen","now","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","gethFilename","../utils/random-bytes","aes-js","scrypt-js","77","hdnode_1","78","scrypt_js_1","secretStorage","amountWei","safeOptions","createRandom","extraEntropy","locale","fromEncryptedWallet","wallet","fromBrainWallet","username","isEncryptedWallet","verifyMessage","./secret-storage","79","wordlist_1","loadWords","LangEn","Wordlist","register","./wordlist","80","exportWordlist","lang","81","contracts_1","./contracts","./providers","./providers/networks","./utils/errors"],"mappings":"CAAA,SAAUA,GAAG,GAAoB,iBAAVC,SAAoC,oBAATC,OAAsBA,OAAOD,QAAQD,SAAS,GAAmB,mBAATG,QAAqBA,OAAOC,IAAKD,O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EAAW/rC,EAAQ,YACvBhB,EAAQw1D,OAASzoB,EAASyoB,OAC1Bx1D,EAAQ23D,WAAa5qB,EAAS4qB,WAC9B33D,EAAQy3D,OAAS1qB,EAAS0qB,OAG1BrrB,QAAQhY,IAAI,sBAEZp0B,EAAQsiB,QADM,SAGZ,CAAC46C,cAAc,GAAGC,cAAc,GAAGC,uBAAuB,GAAGllC,UAAU,GAAGmlC,iBAAiB,GAAGvF,WAAW,MAAM,GAAG,CAAC,IA38dyP,CA28dpP","file":"ethers.min.js","sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i 255) {\n return false;\n }\n }\n\n return true;\n }\n\n function coerceArray(arg, copy) {\n\n // ArrayBuffer view\n if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === 'Uint8Array') {\n\n if (copy) {\n if (arg.slice) {\n arg = arg.slice();\n } else {\n arg = Array.prototype.slice.call(arg);\n }\n }\n\n return arg;\n }\n\n // It's an array; check it is a valid representation of a byte\n if (Array.isArray(arg)) {\n if (!checkInts(arg)) {\n throw new Error('Array contains invalid value: ' + arg);\n }\n\n return new Uint8Array(arg);\n }\n\n // Something else, but behaves like an array (maybe a Buffer? Arguments?)\n if (checkInt(arg.length) && checkInts(arg)) {\n return new Uint8Array(arg);\n }\n\n throw new Error('unsupported array-like object');\n }\n\n function createArray(length) {\n return new Uint8Array(length);\n }\n\n function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {\n if (sourceStart != null || sourceEnd != null) {\n if (sourceArray.slice) {\n sourceArray = sourceArray.slice(sourceStart, sourceEnd);\n } else {\n sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);\n }\n }\n targetArray.set(sourceArray, targetStart);\n }\n\n\n\n var convertUtf8 = (function() {\n function toBytes(text) {\n var result = [], i = 0;\n text = encodeURI(text);\n while (i < text.length) {\n var c = text.charCodeAt(i++);\n\n // if it is a % sign, encode the following 2 bytes as a hex value\n if (c === 37) {\n result.push(parseInt(text.substr(i, 2), 16))\n i += 2;\n\n // otherwise, just the actual byte\n } else {\n result.push(c)\n }\n }\n\n return coerceArray(result);\n }\n\n function fromBytes(bytes) {\n var result = [], i = 0;\n\n while (i < bytes.length) {\n var c = bytes[i];\n\n if (c < 128) {\n result.push(String.fromCharCode(c));\n i++;\n } else if (c > 191 && c < 224) {\n result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f)));\n i += 2;\n } else {\n result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f)));\n i += 3;\n }\n }\n\n return result.join('');\n }\n\n return {\n toBytes: toBytes,\n fromBytes: fromBytes,\n }\n })();\n\n var convertHex = (function() {\n function toBytes(text) {\n var result = [];\n for (var i = 0; i < text.length; i += 2) {\n result.push(parseInt(text.substr(i, 2), 16));\n }\n\n return result;\n }\n\n // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html\n var Hex = '0123456789abcdef';\n\n function fromBytes(bytes) {\n var result = [];\n for (var i = 0; i < bytes.length; i++) {\n var v = bytes[i];\n result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]);\n }\n return result.join('');\n }\n\n return {\n toBytes: toBytes,\n fromBytes: fromBytes,\n }\n })();\n\n\n // Number of rounds by keysize\n var numberOfRounds = {16: 10, 24: 12, 32: 14}\n\n // Round constant words\n var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91];\n\n // S-box and Inverse S-box (S is for Substitution)\n var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 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, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d];\n\n // Transformations for encryption\n var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a];\n var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616];\n var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16];\n var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c];\n\n // Transformations for decryption\n var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742];\n var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857];\n var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8];\n var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0];\n\n // Transformations for decryption key expansion\n var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3];\n var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697];\n var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46];\n var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d];\n\n function convertToInt32(bytes) {\n var result = [];\n for (var i = 0; i < bytes.length; i += 4) {\n result.push(\n (bytes[i ] << 24) |\n (bytes[i + 1] << 16) |\n (bytes[i + 2] << 8) |\n bytes[i + 3]\n );\n }\n return result;\n }\n\n var AES = function(key) {\n if (!(this instanceof AES)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n Object.defineProperty(this, 'key', {\n value: coerceArray(key, true)\n });\n\n this._prepare();\n }\n\n\n AES.prototype._prepare = function() {\n\n var rounds = numberOfRounds[this.key.length];\n if (rounds == null) {\n throw new Error('invalid key size (must be 16, 24 or 32 bytes)');\n }\n\n // encryption round keys\n this._Ke = [];\n\n // decryption round keys\n this._Kd = [];\n\n for (var i = 0; i <= rounds; i++) {\n this._Ke.push([0, 0, 0, 0]);\n this._Kd.push([0, 0, 0, 0]);\n }\n\n var roundKeyCount = (rounds + 1) * 4;\n var KC = this.key.length / 4;\n\n // convert the key into ints\n var tk = convertToInt32(this.key);\n\n // copy values into round key arrays\n var index;\n for (var i = 0; i < KC; i++) {\n index = i >> 2;\n this._Ke[index][i % 4] = tk[i];\n this._Kd[rounds - index][i % 4] = tk[i];\n }\n\n // key expansion (fips-197 section 5.2)\n var rconpointer = 0;\n var t = KC, tt;\n while (t < roundKeyCount) {\n tt = tk[KC - 1];\n tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^\n (S[(tt >> 8) & 0xFF] << 16) ^\n (S[ tt & 0xFF] << 8) ^\n S[(tt >> 24) & 0xFF] ^\n (rcon[rconpointer] << 24));\n rconpointer += 1;\n\n // key expansion (for non-256 bit)\n if (KC != 8) {\n for (var i = 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n\n // key expansion for 256-bit keys is \"slightly different\" (fips-197)\n } else {\n for (var i = 1; i < (KC / 2); i++) {\n tk[i] ^= tk[i - 1];\n }\n tt = tk[(KC / 2) - 1];\n\n tk[KC / 2] ^= (S[ tt & 0xFF] ^\n (S[(tt >> 8) & 0xFF] << 8) ^\n (S[(tt >> 16) & 0xFF] << 16) ^\n (S[(tt >> 24) & 0xFF] << 24));\n\n for (var i = (KC / 2) + 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n }\n\n // copy values into round key arrays\n var i = 0, r, c;\n while (i < KC && t < roundKeyCount) {\n r = t >> 2;\n c = t % 4;\n this._Ke[r][c] = tk[i];\n this._Kd[rounds - r][c] = tk[i++];\n t++;\n }\n }\n\n // inverse-cipher-ify the decryption round key (fips-197 section 5.3)\n for (var r = 1; r < rounds; r++) {\n for (var c = 0; c < 4; c++) {\n tt = this._Kd[r][c];\n this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^\n U2[(tt >> 16) & 0xFF] ^\n U3[(tt >> 8) & 0xFF] ^\n U4[ tt & 0xFF]);\n }\n }\n }\n\n AES.prototype.encrypt = function(plaintext) {\n if (plaintext.length != 16) {\n throw new Error('invalid plaintext size (must be 16 bytes)');\n }\n\n var rounds = this._Ke.length - 1;\n var a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n var t = convertToInt32(plaintext);\n for (var i = 0; i < 4; i++) {\n t[i] ^= this._Ke[0][i];\n }\n\n // apply round transforms\n for (var r = 1; r < rounds; r++) {\n for (var i = 0; i < 4; i++) {\n a[i] = (T1[(t[ i ] >> 24) & 0xff] ^\n T2[(t[(i + 1) % 4] >> 16) & 0xff] ^\n T3[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T4[ t[(i + 3) % 4] & 0xff] ^\n this._Ke[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n var result = createArray(16), tt;\n for (var i = 0; i < 4; i++) {\n tt = this._Ke[rounds][i];\n result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n\n AES.prototype.decrypt = function(ciphertext) {\n if (ciphertext.length != 16) {\n throw new Error('invalid ciphertext size (must be 16 bytes)');\n }\n\n var rounds = this._Kd.length - 1;\n var a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n var t = convertToInt32(ciphertext);\n for (var i = 0; i < 4; i++) {\n t[i] ^= this._Kd[0][i];\n }\n\n // apply round transforms\n for (var r = 1; r < rounds; r++) {\n for (var i = 0; i < 4; i++) {\n a[i] = (T5[(t[ i ] >> 24) & 0xff] ^\n T6[(t[(i + 3) % 4] >> 16) & 0xff] ^\n T7[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T8[ t[(i + 1) % 4] & 0xff] ^\n this._Kd[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n var result = createArray(16), tt;\n for (var i = 0; i < 4; i++) {\n tt = this._Kd[rounds][i];\n result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n\n\n /**\n * Mode Of Operation - Electonic Codebook (ECB)\n */\n var ModeOfOperationECB = function(key) {\n if (!(this instanceof ModeOfOperationECB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Electronic Code Block\";\n this.name = \"ecb\";\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationECB.prototype.encrypt = function(plaintext) {\n plaintext = coerceArray(plaintext);\n\n if ((plaintext.length % 16) !== 0) {\n throw new Error('invalid plaintext size (must be multiple of 16 bytes)');\n }\n\n var ciphertext = createArray(plaintext.length);\n var block = createArray(16);\n\n for (var i = 0; i < plaintext.length; i += 16) {\n copyArray(plaintext, block, 0, i, i + 16);\n block = this._aes.encrypt(block);\n copyArray(block, ciphertext, i);\n }\n\n return ciphertext;\n }\n\n ModeOfOperationECB.prototype.decrypt = function(ciphertext) {\n ciphertext = coerceArray(ciphertext);\n\n if ((ciphertext.length % 16) !== 0) {\n throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');\n }\n\n var plaintext = createArray(ciphertext.length);\n var block = createArray(16);\n\n for (var i = 0; i < ciphertext.length; i += 16) {\n copyArray(ciphertext, block, 0, i, i + 16);\n block = this._aes.decrypt(block);\n copyArray(block, plaintext, i);\n }\n\n return plaintext;\n }\n\n\n /**\n * Mode Of Operation - Cipher Block Chaining (CBC)\n */\n var ModeOfOperationCBC = function(key, iv) {\n if (!(this instanceof ModeOfOperationCBC)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Cipher Block Chaining\";\n this.name = \"cbc\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 bytes)');\n }\n\n this._lastCipherblock = coerceArray(iv, true);\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCBC.prototype.encrypt = function(plaintext) {\n plaintext = coerceArray(plaintext);\n\n if ((plaintext.length % 16) !== 0) {\n throw new Error('invalid plaintext size (must be multiple of 16 bytes)');\n }\n\n var ciphertext = createArray(plaintext.length);\n var block = createArray(16);\n\n for (var i = 0; i < plaintext.length; i += 16) {\n copyArray(plaintext, block, 0, i, i + 16);\n\n for (var j = 0; j < 16; j++) {\n block[j] ^= this._lastCipherblock[j];\n }\n\n this._lastCipherblock = this._aes.encrypt(block);\n copyArray(this._lastCipherblock, ciphertext, i);\n }\n\n return ciphertext;\n }\n\n ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {\n ciphertext = coerceArray(ciphertext);\n\n if ((ciphertext.length % 16) !== 0) {\n throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');\n }\n\n var plaintext = createArray(ciphertext.length);\n var block = createArray(16);\n\n for (var i = 0; i < ciphertext.length; i += 16) {\n copyArray(ciphertext, block, 0, i, i + 16);\n block = this._aes.decrypt(block);\n\n for (var j = 0; j < 16; j++) {\n plaintext[i + j] = block[j] ^ this._lastCipherblock[j];\n }\n\n copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16);\n }\n\n return plaintext;\n }\n\n\n /**\n * Mode Of Operation - Cipher Feedback (CFB)\n */\n var ModeOfOperationCFB = function(key, iv, segmentSize) {\n if (!(this instanceof ModeOfOperationCFB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Cipher Feedback\";\n this.name = \"cfb\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 size)');\n }\n\n if (!segmentSize) { segmentSize = 1; }\n\n this.segmentSize = segmentSize;\n\n this._shiftRegister = coerceArray(iv, true);\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCFB.prototype.encrypt = function(plaintext) {\n if ((plaintext.length % this.segmentSize) != 0) {\n throw new Error('invalid plaintext size (must be segmentSize bytes)');\n }\n\n var encrypted = coerceArray(plaintext, true);\n\n var xorSegment;\n for (var i = 0; i < encrypted.length; i += this.segmentSize) {\n xorSegment = this._aes.encrypt(this._shiftRegister);\n for (var j = 0; j < this.segmentSize; j++) {\n encrypted[i + j] ^= xorSegment[j];\n }\n\n // Shift the register\n copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);\n copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);\n }\n\n return encrypted;\n }\n\n ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {\n if ((ciphertext.length % this.segmentSize) != 0) {\n throw new Error('invalid ciphertext size (must be segmentSize bytes)');\n }\n\n var plaintext = coerceArray(ciphertext, true);\n\n var xorSegment;\n for (var i = 0; i < plaintext.length; i += this.segmentSize) {\n xorSegment = this._aes.encrypt(this._shiftRegister);\n\n for (var j = 0; j < this.segmentSize; j++) {\n plaintext[i + j] ^= xorSegment[j];\n }\n\n // Shift the register\n copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);\n copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);\n }\n\n return plaintext;\n }\n\n /**\n * Mode Of Operation - Output Feedback (OFB)\n */\n var ModeOfOperationOFB = function(key, iv) {\n if (!(this instanceof ModeOfOperationOFB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Output Feedback\";\n this.name = \"ofb\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 bytes)');\n }\n\n this._lastPrecipher = coerceArray(iv, true);\n this._lastPrecipherIndex = 16;\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationOFB.prototype.encrypt = function(plaintext) {\n var encrypted = coerceArray(plaintext, true);\n\n for (var i = 0; i < encrypted.length; i++) {\n if (this._lastPrecipherIndex === 16) {\n this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);\n this._lastPrecipherIndex = 0;\n }\n encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++];\n }\n\n return encrypted;\n }\n\n // Decryption is symetric\n ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;\n\n\n /**\n * Counter object for CTR common mode of operation\n */\n var Counter = function(initialValue) {\n if (!(this instanceof Counter)) {\n throw Error('Counter must be instanitated with `new`');\n }\n\n // We allow 0, but anything false-ish uses the default 1\n if (initialValue !== 0 && !initialValue) { initialValue = 1; }\n\n if (typeof(initialValue) === 'number') {\n this._counter = createArray(16);\n this.setValue(initialValue);\n\n } else {\n this.setBytes(initialValue);\n }\n }\n\n Counter.prototype.setValue = function(value) {\n if (typeof(value) !== 'number' || parseInt(value) != value) {\n throw new Error('invalid counter value (must be an integer)');\n }\n\n for (var index = 15; index >= 0; --index) {\n this._counter[index] = value % 256;\n value = value >> 8;\n }\n }\n\n Counter.prototype.setBytes = function(bytes) {\n bytes = coerceArray(bytes, true);\n\n if (bytes.length != 16) {\n throw new Error('invalid counter bytes size (must be 16 bytes)');\n }\n\n this._counter = bytes;\n };\n\n Counter.prototype.increment = function() {\n for (var i = 15; i >= 0; i--) {\n if (this._counter[i] === 255) {\n this._counter[i] = 0;\n } else {\n this._counter[i]++;\n break;\n }\n }\n }\n\n\n /**\n * Mode Of Operation - Counter (CTR)\n */\n var ModeOfOperationCTR = function(key, counter) {\n if (!(this instanceof ModeOfOperationCTR)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Counter\";\n this.name = \"ctr\";\n\n if (!(counter instanceof Counter)) {\n counter = new Counter(counter)\n }\n\n this._counter = counter;\n\n this._remainingCounter = null;\n this._remainingCounterIndex = 16;\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCTR.prototype.encrypt = function(plaintext) {\n var encrypted = coerceArray(plaintext, true);\n\n for (var i = 0; i < encrypted.length; i++) {\n if (this._remainingCounterIndex === 16) {\n this._remainingCounter = this._aes.encrypt(this._counter._counter);\n this._remainingCounterIndex = 0;\n this._counter.increment();\n }\n encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++];\n }\n\n return encrypted;\n }\n\n // Decryption is symetric\n ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;\n\n\n ///////////////////////\n // Padding\n\n // See:https://tools.ietf.org/html/rfc2315\n function pkcs7pad(data) {\n data = coerceArray(data, true);\n var padder = 16 - (data.length % 16);\n var result = createArray(data.length + padder);\n copyArray(data, result);\n for (var i = data.length; i < result.length; i++) {\n result[i] = padder;\n }\n return result;\n }\n\n function pkcs7strip(data) {\n data = coerceArray(data, true);\n if (data.length < 16) { throw new Error('PKCS#7 invalid length'); }\n\n var padder = data[data.length - 1];\n if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); }\n\n var length = data.length - padder;\n for (var i = 0; i < padder; i++) {\n if (data[length + i] !== padder) {\n throw new Error('PKCS#7 invalid padding byte');\n }\n }\n\n var result = createArray(length);\n copyArray(data, result, 0, 0, length);\n return result;\n }\n\n ///////////////////////\n // Exporting\n\n\n // The block cipher\n var aesjs = {\n AES: AES,\n Counter: Counter,\n\n ModeOfOperation: {\n ecb: ModeOfOperationECB,\n cbc: ModeOfOperationCBC,\n cfb: ModeOfOperationCFB,\n ofb: ModeOfOperationOFB,\n ctr: ModeOfOperationCTR\n },\n\n utils: {\n hex: convertHex,\n utf8: convertUtf8\n },\n\n padding: {\n pkcs7: {\n pad: pkcs7pad,\n strip: pkcs7strip\n }\n },\n\n _arrayTest: {\n coerceArray: coerceArray,\n createArray: createArray,\n copyArray: copyArray,\n }\n };\n\n\n // node.js\n if (typeof exports !== 'undefined') {\n module.exports = aesjs\n\n // RequireJS/AMD\n // http://www.requirejs.org/docs/api.html\n // https://github.com/amdjs/amdjs-api/wiki/AMD\n } else if (typeof(define) === 'function' && define.amd) {\n define(aesjs);\n\n // Web Browsers\n } else {\n\n // If there was an existing library at \"aesjs\" make sure it's still available\n if (root.aesjs) {\n aesjs._aesjs = root.aesjs;\n }\n\n root.aesjs = aesjs;\n }\n\n\n})(this);\n\n},{}],2:[function(require,module,exports){\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\n},{\"buffer\":4}],3:[function(require,module,exports){\nvar randomBytes = require('../../src.ts/utils').randomBytes; module.exports = function(length) { return randomBytes(length); };\n},{\"../../src.ts/utils\":63}],4:[function(require,module,exports){\n\n},{}],5:[function(require,module,exports){\n'use strict';\n\nvar elliptic = exports;\n\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.hmacDRBG = require('./elliptic/hmac-drbg');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves');\n\n// Protocols\nelliptic.ec = require('./elliptic/ec');\nelliptic.eddsa = require('./elliptic/eddsa');\n\n},{\"../package.json\":19,\"./elliptic/curve\":8,\"./elliptic/curves\":11,\"./elliptic/ec\":12,\"./elliptic/eddsa\":15,\"./elliptic/hmac-drbg\":16,\"./elliptic/utils\":18,\"brorand\":3}],6:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar getNAF = utils.getNAF;\nvar getJSF = utils.getJSF;\nvar assert = utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new BN(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);\n\n // Useful for many curves\n this.zero = new BN(0).toRed(this.red);\n this.one = new BN(1).toRed(this.red);\n this.two = new BN(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new BN(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n\n // Generalized Greg Maxwell's trick\n var adjustCount = this.n && this.p.div(this.n);\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n for (var j = 0; j < naf.length; j += doubles.step) {\n var nafW = 0;\n for (var k = j + doubles.step - 1; k >= j; k--)\n nafW = (nafW << 1) + naf[k];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (var j = 0; j < repr.length; j++) {\n var nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var k = 0; i >= 0 && naf[i] === 0; i--)\n k++;\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len,\n jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n for (var i = 0; i < len; i++) {\n var p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (var i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a]);\n naf[b] = getNAF(coeffs[b], wndWidth[b]);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b] /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3 /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (var j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (var i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (var j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (var j = 0; j < len; j++) {\n var z = tmp[j];\n var p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (var i = 0; i < len; i++)\n wnd[i] = null;\n\n if (jacobianResult)\n return acc;\n else\n return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq(/*other*/) {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n\n var len = this.p.byteLength();\n\n // uncompressed, hybrid-odd, hybrid-even\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&\n bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06)\n assert(bytes[bytes.length - 1] % 2 === 0);\n else if (bytes[0] === 0x07)\n assert(bytes[bytes.length - 1] % 2 === 1);\n\n var res = this.point(bytes.slice(1, 1 + len),\n bytes.slice(1 + len, 1 + 2 * len));\n\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&\n bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n\n if (compact)\n return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n\n return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed)\n return false;\n\n var doubles = this.precomputed.doubles;\n if (!doubles)\n return false;\n\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n\n},{\"../../elliptic\":5,\"bn.js\":2}],7:[function(require,module,exports){\nmodule.exports = {};\n},{}],8:[function(require,module,exports){\n'use strict';\n\nvar curve = exports;\n\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');\n\n},{\"./base\":6,\"./edwards\":7,\"./mont\":9,\"./short\":10}],9:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],10:[function(require,module,exports){\n'use strict';\n\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar BN = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar assert = elliptic.utils.assert;\n\nfunction ShortCurve(conf) {\n Base.call(this, 'short', conf);\n\n this.a = new BN(conf.a, 16).toRed(this.red);\n this.b = new BN(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits(ShortCurve, Base);\nmodule.exports = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new BN(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new BN(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16)\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : BN.mont(num);\n var tinv = new BN(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n\n var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new BN(1);\n var y1 = new BN(0);\n var x2 = new BN(0);\n var y2 = new BN(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n var r;\n var x;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n r = v.sub(q.mul(u));\n x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.negative) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.negative) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 }\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd =\n function _endoWnafMulAdd(points, coeffs, jacobianResult) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.negative) {\n split.k1.ineg();\n p = p.neg(true);\n }\n if (split.k2.negative) {\n split.k2.ineg();\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n};\n\nfunction Point(curve, x, y, isRed) {\n Base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits(Point, Base.BasePoint);\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n var endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n } ];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point))\n }\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new BN(k, 16);\n\n if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs, true);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2, true);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n var negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n Base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new BN(0);\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = new BN(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits(JPoint, Base.BasePoint);\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (var i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (var i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new BN(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.eqXToP = function eqXToP(x) {\n var zs = this.z.redSqr();\n var rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(zs);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n return false;\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\n},{\"../../elliptic\":5,\"../curve\":8,\"bn.js\":2,\"inherits\":32}],11:[function(require,module,exports){\n'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar elliptic = require('../elliptic');\n\nvar assert = elliptic.utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new elliptic.curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new elliptic.curve.edwards(options);\n else\n this.curve = new elliptic.curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve\n });\n return curve;\n }\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'\n ]\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'\n ]\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'\n ]\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'\n ]\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650'\n ]\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9'\n ]\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658'\n ]\n});\n\nvar pre;\ntry {\n pre = require('./precomputed/secp256k1');\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3'\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15'\n }\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre\n ]\n});\n\n},{\"../elliptic\":5,\"./precomputed/secp256k1\":17,\"hash.js\":20}],12:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nvar KeyPair = require('./key');\nvar Signature = require('./signature');\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);\n\n options = elliptic.curves[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof elliptic.curves.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.ushrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nmodule.exports = EC;\n\nEC.prototype.keyPair = function keyPair(options) {\n return new KeyPair(this, options);\n};\n\nEC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {\n return KeyPair.fromPrivate(this, priv, enc);\n};\n\nEC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {\n return KeyPair.fromPublic(this, pub, enc);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n pers: options.pers,\n entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),\n nonce: this.n.toArray()\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new BN(2));\n do {\n var priv = new BN(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyFromPrivate(priv);\n } while (true);\n};\n\nEC.prototype._truncateToN = function truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.ushrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, enc, options) {\n if (typeof enc === 'object') {\n options = enc;\n enc = null;\n }\n if (!options)\n options = {};\n\n key = this.keyFromPrivate(key, enc);\n msg = this._truncateToN(new BN(msg, 16));\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray('be', bytes);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray('be', bytes);\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce,\n pers: options.pers,\n persEnc: options.persEnc\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new BN(1));\n\n for (var iter = 0; true; iter++) {\n var k = options.k ?\n options.k(iter) :\n new BN(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var kpX = kp.getX();\n var r = kpX.umod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));\n s = s.umod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |\n (kpX.cmp(r) !== 0 ? 2 : 0);\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0) {\n s = this.n.sub(s);\n recoveryParam ^= 1;\n }\n\n return new Signature({ r: r, s: s, recoveryParam: recoveryParam });\n }\n};\n\nEC.prototype.verify = function verify(msg, signature, key, enc) {\n msg = this._truncateToN(new BN(msg, 16));\n key = this.keyFromPublic(key, enc);\n signature = new Signature(signature, 'hex');\n\n // Perform primitive values validation\n var r = signature.r;\n var s = signature.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).umod(this.n);\n var u2 = sinv.mul(r).umod(this.n);\n\n if (!this.curve._maxwellTrick) {\n var p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().umod(this.n).cmp(r) === 0;\n }\n\n // NOTE: Greg Maxwell's trick, inspired by:\n // https://git.io/vad3K\n\n var p = this.g.jmulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n // Compare `p.x` of Jacobian point with `r`,\n // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the\n // inverse of `p.z^2`\n return p.eqXToP(r);\n};\n\nEC.prototype.recoverPubKey = function(msg, signature, j, enc) {\n assert((3 & j) === j, 'The recovery param is more than two bits');\n signature = new Signature(signature, enc);\n\n var n = this.n;\n var e = new BN(msg);\n var r = signature.r;\n var s = signature.s;\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = j & 1;\n var isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error('Unable to find sencond key candinate');\n\n // 1.1. Let x = r + jn.\n if (isSecondKey)\n r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);\n else\n r = this.curve.pointFromX(r, isYOdd);\n\n var rInv = signature.r.invm(n);\n var s1 = n.sub(e).mul(rInv).umod(n);\n var s2 = s.mul(rInv).umod(n);\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n return this.g.mulAdd(s1, r, s2);\n};\n\nEC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {\n signature = new Signature(signature, enc);\n if (signature.recoveryParam !== null)\n return signature.recoveryParam;\n\n for (var i = 0; i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature, i);\n } catch (e) {\n continue;\n }\n\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error('Unable to find valid recovery factor');\n};\n\n},{\"../../elliptic\":5,\"./key\":13,\"./signature\":14,\"bn.js\":2}],13:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction KeyPair(ec, options) {\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(ec, { priv: ..., pub: ... })\n if (options.priv)\n this._importPrivate(options.priv, options.privEnc);\n if (options.pub)\n this._importPublic(options.pub, options.pubEnc);\n}\nmodule.exports = KeyPair;\n\nKeyPair.fromPublic = function fromPublic(ec, pub, enc) {\n if (pub instanceof KeyPair)\n return pub;\n\n return new KeyPair(ec, {\n pub: pub,\n pubEnc: enc\n });\n};\n\nKeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {\n if (priv instanceof KeyPair)\n return priv;\n\n return new KeyPair(ec, {\n priv: priv,\n privEnc: enc\n });\n};\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n if (!enc)\n return this.pub;\n\n return this.pub.encode(enc, compact);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key, enc) {\n this.priv = new BN(key, enc || 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.umod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key, enc) {\n if (key.x || key.y) {\n // Montgomery points only have an `x` coordinate.\n // Weierstrass/Edwards points on the other hand have both `x` and\n // `y` coordinates.\n if (this.ec.curve.type === 'mont') {\n assert(key.x, 'Need x coordinate');\n } else if (this.ec.curve.type === 'short' ||\n this.ec.curve.type === 'edwards') {\n assert(key.x && key.y, 'Need both x and y coordinate');\n }\n this.pub = this.ec.curve.point(key.x, key.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key, enc);\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n\n},{\"../../elliptic\":5,\"bn.js\":2}],14:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\n\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n\n if (this._importDER(options, enc))\n return;\n\n assert(options.r && options.s, 'Signature without r or s');\n this.r = new BN(options.r, 16);\n this.s = new BN(options.s, 16);\n if (options.recoveryParam === undefined)\n this.recoveryParam = null;\n else\n this.recoveryParam = options.recoveryParam;\n}\nmodule.exports = Signature;\n\nfunction Position() {\n this.place = 0;\n}\n\nfunction getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 0x80)) {\n return initial;\n }\n var octetLen = initial & 0xf;\n var val = 0;\n for (var i = 0, off = p.place; i < octetLen; i++, off++) {\n val <<= 8;\n val |= buf[off];\n }\n p.place = off;\n return val;\n}\n\nfunction rmPadding(buf) {\n var i = 0;\n var len = buf.length - 1;\n while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {\n i++;\n }\n if (i === 0) {\n return buf;\n }\n return buf.slice(i);\n}\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils.toArray(data, enc);\n var p = new Position();\n if (data[p.place++] !== 0x30) {\n return false;\n }\n var len = getLength(data, p);\n if ((len + p.place) !== data.length) {\n return false;\n }\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var rlen = getLength(data, p);\n var r = data.slice(p.place, rlen + p.place);\n p.place += rlen;\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var slen = getLength(data, p);\n if (data.length !== slen + p.place) {\n return false;\n }\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0 && (r[1] & 0x80)) {\n r = r.slice(1);\n }\n if (s[0] === 0 && (s[1] & 0x80)) {\n s = s.slice(1);\n }\n\n this.r = new BN(r);\n this.s = new BN(s);\n this.recoveryParam = null;\n\n return true;\n};\n\nfunction constructLength(arr, len) {\n if (len < 0x80) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n arr.push(octets | 0x80);\n while (--octets) {\n arr.push((len >>> (octets << 3)) & 0xff);\n }\n arr.push(len);\n}\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n r = rmPadding(r);\n s = rmPadding(s);\n\n while (!s[0] && !(s[1] & 0x80)) {\n s = s.slice(1);\n }\n var arr = [ 0x02 ];\n constructLength(arr, r.length);\n arr = arr.concat(r);\n arr.push(0x02);\n constructLength(arr, s.length);\n var backHalf = arr.concat(s);\n var res = [ 0x30 ];\n constructLength(res, backHalf.length);\n res = res.concat(backHalf);\n return utils.encode(res, enc);\n};\n\n},{\"../../elliptic\":5,\"bn.js\":2}],15:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],16:[function(require,module,exports){\n'use strict';\n\nvar hash = require('hash.js');\nvar elliptic = require('../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this.reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils.toArray(options.entropy, options.entropyEnc);\n var nonce = utils.toArray(options.nonce, options.nonceEnc);\n var pers = utils.toArray(options.pers, options.persEnc);\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nmodule.exports = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this.reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new hash.hmac(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils.toBuffer(entropy, entropyEnc);\n add = utils.toBuffer(add, addEnc);\n\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this.reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this.reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils.toArray(add, addEnc);\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this.reseed++;\n return utils.encode(res, enc);\n};\n\n},{\"../elliptic\":5,\"hash.js\":20}],17:[function(require,module,exports){\nmodule.exports = undefined;\n},{}],18:[function(require,module,exports){\n'use strict';\n\nvar utils = exports;\nvar BN = require('bn.js');\n\nutils.assert = function assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n};\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w) {\n var naf = [];\n var ws = 1 << (w + 1);\n var k = num.clone();\n while (k.cmpn(1) >= 0) {\n var z;\n if (k.isOdd()) {\n var mod = k.andln(ws - 1);\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n naf.push(z);\n\n // Optimization, shift by word if possible\n var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;\n for (var i = 1; i < shift; i++)\n naf.push(0);\n k.iushrn(shift);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n []\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n var m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n var m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.iushrn(1);\n k2.iushrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\nfunction cachedProperty(obj, name, computer) {\n var key = '_' + name;\n obj.prototype[name] = function cachedProperty() {\n return this[key] !== undefined ? this[key] :\n this[key] = computer.call(this);\n };\n}\nutils.cachedProperty = cachedProperty;\n\nfunction parseBytes(bytes) {\n return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :\n bytes;\n}\nutils.parseBytes = parseBytes;\n\nfunction intFromLE(bytes) {\n return new BN(bytes, 'hex', 'le');\n}\nutils.intFromLE = intFromLE;\n\n\n},{\"bn.js\":2}],19:[function(require,module,exports){\nmodule.exports={\"version\":\"6.3.3\"}\n},{}],20:[function(require,module,exports){\nvar hash = exports;\n\nhash.utils = require('./hash/utils');\nhash.common = require('./hash/common');\nhash.sha = require('./hash/sha');\nhash.ripemd = require('./hash/ripemd');\nhash.hmac = require('./hash/hmac');\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n\n},{\"./hash/common\":21,\"./hash/hmac\":22,\"./hash/ripemd\":23,\"./hash/sha\":24,\"./hash/utils\":31}],21:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n\n},{\"./utils\":31,\"minimalistic-assert\":34}],22:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n\n},{\"./utils\":31,\"minimalistic-assert\":34}],23:[function(require,module,exports){\nmodule.exports = {ripemd160: null}\n},{}],24:[function(require,module,exports){\n'use strict';\n\nexports.sha1 = require('./sha/1');\nexports.sha224 = require('./sha/224');\nexports.sha256 = require('./sha/256');\nexports.sha384 = require('./sha/384');\nexports.sha512 = require('./sha/512');\n\n},{\"./sha/1\":25,\"./sha/224\":26,\"./sha/256\":27,\"./sha/384\":28,\"./sha/512\":29}],25:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],26:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],27:[function(require,module,exports){\n'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar shaCommon = require('./common');\nvar assert = require('minimalistic-assert');\n\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar ch32 = shaCommon.ch32;\nvar maj32 = shaCommon.maj32;\nvar s0_256 = shaCommon.s0_256;\nvar s1_256 = shaCommon.s1_256;\nvar g0_256 = shaCommon.g0_256;\nvar g1_256 = shaCommon.g1_256;\n\nvar BlockHash = common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nmodule.exports = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\n},{\"../common\":21,\"../utils\":31,\"./common\":30,\"minimalistic-assert\":34}],28:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],29:[function(require,module,exports){\n'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar assert = require('minimalistic-assert');\n\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\n\nvar BlockHash = common.BlockHash;\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nmodule.exports = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n c0_hi = s0_512_hi(ah, al);\n c0_lo = s0_512_lo(ah, al);\n c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\n},{\"../common\":21,\"../utils\":31,\"minimalistic-assert\":34}],30:[function(require,module,exports){\n'use strict';\n\nvar utils = require('../utils');\nvar rotr32 = utils.rotr32;\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\nexports.ft_1 = ft_1;\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\nexports.ch32 = ch32;\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\nexports.maj32 = maj32;\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\nexports.p32 = p32;\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\nexports.s0_256 = s0_256;\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\nexports.s1_256 = s1_256;\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\nexports.g0_256 = g0_256;\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\nexports.g1_256 = g1_256;\n\n},{\"../utils\":31}],31:[function(require,module,exports){\n'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nexports.inherits = inherits;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nexports.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nexports.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nexports.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nexports.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nexports.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nexports.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nexports.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nexports.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nexports.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nexports.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nexports.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nexports.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nexports.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nexports.sum32_5 = sum32_5;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n}\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n}\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n}\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n}\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n}\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n}\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n}\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n}\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.shr64_lo = shr64_lo;\n\n},{\"inherits\":32,\"minimalistic-assert\":34}],32:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function 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 };\n} else {\n // old school shim for old browsers\n module.exports = 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\n},{}],33:[function(require,module,exports){\n(function (process,global){\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\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"_process\":35}],34:[function(require,module,exports){\nmodule.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\n},{}],35:[function(require,module,exports){\n(function (global){\nif (!global.setImmediate) { global.setImmedaite = setTimeout; };\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],36:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\";\n\n(function(root) {\n var MAX_VALUE = 0x7fffffff;\n\n // The SHA256 and PBKDF2 implementation are from scrypt-async-js:\n // See: https://github.com/dchest/scrypt-async-js\n function SHA256(m) {\n var K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,\n 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,\n 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,\n 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,\n 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,\n 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,\n 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n ];\n\n var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a;\n var h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;\n var w = new Array(64);\n\n function blocks(p) {\n var off = 0, len = p.length;\n while (len >= 64) {\n var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i, j, t1, t2;\n\n for (i = 0; i < 16; i++) {\n j = off + i*4;\n w[i] = ((p[j] & 0xff)<<24) | ((p[j+1] & 0xff)<<16) |\n ((p[j+2] & 0xff)<<8) | (p[j+3] & 0xff);\n }\n\n for (i = 16; i < 64; i++) {\n u = w[i-2];\n t1 = ((u>>>17) | (u<<(32-17))) ^ ((u>>>19) | (u<<(32-19))) ^ (u>>>10);\n\n u = w[i-15];\n t2 = ((u>>>7) | (u<<(32-7))) ^ ((u>>>18) | (u<<(32-18))) ^ (u>>>3);\n\n w[i] = (((t1 + w[i-7]) | 0) + ((t2 + w[i-16]) | 0)) | 0;\n }\n\n for (i = 0; i < 64; i++) {\n t1 = ((((((e>>>6) | (e<<(32-6))) ^ ((e>>>11) | (e<<(32-11))) ^\n ((e>>>25) | (e<<(32-25)))) + ((e & f) ^ (~e & g))) | 0) +\n ((h + ((K[i] + w[i]) | 0)) | 0)) | 0;\n\n t2 = ((((a>>>2) | (a<<(32-2))) ^ ((a>>>13) | (a<<(32-13))) ^\n ((a>>>22) | (a<<(32-22)))) + ((a & b) ^ (a & c) ^ (b & c))) | 0;\n\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n\n h0 = (h0 + a) | 0;\n h1 = (h1 + b) | 0;\n h2 = (h2 + c) | 0;\n h3 = (h3 + d) | 0;\n h4 = (h4 + e) | 0;\n h5 = (h5 + f) | 0;\n h6 = (h6 + g) | 0;\n h7 = (h7 + h) | 0;\n\n off += 64;\n len -= 64;\n }\n }\n\n blocks(m);\n\n var i, bytesLeft = m.length % 64,\n bitLenHi = (m.length / 0x20000000) | 0,\n bitLenLo = m.length << 3,\n numZeros = (bytesLeft < 56) ? 56 : 120,\n p = m.slice(m.length - bytesLeft, m.length);\n\n p.push(0x80);\n for (i = bytesLeft + 1; i < numZeros; i++) { p.push(0); }\n p.push((bitLenHi>>>24) & 0xff);\n p.push((bitLenHi>>>16) & 0xff);\n p.push((bitLenHi>>>8) & 0xff);\n p.push((bitLenHi>>>0) & 0xff);\n p.push((bitLenLo>>>24) & 0xff);\n p.push((bitLenLo>>>16) & 0xff);\n p.push((bitLenLo>>>8) & 0xff);\n p.push((bitLenLo>>>0) & 0xff);\n\n blocks(p);\n\n return [\n (h0>>>24) & 0xff, (h0>>>16) & 0xff, (h0>>>8) & 0xff, (h0>>>0) & 0xff,\n (h1>>>24) & 0xff, (h1>>>16) & 0xff, (h1>>>8) & 0xff, (h1>>>0) & 0xff,\n (h2>>>24) & 0xff, (h2>>>16) & 0xff, (h2>>>8) & 0xff, (h2>>>0) & 0xff,\n (h3>>>24) & 0xff, (h3>>>16) & 0xff, (h3>>>8) & 0xff, (h3>>>0) & 0xff,\n (h4>>>24) & 0xff, (h4>>>16) & 0xff, (h4>>>8) & 0xff, (h4>>>0) & 0xff,\n (h5>>>24) & 0xff, (h5>>>16) & 0xff, (h5>>>8) & 0xff, (h5>>>0) & 0xff,\n (h6>>>24) & 0xff, (h6>>>16) & 0xff, (h6>>>8) & 0xff, (h6>>>0) & 0xff,\n (h7>>>24) & 0xff, (h7>>>16) & 0xff, (h7>>>8) & 0xff, (h7>>>0) & 0xff\n ];\n }\n\n function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) {\n // compress password if it's longer than hash block length\n password = password.length <= 64 ? password : SHA256(password);\n\n var i;\n var innerLen = 64 + salt.length + 4;\n var inner = new Array(innerLen);\n var outerKey = new Array(64);\n var dk = [];\n\n // inner = (password ^ ipad) || salt || counter\n for (i = 0; i < 64; i++) inner[i] = 0x36;\n for (i = 0; i < password.length; i++) inner[i] ^= password[i];\n for (i = 0; i < salt.length; i++) inner[64+i] = salt[i];\n for (i = innerLen - 4; i < innerLen; i++) inner[i] = 0;\n\n // outerKey = password ^ opad\n for (i = 0; i < 64; i++) outerKey[i] = 0x5c;\n for (i = 0; i < password.length; i++) outerKey[i] ^= password[i];\n\n // increments counter inside inner\n function incrementCounter() {\n for (var i = innerLen-1; i >= innerLen-4; i--) {\n inner[i]++;\n if (inner[i] <= 0xff) return;\n inner[i] = 0;\n }\n }\n\n // output blocks = SHA256(outerKey || SHA256(inner)) ...\n while (dkLen >= 32) {\n incrementCounter();\n dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))));\n dkLen -= 32;\n }\n if (dkLen > 0) {\n incrementCounter();\n dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0, dkLen));\n }\n\n return dk;\n }\n\n // The following is an adaptation of scryptsy\n // See: https://www.npmjs.com/package/scryptsy\n function blockmix_salsa8(BY, Yi, r, x, _X) {\n var i;\n\n arraycopy(BY, (2 * r - 1) * 16, _X, 0, 16);\n for (i = 0; i < 2 * r; i++) {\n blockxor(BY, i * 16, _X, 16);\n salsa20_8(_X, x);\n arraycopy(_X, 0, BY, Yi + (i * 16), 16);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy(BY, Yi + (i * 2) * 16, BY, (i * 16), 16);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy(BY, Yi + (i * 2 + 1) * 16, BY, (i + r) * 16, 16);\n }\n }\n\n function R(a, b) {\n return (a << b) | (a >>> (32 - b));\n }\n\n function salsa20_8(B, x) {\n arraycopy(B, 0, x, 0, 16);\n\n for (var i = 8; i > 0; i -= 2) {\n x[ 4] ^= R(x[ 0] + x[12], 7);\n x[ 8] ^= R(x[ 4] + x[ 0], 9);\n x[12] ^= R(x[ 8] + x[ 4], 13);\n x[ 0] ^= R(x[12] + x[ 8], 18);\n x[ 9] ^= R(x[ 5] + x[ 1], 7);\n x[13] ^= R(x[ 9] + x[ 5], 9);\n x[ 1] ^= R(x[13] + x[ 9], 13);\n x[ 5] ^= R(x[ 1] + x[13], 18);\n x[14] ^= R(x[10] + x[ 6], 7);\n x[ 2] ^= R(x[14] + x[10], 9);\n x[ 6] ^= R(x[ 2] + x[14], 13);\n x[10] ^= R(x[ 6] + x[ 2], 18);\n x[ 3] ^= R(x[15] + x[11], 7);\n x[ 7] ^= R(x[ 3] + x[15], 9);\n x[11] ^= R(x[ 7] + x[ 3], 13);\n x[15] ^= R(x[11] + x[ 7], 18);\n x[ 1] ^= R(x[ 0] + x[ 3], 7);\n x[ 2] ^= R(x[ 1] + x[ 0], 9);\n x[ 3] ^= R(x[ 2] + x[ 1], 13);\n x[ 0] ^= R(x[ 3] + x[ 2], 18);\n x[ 6] ^= R(x[ 5] + x[ 4], 7);\n x[ 7] ^= R(x[ 6] + x[ 5], 9);\n x[ 4] ^= R(x[ 7] + x[ 6], 13);\n x[ 5] ^= R(x[ 4] + x[ 7], 18);\n x[11] ^= R(x[10] + x[ 9], 7);\n x[ 8] ^= R(x[11] + x[10], 9);\n x[ 9] ^= R(x[ 8] + x[11], 13);\n x[10] ^= R(x[ 9] + x[ 8], 18);\n x[12] ^= R(x[15] + x[14], 7);\n x[13] ^= R(x[12] + x[15], 9);\n x[14] ^= R(x[13] + x[12], 13);\n x[15] ^= R(x[14] + x[13], 18);\n }\n\n for (i = 0; i < 16; ++i) {\n B[i] += x[i];\n }\n }\n\n // naive approach... going back to loop unrolling may yield additional performance\n function blockxor(S, Si, D, len) {\n for (var i = 0; i < len; i++) {\n D[i] ^= S[Si + i]\n }\n }\n\n function arraycopy(src, srcPos, dest, destPos, length) {\n while (length--) {\n dest[destPos++] = src[srcPos++];\n }\n }\n\n function checkBufferish(o) {\n if (!o || typeof(o.length) !== 'number') {\n return false;\n }\n for (var i = 0; i < o.length; i++) {\n if (typeof(o[i]) !== 'number') { return false; }\n\n var v = parseInt(o[i]);\n if (v != o[i] || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n }\n\n function ensureInteger(value, name) {\n var intValue = parseInt(value);\n if (value != intValue) { throw new Error('invalid ' + name); }\n return intValue;\n }\n\n // N = Cpu cost, r = Memory cost, p = parallelization cost\n // callback(error, progress, key)\n function scrypt(password, salt, N, r, p, dkLen, callback) {\n\n if (!callback) { throw new Error('missing callback'); }\n\n N = ensureInteger(N, 'N');\n r = ensureInteger(r, 'r');\n p = ensureInteger(p, 'p');\n\n dkLen = ensureInteger(dkLen, 'dkLen');\n\n if (N === 0 || (N & (N - 1)) !== 0) { throw new Error('N must be power of 2'); }\n\n if (N > MAX_VALUE / 128 / r) { throw new Error('N too large'); }\n if (r > MAX_VALUE / 128 / p) { throw new Error('r too large'); }\n\n if (!checkBufferish(password)) {\n throw new Error('password must be an array or buffer');\n }\n\n if (!checkBufferish(salt)) {\n throw new Error('salt must be an array or buffer');\n }\n\n var b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r);\n var B = new Uint32Array(p * 32 * r)\n for (var i = 0; i < B.length; i++) {\n var j = i * 4;\n B[i] = ((b[j + 3] & 0xff) << 24) |\n ((b[j + 2] & 0xff) << 16) |\n ((b[j + 1] & 0xff) << 8) |\n ((b[j + 0] & 0xff) << 0);\n }\n\n var XY = new Uint32Array(64 * r);\n var V = new Uint32Array(32 * r * N);\n\n var Yi = 32 * r;\n\n // scratch space\n var x = new Uint32Array(16); // salsa20_8\n var _X = new Uint32Array(16); // blockmix_salsa8\n\n var totalOps = p * N * 2;\n var currentOp = 0;\n var lastPercent10 = null;\n\n // Set this to true to abandon the scrypt on the next step\n var stop = false;\n\n // State information\n var state = 0;\n var i0 = 0, i1;\n var Bi;\n\n // How many blockmix_salsa8 can we do per step?\n var limit = parseInt(1000 / r);\n\n // Trick from scrypt-async; if there is a setImmediate shim in place, use it\n var nextTick = (typeof(setImmediate) !== 'undefined') ? setImmediate : setTimeout;\n\n // This is really all I changed; making scryptsy a state machine so we occasionally\n // stop and give other evnts on the evnt loop a chance to run. ~RicMoo\n var incrementalSMix = function() {\n if (stop) {\n return callback(new Error('cancelled'), currentOp / totalOps);\n }\n\n switch (state) {\n case 0:\n // for (var i = 0; i < p; i++)...\n Bi = i0 * 32 * r;\n\n arraycopy(B, Bi, XY, 0, Yi); // ROMix - 1\n\n state = 1; // Move to ROMix 2\n i1 = 0;\n\n // Fall through\n\n case 1:\n\n // Run up to 1000 steps of the first inner smix loop\n var steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (var i = 0; i < steps; i++) { // ROMix - 2\n arraycopy(XY, 0, V, (i1 + i) * Yi, Yi) // ROMix - 3\n blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 4\n }\n\n // for (var i = 0; i < N; i++)\n i1 += steps;\n currentOp += steps;\n\n // Call the callback with the progress (optionally stopping us)\n var percent10 = parseInt(1000 * currentOp / totalOps);\n if (percent10 !== lastPercent10) {\n stop = callback(null, currentOp / totalOps);\n if (stop) { break; }\n lastPercent10 = percent10;\n }\n\n if (i1 < N) {\n break;\n }\n\n i1 = 0; // Move to ROMix 6\n state = 2;\n\n // Fall through\n\n case 2:\n\n // Run up to 1000 steps of the second inner smix loop\n var steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (var i = 0; i < steps; i++) { // ROMix - 6\n var offset = (2 * r - 1) * 16; // ROMix - 7\n var j = XY[offset] & (N - 1);\n blockxor(V, j * Yi, XY, Yi); // ROMix - 8 (inner)\n blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 9 (outer)\n }\n\n // for (var i = 0; i < N; i++)...\n i1 += steps;\n currentOp += steps;\n\n // Call the callback with the progress (optionally stopping us)\n var percent10 = parseInt(1000 * currentOp / totalOps);\n if (percent10 !== lastPercent10) {\n stop = callback(null, currentOp / totalOps);\n if (stop) { break; }\n lastPercent10 = percent10;\n }\n\n if (i1 < N) {\n break;\n }\n\n arraycopy(XY, 0, B, Bi, Yi); // ROMix - 10\n\n // for (var i = 0; i < p; i++)...\n i0++;\n if (i0 < p) {\n state = 0;\n break;\n }\n\n b = [];\n for (var i = 0; i < B.length; i++) {\n b.push((B[i] >> 0) & 0xff);\n b.push((B[i] >> 8) & 0xff);\n b.push((B[i] >> 16) & 0xff);\n b.push((B[i] >> 24) & 0xff);\n }\n\n var derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen);\n\n // Done; don't break (which would reschedule)\n return callback(null, 1.0, derivedKey);\n }\n\n // Schedule the next steps\n nextTick(incrementalSMix);\n }\n\n // Bootstrap the incremental smix\n incrementalSMix();\n }\n\n // node.js\n if (typeof(exports) !== 'undefined') {\n module.exports = scrypt;\n\n // RequireJS/AMD\n // http://www.requirejs.org/docs/api.html\n // https://github.com/amdjs/amdjs-api/wiki/AMD\n } else if (typeof(define) === 'function' && define.amd) {\n define(scrypt);\n\n // Web Browsers\n } else if (root) {\n\n // If there was an existing library \"scrypt\", make sure it is still available\n if (root.scrypt) {\n root._scrypt = root.scrypt;\n }\n\n root.scrypt = scrypt;\n }\n\n})(this);\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"timers\":37}],37:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],38:[function(require,module,exports){\n(function (global){\n\nvar rng;\n\nif (global.crypto && crypto.getRandomValues) {\n // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto\n // Moderately fast, high quality\n var _rnds8 = new Uint8Array(16);\n rng = function whatwgRNG() {\n crypto.getRandomValues(_rnds8);\n return _rnds8;\n };\n}\n\nif (!rng) {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var _rnds = new Array(16);\n rng = function() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return _rnds;\n };\n}\n\nmodule.exports = rng;\n\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],39:[function(require,module,exports){\n// uuid.js\n//\n// Copyright (c) 2010-2012 Robert Kieffer\n// MIT License - http://opensource.org/licenses/mit-license.php\n\n// Unique ID creation requires a high quality random # generator. We feature\n// detect to determine the best RNG source, normalizing to a function that\n// returns 128-bits of randomness, since that's what's usually required\nvar _rng = require('./rng');\n\n// Maps for number <-> hex string conversion\nvar _byteToHex = [];\nvar _hexToByte = {};\nfor (var i = 0; i < 256; i++) {\n _byteToHex[i] = (i + 0x100).toString(16).substr(1);\n _hexToByte[_byteToHex[i]] = i;\n}\n\n// **`parse()` - Parse a UUID into it's component bytes**\nfunction parse(s, buf, offset) {\n var i = (buf && offset) || 0, ii = 0;\n\n buf = buf || [];\n s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {\n if (ii < 16) { // Don't overflow!\n buf[i + ii++] = _hexToByte[oct];\n }\n });\n\n // Zero out remaining bytes if string was short\n while (ii < 16) {\n buf[i + ii++] = 0;\n }\n\n return buf;\n}\n\n// **`unparse()` - Convert UUID byte array (ala parse()) into a string**\nfunction unparse(buf, offset) {\n var i = offset || 0, bth = _byteToHex;\n return bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]];\n}\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\n// random #'s we need to init node and clockseq\nvar _seedBytes = _rng();\n\n// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\nvar _nodeId = [\n _seedBytes[0] | 0x01,\n _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]\n];\n\n// Per 4.2.2, randomize (14 bit) clockseq\nvar _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;\n\n// Previous uuid creation time\nvar _lastMSecs = 0, _lastNSecs = 0;\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n var node = options.node || _nodeId;\n for (var n = 0; n < 6; n++) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : unparse(b);\n}\n\n// **`v4()` - Generate random UUID**\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v4(options, buf, offset) {\n // Deprecated - 'format' argument, as supported in v1.2\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options == 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || _rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ii++) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || unparse(rnds);\n}\n\n// Export public API\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\nuuid.parse = parse;\nuuid.unparse = unparse;\n\nmodule.exports = uuid;\n\n},{\"./rng\":38}],40:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nmodule.exports = {\n decode: function (textData) {\n textData = atob(textData);\n var data = [];\n for (var i = 0; i < textData.length; i++) {\n data.push(textData.charCodeAt(i));\n }\n return bytes_1.arrayify(data);\n },\n encode: function (data) {\n data = bytes_1.arrayify(data);\n var textData = '';\n for (var i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n }\n};\n\n},{\"../src.ts/utils/bytes\":60}],41:[function(require,module,exports){\narguments[4][4][0].apply(exports,arguments)\n},{\"dup\":4}],42:[function(require,module,exports){\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 hash = __importStar(require(\"hash.js\"));\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nvar errors = __importStar(require(\"../src.ts/utils/errors\"));\nvar hmac = hash['hmac'];\nvar supportedAlgorithms = { sha256: true, sha512: true };\nfunction computeHmac(algorithm, key, data) {\n if (!supportedAlgorithms[algorithm]) {\n errors.throwError('unsupported algorithm ' + algorithm, errors.UNSUPPORTED_OPERATION, { operation: 'hmac', algorithm: algorithm });\n }\n return bytes_1.arrayify(hmac(hash[algorithm], bytes_1.arrayify(key)).update(bytes_1.arrayify(data)).digest());\n}\nexports.computeHmac = computeHmac;\n\n},{\"../src.ts/utils/bytes\":60,\"../src.ts/utils/errors\":61,\"hash.js\":20}],43:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nvar hmac_1 = require(\"../src.ts/utils/hmac\");\nfunction pbkdf2(password, salt, iterations, keylen, hashAlgorithm) {\n password = bytes_1.arrayify(password);\n salt = bytes_1.arrayify(salt);\n var hLen;\n var l = 1;\n var DK = new Uint8Array(keylen);\n var block1 = new Uint8Array(salt.length + 4);\n block1.set(salt);\n //salt.copy(block1, 0, 0, salt.length)\n var r;\n var T;\n for (var i = 1; i <= l; i++) {\n //block1.writeUInt32BE(i, salt.length)\n block1[salt.length] = (i >> 24) & 0xff;\n block1[salt.length + 1] = (i >> 16) & 0xff;\n block1[salt.length + 2] = (i >> 8) & 0xff;\n block1[salt.length + 3] = i & 0xff;\n //var U = createHmac(password).update(block1).digest();\n var U = hmac_1.computeHmac(hashAlgorithm, password, block1);\n if (!hLen) {\n hLen = U.length;\n T = new Uint8Array(hLen);\n l = Math.ceil(keylen / hLen);\n r = keylen - (l - 1) * hLen;\n }\n //U.copy(T, 0, 0, hLen)\n T.set(U);\n for (var j = 1; j < iterations; j++) {\n //U = createHmac(password).update(U).digest();\n U = hmac_1.computeHmac(hashAlgorithm, password, U);\n for (var k = 0; k < hLen; k++)\n T[k] ^= U[k];\n }\n var destPos = (i - 1) * hLen;\n var len = (i === l ? r : hLen);\n //T.copy(DK, destPos, 0, len)\n DK.set(bytes_1.arrayify(T).slice(0, len), destPos);\n }\n return bytes_1.arrayify(DK);\n}\nexports.pbkdf2 = pbkdf2;\n\n},{\"../src.ts/utils/bytes\":60,\"../src.ts/utils/hmac\":42}],44:[function(require,module,exports){\n(function (global){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nvar properties_1 = require(\"../src.ts/utils/properties\");\nvar crypto = global['crypto'] || global['msCrypto'];\nif (!crypto || !crypto.getRandomValues) {\n console.log('WARNING: Missing strong random number source; using weak randomBytes');\n crypto = {\n getRandomValues: function (buffer) {\n for (var round = 0; round < 20; round++) {\n for (var i = 0; i < buffer.length; i++) {\n if (round) {\n buffer[i] ^= Math.trunc(256 * Math.random());\n }\n else {\n buffer[i] = Math.trunc(256 * Math.random());\n }\n }\n }\n return buffer;\n },\n _weakCrypto: true\n };\n}\nfunction randomBytes(length) {\n if (length <= 0 || length > 1024 || parseInt(length) != length) {\n throw new Error('invalid length');\n }\n var result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return bytes_1.arrayify(result);\n}\nexports.randomBytes = randomBytes;\n;\nif (crypto._weakCrypto === true) {\n properties_1.defineReadOnly(randomBytes, '_weakCrypto', true);\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../src.ts/utils/bytes\":60,\"../src.ts/utils/properties\":65}],45:[function(require,module,exports){\n'use strict';\ntry {\n module.exports.XMLHttpRequest = XMLHttpRequest;\n}\ncatch (error) {\n console.log('Warning: XMLHttpRequest is not defined');\n module.exports.XMLHttpRequest = null;\n}\n\n},{}],46:[function(require,module,exports){\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 interface_1 = require(\"./interface\");\nvar provider_1 = require(\"../providers/provider\");\nvar wallet_1 = require(\"../wallet/wallet\");\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar allowedTransactionKeys = {\n data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true\n};\n// Recursively replaces ENS names with promises to resolve the name and\n// stalls until all promises have returned\n// @TODO: Expand this to resolve any promises too\nfunction resolveAddresses(provider, value, paramType) {\n if (Array.isArray(paramType)) {\n var promises = [];\n paramType.forEach(function (paramType, index) {\n var v = null;\n if (Array.isArray(value)) {\n v = value[index];\n }\n else {\n v = value[paramType.name];\n }\n promises.push(resolveAddresses(provider, v, paramType));\n });\n return Promise.all(promises);\n }\n if (paramType.type === 'address') {\n return provider.resolveName(value);\n }\n if (paramType.components) {\n return resolveAddresses(provider, value, paramType.components);\n }\n return Promise.resolve(value);\n}\nfunction runMethod(contract, functionName, estimateOnly) {\n var method = contract.interface.functions[functionName];\n return function () {\n var params = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n params[_i] = arguments[_i];\n }\n var tx = {};\n // If 1 extra parameter was passed in, it contains overrides\n if (params.length === method.inputs.length + 1 && typeof (params[params.length - 1]) === 'object') {\n tx = properties_1.shallowCopy(params.pop());\n // Check for unexpected keys (e.g. using \"gas\" instead of \"gasLimit\")\n for (var key in tx) {\n if (!allowedTransactionKeys[key]) {\n throw new Error('unknown transaction override ' + key);\n }\n }\n }\n if (params.length != method.inputs.length) {\n throw new Error('incorrect number of arguments');\n }\n // Check overrides make sense\n ['data', 'to'].forEach(function (key) {\n if (tx[key] != null) {\n errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });\n }\n });\n // Send to the contract address\n tx.to = contract.addressPromise;\n return resolveAddresses(contract.provider, params, method.inputs).then(function (params) {\n tx.data = method.encode(params);\n if (method.type === 'call') {\n // Call (constant functions) always cost 0 ether\n if (estimateOnly) {\n return Promise.resolve(bignumber_1.ConstantZero);\n }\n if (!contract.provider) {\n errors.throwError('call (constant functions) require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'call' });\n }\n // Check overrides make sense\n ['gasLimit', 'gasPrice', 'value'].forEach(function (key) {\n if (tx[key] != null) {\n throw new Error('call cannot override ' + key);\n }\n });\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress();\n }\n return contract.provider.call(tx).then(function (value) {\n try {\n var result = method.decode(value);\n if (method.outputs.length === 1) {\n result = result[0];\n }\n return result;\n }\n catch (error) {\n if (value === '0x' && method.outputs.length > 0) {\n errors.throwError('call exception', errors.CALL_EXCEPTION, {\n address: contract.address,\n method: method.signature,\n value: params\n });\n }\n throw error;\n }\n });\n }\n else if (method.type === 'transaction') {\n // Only computing the transaction estimate\n if (estimateOnly) {\n if (!contract.provider) {\n errors.throwError('estimate gas require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'estimateGas' });\n }\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress();\n }\n return contract.provider.estimateGas(tx);\n }\n if (!contract.signer) {\n errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });\n }\n // Make sure they aren't overriding something they shouldn't\n if (tx.from != null) {\n errors.throwError('cannot override from in a transaction', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });\n }\n return contract.signer.sendTransaction(tx);\n }\n throw new Error('invalid type - ' + method.type);\n return null;\n });\n };\n}\nvar Contract = /** @class */ (function () {\n // https://github.com/Microsoft/TypeScript/issues/5453\n // Once this issue is resolved (there are open PR) we can do this nicer\n // by making addressOrName default to null for 2 operand calls. :)\n function Contract(addressOrName, contractInterface, signerOrProvider) {\n var _this = this;\n errors.checkNew(this, Contract);\n // @TODO: Maybe still check the addressOrName looks like a valid address or name?\n //address = getAddress(address);\n if (contractInterface instanceof interface_1.Interface) {\n properties_1.defineReadOnly(this, 'interface', contractInterface);\n }\n else {\n properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface));\n }\n if (signerOrProvider instanceof wallet_1.Signer) {\n properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider);\n properties_1.defineReadOnly(this, 'signer', signerOrProvider);\n }\n else if (signerOrProvider instanceof provider_1.Provider) {\n properties_1.defineReadOnly(this, 'provider', signerOrProvider);\n properties_1.defineReadOnly(this, 'signer', null);\n }\n else {\n errors.throwError('invalid signer or provider', errors.INVALID_ARGUMENT, { arg: 'signerOrProvider', value: signerOrProvider });\n }\n properties_1.defineReadOnly(this, 'estimate', {});\n properties_1.defineReadOnly(this, 'events', {});\n properties_1.defineReadOnly(this, 'functions', {});\n // Not connected to an on-chain instance, so do not connect functions and events\n if (!addressOrName) {\n properties_1.defineReadOnly(this, 'address', null);\n properties_1.defineReadOnly(this, 'addressPromise', Promise.resolve(null));\n return;\n }\n properties_1.defineReadOnly(this, 'address', addressOrName);\n properties_1.defineReadOnly(this, 'addressPromise', this.provider.resolveName(addressOrName));\n Object.keys(this.interface.functions).forEach(function (name) {\n var run = runMethod(_this, name, false);\n if (_this[name] == null) {\n properties_1.defineReadOnly(_this, name, run);\n }\n else {\n console.log('WARNING: Multiple definitions for ' + name);\n }\n if (_this.functions[name] == null) {\n properties_1.defineReadOnly(_this.functions, name, run);\n properties_1.defineReadOnly(_this.estimate, name, runMethod(_this, name, true));\n }\n });\n Object.keys(this.interface.events).forEach(function (eventName) {\n var eventInfo = _this.interface.events[eventName];\n var eventCallback = null;\n var contract = _this;\n function handleEvent(log) {\n contract.addressPromise.then(function (address) {\n // Not meant for us (the topics just has the same name)\n if (address != log.address) {\n return;\n }\n try {\n var result = eventInfo.decode(log.data, log.topics);\n // Some useful things to have with the log\n log.args = result;\n log.event = eventName;\n log.parse = eventInfo.parse;\n log.removeListener = function () {\n contract.provider.removeListener([eventInfo.topic], handleEvent);\n };\n log.getBlock = function () { return contract.provider.getBlock(log.blockHash); ; };\n log.getTransaction = function () { return contract.provider.getTransaction(log.transactionHash); };\n log.getTransactionReceipt = function () { return contract.provider.getTransactionReceipt(log.transactionHash); };\n log.eventSignature = eventInfo.signature;\n eventCallback.apply(log, Array.prototype.slice.call(result));\n }\n catch (error) {\n console.log(error);\n }\n });\n }\n var property = {\n enumerable: true,\n get: function () {\n return eventCallback;\n },\n set: function (value) {\n if (!value) {\n value = null;\n }\n if (!contract.provider) {\n errors.throwError('events require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'events' });\n }\n if (!value && eventCallback) {\n contract.provider.removeListener([eventInfo.topic], handleEvent);\n }\n else if (value && !eventCallback) {\n contract.provider.on([eventInfo.topic], handleEvent);\n }\n eventCallback = value;\n }\n };\n var propertyName = 'on' + eventName.toLowerCase();\n if (_this[propertyName] == null) {\n Object.defineProperty(_this, propertyName, property);\n }\n Object.defineProperty(_this.events, eventName, property);\n }, this);\n }\n // Reconnect to a different signer or provider\n Contract.prototype.connect = function (signerOrProvider) {\n return new Contract(this.address, this.interface, signerOrProvider);\n };\n // Deploy the contract with the bytecode, resolving to the deployed address.\n // Use contract.deployTransaction.wait() to wait until the contract has\n // been mined.\n Contract.prototype.deploy = function (bytecode) {\n var _this = this;\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (this.signer == null) {\n throw new Error('missing signer'); // @TODO: errors.throwError\n }\n if (!bytes_1.isHexString(bytecode)) {\n errors.throwError('bytecode must be a valid hex string', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n if ((bytecode.length % 2) !== 0) {\n errors.throwError('bytecode must be valid data (even length)', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n // @TODO: overrides of args.length = this.interface.deployFunction.inputs.length + 1\n return this.signer.sendTransaction({\n data: this.interface.deployFunction.encode(bytecode, args)\n }).then(function (tx) {\n var contract = new Contract(address_1.getContractAddress(tx), _this.interface, _this.signer || _this.provider);\n properties_1.defineReadOnly(contract, 'deployTransaction', tx);\n return contract;\n });\n };\n return Contract;\n}());\nexports.Contract = Contract;\n\n},{\"../providers/provider\":55,\"../utils/address\":58,\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/properties\":65,\"../wallet/wallet\":78,\"./interface\":48}],47:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar contract_1 = require(\"./contract\");\nexports.Contract = contract_1.Contract;\nvar interface_1 = require(\"./interface\");\nexports.Interface = interface_1.Interface;\n\n},{\"./contract\":46,\"./interface\":48}],48:[function(require,module,exports){\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 abi_coder_1 = require(\"../utils/abi-coder\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nfunction parseParams(params) {\n var names = [];\n var types = [];\n params.forEach(function (param) {\n if (param.components != null) {\n if (param.type.substring(0, 5) !== 'tuple') {\n throw new Error('internal error; report on GitHub');\n }\n var suffix = '';\n var arrayBracket = param.type.indexOf('[');\n if (arrayBracket >= 0) {\n suffix = param.type.substring(arrayBracket);\n }\n var result = parseParams(param.components);\n names.push({ name: (param.name || null), names: result.names });\n types.push('tuple(' + result.types.join(',') + ')' + suffix);\n }\n else {\n names.push(param.name || null);\n types.push(param.type);\n }\n });\n return {\n names: names,\n types: types\n };\n}\nvar Description = /** @class */ (function () {\n function Description(info) {\n for (var key in info) {\n var value = info[key];\n if (value != null && typeof (value) === 'object') {\n properties_1.defineFrozen(this, key, info[key]);\n }\n else {\n properties_1.defineReadOnly(this, key, info[key]);\n }\n }\n }\n return Description;\n}());\nexports.Description = Description;\n// @TOOD: Make this a description\nvar Indexed = /** @class */ (function (_super) {\n __extends(Indexed, _super);\n function Indexed() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Indexed;\n}(Description));\nexports.Indexed = Indexed;\nvar DeployDescription = /** @class */ (function (_super) {\n __extends(DeployDescription, _super);\n function DeployDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DeployDescription.prototype.encode = function (bytecode, params) {\n if (!bytes_1.isHexString(bytecode)) {\n errors.throwError('invalid contract bytecode', errors.INVALID_ARGUMENT, {\n arg: 'bytecode',\n type: typeof (bytecode),\n value: bytecode\n });\n }\n if (params.length < this.inputs.length) {\n errors.throwError('missing constructor argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n else if (params.length > this.inputs.length) {\n errors.throwError('too many constructor arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n try {\n return (bytecode + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2));\n }\n catch (error) {\n errors.throwError('invalid constructor argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n return null;\n };\n return DeployDescription;\n}(Description));\nexports.DeployDescription = DeployDescription;\nvar FunctionDescription = /** @class */ (function (_super) {\n __extends(FunctionDescription, _super);\n function FunctionDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FunctionDescription.prototype.encode = function (params) {\n if (params.length < this.inputs.length) {\n errors.throwError('missing input argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length,\n name: this.name\n });\n }\n else if (params.length > this.inputs.length) {\n errors.throwError('too many input arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n try {\n return this.sighash + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2);\n }\n catch (error) {\n errors.throwError('invalid input argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n return null;\n };\n FunctionDescription.prototype.decode = function (data) {\n try {\n return abi_coder_1.defaultAbiCoder.decode(this.outputs, bytes_1.arrayify(data));\n }\n catch (error) {\n errors.throwError('invalid data for function output', errors.INVALID_ARGUMENT, {\n arg: 'data',\n errorArg: error.arg,\n errorValue: error.value,\n value: data,\n reason: error.reason\n });\n }\n };\n return FunctionDescription;\n}(Description));\nexports.FunctionDescription = FunctionDescription;\nvar Result = /** @class */ (function (_super) {\n __extends(Result, _super);\n function Result() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Result;\n}(Description));\nvar EventDescription = /** @class */ (function (_super) {\n __extends(EventDescription, _super);\n function EventDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n EventDescription.prototype.decode = function (data, topics) {\n // Strip the signature off of non-anonymous topics\n if (topics != null && !this.anonymous) {\n topics = topics.slice(1);\n }\n var inputIndexed = [], inputNonIndexed = [];\n var inputDynamic = [];\n this.inputs.forEach(function (param, index) {\n if (param.indexed) {\n if (param.type === 'string' || param.type === 'bytes' || param.type.indexOf('[') >= 0 || param.type.substring(0, 5) === 'tuple') {\n inputIndexed.push({ type: 'bytes32', name: (param.name || '') });\n inputDynamic.push(true);\n }\n else {\n inputIndexed.push(param);\n inputDynamic.push(false);\n }\n }\n else {\n inputNonIndexed.push(param);\n inputDynamic.push(false);\n }\n });\n if (topics != null) {\n var resultIndexed = abi_coder_1.defaultAbiCoder.decode(inputIndexed, bytes_1.concat(topics));\n }\n var resultNonIndexed = abi_coder_1.defaultAbiCoder.decode(inputNonIndexed, bytes_1.arrayify(data));\n var result = new Result({});\n var nonIndexedIndex = 0, indexedIndex = 0;\n this.inputs.forEach(function (input, index) {\n if (input.indexed) {\n if (topics == null) {\n result[index] = new Indexed({ type: 'indexed', hash: null });\n }\n else if (inputDynamic[index]) {\n result[index] = new Indexed({ type: 'indexed', hash: resultIndexed[indexedIndex++] });\n }\n else {\n result[index] = resultIndexed[indexedIndex++];\n }\n }\n else {\n result[index] = resultNonIndexed[nonIndexedIndex++];\n }\n if (input.name) {\n result[input.name] = result[index];\n }\n });\n result.length = this.inputs.length;\n return result;\n };\n return EventDescription;\n}(Description));\nexports.EventDescription = EventDescription;\nvar TransactionDescription = /** @class */ (function (_super) {\n __extends(TransactionDescription, _super);\n function TransactionDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return TransactionDescription;\n}(Description));\nvar LogDescription = /** @class */ (function (_super) {\n __extends(LogDescription, _super);\n function LogDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LogDescription;\n}(Description));\nfunction addMethod(method) {\n switch (method.type) {\n case 'constructor': {\n var description = new DeployDescription({\n inputs: method.inputs,\n payable: (method.payable == null || !!method.payable),\n type: 'deploy'\n });\n if (!this.deployFunction) {\n this.deployFunction = description;\n }\n break;\n }\n case 'function': {\n // @TODO: See event\n var signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n var sighash = keccak256_1.keccak256(utf8_1.toUtf8Bytes(signature)).substring(0, 10);\n var description = new FunctionDescription({\n inputs: method.inputs,\n outputs: method.outputs,\n payable: (method.payable == null || !!method.payable),\n type: ((method.constant) ? 'call' : 'transaction'),\n signature: signature,\n sighash: sighash,\n });\n // Expose the first (and hopefully unique named function\n if (method.name && this.functions[method.name] == null) {\n properties_1.defineReadOnly(this.functions, method.name, description);\n }\n // Expose all methods by their signature, for overloaded functions\n if (this.functions[description.signature] == null) {\n properties_1.defineReadOnly(this.functions, description.signature, description);\n }\n break;\n }\n case 'event': {\n // @TODO: method.params instead? As well? Different fomrat?\n //let inputParams = parseParams(method.inputs);\n // @TODO: Don't use parseParams (create new function in ABI, formatSignature)\n var signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n var description = new EventDescription({\n name: method.name,\n signature: signature,\n inputs: method.inputs,\n topic: keccak256_1.keccak256(utf8_1.toUtf8Bytes(signature)),\n anonymous: (!!method.anonymous),\n type: 'event'\n });\n // Expose the first (and hopefully unique) event name\n if (method.name && this.events[method.name] == null) {\n properties_1.defineReadOnly(this.events, method.name, description);\n }\n // Expose all events by their signature, for overloaded functions\n if (this.events[description.signature] == null) {\n properties_1.defineReadOnly(this.events, description.signature, description);\n }\n break;\n }\n case 'fallback':\n // Nothing to do for fallback\n break;\n default:\n console.log('WARNING: unsupported ABI type - ' + method.type);\n break;\n }\n}\nvar Interface = /** @class */ (function () {\n function Interface(abi) {\n errors.checkNew(this, Interface);\n if (typeof (abi) === 'string') {\n try {\n abi = JSON.parse(abi);\n }\n catch (error) {\n errors.throwError('could not parse ABI JSON', errors.INVALID_ARGUMENT, {\n arg: 'abi',\n errorMessage: error.message,\n value: abi\n });\n }\n if (!Array.isArray(abi)) {\n errors.throwError('invalid abi', errors.INVALID_ARGUMENT, { arg: 'abi', value: abi });\n return null;\n }\n }\n properties_1.defineReadOnly(this, 'functions', {});\n properties_1.defineReadOnly(this, 'events', {});\n // Convert any supported ABI format into a standard ABI format\n var _abi = [];\n abi.forEach(function (fragment) {\n if (typeof (fragment) === 'string') {\n fragment = abi_coder_1.parseSignature(fragment);\n }\n _abi.push(fragment);\n });\n properties_1.defineFrozen(this, 'abi', _abi);\n _abi.forEach(addMethod, this);\n // If there wasn't a constructor, create the default constructor\n if (!this.deployFunction) {\n addMethod.call(this, { type: 'constructor', inputs: [] });\n }\n }\n Interface.prototype.parseTransaction = function (tx) {\n var sighash = tx.data.substring(0, 10).toLowerCase();\n for (var name in this.functions) {\n if (name.indexOf('(') === -1) {\n continue;\n }\n var func = this.functions[name];\n if (func.sighash === sighash) {\n var result = abi_coder_1.defaultAbiCoder.decode(func.inputs, '0x' + tx.data.substring(10));\n return new TransactionDescription({\n args: result,\n decode: func.decode,\n name: name,\n signature: func.signature,\n sighash: func.sighash,\n type: 'transaction',\n value: bignumber_1.bigNumberify(tx.value || 0),\n });\n }\n }\n return null;\n };\n Interface.prototype.parseLog = function (log) {\n for (var name in this.events) {\n if (name.indexOf('(') === -1) {\n continue;\n }\n var event = this.events[name];\n if (event.anonymous) {\n continue;\n }\n if (event.topic !== log.topics[0]) {\n continue;\n }\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse and return it?\n return new LogDescription({\n name: event.name,\n signature: event.signature,\n topic: event.topic,\n type: 'log',\n values: event.decode(log.data, log.topics)\n });\n }\n return null;\n };\n return Interface;\n}());\nexports.Interface = Interface;\n\n},{\"../utils/abi-coder\":57,\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/keccak256\":64,\"../utils/properties\":65,\"../utils/utf8\":72}],49:[function(require,module,exports){\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 });\nvar provider_1 = require(\"./provider\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar properties_1 = require(\"../utils/properties\");\nvar web_1 = require(\"../utils/web\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// The transaction has already been sanitized by the calls in Provider\nfunction getTransactionString(transaction) {\n var result = [];\n for (var key in transaction) {\n if (transaction[key] == null) {\n continue;\n }\n var value = bytes_1.hexlify(transaction[key]);\n if ({ gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) {\n value = bytes_1.hexStripZeros(value);\n }\n result.push(key + '=' + value);\n }\n return result.join('&');\n}\nfunction getResult(result) {\n // getLogs, getHistory have weird success responses\n if (result.status == 0 && (result.message === 'No records found' || result.message === 'No transactions found')) {\n return result.result;\n }\n if (result.status != 1 || result.message != 'OK') {\n // @TODO: not any\n var error = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n return result.result;\n}\nfunction getJsonResult(result) {\n if (result.jsonrpc != '2.0') {\n // @TODO: not any\n var error = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n if (result.error) {\n // @TODO: not any\n var error = new Error(result.error.message || 'unknown error');\n if (result.error.code) {\n error.code = result.error.code;\n }\n if (result.error.data) {\n error.data = result.error.data;\n }\n throw error;\n }\n return result.result;\n}\n// The blockTag was normalized as a string by the Provider pre-perform operations\nfunction checkLogTag(blockTag) {\n if (blockTag === 'pending') {\n throw new Error('pending not supported');\n }\n if (blockTag === 'latest') {\n return blockTag;\n }\n return parseInt(blockTag.substring(2), 16);\n}\nvar EtherscanProvider = /** @class */ (function (_super) {\n __extends(EtherscanProvider, _super);\n function EtherscanProvider(network, apiKey) {\n var _this = _super.call(this, network) || this;\n errors.checkNew(_this, EtherscanProvider);\n var name = 'invalid';\n if (_this.network) {\n name = _this.network.name;\n }\n var baseUrl = null;\n switch (name) {\n case 'homestead':\n baseUrl = 'https://api.etherscan.io';\n break;\n case 'ropsten':\n baseUrl = 'https://api-ropsten.etherscan.io';\n break;\n case 'rinkeby':\n baseUrl = 'https://api-rinkeby.etherscan.io';\n break;\n case 'kovan':\n baseUrl = 'https://api-kovan.etherscan.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n properties_1.defineReadOnly(_this, 'baseUrl', baseUrl);\n properties_1.defineReadOnly(_this, 'apiKey', apiKey);\n return _this;\n }\n EtherscanProvider.prototype.perform = function (method, params) {\n //if (!params) { params = {}; }\n var url = this.baseUrl;\n var apiKey = '';\n if (this.apiKey) {\n apiKey += '&apikey=' + this.apiKey;\n }\n switch (method) {\n case 'getBlockNumber':\n url += '/api?module=proxy&action=eth_blockNumber' + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getGasPrice':\n url += '/api?module=proxy&action=eth_gasPrice' + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getBalance':\n // Returns base-10 result\n url += '/api?module=account&action=balance&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getResult);\n case 'getTransactionCount':\n url += '/api?module=proxy&action=eth_getTransactionCount&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getCode':\n url += '/api?module=proxy&action=eth_getCode&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getStorageAt':\n url += '/api?module=proxy&action=eth_getStorageAt&address=' + params.address;\n url += '&position=' + params.position;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'sendTransaction':\n url += '/api?module=proxy&action=eth_sendRawTransaction&hex=' + params.signedTransaction;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getBlock':\n if (params.blockTag) {\n url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;\n url += '&boolean=false';\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n }\n throw new Error('getBlock by blockHash not implmeneted');\n case 'getTransaction':\n url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getTransactionReceipt':\n url += '/api?module=proxy&action=eth_getTransactionReceipt&txhash=' + params.transactionHash;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'call':\n var transaction = getTransactionString(params.transaction);\n if (transaction) {\n transaction = '&' + transaction;\n }\n url += '/api?module=proxy&action=eth_call' + transaction;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'estimateGas':\n var transaction = getTransactionString(params.transaction);\n if (transaction) {\n transaction = '&' + transaction;\n }\n url += '/api?module=proxy&action=eth_estimateGas&' + transaction;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getLogs':\n url += '/api?module=logs&action=getLogs';\n try {\n if (params.filter.fromBlock) {\n url += '&fromBlock=' + checkLogTag(params.filter.fromBlock);\n }\n if (params.filter.toBlock) {\n url += '&toBlock=' + checkLogTag(params.filter.toBlock);\n }\n if (params.filter.address) {\n url += '&address=' + params.filter.address;\n }\n // @TODO: We can handle slightly more complicated logs using the logs API\n if (params.filter.topics && params.filter.topics.length > 0) {\n if (params.filter.topics.length > 1) {\n throw new Error('unsupported topic format');\n }\n var topic0 = params.filter.topics[0];\n if (typeof (topic0) !== 'string' || topic0.length !== 66) {\n throw new Error('unsupported topic0 format');\n }\n url += '&topic0=' + topic0;\n }\n }\n catch (error) {\n return Promise.reject(error);\n }\n url += apiKey;\n var self = this;\n return web_1.fetchJson(url, null, getResult).then(function (logs) {\n var txs = {};\n var seq = Promise.resolve();\n logs.forEach(function (log) {\n seq = seq.then(function () {\n if (log.blockHash != null) {\n return null;\n }\n log.blockHash = txs[log.transactionHash];\n if (log.blockHash == null) {\n return self.getTransaction(log.transactionHash).then(function (tx) {\n txs[log.transactionHash] = tx.blockHash;\n log.blockHash = tx.blockHash;\n });\n }\n return null;\n });\n });\n return seq.then(function () {\n return logs;\n });\n });\n case 'getEtherPrice':\n if (this.network.name !== 'homestead') {\n return Promise.resolve(0.0);\n }\n url += '/api?module=stats&action=ethprice';\n url += apiKey;\n return web_1.fetchJson(url, null, getResult).then(function (result) {\n return parseFloat(result.ethusd);\n });\n default:\n break;\n }\n return _super.prototype.perform.call(this, method, params);\n };\n // @TODO: Allow startBlock and endBlock to be Promises\n EtherscanProvider.prototype.getHistory = function (addressOrName, startBlock, endBlock) {\n var url = this.baseUrl;\n var apiKey = '';\n if (this.apiKey) {\n apiKey += '&apikey=' + this.apiKey;\n }\n if (startBlock == null) {\n startBlock = 0;\n }\n if (endBlock == null) {\n endBlock = 99999999;\n }\n return this.resolveName(addressOrName).then(function (address) {\n url += '/api?module=account&action=txlist&address=' + address;\n url += '&startblock=' + startBlock;\n url += '&endblock=' + endBlock;\n url += '&sort=asc' + apiKey;\n return web_1.fetchJson(url, null, getResult).then(function (result) {\n var output = [];\n result.forEach(function (tx) {\n ['contractAddress', 'to'].forEach(function (key) {\n if (tx[key] == '') {\n delete tx[key];\n }\n });\n if (tx.creates == null && tx.contractAddress != null) {\n tx.creates = tx.contractAddress;\n }\n var item = provider_1.checkTransactionResponse(tx);\n if (tx.timeStamp) {\n item.timestamp = parseInt(tx.timeStamp);\n }\n output.push(item);\n });\n return output;\n });\n });\n };\n return EtherscanProvider;\n}(provider_1.Provider));\nexports.EtherscanProvider = EtherscanProvider;\n\n},{\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/properties\":65,\"../utils/web\":73,\"./provider\":55}],50:[function(require,module,exports){\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 });\nvar provider_1 = require(\"./provider\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// Returns:\n// - true is all networks match\n// - false if any network is null\n// - throws if any 2 networks do not match\nfunction checkNetworks(networks) {\n var result = true;\n var check = null;\n networks.forEach(function (network) {\n // Null\n if (network == null) {\n result = false;\n return;\n }\n // Have nothing to compre to yet\n if (check == null) {\n check = network;\n return;\n }\n // Matches!\n if (check.name === network.name &&\n check.chainId === network.chainId &&\n check.ensAddress === network.ensAddress) {\n return;\n }\n errors.throwError('provider mismatch', errors.INVALID_ARGUMENT, { arg: 'providers', networks: networks });\n });\n return result;\n}\nvar FallbackProvider = /** @class */ (function (_super) {\n __extends(FallbackProvider, _super);\n function FallbackProvider(providers) {\n var _this = this;\n if (providers.length === 0) {\n throw new Error('no providers');\n }\n // All networks are ready, we can know the network for certain\n var ready = checkNetworks(providers.map(function (p) { return p.network; }));\n if (ready) {\n _this = _super.call(this, providers[0].network) || this;\n }\n else {\n // The network won't be known until all child providers know\n var ready_1 = Promise.all(providers.map(function (p) { return p.getNetwork(); })).then(function (networks) {\n if (!checkNetworks(networks)) {\n errors.throwError('getNetwork returned null', errors.UNKNOWN_ERROR, {});\n }\n return networks[0];\n });\n _this = _super.call(this, ready_1) || this;\n }\n errors.checkNew(_this, FallbackProvider);\n // Preserve a copy, so we don't get mutated\n _this._providers = providers.slice(0);\n return _this;\n }\n Object.defineProperty(FallbackProvider.prototype, \"providers\", {\n get: function () {\n // Return a copy, so we don't get mutated\n return this._providers.slice(0);\n },\n enumerable: true,\n configurable: true\n });\n FallbackProvider.prototype.perform = function (method, params) {\n // Creates a copy of the providers array\n var providers = this.providers;\n return new Promise(function (resolve, reject) {\n var firstError = null;\n function next() {\n if (!providers.length) {\n reject(firstError);\n return;\n }\n var provider = providers.shift();\n provider.perform(method, params).then(function (result) {\n resolve(result);\n }, function (error) {\n if (!firstError) {\n firstError = error;\n }\n next();\n });\n }\n next();\n });\n };\n return FallbackProvider;\n}(provider_1.Provider));\nexports.FallbackProvider = FallbackProvider;\n\n},{\"../utils/errors\":61,\"./provider\":55}],51:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar provider_1 = require(\"./provider\");\nexports.Provider = provider_1.Provider;\nexports.ProviderSigner = provider_1.ProviderSigner;\nvar etherscan_provider_1 = require(\"./etherscan-provider\");\nexports.EtherscanProvider = etherscan_provider_1.EtherscanProvider;\nvar fallback_provider_1 = require(\"./fallback-provider\");\nexports.FallbackProvider = fallback_provider_1.FallbackProvider;\nvar ipc_provider_1 = require(\"./ipc-provider\");\nexports.IpcProvider = ipc_provider_1.IpcProvider;\nvar infura_provider_1 = require(\"./infura-provider\");\nexports.InfuraProvider = infura_provider_1.InfuraProvider;\nvar json_rpc_provider_1 = require(\"./json-rpc-provider\");\nexports.JsonRpcProvider = json_rpc_provider_1.JsonRpcProvider;\nvar web3_provider_1 = require(\"./web3-provider\");\nexports.Web3Provider = web3_provider_1.Web3Provider;\nfunction getDefaultProvider(network) {\n return new fallback_provider_1.FallbackProvider([\n new infura_provider_1.InfuraProvider(network),\n new etherscan_provider_1.EtherscanProvider(network),\n ]);\n}\nexports.getDefaultProvider = getDefaultProvider;\n\n},{\"./etherscan-provider\":49,\"./fallback-provider\":50,\"./infura-provider\":52,\"./ipc-provider\":41,\"./json-rpc-provider\":53,\"./provider\":55,\"./web3-provider\":56}],52:[function(require,module,exports){\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 });\nvar json_rpc_provider_1 = require(\"./json-rpc-provider\");\nvar networks_1 = require(\"./networks\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar InfuraProvider = /** @class */ (function (_super) {\n __extends(InfuraProvider, _super);\n function InfuraProvider(network, apiAccessToken) {\n var _this = this;\n network = networks_1.getNetwork((network == null) ? 'homestead' : network);\n var host = null;\n switch (network.name) {\n case 'homestead':\n host = 'mainnet.infura.io';\n break;\n case 'ropsten':\n host = 'ropsten.infura.io';\n break;\n case 'rinkeby':\n host = 'rinkeby.infura.io';\n break;\n case 'kovan':\n host = 'kovan.infura.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n _this = _super.call(this, 'https://' + host + '/' + (apiAccessToken || ''), network) || this;\n errors.checkNew(_this, InfuraProvider);\n properties_1.defineReadOnly(_this, 'apiAccessToken', apiAccessToken || null);\n return _this;\n }\n InfuraProvider.prototype._startPending = function () {\n console.log('WARNING: INFURA does not support pending filters');\n };\n InfuraProvider.prototype.getSigner = function (address) {\n errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });\n return null;\n };\n InfuraProvider.prototype.listAccounts = function () {\n return Promise.resolve([]);\n };\n return InfuraProvider;\n}(json_rpc_provider_1.JsonRpcProvider));\nexports.InfuraProvider = InfuraProvider;\n\n},{\"../utils/errors\":61,\"../utils/properties\":65,\"./json-rpc-provider\":53,\"./networks\":54}],53:[function(require,module,exports){\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/JSON-RPC\nvar networks_1 = require(\"./networks\");\nvar provider_1 = require(\"./provider\");\nvar wallet_1 = require(\"../wallet/wallet\");\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar properties_1 = require(\"../utils/properties\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar web_1 = require(\"../utils/web\");\nvar errors = __importStar(require(\"../utils/errors\"));\nfunction timer(timeout) {\n return new Promise(function (resolve) {\n setTimeout(function () {\n resolve();\n }, timeout);\n });\n}\nfunction getResult(payload) {\n if (payload.error) {\n // @TODO: not any\n var error = new Error(payload.error.message);\n error.code = payload.error.code;\n error.data = payload.error.data;\n throw error;\n }\n return payload.result;\n}\n// Convert an ethers.js transaction into a JSON-RPC transaction\n// - gasLimit => gas\n// - All values hexlified\n// - All numeric values zero-striped\nfunction hexlifyTransaction(transaction) {\n var result = {};\n // Some nodes (INFURA ropsten; INFURA mainnet is fine) don't like extra zeros.\n ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(function (key) {\n if (transaction[key] == null) {\n return;\n }\n var value = bytes_1.hexStripZeros(bytes_1.hexlify(transaction[key]));\n if (key === 'gasLimit') {\n key = 'gas';\n }\n result[key] = value;\n });\n ['from', 'to', 'data'].forEach(function (key) {\n if (transaction[key] == null) {\n return;\n }\n result[key] = bytes_1.hexlify(transaction[key]);\n });\n return result;\n}\nexports.hexlifyTransaction = hexlifyTransaction;\nfunction getLowerCase(value) {\n if (value) {\n return value.toLowerCase();\n }\n return value;\n}\nvar JsonRpcSigner = /** @class */ (function (_super) {\n __extends(JsonRpcSigner, _super);\n function JsonRpcSigner(provider, address) {\n var _this = _super.call(this) || this;\n errors.checkNew(_this, JsonRpcSigner);\n properties_1.defineReadOnly(_this, 'provider', provider);\n // Statically attach to a given address\n if (address) {\n properties_1.defineReadOnly(_this, '_address', address);\n }\n return _this;\n }\n Object.defineProperty(JsonRpcSigner.prototype, \"address\", {\n get: function () {\n if (!this._address) {\n errors.throwError('no sync sync address available; use getAddress', errors.UNSUPPORTED_OPERATION, { operation: 'address' });\n }\n return this._address;\n },\n enumerable: true,\n configurable: true\n });\n JsonRpcSigner.prototype.getAddress = function () {\n if (this._address) {\n return Promise.resolve(this._address);\n }\n return this.provider.send('eth_accounts', []).then(function (accounts) {\n if (accounts.length === 0) {\n errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });\n }\n return address_1.getAddress(accounts[0]);\n });\n };\n JsonRpcSigner.prototype.getBalance = function (blockTag) {\n return this.provider.getBalance(this.getAddress(), blockTag);\n };\n JsonRpcSigner.prototype.getTransactionCount = function (blockTag) {\n return this.provider.getTransactionCount(this.getAddress(), blockTag);\n };\n JsonRpcSigner.prototype.sendTransaction = function (transaction) {\n var _this = this;\n var tx = hexlifyTransaction(transaction);\n if (tx.from == null) {\n tx.from = this.getAddress().then(function (address) {\n if (!address) {\n return null;\n }\n return address.toLowerCase();\n });\n }\n return properties_1.resolveProperties(tx).then(function (tx) {\n return _this.provider.send('eth_sendTransaction', [transaction]);\n });\n };\n JsonRpcSigner.prototype.signMessage = function (message) {\n var _this = this;\n var data = ((typeof (message) === 'string') ? utf8_1.toUtf8Bytes(message) : message);\n return this.getAddress().then(function (address) {\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n return _this.provider.send('eth_sign', [address.toLowerCase(), bytes_1.hexlify(data)]);\n });\n };\n JsonRpcSigner.prototype.unlock = function (password) {\n var provider = this.provider;\n return this.getAddress().then(function (address) {\n return provider.send('personal_unlockAccount', [address.toLowerCase(), password, null]);\n });\n };\n return JsonRpcSigner;\n}(wallet_1.Signer));\nexports.JsonRpcSigner = JsonRpcSigner;\nvar JsonRpcProvider = /** @class */ (function (_super) {\n __extends(JsonRpcProvider, _super);\n function JsonRpcProvider(url, network) {\n var _this = this;\n // One parameter, but it is a network name, so swap it with the URL\n if (typeof (url) === 'string') {\n if (network === null && networks_1.getNetwork(url)) {\n network = url;\n url = null;\n }\n }\n if (network) {\n // The network has been specified explicitly, we can use it\n _this = _super.call(this, network) || this;\n }\n else {\n // The network is unknown, query the JSON-RPC for it\n var ready = new Promise(function (resolve, reject) {\n setTimeout(function () {\n _this.send('net_version', []).then(function (result) {\n var chainId = parseInt(result);\n resolve(networks_1.getNetwork(chainId));\n });\n });\n });\n _this = _super.call(this, ready) || this;\n }\n errors.checkNew(_this, JsonRpcProvider);\n // Default URL\n if (!url) {\n url = 'http://localhost:8545';\n }\n if (typeof (url) === 'string') {\n _this.connection = {\n url: url\n };\n }\n else {\n _this.connection = url;\n }\n return _this;\n }\n JsonRpcProvider.prototype.getSigner = function (address) {\n return new JsonRpcSigner(this, address);\n };\n JsonRpcProvider.prototype.listAccounts = function () {\n return this.send('eth_accounts', []).then(function (accounts) {\n return accounts.map(function (a) { return address_1.getAddress(a); });\n });\n };\n JsonRpcProvider.prototype.send = function (method, params) {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n return web_1.fetchJson(this.connection, JSON.stringify(request), getResult);\n };\n JsonRpcProvider.prototype.perform = function (method, params) {\n switch (method) {\n case 'getBlockNumber':\n return this.send('eth_blockNumber', []);\n case 'getGasPrice':\n return this.send('eth_gasPrice', []);\n case 'getBalance':\n return this.send('eth_getBalance', [getLowerCase(params.address), params.blockTag]);\n case 'getTransactionCount':\n return this.send('eth_getTransactionCount', [getLowerCase(params.address), params.blockTag]);\n case 'getCode':\n return this.send('eth_getCode', [getLowerCase(params.address), params.blockTag]);\n case 'getStorageAt':\n return this.send('eth_getStorageAt', [getLowerCase(params.address), params.position, params.blockTag]);\n case 'sendTransaction':\n return this.send('eth_sendRawTransaction', [params.signedTransaction]);\n case 'getBlock':\n if (params.blockTag) {\n return this.send('eth_getBlockByNumber', [params.blockTag, false]);\n }\n else if (params.blockHash) {\n return this.send('eth_getBlockByHash', [params.blockHash, false]);\n }\n return Promise.reject(new Error('invalid block tag or block hash'));\n case 'getTransaction':\n return this.send('eth_getTransactionByHash', [params.transactionHash]);\n case 'getTransactionReceipt':\n return this.send('eth_getTransactionReceipt', [params.transactionHash]);\n case 'call':\n return this.send('eth_call', [hexlifyTransaction(params.transaction), 'latest']);\n case 'estimateGas':\n return this.send('eth_estimateGas', [hexlifyTransaction(params.transaction)]);\n case 'getLogs':\n if (params.filter && params.filter.address != null) {\n params.filter.address = getLowerCase(params.filter.address);\n }\n return this.send('eth_getLogs', [params.filter]);\n default:\n break;\n }\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n };\n JsonRpcProvider.prototype._startPending = function () {\n if (this._pendingFilter != null) {\n return;\n }\n var self = this;\n var pendingFilter = this.send('eth_newPendingTransactionFilter', []);\n this._pendingFilter = pendingFilter;\n pendingFilter.then(function (filterId) {\n function poll() {\n self.send('eth_getFilterChanges', [filterId]).then(function (hashes) {\n if (self._pendingFilter != pendingFilter) {\n return null;\n }\n var seq = Promise.resolve();\n hashes.forEach(function (hash) {\n self._emitted['t:' + hash.toLowerCase()] = 'pending';\n seq = seq.then(function () {\n return self.getTransaction(hash).then(function (tx) {\n self.emit('pending', tx);\n });\n });\n });\n return seq.then(function () {\n return timer(1000);\n });\n }).then(function () {\n if (self._pendingFilter != pendingFilter) {\n self.send('eth_uninstallFilter', [filterId]);\n return;\n }\n setTimeout(function () { poll(); }, 0);\n });\n }\n poll();\n return filterId;\n });\n };\n JsonRpcProvider.prototype._stopPending = function () {\n this._pendingFilter = null;\n };\n return JsonRpcProvider;\n}(provider_1.Provider));\nexports.JsonRpcProvider = JsonRpcProvider;\n\n},{\"../utils/address\":58,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/properties\":65,\"../utils/utf8\":72,\"../utils/web\":73,\"../wallet/wallet\":78,\"./networks\":54,\"./provider\":55}],54:[function(require,module,exports){\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(\"../utils/errors\"));\nvar homestead = {\n chainId: 1,\n ensAddress: \"0x314159265dd8dbb310642f98f50c066173c1259b\",\n name: \"homestead\"\n};\nvar ropsten = {\n chainId: 3,\n ensAddress: \"0x112234455c3a32fd11230c42e7bccd4a84e02010\",\n name: \"ropsten\"\n};\nvar networks = {\n unspecified: {\n chainId: 0\n },\n homestead: homestead,\n mainnet: homestead,\n morden: {\n chainId: 2\n },\n ropsten: ropsten,\n testnet: ropsten,\n rinkeby: {\n chainId: 4,\n ensAddress: \"0xe7410170f87102DF0055eB195163A03B7F2Bff4A\"\n },\n kovan: {\n chainId: 42\n },\n classic: {\n chainId: 61\n }\n};\n/**\n * getNetwork\n *\n * Converts a named common networks or chain ID (network ID) to a Network\n * and verifies a network is a valid Network..\n */\nfunction getNetwork(network) {\n // No network (null) or unspecified (chainId = 0)\n if (!network) {\n return null;\n }\n if (typeof (network) === 'number') {\n for (var name in networks) {\n var n_1 = networks[name];\n if (n_1.chainId === network) {\n return {\n name: name,\n chainId: n_1.chainId,\n ensAddress: n_1.ensAddress\n };\n }\n }\n return {\n chainId: network,\n name: 'unknown'\n };\n }\n if (typeof (network) === 'string') {\n var n_2 = networks[network];\n if (n_2 == null) {\n return null;\n }\n return {\n name: network,\n chainId: n_2.chainId,\n ensAddress: n_2.ensAddress\n };\n }\n var n = networks[network.name];\n // Not a standard network; check that it is a valid network in general\n if (!n) {\n if (typeof (n.chainId) !== 'number') {\n errors.throwError('invalid network chainId', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n return network;\n }\n // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155)\n if (network.chainId !== 0 && network.chainId !== n.chainId) {\n errors.throwError('network chainId mismatch', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n // Standard Network\n return {\n name: network.name,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n}\nexports.getNetwork = getNetwork;\n\n},{\"../utils/errors\":61}],55:[function(require,module,exports){\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//import inherits = require('inherits');\nvar wallet_1 = require(\"../wallet/wallet\");\nvar address_1 = require(\"../utils/address\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar rlp_1 = require(\"../utils/rlp\");\nvar hash_1 = require(\"../utils/hash\");\nvar networks_1 = require(\"./networks\");\nvar properties_1 = require(\"../utils/properties\");\nvar transaction_1 = require(\"../utils/transaction\");\nvar errors = __importStar(require(\"../utils/errors\"));\nfunction copyObject(obj) {\n var result = {};\n for (var key in obj) {\n result[key] = obj[key];\n }\n return result;\n}\n;\n;\n//////////////////////////////\n// Request and Response Checking\n// @TODO: not any?\nfunction check(format, object) {\n var result = {};\n for (var key in format) {\n try {\n var value = format[key](object[key]);\n if (value !== undefined) {\n result[key] = value;\n }\n }\n catch (error) {\n error.checkKey = key;\n error.checkValue = object[key];\n throw error;\n }\n }\n return result;\n}\nfunction allowNull(check, nullValue) {\n return (function (value) {\n if (value == null) {\n return nullValue;\n }\n return check(value);\n });\n}\nfunction allowFalsish(check, replaceValue) {\n return (function (value) {\n if (!value) {\n return replaceValue;\n }\n return check(value);\n });\n}\nfunction arrayOf(check) {\n return (function (array) {\n if (!Array.isArray(array)) {\n throw new Error('not an array');\n }\n var result = [];\n array.forEach(function (value) {\n result.push(check(value));\n });\n return result;\n });\n}\nfunction checkHash(hash) {\n if (typeof (hash) === 'string' && bytes_1.hexDataLength(hash) === 32) {\n return hash;\n }\n errors.throwError('invalid hash', errors.INVALID_ARGUMENT, { arg: 'hash', value: hash });\n return null;\n}\nfunction checkNumber(number) {\n return bignumber_1.bigNumberify(number).toNumber();\n}\n// Returns the difficulty as a number, or if too large (i.e. PoA network) null\nfunction checkDifficulty(value) {\n var v = bignumber_1.bigNumberify(value);\n try {\n return v.toNumber();\n }\n catch (error) { }\n return null;\n}\nfunction checkBoolean(value) {\n if (typeof (value) === 'boolean') {\n return value;\n }\n if (typeof (value) === 'string') {\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n }\n throw new Error('invaid boolean - ' + value);\n}\nfunction checkUint256(uint256) {\n if (!bytes_1.isHexString(uint256)) {\n throw new Error('invalid uint256');\n }\n while (uint256.length < 66) {\n uint256 = '0x0' + uint256.substring(2);\n }\n return uint256;\n}\n/*\nfunction checkString(string) {\n if (typeof(string) !== 'string') { throw new Error('invalid string'); }\n return string;\n}\n*/\nfunction checkBlockTag(blockTag) {\n if (blockTag == null) {\n return 'latest';\n }\n if (blockTag === 'earliest') {\n return '0x0';\n }\n if (blockTag === 'latest' || blockTag === 'pending') {\n return blockTag;\n }\n if (typeof (blockTag) === 'number') {\n return bytes_1.hexStripZeros(bytes_1.hexlify(blockTag));\n }\n if (bytes_1.isHexString(blockTag)) {\n return bytes_1.hexStripZeros(blockTag);\n }\n throw new Error('invalid blockTag');\n}\nvar formatBlock = {\n hash: checkHash,\n parentHash: checkHash,\n number: checkNumber,\n timestamp: checkNumber,\n nonce: allowNull(bytes_1.hexlify),\n difficulty: checkDifficulty,\n gasLimit: bignumber_1.bigNumberify,\n gasUsed: bignumber_1.bigNumberify,\n miner: address_1.getAddress,\n extraData: bytes_1.hexlify,\n //transactions: allowNull(arrayOf(checkTransaction)),\n transactions: allowNull(arrayOf(checkHash)),\n};\nfunction checkBlock(block) {\n if (block.author != null && block.miner == null) {\n block.miner = block.author;\n }\n return check(formatBlock, block);\n}\nvar formatTransaction = {\n hash: checkHash,\n blockHash: allowNull(checkHash, null),\n blockNumber: allowNull(checkNumber, null),\n transactionIndex: allowNull(checkNumber, null),\n from: address_1.getAddress,\n gasPrice: bignumber_1.bigNumberify,\n gasLimit: bignumber_1.bigNumberify,\n to: allowNull(address_1.getAddress, null),\n value: bignumber_1.bigNumberify,\n nonce: checkNumber,\n data: bytes_1.hexlify,\n r: allowNull(checkUint256),\n s: allowNull(checkUint256),\n v: allowNull(checkNumber),\n creates: allowNull(address_1.getAddress, null),\n raw: allowNull(bytes_1.hexlify),\n};\nfunction checkTransactionResponse(transaction) {\n // Rename gas to gasLimit\n if (transaction.gas != null && transaction.gasLimit == null) {\n transaction.gasLimit = transaction.gas;\n }\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (transaction.to && bignumber_1.bigNumberify(transaction.to).isZero()) {\n transaction.to = '0x0000000000000000000000000000000000000000';\n }\n // Rename input to data\n if (transaction.input != null && transaction.data == null) {\n transaction.data = transaction.input;\n }\n // If to and creates are empty, populate the creates from the transaction\n if (transaction.to == null && transaction.creates == null) {\n transaction.creates = address_1.getContractAddress(transaction);\n }\n if (!transaction.raw) {\n // Very loose providers (e.g. TestRPC) don't provide a signature or raw\n if (transaction.v && transaction.r && transaction.s) {\n var raw = [\n bytes_1.stripZeros(bytes_1.hexlify(transaction.nonce)),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.gasPrice)),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.gasLimit)),\n (transaction.to || \"0x\"),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.value || '0x')),\n bytes_1.hexlify(transaction.data || '0x'),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.v || '0x')),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.r)),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.s)),\n ];\n transaction.raw = rlp_1.encode(raw);\n }\n }\n var result = check(formatTransaction, transaction);\n var networkId = transaction.networkId;\n if (bytes_1.isHexString(networkId)) {\n networkId = bignumber_1.bigNumberify(networkId).toNumber();\n }\n if (typeof (networkId) !== 'number' && result.v != null) {\n networkId = (result.v - 35) / 2;\n if (networkId < 0) {\n networkId = 0;\n }\n networkId = parseInt(networkId);\n }\n if (typeof (networkId) !== 'number') {\n networkId = 0;\n }\n result.networkId = networkId;\n // 0x0000... should actually be null\n if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {\n result.blockHash = null;\n }\n return result;\n}\nexports.checkTransactionResponse = checkTransactionResponse;\nvar formatTransactionRequest = {\n from: allowNull(address_1.getAddress),\n nonce: allowNull(checkNumber),\n gasLimit: allowNull(bignumber_1.bigNumberify),\n gasPrice: allowNull(bignumber_1.bigNumberify),\n to: allowNull(address_1.getAddress),\n value: allowNull(bignumber_1.bigNumberify),\n data: allowNull(bytes_1.hexlify),\n};\nfunction checkTransactionRequest(transaction) {\n return check(formatTransactionRequest, transaction);\n}\nvar formatTransactionReceiptLog = {\n transactionLogIndex: allowNull(checkNumber),\n transactionIndex: checkNumber,\n blockNumber: checkNumber,\n transactionHash: checkHash,\n address: address_1.getAddress,\n topics: arrayOf(checkHash),\n data: bytes_1.hexlify,\n logIndex: checkNumber,\n blockHash: checkHash,\n};\nfunction checkTransactionReceiptLog(log) {\n return check(formatTransactionReceiptLog, log);\n}\nvar formatTransactionReceipt = {\n contractAddress: allowNull(address_1.getAddress, null),\n transactionIndex: checkNumber,\n root: allowNull(checkHash),\n gasUsed: bignumber_1.bigNumberify,\n logsBloom: allowNull(bytes_1.hexlify),\n blockHash: checkHash,\n transactionHash: checkHash,\n logs: arrayOf(checkTransactionReceiptLog),\n blockNumber: checkNumber,\n cumulativeGasUsed: bignumber_1.bigNumberify,\n status: allowNull(checkNumber)\n};\nfunction checkTransactionReceipt(transactionReceipt) {\n //var status = transactionReceipt.status;\n //var root = transactionReceipt.root;\n var result = check(formatTransactionReceipt, transactionReceipt);\n result.logs.forEach(function (entry, index) {\n if (entry.transactionLogIndex == null) {\n entry.transactionLogIndex = index;\n }\n });\n if (transactionReceipt.status != null) {\n result.byzantium = true;\n }\n return result;\n}\nfunction checkTopics(topics) {\n if (Array.isArray(topics)) {\n topics.forEach(function (topic) {\n checkTopics(topic);\n });\n }\n else if (topics != null) {\n checkHash(topics);\n }\n return topics;\n}\nvar formatFilter = {\n fromBlock: allowNull(checkBlockTag, undefined),\n toBlock: allowNull(checkBlockTag, undefined),\n address: allowNull(address_1.getAddress, undefined),\n topics: allowNull(checkTopics, undefined),\n};\nfunction checkFilter(filter) {\n return check(formatFilter, filter);\n}\nvar formatLog = {\n blockNumber: allowNull(checkNumber),\n blockHash: allowNull(checkHash),\n transactionIndex: checkNumber,\n removed: allowNull(checkBoolean),\n address: address_1.getAddress,\n data: allowFalsish(bytes_1.hexlify, '0x'),\n topics: arrayOf(checkHash),\n transactionHash: checkHash,\n logIndex: checkNumber,\n};\nfunction checkLog(log) {\n return check(formatLog, log);\n}\nfunction stallPromise(allowNullFunc, executeFunc) {\n return new Promise(function (resolve, reject) {\n var attempt = 0;\n function check() {\n executeFunc().then(function (result) {\n // If we have a result, or are allowed null then we're done\n if (result || allowNullFunc()) {\n resolve(result);\n // Otherwise, exponential back-off (up to 10s) our next request\n }\n else {\n attempt++;\n var timeout = 500 + 250 * Math.trunc(Math.random() * (1 << attempt));\n if (timeout > 10000) {\n timeout = 10000;\n }\n setTimeout(check, timeout);\n }\n }, function (error) {\n reject(error);\n });\n }\n check();\n });\n}\n//////////////////////////////\n// Event Serializeing\nfunction recurse(object, convertFunc) {\n if (Array.isArray(object)) {\n var result = [];\n object.forEach(function (object) {\n result.push(recurse(object, convertFunc));\n });\n return result;\n }\n return convertFunc(object);\n}\nfunction getEventString(object) {\n try {\n return 'address:' + address_1.getAddress(object);\n }\n catch (error) { }\n if (object === 'block') {\n return 'block';\n }\n else if (object === 'pending') {\n return 'pending';\n }\n else if (bytes_1.hexDataLength(object) === 32) {\n return 'tx:' + object;\n }\n else if (Array.isArray(object)) {\n object = recurse(object, function (object) {\n if (object == null) {\n object = '0x';\n }\n return object;\n });\n try {\n return 'topic:' + rlp_1.encode(object);\n }\n catch (error) {\n console.log(error);\n }\n }\n try {\n throw new Error();\n }\n catch (e) {\n console.log(e.stack);\n }\n throw new Error('invalid event - ' + object);\n}\nfunction parseEventString(string) {\n if (string.substring(0, 3) === 'tx:') {\n return { type: 'transaction', hash: string.substring(3) };\n }\n else if (string === 'block') {\n return { type: 'block' };\n }\n else if (string === 'pending') {\n return { type: 'pending' };\n }\n else if (string.substring(0, 8) === 'address:') {\n return { type: 'address', address: string.substring(8) };\n }\n else if (string.substring(0, 6) === 'topic:') {\n try {\n var object = rlp_1.decode(string.substring(6));\n object = recurse(object, function (object) {\n if (object === '0x') {\n object = null;\n }\n return object;\n });\n return { type: 'topic', topic: object };\n }\n catch (error) {\n console.log(error);\n }\n }\n throw new Error('invalid event string');\n}\n//////////////////////////////\n// Provider Object\n/* @TODO:\ntype Event = {\n eventName: string,\n listener: any, // @TODO: Function any: any\n type: string,\n}\n*/\n// @TODO: Perhaps allow a SignDigestAsyncFunc?\n// Enable a simple signing function and provider to provide a full Signer\nvar ProviderSigner = /** @class */ (function (_super) {\n __extends(ProviderSigner, _super);\n function ProviderSigner(address, signDigest, provider) {\n var _this = _super.call(this) || this;\n errors.checkNew(_this, ProviderSigner);\n properties_1.defineReadOnly(_this, '_addressPromise', Promise.resolve(address));\n properties_1.defineReadOnly(_this, 'signDigest', signDigest);\n properties_1.defineReadOnly(_this, 'provider', provider);\n return _this;\n }\n ProviderSigner.prototype.getAddress = function () {\n return this._addressPromise;\n };\n ProviderSigner.prototype.signMessage = function (message) {\n return Promise.resolve(bytes_1.joinSignature(this.signDigest(hash_1.hashMessage(message))));\n };\n ProviderSigner.prototype.sendTransaction = function (transaction) {\n var _this = this;\n transaction = properties_1.shallowCopy(transaction);\n if (transaction.chainId == null) {\n transaction.chainId = this.provider.getNetwork().then(function (network) {\n return network.chainId;\n });\n }\n if (transaction.from == null) {\n transaction.from = this.getAddress();\n }\n if (transaction.gasLimit == null) {\n transaction.gasLimit = this.provider.estimateGas(transaction);\n }\n if (transaction.gasPrice == null) {\n transaction.gasPrice = this.provider.getGasPrice();\n }\n return properties_1.resolveProperties(transaction).then(function (tx) {\n var signedTx = transaction_1.sign(tx, _this.signDigest);\n return _this._addressPromise.then(function (address) {\n if (transaction_1.parse(signedTx).from !== address) {\n errors.throwError('signing address does not match expected address', errors.UNKNOWN_ERROR, { address: transaction_1.parse(signedTx).from, expectedAddress: address, signedTransaction: signedTx });\n }\n return _this.provider.sendTransaction(signedTx);\n });\n });\n };\n return ProviderSigner;\n}(wallet_1.Signer));\nexports.ProviderSigner = ProviderSigner;\nvar Provider = /** @class */ (function () {\n function Provider(network) {\n var _this = this;\n errors.checkNew(this, Provider);\n if (network instanceof Promise) {\n properties_1.defineReadOnly(this, 'ready', network.then(function (network) {\n properties_1.defineReadOnly(_this, '_network', network);\n return network;\n }));\n }\n else {\n var knownNetwork = networks_1.getNetwork((network == null) ? 'homestead' : network);\n if (knownNetwork) {\n properties_1.defineReadOnly(this, '_network', knownNetwork);\n properties_1.defineReadOnly(this, 'ready', Promise.resolve(this._network));\n }\n else {\n errors.throwError('invalid network', errors.INVALID_ARGUMENT, { arg: 'network', value: network });\n }\n }\n this._lastBlockNumber = -2;\n // Balances being watched for changes\n this._balances = {};\n // Events being listened to\n this._events = {};\n this._pollingInterval = 4000;\n // We use this to track recent emitted events; for example, if we emit a \"block\" of 100\n // and we get a `getBlock(100)` request which would result in null, we should retry\n // until we get a response. This provides devs with a consistent view. Similarly for\n // transaction hashes.\n this._emitted = { block: this._lastBlockNumber };\n }\n Provider.prototype._doPoll = function () {\n var _this = this;\n this.getBlockNumber().then(function (blockNumber) {\n // If the block hasn't changed, meh.\n if (blockNumber === _this._lastBlockNumber) {\n return;\n }\n if (_this._lastBlockNumber === -2) {\n _this._lastBlockNumber = blockNumber - 1;\n }\n // Notify all listener for each block that has passed\n for (var i = _this._lastBlockNumber + 1; i <= blockNumber; i++) {\n if (_this._emitted.block < i) {\n _this._emitted.block = i;\n // Evict any transaction hashes or block hashes over 12 blocks\n // old, since they should not return null anyways\n Object.keys(_this._emitted).forEach(function (key) {\n if (key === 'block') {\n return;\n }\n if (_this._emitted[key] > i + 12) {\n delete _this._emitted[key];\n }\n });\n }\n _this.emit('block', i);\n }\n // Sweep balances and remove addresses we no longer have events for\n var newBalances = {};\n // Find all transaction hashes we are waiting on\n Object.keys(_this._events).forEach(function (eventName) {\n var event = parseEventString(eventName);\n if (event.type === 'transaction') {\n _this.getTransaction(event.hash).then(function (transaction) {\n if (!transaction || transaction.blockNumber == null) {\n return;\n }\n _this._emitted['t:' + transaction.hash.toLowerCase()] = transaction.blockNumber;\n _this.emit(event.hash, transaction);\n });\n }\n else if (event.type === 'address') {\n if (_this._balances[event.address]) {\n newBalances[event.address] = _this._balances[event.address];\n }\n _this.getBalance(event.address, 'latest').then(function (balance) {\n var lastBalance = this._balances[event.address];\n if (lastBalance && balance.eq(lastBalance)) {\n return;\n }\n this._balances[event.address] = balance;\n this.emit(event.address, balance);\n });\n }\n else if (event.type === 'topic') {\n _this.getLogs({\n fromBlock: _this._lastBlockNumber + 1,\n toBlock: blockNumber,\n topics: event.topic\n }).then(function (logs) {\n if (logs.length === 0) {\n return;\n }\n logs.forEach(function (log) {\n _this._emitted['b:' + log.blockHash.toLowerCase()] = log.blockNumber;\n _this._emitted['t:' + log.transactionHash.toLowerCase()] = log.blockNumber;\n _this.emit(event.topic, log);\n });\n });\n }\n });\n _this._lastBlockNumber = blockNumber;\n _this._balances = newBalances;\n });\n this.doPoll();\n };\n Provider.prototype.resetEventsBlock = function (blockNumber) {\n this._lastBlockNumber = this.blockNumber;\n this._doPoll();\n };\n Object.defineProperty(Provider.prototype, \"network\", {\n get: function () {\n return this._network;\n },\n enumerable: true,\n configurable: true\n });\n Provider.prototype.getNetwork = function () {\n return this.ready;\n };\n Object.defineProperty(Provider.prototype, \"blockNumber\", {\n get: function () {\n if (this._lastBlockNumber < 0) {\n return null;\n }\n return this._lastBlockNumber;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Provider.prototype, \"polling\", {\n get: function () {\n return (this._poller != null);\n },\n set: function (value) {\n var _this = this;\n setTimeout(function () {\n if (value && !_this._poller) {\n _this._poller = setInterval(_this._doPoll.bind(_this), _this.pollingInterval);\n }\n else if (!value && _this._poller) {\n clearInterval(_this._poller);\n _this._poller = null;\n }\n }, 0);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Provider.prototype, \"pollingInterval\", {\n get: function () {\n return this._pollingInterval;\n },\n set: function (value) {\n var _this = this;\n if (typeof (value) !== 'number' || value <= 0 || Math.trunc(value) != value) {\n throw new Error('invalid polling interval');\n }\n this._pollingInterval = value;\n if (this._poller) {\n clearInterval(this._poller);\n this._poller = setInterval(function () { _this._doPoll(); }, this._pollingInterval);\n }\n },\n enumerable: true,\n configurable: true\n });\n // @TODO: Add .poller which must be an event emitter with a 'start', 'stop' and 'block' event;\n // this will be used once we move to the WebSocket or other alternatives to polling\n Provider.prototype.waitForTransaction = function (transactionHash, timeout) {\n var self = this;\n return new Promise(function (resolve, reject) {\n var timer = null;\n function complete(transaction) {\n if (timer) {\n clearTimeout(timer);\n }\n resolve(transaction);\n }\n self.once(transactionHash, complete);\n if (typeof (timeout) === 'number' && timeout > 0) {\n timer = setTimeout(function () {\n self.removeListener(transactionHash, complete);\n reject(new Error('timeout'));\n }, timeout);\n }\n });\n };\n Provider.prototype.getBlockNumber = function () {\n var _this = this;\n return this.ready.then(function () {\n return _this.perform('getBlockNumber', {}).then(function (result) {\n var value = Math.trunc(result);\n if (value != result) {\n throw new Error('invalid response - getBlockNumber');\n }\n return value;\n });\n });\n };\n Provider.prototype.getGasPrice = function () {\n var _this = this;\n return this.ready.then(function () {\n return _this.perform('getGasPrice', {}).then(function (result) {\n return bignumber_1.bigNumberify(result);\n });\n });\n };\n Provider.prototype.getBalance = function (addressOrName, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return _this.perform('getBalance', params).then(function (result) {\n return bignumber_1.bigNumberify(result);\n });\n });\n });\n });\n };\n Provider.prototype.getTransactionCount = function (addressOrName, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return _this.perform('getTransactionCount', params).then(function (result) {\n var value = parseInt(result);\n if (value != result) {\n throw new Error('invalid response - getTransactionCount');\n }\n return value;\n });\n });\n });\n });\n };\n Provider.prototype.getCode = function (addressOrName, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return _this.perform('getCode', params).then(function (result) {\n return bytes_1.hexlify(result);\n });\n });\n });\n });\n };\n Provider.prototype.getStorageAt = function (addressOrName, position, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, position = _a.position, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = {\n address: address,\n blockTag: checkBlockTag(blockTag),\n position: bytes_1.hexStripZeros(bytes_1.hexlify(position)),\n };\n return _this.perform('getStorageAt', params).then(function (result) {\n return bytes_1.hexlify(result);\n });\n });\n });\n });\n };\n Provider.prototype.sendTransaction = function (signedTransaction) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ signedTransaction: signedTransaction }).then(function (_a) {\n var signedTransaction = _a.signedTransaction;\n var params = { signedTransaction: bytes_1.hexlify(signedTransaction) };\n return _this.perform('sendTransaction', params).then(function (hash) {\n if (bytes_1.hexDataLength(hash) !== 32) {\n throw new Error('invalid response - sendTransaction');\n }\n // A signed transaction always has a from (and we add wait below)\n var tx = transaction_1.parse(signedTransaction);\n // Check the hash we expect is the same as the hash the server reported\n if (tx.hash !== hash) {\n errors.throwError('Transaction hash mismatch from Proivder.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n _this._emitted['t:' + tx.hash.toLowerCase()] = 'pending';\n tx.wait = function (timeout) {\n return _this.waitForTransaction(hash, timeout);\n };\n return tx;\n });\n });\n });\n };\n Provider.prototype.call = function (transaction) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties(transaction).then(function (transaction) {\n return _this._resolveNames(transaction, ['to', 'from']).then(function (transaction) {\n var params = { transaction: checkTransactionRequest(transaction) };\n return _this.perform('call', params).then(function (result) {\n return bytes_1.hexlify(result);\n });\n });\n });\n });\n };\n Provider.prototype.estimateGas = function (transaction) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties(transaction).then(function (transaction) {\n return _this._resolveNames(transaction, ['to', 'from']).then(function (transaction) {\n var params = { transaction: checkTransactionRequest(transaction) };\n return _this.perform('estimateGas', params).then(function (result) {\n return bignumber_1.bigNumberify(result);\n });\n });\n });\n });\n };\n Provider.prototype.getBlock = function (blockHashOrBlockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(function (_a) {\n var blockHashOrBlockTag = _a.blockHashOrBlockTag;\n try {\n var blockHash = bytes_1.hexlify(blockHashOrBlockTag);\n if (bytes_1.hexDataLength(blockHash) === 32) {\n return stallPromise(function () {\n return (_this._emitted['b:' + blockHash.toLowerCase()] == null);\n }, function () {\n return _this.perform('getBlock', { blockHash: blockHash }).then(function (block) {\n if (block == null) {\n return null;\n }\n return checkBlock(block);\n });\n });\n }\n }\n catch (error) { }\n try {\n var blockTag = checkBlockTag(blockHashOrBlockTag);\n return stallPromise(function () {\n if (bytes_1.isHexString(blockTag)) {\n var blockNumber = parseInt(blockTag.substring(2), 16);\n return blockNumber > _this._emitted.block;\n }\n return true;\n }, function () {\n return _this.perform('getBlock', { blockTag: blockTag }).then(function (block) {\n if (block == null) {\n return null;\n }\n return checkBlock(block);\n });\n });\n }\n catch (error) { }\n throw new Error('invalid block hash or block tag');\n });\n });\n };\n Provider.prototype.getTransaction = function (transactionHash) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ transactionHash: transactionHash }).then(function (_a) {\n var transactionHash = _a.transactionHash;\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(function () {\n return (_this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, function () {\n return _this.perform('getTransaction', params).then(function (result) {\n if (result != null) {\n result = checkTransactionResponse(result);\n }\n return result;\n });\n });\n });\n });\n };\n Provider.prototype.getTransactionReceipt = function (transactionHash) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ transactionHash: transactionHash }).then(function (_a) {\n var transactionHash = _a.transactionHash;\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(function () {\n return (_this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, function () {\n return _this.perform('getTransactionReceipt', params).then(function (result) {\n if (result != null) {\n result = checkTransactionReceipt(result);\n }\n return result;\n });\n });\n });\n });\n };\n Provider.prototype.getLogs = function (filter) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties(filter).then(function (filter) {\n return _this._resolveNames(filter, ['address']).then(function (filter) {\n var params = { filter: checkFilter(filter) };\n return _this.perform('getLogs', params).then(function (result) {\n return arrayOf(checkLog)(result);\n });\n });\n });\n });\n };\n Provider.prototype.getEtherPrice = function () {\n var _this = this;\n return this.ready.then(function () {\n return _this.perform('getEtherPrice', {}).then(function (result) {\n // @TODO: Check valid float\n return result;\n });\n });\n };\n Provider.prototype._resolveNames = function (object, keys) {\n var promises = [];\n var result = copyObject(object);\n keys.forEach(function (key) {\n if (result[key] === undefined) {\n return;\n }\n promises.push(this.resolveName(result[key]).then(function (address) {\n result[key] = address;\n }));\n }, this);\n return Promise.all(promises).then(function () { return result; });\n };\n Provider.prototype._getResolver = function (name) {\n var _this = this;\n // Get the resolver from the blockchain\n return this.getNetwork().then(function (network) {\n // No ENS...\n if (!network.ensAddress) {\n errors.throwError('network does support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });\n }\n // keccak256('resolver(bytes32)')\n var data = '0x0178b8bf' + hash_1.namehash(name).substring(2);\n var transaction = { to: network.ensAddress, data: data };\n return _this.call(transaction).then(function (data) {\n // extract the address from the data\n if (bytes_1.hexDataLength(data) !== 32) {\n return null;\n }\n return address_1.getAddress(bytes_1.hexDataSlice(data, 12));\n });\n });\n };\n Provider.prototype.resolveName = function (name) {\n var _this = this;\n // If it is a promise, resolve it then recurse\n if (name instanceof Promise) {\n return name.then(function (addressOrName) {\n return _this.resolveName(addressOrName);\n });\n }\n // If it is already an address, nothing to resolve\n try {\n return Promise.resolve(address_1.getAddress(name));\n }\n catch (error) { }\n var self = this;\n var nodeHash = hash_1.namehash(name);\n // Get the addr from the resovler\n return this._getResolver(name).then(function (resolverAddress) {\n // keccak256('addr(bytes32)')\n var data = '0x3b3b57de' + nodeHash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n // extract the address from the data\n }).then(function (data) {\n if (bytes_1.hexDataLength(data) !== 32) {\n return null;\n }\n var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));\n if (address === '0x0000000000000000000000000000000000000000') {\n return null;\n }\n return address;\n });\n };\n Provider.prototype.lookupAddress = function (address) {\n var _this = this;\n if (address instanceof Promise) {\n return address.then(function (address) {\n return _this.lookupAddress(address);\n });\n }\n address = address_1.getAddress(address);\n var name = address.substring(2) + '.addr.reverse';\n var nodehash = hash_1.namehash(name);\n var self = this;\n return this._getResolver(name).then(function (resolverAddress) {\n if (!resolverAddress) {\n return null;\n }\n // keccak('name(bytes32)')\n var data = '0x691f3431' + nodehash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n }).then(function (data) {\n // Strip off the \"0x\"\n data = data.substring(2);\n // Strip off the dynamic string pointer (0x20)\n if (data.length < 64) {\n return null;\n }\n data = data.substring(64);\n if (data.length < 64) {\n return null;\n }\n var length = bignumber_1.bigNumberify('0x' + data.substring(0, 64)).toNumber();\n data = data.substring(64);\n if (2 * length > data.length) {\n return null;\n }\n var name = utf8_1.toUtf8String('0x' + data.substring(0, 2 * length));\n // Make sure the reverse record matches the foward record\n return self.resolveName(name).then(function (addr) {\n if (addr != address) {\n return null;\n }\n return name;\n });\n });\n };\n Provider.prototype.doPoll = function () {\n };\n Provider.prototype.perform = function (method, params) {\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n };\n Provider.prototype._startPending = function () {\n console.log('WARNING: this provider does not support pending events');\n };\n Provider.prototype._stopPending = function () {\n };\n Provider.prototype.on = function (eventName, listener) {\n var key = getEventString(eventName);\n if (!this._events[key]) {\n this._events[key] = [];\n }\n this._events[key].push({ eventName: eventName, listener: listener, type: 'on' });\n if (key === 'pending') {\n this._startPending();\n }\n this.polling = true;\n return this;\n };\n Provider.prototype.once = function (eventName, listener) {\n var key = getEventString(eventName);\n if (!this._events[key]) {\n this._events[key] = [];\n }\n this._events[key].push({ eventName: eventName, listener: listener, type: 'once' });\n if (key === 'pending') {\n this._startPending();\n }\n this.polling = true;\n return this;\n };\n Provider.prototype.emit = function (eventName) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var result = false;\n var key = getEventString(eventName);\n //var args = Array.prototype.slice.call(arguments, 1);\n var listeners = this._events[key];\n if (!listeners) {\n return result;\n }\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n if (listener.type === 'once') {\n listeners.splice(i, 1);\n i--;\n }\n try {\n listener.listener.apply(this, args);\n result = true;\n }\n catch (error) {\n console.log('Event Listener Error: ' + error.message);\n }\n }\n if (listeners.length === 0) {\n delete this._events[key];\n if (key === 'pending') {\n this._stopPending();\n }\n }\n if (this.listenerCount() === 0) {\n this.polling = false;\n }\n return result;\n };\n // @TODO: type EventName\n Provider.prototype.listenerCount = function (eventName) {\n if (!eventName) {\n var result = 0;\n for (var key in this._events) {\n result += this._events[key].length;\n }\n return result;\n }\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) {\n return 0;\n }\n return listeners.length;\n };\n // @TODO: func\n Provider.prototype.listeners = function (eventName) {\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) {\n return [];\n }\n var result = [];\n for (var i = 0; i < listeners.length; i++) {\n result.push(listeners[i].listener);\n }\n return result;\n };\n Provider.prototype.removeAllListeners = function (eventName) {\n delete this._events[getEventString(eventName)];\n if (this.listenerCount() === 0) {\n this.polling = false;\n }\n return this;\n };\n Provider.prototype.removeListener = function (eventName, listener) {\n var eventNameString = getEventString(eventName);\n var listeners = this._events[eventNameString];\n if (!listeners) {\n return this;\n }\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].listener === listener) {\n listeners.splice(i, 1);\n break;\n }\n }\n if (listeners.length === 0) {\n this.removeAllListeners(eventName);\n }\n return this;\n };\n return Provider;\n}());\nexports.Provider = Provider;\n\n},{\"../utils/address\":58,\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/hash\":62,\"../utils/properties\":65,\"../utils/rlp\":66,\"../utils/transaction\":70,\"../utils/utf8\":72,\"../wallet/wallet\":78,\"./networks\":54}],56:[function(require,module,exports){\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 });\nvar json_rpc_provider_1 = require(\"./json-rpc-provider\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar Web3Provider = /** @class */ (function (_super) {\n __extends(Web3Provider, _super);\n function Web3Provider(web3Provider, network) {\n var _this = this;\n if (!web3Provider || !web3Provider.sendAsync) {\n errors.throwError('invalid web3Provider', errors.INVALID_ARGUMENT, { arg: 'web3Provider', value: web3Provider });\n }\n // HTTP has a host; IPC has a path.\n var url = web3Provider.host || web3Provider.path || 'unknown';\n _this = _super.call(this, url, network) || this;\n errors.checkNew(_this, Web3Provider);\n properties_1.defineReadOnly(_this, '_web3Provider', web3Provider);\n return _this;\n }\n Web3Provider.prototype.send = function (method, params) {\n var _this = this;\n // Metamask complains about eth_sign (and on some versions hangs)\n if (method == 'eth_sign' && this._web3Provider.isMetaMask) {\n // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign\n method = 'personal_sign';\n params = [params[1], params[0]];\n }\n return new Promise(function (resolve, reject) {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n _this._web3Provider.sendAsync(request, function (error, result) {\n if (error) {\n reject(error);\n return;\n }\n if (result.error) {\n // @TODO: not any\n var error = new Error(result.error.message);\n error.code = result.error.code;\n error.data = result.error.data;\n reject(error);\n return;\n }\n resolve(result.result);\n });\n });\n };\n return Web3Provider;\n}(json_rpc_provider_1.JsonRpcProvider));\nexports.Web3Provider = Web3Provider;\n\n},{\"../utils/errors\":61,\"../utils/properties\":65,\"./json-rpc-provider\":53}],57:[function(require,module,exports){\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 address_1 = require(\"./address\");\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar properties_1 = require(\"./properties\");\nvar errors = __importStar(require(\"./errors\"));\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 function throwError(i) {\n throw new Error('unexpected character \"' + param[i] + '\" at position ' + i + ' in \"' + param + '\"');\n }\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 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 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 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 console.log('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 inputs: [],\n name: '',\n outputs: [],\n payable: false,\n stateMutability: null,\n type: 'function'\n };\n var 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 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 '':\n break;\n default:\n console.log('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 return abi;\n}\nfunction parseParamType(type) {\n return parseParam(type, true);\n}\nexports.parseParamType = parseParamType;\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(/\\(/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}());\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 v = v.toTwos(this.size * 8).maskn(this.size * 8);\n //value = value.toTwos(size * 8).maskn(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 type: typeof (value),\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 > 32) {\n throw new Error();\n }\n result.set(data);\n }\n catch (error) {\n errors.throwError('invalid ' + this.name + ' value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof (value),\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 type: typeof (value),\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 = Math.trunc(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: Math.trunc(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 type: typeof (value),\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 type: typeof (value),\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 Math.trunc(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 type: typeof (values),\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 type: typeof (value),\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 if (count !== value.length) {\n errors.throwError('array value length mismatch', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n count: value.length,\n expectedCount: count,\n value: value\n });\n }\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(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 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 result.push(accum);\n return result;\n}\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.type = match[1];\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 = properties_1.jsonCopy(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.jsonCopy(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},{\"./address\":58,\"./bignumber\":59,\"./bytes\":60,\"./errors\":61,\"./properties\":65,\"./utf8\":72}],58:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use this for base 36 maths\nvar BN = require(\"bn.js\");\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar rlp_1 = require(\"./rlp\");\nvar errors = require(\"./errors\");\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(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(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\n},{\"./bytes\":60,\"./errors\":61,\"./keccak256\":64,\"./rlp\":66,\"bn.js\":2}],59:[function(require,module,exports){\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(\"../utils/errors\"));\nfunction _isBigNumber(value) {\n return isBigNumber(value);\n}\nvar BigNumber = /** @class */ (function () {\n function BigNumber(value) {\n errors.checkNew(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, '_bn', new bn_js_1.default.BN(value.substring(2), 16));\n }\n else if (value[0] === '-' && bytes_1.isHexString(value.substring(1))) {\n properties_1.defineReadOnly(this, '_bn', (new bn_js_1.default.BN(value.substring(3), 16)).mul(exports.ConstantNegativeOne._bn));\n }\n else if (value.match(/^-?[0-9]*$/)) {\n if (value == '') {\n value = '0';\n }\n properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value));\n }\n }\n else if (typeof (value) === 'number') {\n if (Math.trunc(value) !== value) {\n errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: Math.trunc(value) });\n }\n try {\n properties_1.defineReadOnly(this, '_bn', 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 (bn_js_1.default.BN.isBN(value)) {\n properties_1.defineReadOnly(this, '_bn', value);\n }\n else if (_isBigNumber(value)) {\n properties_1.defineReadOnly(this, '_bn', value._bn);\n }\n else if (bytes_1.isArrayish(value)) {\n properties_1.defineReadOnly(this, '_bn', 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 new BigNumber(this._bn.fromTwos(value));\n };\n BigNumber.prototype.toTwos = function (value) {\n return new BigNumber(this._bn.toTwos(value));\n };\n BigNumber.prototype.add = function (other) {\n return new BigNumber(this._bn.add(bigNumberify(other)._bn));\n };\n BigNumber.prototype.sub = function (other) {\n return new BigNumber(this._bn.sub(bigNumberify(other)._bn));\n };\n BigNumber.prototype.div = function (other) {\n var o = bigNumberify(other)._bn;\n if (o.isZero()) {\n errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });\n }\n return new BigNumber(this._bn.div(o));\n };\n BigNumber.prototype.mul = function (other) {\n return new BigNumber(this._bn.mul(bigNumberify(other)._bn));\n };\n BigNumber.prototype.mod = function (other) {\n return new BigNumber(this._bn.mod(bigNumberify(other)._bn));\n };\n BigNumber.prototype.pow = function (other) {\n return new BigNumber(this._bn.pow(bigNumberify(other)._bn));\n };\n BigNumber.prototype.maskn = function (value) {\n return new BigNumber(this._bn.maskn(value));\n };\n BigNumber.prototype.eq = function (other) {\n return this._bn.eq(bigNumberify(other)._bn);\n };\n BigNumber.prototype.lt = function (other) {\n return this._bn.lt(bigNumberify(other)._bn);\n };\n BigNumber.prototype.lte = function (other) {\n return this._bn.lte(bigNumberify(other)._bn);\n };\n BigNumber.prototype.gt = function (other) {\n return this._bn.gt(bigNumberify(other)._bn);\n };\n BigNumber.prototype.gte = function (other) {\n return this._bn.gte(bigNumberify(other)._bn);\n };\n BigNumber.prototype.isZero = function () {\n return this._bn.isZero();\n };\n BigNumber.prototype.toNumber = function () {\n try {\n return this._bn.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 this._bn.toString(10);\n };\n BigNumber.prototype.toHexString = function () {\n var hex = this._bn.toString(16);\n if (hex.length % 2) {\n hex = '0' + hex;\n }\n return '0x' + hex;\n };\n return BigNumber;\n}());\nexports.BigNumber = BigNumber;\nfunction isBigNumber(value) {\n return (value._bn && value._bn.mod);\n}\nexports.isBigNumber = isBigNumber;\nfunction bigNumberify(value) {\n if (_isBigNumber(value)) {\n return value;\n }\n return new BigNumber(value);\n}\nexports.bigNumberify = bigNumberify;\nexports.ConstantNegativeOne = bigNumberify(-1);\nexports.ConstantZero = bigNumberify(0);\nexports.ConstantOne = bigNumberify(1);\nexports.ConstantTwo = bigNumberify(2);\nexports.ConstantWeiPerEther = bigNumberify(new bn_js_1.default.BN('1000000000000000000'));\n\n},{\"../utils/errors\":61,\"./bytes\":60,\"./properties\":65,\"bn.js\":2}],60:[function(require,module,exports){\n\"use strict\";\n/**\n * Conversion Utilities\n *\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = require(\"./errors\");\nfunction isBigNumber(value) {\n return !!value._bn;\n}\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 new Uint8Array(Array.prototype.slice.apply(array, args));\n };\n return array;\n}\nfunction isArrayish(value) {\n if (!value || parseInt(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(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 (isBigNumber(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 else if (typeof (value) === 'string') {\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 (isBigNumber(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 var hex = '';\n while (value) {\n hex = HexCharacters[value & 0x0f] + hex;\n value = Math.trunc(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, length) {\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 (length != null) {\n return '0x' + data.substring(offset, offset + 2 * length);\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 splitSignature(signature) {\n var bytes = arrayify(signature);\n if (bytes.length !== 65) {\n throw new Error('invalid signature');\n }\n var v = bytes[64];\n if (v !== 27 && v !== 28) {\n v = 27 + (v % 2);\n }\n return {\n r: hexlify(bytes.slice(0, 32)),\n s: hexlify(bytes.slice(32, 64)),\n recoveryParam: (v - 27),\n v: v\n };\n}\nexports.splitSignature = splitSignature;\nfunction joinSignature(signature) {\n return hexlify(concat([\n hexZeroPad(signature.r, 32),\n hexZeroPad(signature.s, 32),\n (signature.recoveryParam ? '0x1c' : '0x1b')\n ]));\n}\nexports.joinSignature = joinSignature;\n\n},{\"./errors\":61}],61:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\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\nexports.CALL_EXCEPTION = 'CALL_EXCEPTION';\n// Response from a server was invalid\n// - response: The body of the response\n//'BAD_RESPONSE',\n// Invalid argument (e.g. type) to a function:\n// - arg: The argument name that was invalid\n// - value: The value of the argument\n// - type: The type of the argument\n// - expected: What was expected\nexports.INVALID_ARGUMENT = 'INVALID_ARGUMENT';\n// Missing argument to a function:\n// - arg: The argument name that is required\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// Unsupported operation\n// - operation\nexports.UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION';\n// @TODO: Enum\nfunction throwError(message, code, params) {\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 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;\n\n},{}],62:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar keccak256_1 = require(\"./keccak256\");\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 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 throw new Error('contains invalid UseSTD3ASCIIRules characters');\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 var payload = 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 return keccak256_1.keccak256(payload);\n}\nexports.hashMessage = hashMessage;\n\n},{\"./bytes\":60,\"./keccak256\":64,\"./utf8\":72}],63:[function(require,module,exports){\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 });\n// This is SUPER useful, but adds 140kb (even zipped, adds 40kb)\n//var unorm = require('unorm');\nvar address_1 = require(\"./address\");\nexports.getAddress = address_1.getAddress;\nexports.getContractAddress = address_1.getContractAddress;\nexports.getIcapAddress = address_1.getIcapAddress;\nvar abi_coder_1 = require(\"./abi-coder\");\nexports.AbiCoder = abi_coder_1.AbiCoder;\nexports.defaultAbiCoder = abi_coder_1.defaultAbiCoder;\nexports.parseSignature = abi_coder_1.parseSignature;\nexports.parseParamType = abi_coder_1.parseParamType;\nvar base64 = __importStar(require(\"./base64\"));\nexports.base64 = base64;\nvar bignumber_1 = require(\"./bignumber\");\nexports.BigNumber = bignumber_1.BigNumber;\nexports.bigNumberify = bignumber_1.bigNumberify;\nvar bytes_1 = require(\"./bytes\");\nexports.arrayify = bytes_1.arrayify;\nexports.concat = bytes_1.concat;\nexports.hexlify = bytes_1.hexlify;\nexports.joinSignature = bytes_1.joinSignature;\nexports.padZeros = bytes_1.padZeros;\nexports.splitSignature = bytes_1.splitSignature;\nexports.stripZeros = bytes_1.stripZeros;\nvar hash_1 = require(\"./hash\");\nexports.hashMessage = hash_1.hashMessage;\nexports.id = hash_1.id;\nexports.namehash = hash_1.namehash;\nvar keccak256_1 = require(\"./keccak256\");\nexports.keccak256 = keccak256_1.keccak256;\nvar sha2_1 = require(\"./sha2\");\nexports.sha256 = sha2_1.sha256;\nvar solidity_1 = require(\"./solidity\");\nexports.solidityKeccak256 = solidity_1.keccak256;\nexports.solidityPack = solidity_1.pack;\nexports.soliditySha256 = solidity_1.sha256;\nvar random_bytes_1 = require(\"./random-bytes\");\nexports.randomBytes = random_bytes_1.randomBytes;\nvar properties_1 = require(\"./properties\");\nexports.defineFrozen = properties_1.defineFrozen;\nexports.defineReadOnly = properties_1.defineReadOnly;\nexports.resolveProperties = properties_1.resolveProperties;\nexports.shallowCopy = properties_1.shallowCopy;\nvar RLP = __importStar(require(\"./rlp\"));\nexports.RLP = RLP;\nvar utf8_1 = require(\"./utf8\");\nexports.toUtf8Bytes = utf8_1.toUtf8Bytes;\nexports.toUtf8String = utf8_1.toUtf8String;\nvar units_1 = require(\"./units\");\nexports.formatEther = units_1.formatEther;\nexports.parseEther = units_1.parseEther;\nexports.formatUnits = units_1.formatUnits;\nexports.parseUnits = units_1.parseUnits;\nvar web_1 = require(\"./web\");\nexports.fetchJson = web_1.fetchJson;\nvar transaction_1 = require(\"./transaction\");\nexports.parseTransaction = transaction_1.parse;\nvar errors = __importStar(require(\"./errors\"));\nexports.errors = errors;\n// NFKD (decomposed)\n//const etherSymbol = '\\uD835\\uDF63';\n// NFKC (composed)\nvar etherSymbol = '\\u039e';\nexports.etherSymbol = etherSymbol;\n\n},{\"./abi-coder\":57,\"./address\":58,\"./base64\":40,\"./bignumber\":59,\"./bytes\":60,\"./errors\":61,\"./hash\":62,\"./keccak256\":64,\"./properties\":65,\"./random-bytes\":44,\"./rlp\":66,\"./sha2\":68,\"./solidity\":69,\"./transaction\":70,\"./units\":71,\"./utf8\":72,\"./web\":73}],64:[function(require,module,exports){\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\n},{\"./bytes\":60,\"js-sha3\":33}],65:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\nexports.defineReadOnly = defineReadOnly;\nfunction defineFrozen(object, name, value) {\n var frozen = JSON.stringify(value);\n Object.defineProperty(object, name, {\n enumerable: true,\n get: function () { return JSON.parse(frozen); }\n });\n}\nexports.defineFrozen = defineFrozen;\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) { result[key] = value; }));\n }\n else {\n result[key] = value;\n }\n });\n return Promise.all(promises).then(function () {\n return object;\n });\n}\nexports.resolveProperties = resolveProperties;\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;\nfunction jsonCopy(object) {\n return JSON.parse(JSON.stringify(object));\n}\nexports.jsonCopy = jsonCopy;\n\n},{}],66:[function(require,module,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 else {\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 }\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\n},{\"./bytes\":60}],67:[function(require,module,exports){\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 address_1 = require(\"./address\");\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar properties_1 = require(\"./properties\");\nvar errors = __importStar(require(\"./errors\"));\nvar elliptic = __importStar(require(\"elliptic\"));\nvar curve = new elliptic.ec('secp256k1');\nexports.N = '0x' + curve.n.toString(16);\nvar KeyPair = /** @class */ (function () {\n function KeyPair(privateKey) {\n var keyPair = curve.keyFromPrivate(bytes_1.arrayify(privateKey));\n properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(keyPair.priv.toArray('be', 32)));\n properties_1.defineReadOnly(this, 'publicKey', '0x' + keyPair.getPublic(false, 'hex'));\n properties_1.defineReadOnly(this, 'compressedPublicKey', '0x' + keyPair.getPublic(true, 'hex'));\n properties_1.defineReadOnly(this, 'publicKeyBytes', keyPair.getPublic().encode(null, true));\n }\n KeyPair.prototype.sign = function (digest) {\n var keyPair = curve.keyFromPrivate(bytes_1.arrayify(this.privateKey));\n var signature = keyPair.sign(bytes_1.arrayify(digest), { canonical: true });\n return {\n recoveryParam: signature.recoveryParam,\n r: bytes_1.hexZeroPad('0x' + signature.r.toString(16), 32),\n s: bytes_1.hexZeroPad('0x' + signature.s.toString(16), 32),\n v: 27 + signature.recoveryParam\n };\n };\n return KeyPair;\n}());\nexports.KeyPair = KeyPair;\nfunction recoverPublicKey(digest, signature) {\n var sig = {\n r: bytes_1.arrayify(signature.r),\n s: bytes_1.arrayify(signature.s)\n };\n return '0x' + curve.recoverPubKey(bytes_1.arrayify(digest), sig, signature.recoveryParam).encode('hex', false);\n}\nexports.recoverPublicKey = recoverPublicKey;\nfunction computePublicKey(key, compressed) {\n var bytes = bytes_1.arrayify(key);\n if (bytes.length === 32) {\n var keyPair = new KeyPair(bytes);\n if (compressed) {\n return keyPair.compressedPublicKey;\n }\n return keyPair.publicKey;\n }\n else if (bytes.length === 33) {\n if (compressed) {\n return bytes_1.hexlify(bytes);\n }\n return '0x' + curve.keyFromPublic(bytes).getPublic(false, 'hex');\n }\n else if (bytes.length === 65) {\n if (!compressed) {\n return bytes_1.hexlify(bytes);\n }\n return '0x' + curve.keyFromPublic(bytes).getPublic(true, 'hex');\n }\n errors.throwError('invalid public or private key', errors.INVALID_ARGUMENT, { arg: 'key', value: '[REDACTED]' });\n return null;\n}\nexports.computePublicKey = computePublicKey;\nfunction recoverAddress(digest, signature) {\n return computeAddress(recoverPublicKey(digest, signature));\n}\nexports.recoverAddress = recoverAddress;\nfunction computeAddress(key) {\n // Strip off the leading \"0x04\"\n var publicKey = '0x' + computePublicKey(key).slice(4);\n return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));\n}\nexports.computeAddress = computeAddress;\n\n},{\"./address\":58,\"./bytes\":60,\"./errors\":61,\"./keccak256\":64,\"./properties\":65,\"elliptic\":5}],68:[function(require,module,exports){\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 _hash = __importStar(require(\"hash.js\"));\nvar bytes_1 = require(\"./bytes\");\nvar _sha256 = _hash['sha256'];\nvar _sha512 = _hash['sha512'];\nfunction sha256(data) {\n return '0x' + (_sha256().update(bytes_1.arrayify(data)).digest('hex'));\n}\nexports.sha256 = sha256;\nfunction sha512(data) {\n return '0x' + (_sha512().update(bytes_1.arrayify(data)).digest('hex'));\n}\nexports.sha512 = sha512;\n\n},{\"./bytes\":60,\"hash.js\":20}],69:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar keccak256_1 = require(\"./keccak256\");\nvar sha2_1 = require(\"./sha2\");\nvar regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nvar regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nvar regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\nvar Zeros = '0000000000000000000000000000000000000000000000000000000000000000';\nfunction _pack(type, value, isArray) {\n switch (type) {\n case 'address':\n if (isArray) {\n return bytes_1.padZeros(value, 32);\n }\n return bytes_1.arrayify(value);\n case 'string':\n return utf8_1.toUtf8Bytes(value);\n case 'bytes':\n return bytes_1.arrayify(value);\n case 'bool':\n value = (value ? '0x01' : '0x00');\n if (isArray) {\n return bytes_1.padZeros(value, 32);\n }\n return bytes_1.arrayify(value);\n }\n var match = type.match(regexNumber);\n if (match) {\n //var signed = (match[1] === 'int')\n var size = parseInt(match[2] || \"256\");\n if ((size % 8 != 0) || size === 0 || size > 256) {\n throw new Error('invalid number type - ' + type);\n }\n if (isArray) {\n size = 256;\n }\n value = bignumber_1.bigNumberify(value).toTwos(size);\n return bytes_1.padZeros(value, size / 8);\n }\n match = type.match(regexBytes);\n if (match) {\n var size = parseInt(match[1]);\n if (String(size) != match[1] || size === 0 || size > 32) {\n throw new Error('invalid number type - ' + type);\n }\n if (bytes_1.arrayify(value).byteLength !== size) {\n throw new Error('invalid value for ' + type);\n }\n if (isArray) {\n return bytes_1.arrayify((value + Zeros).substring(0, 66));\n }\n return value;\n }\n match = type.match(regexArray);\n if (match) {\n var baseType = match[1];\n var count = parseInt(match[2] || value.length);\n if (count != value.length) {\n throw new Error('invalid value for ' + type);\n }\n var result = [];\n value.forEach(function (value) {\n value = _pack(baseType, value, true);\n result.push(value);\n });\n return bytes_1.concat(result);\n }\n throw new Error('unknown type - ' + type);\n}\n// @TODO: Array Enum\nfunction pack(types, values) {\n if (types.length != values.length) {\n throw new Error('type/value count mismatch');\n }\n var tight = [];\n types.forEach(function (type, index) {\n tight.push(_pack(type, values[index]));\n });\n return bytes_1.hexlify(bytes_1.concat(tight));\n}\nexports.pack = pack;\nfunction keccak256(types, values) {\n return keccak256_1.keccak256(pack(types, values));\n}\nexports.keccak256 = keccak256;\nfunction sha256(types, values) {\n return sha2_1.sha256(pack(types, values));\n}\nexports.sha256 = sha256;\n\n},{\"./bignumber\":59,\"./bytes\":60,\"./keccak256\":64,\"./sha2\":68,\"./utf8\":72}],70:[function(require,module,exports){\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 address_1 = require(\"./address\");\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar secp256k1_1 = require(\"./secp256k1\");\nvar RLP = __importStar(require(\"./rlp\"));\nfunction handleAddress(value) {\n if (value === '0x') {\n return null;\n }\n return address_1.getAddress(value);\n}\nfunction handleNumber(value) {\n if (value === '0x') {\n return bignumber_1.ConstantZero;\n }\n return bignumber_1.bigNumberify(value);\n}\nvar transactionFields = [\n { name: 'nonce', maxLength: 32 },\n { name: 'gasPrice', maxLength: 32 },\n { name: 'gasLimit', maxLength: 32 },\n { name: 'to', length: 20 },\n { name: 'value', maxLength: 32 },\n { name: 'data' },\n];\nfunction sign(transaction, signDigest) {\n var raw = [];\n transactionFields.forEach(function (fieldInfo) {\n var value = transaction[fieldInfo.name] || ([]);\n value = bytes_1.arrayify(bytes_1.hexlify(value));\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n var error = new Error('invalid ' + fieldInfo.name);\n error.reason = 'wrong length';\n error.value = value;\n throw error;\n }\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = bytes_1.stripZeros(value);\n if (value.length > fieldInfo.maxLength) {\n var error = new Error('invalid ' + fieldInfo.name);\n error.reason = 'too long';\n error.value = value;\n throw error;\n }\n }\n raw.push(bytes_1.hexlify(value));\n });\n // @TOOD:\n throw new Error('implement');\n // Requesting an unsigned transation\n if (!signDigest) {\n var v_1 = 27 + signature.recoveryParam;\n if (transaction.chainId) {\n v_1 += transaction.chainId * 2 + 8;\n }\n //raw.push(hexlify(transaction.chainId));\n raw.push(bytes_1.hexlify(v_1));\n raw.push('0x');\n raw.push('0x');\n }\n if (transaction.chainId) {\n raw.push(bytes_1.hexlify(transaction.chainId));\n raw.push('0x');\n raw.push('0x');\n }\n var digest = keccak256_1.keccak256(RLP.encode(raw));\n var signature = signDigest(digest);\n var v = 27 + signature.recoveryParam;\n if (transaction.chainId) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += transaction.chainId * 2 + 8;\n }\n raw.push(bytes_1.hexlify(v));\n raw.push(bytes_1.stripZeros(bytes_1.arrayify(signature.r)));\n raw.push(bytes_1.stripZeros(bytes_1.arrayify(signature.s)));\n return RLP.encode(raw);\n}\nexports.sign = sign;\nfunction parse(rawTransaction) {\n var signedTransaction = RLP.decode(rawTransaction);\n if (signedTransaction.length !== 9) {\n throw new Error('invalid transaction');\n }\n var tx = {\n nonce: handleNumber(signedTransaction[0]).toNumber(),\n gasPrice: handleNumber(signedTransaction[1]),\n gasLimit: handleNumber(signedTransaction[2]),\n to: handleAddress(signedTransaction[3]),\n value: handleNumber(signedTransaction[4]),\n data: signedTransaction[5],\n chainId: 0\n };\n var v = bytes_1.arrayify(signedTransaction[6]);\n var r = bytes_1.arrayify(signedTransaction[7]);\n var s = bytes_1.arrayify(signedTransaction[8]);\n if (v.length >= 1 && r.length >= 1 && r.length <= 32 && s.length >= 1 && s.length <= 32) {\n tx.v = bignumber_1.bigNumberify(v).toNumber();\n tx.r = bytes_1.hexZeroPad(signedTransaction[7], 32);\n tx.s = bytes_1.hexZeroPad(signedTransaction[8], 32);\n var chainId = (tx.v - 35) / 2;\n if (chainId < 0) {\n chainId = 0;\n }\n chainId = Math.trunc(chainId);\n tx.chainId = chainId;\n var recoveryParam = tx.v - 27;\n var raw = signedTransaction.slice(0, 6);\n if (chainId) {\n raw.push(bytes_1.hexlify(chainId));\n raw.push('0x');\n raw.push('0x');\n recoveryParam -= chainId * 2 + 8;\n }\n var digest = keccak256_1.keccak256(RLP.encode(raw));\n try {\n tx.from = secp256k1_1.recoverAddress(digest, { r: bytes_1.hexlify(r), s: bytes_1.hexlify(s), recoveryParam: recoveryParam });\n }\n catch (error) {\n console.log(error);\n }\n tx.hash = keccak256_1.keccak256(rawTransaction);\n }\n return tx;\n}\nexports.parse = parse;\n\n},{\"./address\":58,\"./bignumber\":59,\"./bytes\":60,\"./keccak256\":64,\"./rlp\":66,\"./secp256k1\":67}],71:[function(require,module,exports){\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 bignumber_1 = require(\"./bignumber\");\nvar errors = __importStar(require(\"./errors\"));\nvar names = [\n 'wei',\n 'kwei',\n 'Mwei',\n 'Gwei',\n 'szabo',\n 'finny',\n 'ether',\n];\nvar getUnitInfo = (function () {\n var unitInfos = {};\n function getUnitInfo(value) {\n return {\n decimals: value.length - 1,\n tenPower: bignumber_1.bigNumberify(value)\n };\n }\n // Cache the common units\n var value = '1';\n names.forEach(function (name) {\n var info = getUnitInfo(value);\n unitInfos[name.toLowerCase()] = info;\n unitInfos[String(info.decimals)] = info;\n value += '000';\n });\n return function (name) {\n // Try the cache\n var info = unitInfos[String(name).toLowerCase()];\n if (!info && typeof (name) === 'number' && Math.trunc(name) == name && name >= 0 && name <= 256) {\n var value = '1';\n for (var i = 0; i < name; i++) {\n value += '0';\n }\n info = getUnitInfo(value);\n }\n // Make sure we got something\n if (!info) {\n errors.throwError('invalid unitType', errors.INVALID_ARGUMENT, { arg: 'name', value: name });\n }\n return info;\n };\n})();\nfunction formatUnits(value, unitType, options) {\n /*\n if (typeof(unitType) === 'object' && !options) {\n options = unitType;\n unitType = undefined;\n }\n if (unitType == null) { unitType = 18; }\n */\n if (!options) {\n options = {};\n }\n var unitInfo = getUnitInfo(unitType);\n // Make sure wei is a big number (convert as necessary)\n value = bignumber_1.bigNumberify(value);\n var negative = value.lt(bignumber_1.ConstantZero);\n if (negative) {\n value = value.mul(bignumber_1.ConstantNegativeOne);\n }\n var fraction = value.mod(unitInfo.tenPower).toString();\n while (fraction.length < unitInfo.decimals) {\n fraction = '0' + fraction;\n }\n // Strip off trailing zeros (but keep one if would otherwise be bare decimal point)\n if (!options.pad) {\n fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];\n }\n var whole = value.div(unitInfo.tenPower).toString();\n if (options.commify) {\n whole = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n }\n value = whole + '.' + fraction;\n if (negative) {\n value = '-' + value;\n }\n return value;\n}\nexports.formatUnits = formatUnits;\nfunction parseUnits(value, unitType) {\n if (unitType == null) {\n unitType = 18;\n }\n var unitInfo = getUnitInfo(unitType);\n if (typeof (value) !== 'string' || !value.match(/^-?[0-9.,]+$/)) {\n errors.throwError('invalid decimal value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n // Remove commas\n var value = value.replace(/,/g, '');\n // Is it negative?\n var negative = (value.substring(0, 1) === '-');\n if (negative) {\n value = value.substring(1);\n }\n if (value === '.') {\n errors.throwError('missing value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n // Split it into a whole and fractional part\n var comps = value.split('.');\n if (comps.length > 2) {\n errors.throwError('too many decimal points', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n var whole = comps[0], fraction = comps[1];\n if (!whole) {\n whole = '0';\n }\n if (!fraction) {\n fraction = '0';\n }\n // Prevent underflow\n if (fraction.length > unitInfo.decimals) {\n errors.throwError('underflow occurred', errors.NUMERIC_FAULT, { operation: 'division', fault: \"underflow\" });\n }\n // Fully pad the string with zeros to get to wei\n while (fraction.length < unitInfo.decimals) {\n fraction += '0';\n }\n var wholeValue = bignumber_1.bigNumberify(whole);\n var fractionValue = bignumber_1.bigNumberify(fraction);\n var wei = (wholeValue.mul(unitInfo.tenPower)).add(fractionValue);\n if (negative) {\n wei = wei.mul(bignumber_1.ConstantNegativeOne);\n }\n return wei;\n}\nexports.parseUnits = parseUnits;\nfunction formatEther(wei, options) {\n return formatUnits(wei, 18, options);\n}\nexports.formatEther = formatEther;\nfunction parseEther(ether) {\n return parseUnits(ether, 18);\n}\nexports.parseEther = parseEther;\n\n},{\"./bignumber\":59,\"./errors\":61}],72:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"./bytes\");\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 str = str.normalize(form);\n }\n var result = [];\n var offset = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 128) {\n result[offset++] = c;\n }\n else if (c < 2048) {\n result[offset++] = (c >> 6) | 192;\n result[offset++] = (c & 63) | 128;\n }\n else if (((c & 0xFC00) == 0xD800) && (i + 1) < str.length && ((str.charCodeAt(i + 1) & 0xFC00) == 0xDC00)) {\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF);\n result[offset++] = (c >> 18) | 240;\n result[offset++] = ((c >> 12) & 63) | 128;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n }\n else {\n result[offset++] = (c >> 12) | 224;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\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) {\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 if (c >> 7 == 0) {\n // 0xxx xxxx\n result += String.fromCharCode(c);\n continue;\n }\n // Invalid starting byte\n if (c >> 6 == 0x02) {\n continue;\n }\n // Multibyte; how many bytes left for thus character?\n var extraLength = null;\n if (c >> 5 == 0x06) {\n extraLength = 1;\n }\n else if (c >> 4 == 0x0e) {\n extraLength = 2;\n }\n else if (c >> 3 == 0x1e) {\n extraLength = 3;\n }\n else if (c >> 2 == 0x3e) {\n extraLength = 4;\n }\n else if (c >> 1 == 0x7e) {\n extraLength = 5;\n }\n else {\n continue;\n }\n // Do we have enough bytes in our data?\n if (i + extraLength > bytes.length) {\n // If there is an invalid unprocessed byte, try to continue\n for (; i < bytes.length; i++) {\n if (bytes[i] >> 6 != 0x02) {\n break;\n }\n }\n if (i != bytes.length)\n continue;\n // All leftover bytes are valid.\n return result;\n }\n // Remove the UTF-8 prefix from the char (res)\n var res = c & ((1 << (8 - extraLength - 1)) - 1);\n var count;\n for (count = 0; count < extraLength; count++) {\n var nextChar = bytes[i++];\n // Is the char valid multibyte part?\n if (nextChar >> 6 != 0x02) {\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n }\n if (count != extraLength) {\n i--;\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;\n\n},{\"./bytes\":60}],73:[function(require,module,exports){\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 xmlhttprequest_1 = require(\"xmlhttprequest\");\nvar utf8_1 = require(\"./utf8\");\nvar base64_1 = require(\"./base64\");\nvar errors = __importStar(require(\"./errors\"));\nfunction fetchJson(url, json, processFunc) {\n var headers = [];\n if (typeof (url) === 'object' && url.url != null) {\n if (url.url == null) {\n errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });\n }\n if (url.user != null && url.password != null) {\n if (url.url.substring(0, 6) !== 'https:' && url.allowInsecure !== true) {\n errors.throwError('basic authentication requires a secure https url', errors.INVALID_ARGUMENT, { arg: 'url', url: url.url, user: url.user, password: '[REDACTED]' });\n }\n var authorization = url.user + ':' + url.password;\n headers.push({\n key: 'Authorization',\n value: 'Basic ' + base64_1.encode(utf8_1.toUtf8Bytes(authorization))\n });\n }\n url = url.url;\n }\n return new Promise(function (resolve, reject) {\n var request = new xmlhttprequest_1.XMLHttpRequest();\n if (json) {\n request.open('POST', url, true);\n headers.push({ key: 'Content-Type', value: 'application/json' });\n }\n else {\n request.open('GET', url, true);\n }\n headers.forEach(function (header) {\n request.setRequestHeader(header.key, header.value);\n });\n request.onreadystatechange = function () {\n if (request.readyState !== 4) {\n return;\n }\n try {\n var result = JSON.parse(request.responseText);\n }\n catch (error) {\n // @TODO: not any!\n var jsonError = new Error('invalid json response');\n jsonError.orginialError = error;\n jsonError.responseText = request.responseText;\n jsonError.url = url;\n reject(jsonError);\n return;\n }\n if (processFunc) {\n try {\n result = processFunc(result);\n }\n catch (error) {\n error.url = url;\n error.body = json;\n error.responseText = request.responseText;\n reject(error);\n return;\n }\n }\n if (request.status != 200) {\n // @TODO: not any!\n var error = new Error('invalid response - ' + request.status);\n error.statusCode = request.statusCode;\n reject(error);\n return;\n }\n resolve(result);\n };\n request.onerror = function (error) {\n reject(error);\n };\n try {\n if (json) {\n request.send(json);\n }\n else {\n request.send();\n }\n }\n catch (error) {\n // @TODO: not any!\n var connectionError = new Error('connection error');\n connectionError.error = error;\n reject(connectionError);\n }\n });\n}\nexports.fetchJson = fetchJson;\n\n},{\"./base64\":40,\"./errors\":61,\"./utf8\":72,\"xmlhttprequest\":45}],74:[function(require,module,exports){\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 });\n// See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki\n// See: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\n// The English language word list.\n// For additional word lists, please see /src.tc/wordlists/\nvar lang_en_1 = require(\"../wordlists/lang-en\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar pbkdf2_1 = require(\"../utils/pbkdf2\");\nvar hmac_1 = require(\"../utils/hmac\");\nvar properties_1 = require(\"../utils/properties\");\nvar secp256k1_1 = require(\"../utils/secp256k1\");\nvar sha2_1 = require(\"../utils/sha2\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// \"Bitcoin seed\"\nvar MasterSecret = utf8_1.toUtf8Bytes('Bitcoin seed');\nvar HardenedBit = 0x80000000;\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits) {\n return ((1 << bits) - 1) << (8 - bits);\n}\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits) {\n return (1 << bits) - 1;\n}\nexports.defaultPath = \"m/44'/60'/0'/0/0\";\nvar HDNode = /** @class */ (function () {\n /**\n * This constructor should not be called directly.\n *\n * Please use:\n * - fromMnemonic\n * - fromSeed\n */\n function HDNode(privateKey, chainCode, index, depth, mnemonic, path) {\n errors.checkNew(this, HDNode);\n properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKey));\n properties_1.defineReadOnly(this, 'privateKey', this.keyPair.privateKey);\n properties_1.defineReadOnly(this, 'publicKey', this.keyPair.compressedPublicKey);\n properties_1.defineReadOnly(this, 'chainCode', bytes_1.hexlify(chainCode));\n properties_1.defineReadOnly(this, 'index', index);\n properties_1.defineReadOnly(this, 'depth', depth);\n properties_1.defineReadOnly(this, 'mnemonic', mnemonic);\n properties_1.defineReadOnly(this, 'path', path);\n }\n HDNode.prototype._derive = function (index) {\n // Public parent key -> public child key\n if (!this.privateKey) {\n if (index >= HardenedBit) {\n throw new Error('cannot derive child of neutered node');\n }\n throw new Error('not implemented');\n }\n var data = new Uint8Array(37);\n // Base path\n var mnemonic = this.mnemonic;\n var path = this.path;\n if (path) {\n path += '/' + index;\n }\n if (index & HardenedBit) {\n // Data = 0x00 || ser_256(k_par)\n data.set(bytes_1.arrayify(this.privateKey), 1);\n // Hardened path\n if (path) {\n path += \"'\";\n }\n }\n else {\n // Data = ser_p(point(k_par))\n data.set(this.keyPair.publicKeyBytes);\n }\n // Data += ser_32(i)\n for (var i = 24; i >= 0; i -= 8) {\n data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);\n }\n var I = hmac_1.computeHmac('sha512', this.chainCode, data);\n var IL = bignumber_1.bigNumberify(I.slice(0, 32));\n var IR = I.slice(32);\n var ki = IL.add(this.keyPair.privateKey).mod(secp256k1_1.N);\n return new HDNode(bytes_1.arrayify(ki), IR, index, this.depth + 1, mnemonic, path);\n };\n HDNode.prototype.derivePath = function (path) {\n var components = path.split('/');\n if (components.length === 0 || (components[0] === 'm' && this.depth !== 0)) {\n throw new Error('invalid path');\n }\n if (components[0] === 'm') {\n components.shift();\n }\n var result = this;\n for (var i = 0; i < components.length; i++) {\n var component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n var index = parseInt(component.substring(0, component.length - 1));\n if (index >= HardenedBit) {\n throw new Error('invalid path index - ' + component);\n }\n result = result._derive(HardenedBit + index);\n }\n else if (component.match(/^[0-9]+$/)) {\n var index = parseInt(component);\n if (index >= HardenedBit) {\n throw new Error('invalid path index - ' + component);\n }\n result = result._derive(index);\n }\n else {\n throw new Error('invlaid path component - ' + component);\n }\n }\n return result;\n };\n return HDNode;\n}());\nexports.HDNode = HDNode;\nfunction _fromSeed(seed, mnemonic) {\n var seedArray = bytes_1.arrayify(seed);\n if (seedArray.length < 16 || seedArray.length > 64) {\n throw new Error('invalid seed');\n }\n var I = bytes_1.arrayify(hmac_1.computeHmac('sha512', MasterSecret, seedArray));\n return new HDNode(I.slice(0, 32), I.slice(32), 0, 0, mnemonic, 'm');\n}\nfunction fromMnemonic(mnemonic, wordlist) {\n // Check that the checksum s valid (will throw an error)\n mnemonicToEntropy(mnemonic, wordlist);\n return _fromSeed(mnemonicToSeed(mnemonic), mnemonic);\n}\nexports.fromMnemonic = fromMnemonic;\nfunction fromSeed(seed) {\n return _fromSeed(seed, null);\n}\nexports.fromSeed = fromSeed;\nfunction mnemonicToSeed(mnemonic, password) {\n if (!password) {\n password = '';\n }\n var salt = utf8_1.toUtf8Bytes('mnemonic' + password, utf8_1.UnicodeNormalizationForm.NFKD);\n return bytes_1.hexlify(pbkdf2_1.pbkdf2(utf8_1.toUtf8Bytes(mnemonic, utf8_1.UnicodeNormalizationForm.NFKD), salt, 2048, 64, 'sha512'));\n}\nexports.mnemonicToSeed = mnemonicToSeed;\nfunction mnemonicToEntropy(mnemonic, wordlist) {\n if (!wordlist) {\n wordlist = lang_en_1.langEn;\n }\n var words = wordlist.split(mnemonic);\n if ((words.length % 3) !== 0) {\n throw new Error('invalid mnemonic');\n }\n var entropy = bytes_1.arrayify(new Uint8Array(Math.ceil(11 * words.length / 8)));\n var offset = 0;\n for (var i = 0; i < words.length; i++) {\n var index = wordlist.getWordIndex(words[i].normalize('NFKD'));\n if (index === -1) {\n throw new Error('invalid mnemonic');\n }\n for (var bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n var entropyBits = 32 * words.length / 3;\n var checksumBits = words.length / 3;\n var checksumMask = getUpperMask(checksumBits);\n var checksum = bytes_1.arrayify(sha2_1.sha256(entropy.slice(0, entropyBits / 8)))[0];\n checksum &= checksumMask;\n if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {\n throw new Error('invalid checksum');\n }\n return bytes_1.hexlify(entropy.slice(0, entropyBits / 8));\n}\nexports.mnemonicToEntropy = mnemonicToEntropy;\nfunction entropyToMnemonic(entropy, wordlist) {\n entropy = bytes_1.arrayify(entropy);\n if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) {\n throw new Error('invalid entropy');\n }\n var indices = [0];\n var remainingBits = 11;\n for (var i = 0; i < entropy.length; i++) {\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n remainingBits -= 8;\n // This byte will complete an 11-bit index\n }\n else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n remainingBits += 3;\n }\n }\n // Compute the checksum bits\n var checksum = bytes_1.arrayify(sha2_1.sha256(entropy))[0];\n var checksumBits = entropy.length / 4;\n checksum &= getUpperMask(checksumBits);\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n if (!wordlist) {\n wordlist = lang_en_1.langEn;\n }\n return wordlist.join(indices.map(function (index) { return wordlist.getWord(index); }));\n}\nexports.entropyToMnemonic = entropyToMnemonic;\nfunction isValidMnemonic(mnemonic, wordlist) {\n try {\n mnemonicToEntropy(mnemonic, wordlist);\n return true;\n }\n catch (error) { }\n return false;\n}\nexports.isValidMnemonic = isValidMnemonic;\n\n},{\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/hmac\":42,\"../utils/pbkdf2\":43,\"../utils/properties\":65,\"../utils/secp256k1\":67,\"../utils/sha2\":68,\"../utils/utf8\":72,\"../wordlists/lang-en\":79}],75:[function(require,module,exports){\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 wallet_1 = require(\"./wallet\");\nexports.Wallet = wallet_1.Wallet;\nvar HDNode = __importStar(require(\"./hdnode\"));\nexports.HDNode = HDNode;\nvar signing_key_1 = require(\"./signing-key\");\nexports.SigningKey = signing_key_1.SigningKey;\n\n},{\"./hdnode\":74,\"./signing-key\":77,\"./wallet\":78}],76:[function(require,module,exports){\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 aes = require(\"aes-js\");\nvar scrypt = require(\"scrypt-js\");\nvar uuid = require(\"uuid\");\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar pbkdf2_1 = require(\"../utils/pbkdf2\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar random_bytes_1 = require(\"../utils/random-bytes\");\nvar signing_key_1 = require(\"./signing-key\");\nvar HDNode = __importStar(require(\"./hdnode\"));\n// @TODO: Maybe move this to HDNode?\nvar defaultPath = \"m/44'/60'/0'/0/0\";\nfunction looseArrayify(hexString) {\n if (typeof (hexString) === 'string' && hexString.substring(0, 2) !== '0x') {\n hexString = '0x' + hexString;\n }\n return bytes_1.arrayify(hexString);\n}\nfunction zpad(value, length) {\n value = String(value);\n while (value.length < length) {\n value = '0' + value;\n }\n return value;\n}\nfunction getPassword(password) {\n if (typeof (password) === 'string') {\n return utf8_1.toUtf8Bytes(password, utf8_1.UnicodeNormalizationForm.NFKC);\n }\n return bytes_1.arrayify(password);\n}\n// Search an Object and its children recursively, caselessly.\nfunction searchPath(object, path) {\n var currentChild = object;\n var comps = path.toLowerCase().split('/');\n for (var i = 0; i < comps.length; i++) {\n // Search for a child object with a case-insensitive matching key\n var matchingChild = null;\n for (var key in currentChild) {\n if (key.toLowerCase() === comps[i]) {\n matchingChild = currentChild[key];\n break;\n }\n }\n // Didn't find one. :'(\n if (matchingChild === null) {\n return null;\n }\n // Now check this child...\n currentChild = matchingChild;\n }\n return currentChild;\n}\nfunction isCrowdsaleWallet(json) {\n try {\n var data = JSON.parse(json);\n }\n catch (error) {\n return false;\n }\n return (data.encseed && data.ethaddr);\n}\nexports.isCrowdsaleWallet = isCrowdsaleWallet;\nfunction isValidWallet(json) {\n try {\n var data = JSON.parse(json);\n }\n catch (error) {\n return false;\n }\n if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) {\n return false;\n }\n // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff\n return true;\n}\nexports.isValidWallet = isValidWallet;\n// @TODO: Make a type for string or arrayish\n// See: https://github.com/ethereum/pyethsaletool\nfunction decryptCrowdsale(json, password) {\n var data = JSON.parse(json);\n password = getPassword(password);\n // Ethereum Address\n var ethaddr = address_1.getAddress(searchPath(data, 'ethaddr'));\n // Encrypted Seed\n var encseed = looseArrayify(searchPath(data, 'encseed'));\n if (!encseed || (encseed.length % 16) !== 0) {\n throw new Error('invalid encseed');\n }\n var key = pbkdf2_1.pbkdf2(password, password, 2000, 32, 'sha256').slice(0, 16);\n var iv = encseed.slice(0, 16);\n var encryptedSeed = encseed.slice(16);\n // Decrypt the seed\n var aesCbc = new aes.ModeOfOperation.cbc(key, iv);\n var seed = bytes_1.arrayify(aesCbc.decrypt(encryptedSeed));\n seed = aes.padding.pkcs7.strip(seed);\n // This wallet format is weird... Convert the binary encoded hex to a string.\n var seedHex = '';\n for (var i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n var seedHexBytes = utf8_1.toUtf8Bytes(seedHex);\n var signingKey = new signing_key_1.SigningKey(keccak256_1.keccak256(seedHexBytes));\n if (signingKey.address !== ethaddr) {\n throw new Error('corrupt crowdsale wallet');\n }\n return signingKey;\n}\nexports.decryptCrowdsale = decryptCrowdsale;\n//@TODO: string or arrayish\nfunction decrypt(json, password, progressCallback) {\n var data = JSON.parse(json);\n password = getPassword(password);\n var decrypt = function (key, ciphertext) {\n var cipher = searchPath(data, 'crypto/cipher');\n if (cipher === 'aes-128-ctr') {\n var iv = looseArrayify(searchPath(data, 'crypto/cipherparams/iv'));\n var counter = new aes.Counter(iv);\n var aesCtr = new aes.ModeOfOperation.ctr(key, counter);\n return bytes_1.arrayify(aesCtr.decrypt(ciphertext));\n }\n return null;\n };\n var computeMAC = function (derivedHalf, ciphertext) {\n return keccak256_1.keccak256(bytes_1.concat([derivedHalf, ciphertext]));\n };\n var getSigningKey = function (key, reject) {\n var ciphertext = looseArrayify(searchPath(data, 'crypto/ciphertext'));\n var computedMAC = bytes_1.hexlify(computeMAC(key.slice(16, 32), ciphertext)).substring(2);\n if (computedMAC !== searchPath(data, 'crypto/mac').toLowerCase()) {\n reject(new Error('invalid password'));\n return null;\n }\n var privateKey = decrypt(key.slice(0, 16), ciphertext);\n var mnemonicKey = key.slice(32, 64);\n if (!privateKey) {\n reject(new Error('unsupported cipher'));\n return null;\n }\n var signingKey = new signing_key_1.SigningKey(privateKey);\n if (signingKey.address !== address_1.getAddress(data.address)) {\n reject(new Error('address mismatch'));\n return null;\n }\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n if (searchPath(data, 'x-ethers/version') === '0.1') {\n var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext'));\n var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter'));\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n var path = searchPath(data, 'x-ethers/path') || defaultPath;\n var entropy = bytes_1.arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext));\n var mnemonic = HDNode.entropyToMnemonic(entropy);\n var node = HDNode.fromMnemonic(mnemonic).derivePath(path);\n if (node.privateKey != bytes_1.hexlify(privateKey)) {\n reject(new Error('mnemonic mismatch'));\n return null;\n }\n signingKey = new signing_key_1.SigningKey(node);\n }\n return signingKey;\n };\n return new Promise(function (resolve, reject) {\n var kdf = searchPath(data, 'crypto/kdf');\n if (kdf && typeof (kdf) === 'string') {\n if (kdf.toLowerCase() === 'scrypt') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n var N = parseInt(searchPath(data, 'crypto/kdfparams/n'));\n var r = parseInt(searchPath(data, 'crypto/kdfparams/r'));\n var p = parseInt(searchPath(data, 'crypto/kdfparams/p'));\n if (!N || !r || !p) {\n reject(new Error('unsupported key-derivation function parameters'));\n return;\n }\n // Make sure N is a power of 2\n if ((N & (N - 1)) !== 0) {\n reject(new Error('unsupported key-derivation function parameter value for N'));\n return;\n }\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject(new Error('unsupported key-derivation derived-key length'));\n return;\n }\n scrypt(password, salt, N, r, p, 64, function (error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n }\n else if (key) {\n key = bytes_1.arrayify(key);\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) {\n return;\n }\n if (progressCallback) {\n progressCallback(1);\n }\n resolve(signingKey);\n }\n else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n }\n else if (kdf.toLowerCase() === 'pbkdf2') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n var prfFunc = null;\n var prf = searchPath(data, 'crypto/kdfparams/prf');\n if (prf === 'hmac-sha256') {\n prfFunc = 'sha256';\n }\n else if (prf === 'hmac-sha512') {\n prfFunc = 'sha512';\n }\n else {\n reject(new Error('unsupported prf'));\n return;\n }\n var c = parseInt(searchPath(data, 'crypto/kdfparams/c'));\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject(new Error('unsupported key-derivation derived-key length'));\n return;\n }\n var key = pbkdf2_1.pbkdf2(password, salt, c, dkLen, prfFunc);\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) {\n return;\n }\n resolve(signingKey);\n }\n else {\n reject(new Error('unsupported key-derivation function'));\n }\n }\n else {\n reject(new Error('unsupported key-derivation function'));\n }\n });\n}\nexports.decrypt = decrypt;\n// @TOOD: Options\nfunction encrypt(privateKey, password, options, progressCallback) {\n // the options are optional, so adjust the call as needed\n if (typeof (options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (!options) {\n options = {};\n }\n // Check the private key\n var privateKeyBytes = null;\n if (privateKey instanceof signing_key_1.SigningKey) {\n privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);\n }\n else {\n privateKeyBytes = bytes_1.arrayify(privateKey);\n }\n if (privateKeyBytes.length !== 32) {\n throw new Error('invalid private key');\n }\n password = getPassword(password);\n var entropy = options.entropy;\n if (options.mnemonic) {\n if (entropy) {\n if (HDNode.entropyToMnemonic(entropy) !== options.mnemonic) {\n throw new Error('entropy and mnemonic mismatch');\n }\n }\n else {\n entropy = HDNode.mnemonicToEntropy(options.mnemonic);\n }\n }\n if (entropy) {\n entropy = bytes_1.arrayify(entropy);\n }\n var path = options.path;\n if (entropy && !path) {\n path = defaultPath;\n }\n var client = options.client;\n if (!client) {\n client = \"ethers.js\";\n }\n // Check/generate the salt\n var salt = options.salt;\n if (salt) {\n salt = bytes_1.arrayify(salt);\n }\n else {\n salt = random_bytes_1.randomBytes(32);\n ;\n }\n // Override initialization vector\n var iv = null;\n if (options.iv) {\n iv = bytes_1.arrayify(options.iv);\n if (iv.length !== 16) {\n throw new Error('invalid iv');\n }\n }\n else {\n iv = random_bytes_1.randomBytes(16);\n }\n // Override the uuid\n var uuidRandom = options.uuid;\n if (uuidRandom) {\n uuidRandom = bytes_1.arrayify(uuidRandom);\n if (uuidRandom.length !== 16) {\n throw new Error('invalid uuid');\n }\n }\n else {\n uuidRandom = random_bytes_1.randomBytes(16);\n }\n // Override the scrypt password-based key derivation function parameters\n var N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) {\n N = options.scrypt.N;\n }\n if (options.scrypt.r) {\n r = options.scrypt.r;\n }\n if (options.scrypt.p) {\n p = options.scrypt.p;\n }\n }\n return new Promise(function (resolve, reject) {\n // We take 64 bytes:\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n scrypt(password, salt, N, r, p, 64, function (error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n }\n else if (key) {\n key = bytes_1.arrayify(key);\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n var derivedKey = key.slice(0, 16);\n var macPrefix = key.slice(16, 32);\n // This will be used to encrypt the mnemonic phrase (if any)\n var mnemonicKey = key.slice(32, 64);\n // Get the address for this private key\n var address = (new signing_key_1.SigningKey(privateKeyBytes)).address;\n // Encrypt the private key\n var counter = new aes.Counter(iv);\n var aesCtr = new aes.ModeOfOperation.ctr(derivedKey, counter);\n var ciphertext = bytes_1.arrayify(aesCtr.encrypt(privateKeyBytes));\n // Compute the message authentication code, used to check the password\n var mac = keccak256_1.keccak256(bytes_1.concat([macPrefix, ciphertext]));\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n var data = {\n address: address.substring(2).toLowerCase(),\n id: uuid.v4({ random: uuidRandom }),\n version: 3,\n Crypto: {\n cipher: 'aes-128-ctr',\n cipherparams: {\n iv: bytes_1.hexlify(iv).substring(2),\n },\n ciphertext: bytes_1.hexlify(ciphertext).substring(2),\n kdf: 'scrypt',\n kdfparams: {\n salt: bytes_1.hexlify(salt).substring(2),\n n: N,\n dklen: 32,\n p: p,\n r: r\n },\n mac: mac.substring(2)\n }\n };\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (entropy) {\n var mnemonicIv = random_bytes_1.randomBytes(16);\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n var mnemonicCiphertext = bytes_1.arrayify(mnemonicAesCtr.encrypt(entropy));\n var now = new Date();\n var timestamp = (now.getUTCFullYear() + '-' +\n zpad(now.getUTCMonth() + 1, 2) + '-' +\n zpad(now.getUTCDate(), 2) + 'T' +\n zpad(now.getUTCHours(), 2) + '-' +\n zpad(now.getUTCMinutes(), 2) + '-' +\n zpad(now.getUTCSeconds(), 2) + '.0Z');\n data['x-ethers'] = {\n client: client,\n gethFilename: ('UTC--' + timestamp + '--' + data.address),\n mnemonicCounter: bytes_1.hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: bytes_1.hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\"\n };\n }\n if (progressCallback) {\n progressCallback(1);\n }\n resolve(JSON.stringify(data));\n }\n else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n}\nexports.encrypt = encrypt;\n\n},{\"../utils/address\":58,\"../utils/bytes\":60,\"../utils/keccak256\":64,\"../utils/pbkdf2\":43,\"../utils/random-bytes\":44,\"../utils/utf8\":72,\"./hdnode\":74,\"./signing-key\":77,\"aes-js\":1,\"scrypt-js\":36,\"uuid\":39}],77:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * SigningKey\n *\n *\n */\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar hdnode_1 = require(\"./hdnode\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar properties_1 = require(\"../utils/properties\");\nvar secp256k1_1 = require(\"../utils/secp256k1\");\nvar errors = require(\"../utils/errors\");\nvar SigningKey = /** @class */ (function () {\n function SigningKey(privateKey) {\n errors.checkNew(this, SigningKey);\n var privateKeyBytes = null;\n if (privateKey instanceof hdnode_1.HDNode) {\n properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic);\n properties_1.defineReadOnly(this, 'path', privateKey.path);\n privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);\n }\n else {\n privateKeyBytes = bytes_1.arrayify(privateKey);\n }\n try {\n if (privateKeyBytes.length !== 32) {\n errors.throwError('exactly 32 bytes required', errors.INVALID_ARGUMENT, { value: privateKey });\n }\n }\n catch (error) {\n var params = { arg: 'privateKey', reason: error.reason, value: '[REDACTED]' };\n if (error.value) {\n if (typeof (error.value.length) === 'number') {\n params.length = error.value.length;\n }\n params.type = typeof (error.value);\n }\n errors.throwError('invalid private key', error.code, params);\n }\n properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(privateKeyBytes));\n properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));\n properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);\n properties_1.defineReadOnly(this, 'address', computeAddress(this.keyPair.publicKey));\n }\n SigningKey.prototype.signDigest = function (digest) {\n return this.keyPair.sign(digest);\n };\n return SigningKey;\n}());\nexports.SigningKey = SigningKey;\nfunction recoverAddress(digest, signature) {\n return computeAddress(secp256k1_1.recoverPublicKey(digest, signature));\n}\nexports.recoverAddress = recoverAddress;\nfunction computeAddress(key) {\n // Strip off the leading \"0x04\"\n var publicKey = '0x' + secp256k1_1.computePublicKey(key).slice(4);\n return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));\n}\nexports.computeAddress = computeAddress;\n\n},{\"../utils/address\":58,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/keccak256\":64,\"../utils/properties\":65,\"../utils/secp256k1\":67,\"./hdnode\":74}],78:[function(require,module,exports){\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 __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 });\nvar scrypt_js_1 = __importDefault(require(\"scrypt-js\"));\nvar hdnode_1 = require(\"./hdnode\");\nvar secretStorage = __importStar(require(\"./secret-storage\"));\nvar signing_key_1 = require(\"./signing-key\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar hash_1 = require(\"../utils/hash\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar properties_1 = require(\"../utils/properties\");\nvar random_bytes_1 = require(\"../utils/random-bytes\");\nvar transaction_1 = require(\"../utils/transaction\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// This ensures we inject a setImmediate into the global space, which\n// dramatically improves the performance of the scrypt PBKDF.\nconsole.log(\"Fix this! Setimmediate\");\n//import _setimmediate = require('setimmediate');\nvar Signer = /** @class */ (function () {\n function Signer() {\n }\n return Signer;\n}());\nexports.Signer = Signer;\nvar Wallet = /** @class */ (function (_super) {\n __extends(Wallet, _super);\n function Wallet(privateKey, provider) {\n var _this = _super.call(this) || this;\n errors.checkNew(_this, Wallet);\n // Make sure we have a valid signing key\n if (privateKey instanceof signing_key_1.SigningKey) {\n properties_1.defineReadOnly(_this, 'signingKey', privateKey);\n }\n else {\n properties_1.defineReadOnly(_this, 'signingKey', new signing_key_1.SigningKey(privateKey));\n }\n properties_1.defineReadOnly(_this, 'provider', provider);\n return _this;\n }\n Object.defineProperty(Wallet.prototype, \"address\", {\n get: function () { return this.signingKey.address; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Wallet.prototype, \"mnemonic\", {\n get: function () { return this.signingKey.mnemonic; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Wallet.prototype, \"path\", {\n get: function () { return this.signingKey.mnemonic; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Wallet.prototype, \"privateKey\", {\n get: function () { return this.signingKey.privateKey; },\n enumerable: true,\n configurable: true\n });\n /**\n * Create a new instance of this Wallet connected to provider.\n */\n Wallet.prototype.connect = function (provider) {\n return new Wallet(this.signingKey, provider);\n };\n Wallet.prototype.getAddress = function () {\n return Promise.resolve(this.address);\n };\n Wallet.prototype.sign = function (transaction) {\n var _this = this;\n return properties_1.resolveProperties(transaction).then(function (tx) {\n return transaction_1.sign(tx, _this.signingKey.signDigest.bind(_this.signingKey));\n });\n };\n Wallet.prototype.signMessage = function (message) {\n return Promise.resolve(bytes_1.joinSignature(this.signingKey.signDigest(hash_1.hashMessage(message))));\n };\n Wallet.prototype.getBalance = function (blockTag) {\n if (!this.provider) {\n throw new Error('missing provider');\n }\n return this.provider.getBalance(this.address, blockTag);\n };\n Wallet.prototype.getTransactionCount = function (blockTag) {\n if (!this.provider) {\n throw new Error('missing provider');\n }\n return this.provider.getTransactionCount(this.address, blockTag);\n };\n Wallet.prototype.sendTransaction = function (transaction) {\n var _this = this;\n if (!this.provider) {\n throw new Error('missing provider');\n }\n if (!transaction || typeof (transaction) !== 'object') {\n throw new Error('invalid transaction object');\n }\n var tx = properties_1.shallowCopy(transaction);\n if (tx.to != null) {\n tx.to = this.provider.resolveName(tx.to);\n }\n if (tx.gasLimit == null) {\n tx.gasLimit = this.provider.estimateGas(tx);\n }\n if (tx.gasPrice == null) {\n tx.gasPrice = this.provider.getGasPrice();\n }\n if (tx.nonce == null) {\n tx.nonce = this.getTransactionCount();\n }\n if (tx.chainId == null) {\n tx.chainId = this.provider.getNetwork().then(function (network) { return network.chainId; });\n }\n return properties_1.resolveProperties(tx).then(function (tx) {\n console.log('To Sign', tx);\n return _this.provider.sendTransaction(_this.sign(tx));\n });\n };\n Wallet.prototype.send = function (addressOrName, amountWei, options) {\n if (!options) {\n options = {};\n }\n return this.sendTransaction({\n to: addressOrName,\n gasLimit: options.gasLimit,\n gasPrice: options.gasPrice,\n nonce: options.nonce,\n value: amountWei,\n });\n };\n Wallet.prototype.encrypt = function (password, options, progressCallback) {\n if (typeof (options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (progressCallback && typeof (progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n if (!options) {\n options = {};\n }\n if (this.mnemonic) {\n // Make sure we don't accidentally bubble the mnemonic up the call-stack\n var safeOptions = {};\n for (var key in options) {\n safeOptions[key] = options[key];\n }\n options = safeOptions;\n // Set the mnemonic and path\n options.mnemonic = this.mnemonic;\n options.path = this.path;\n }\n return secretStorage.encrypt(this.privateKey, password, options, progressCallback);\n };\n /**\n * Static methods to create Wallet instances.\n */\n Wallet.createRandom = function (options) {\n var entropy = random_bytes_1.randomBytes(16);\n if (!options) {\n options = {};\n }\n if (options.extraEntropy) {\n entropy = bytes_1.arrayify(keccak256_1.keccak256(bytes_1.concat([entropy, options.extraEntropy])).substring(0, 34));\n }\n var mnemonic = hdnode_1.entropyToMnemonic(entropy, options.locale);\n return Wallet.fromMnemonic(mnemonic, options.path, options.locale);\n };\n Wallet.fromEncryptedWallet = function (json, password, progressCallback) {\n if (progressCallback && typeof (progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n return new Promise(function (resolve, reject) {\n if (secretStorage.isCrowdsaleWallet(json)) {\n try {\n var privateKey = secretStorage.decryptCrowdsale(json, password);\n resolve(new Wallet(privateKey));\n }\n catch (error) {\n reject(error);\n }\n }\n else if (secretStorage.isValidWallet(json)) {\n secretStorage.decrypt(json, password, progressCallback).then(function (signingKey) {\n var wallet = new Wallet(signingKey);\n /*\n if (signingKey.mnemonic && signingKey.path) {\n wallet.mnemonic = signingKey.mnemonic;\n wallet.path = signingKey.path;\n }\n */\n resolve(wallet);\n }, function (error) {\n reject(error);\n });\n }\n else {\n reject('invalid wallet JSON');\n }\n });\n };\n Wallet.fromMnemonic = function (mnemonic, path, wordlist) {\n if (!path) {\n path = hdnode_1.defaultPath;\n }\n return new Wallet(hdnode_1.fromMnemonic(mnemonic, wordlist).derivePath(path));\n };\n Wallet.fromBrainWallet = function (username, password, progressCallback) {\n if (progressCallback && typeof (progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n if (typeof (username) === 'string') {\n username = utf8_1.toUtf8Bytes(username, utf8_1.UnicodeNormalizationForm.NFKC);\n }\n else {\n username = bytes_1.arrayify(username);\n }\n if (typeof (password) === 'string') {\n password = utf8_1.toUtf8Bytes(password, utf8_1.UnicodeNormalizationForm.NFKC);\n }\n else {\n password = bytes_1.arrayify(password);\n }\n return new Promise(function (resolve, reject) {\n scrypt_js_1.default(password, username, (1 << 18), 8, 1, 32, function (error, progress, key) {\n if (error) {\n reject(error);\n }\n else if (key) {\n resolve(new Wallet(bytes_1.hexlify(key)));\n }\n else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n };\n /**\n * Determine if this is an encryped JSON wallet.\n */\n Wallet.isEncryptedWallet = function (json) {\n return (secretStorage.isValidWallet(json) || secretStorage.isCrowdsaleWallet(json));\n };\n /**\n * Verify a signed message, returning the address of the signer.\n */\n Wallet.verifyMessage = function (message, signature) {\n signature = bytes_1.hexlify(signature);\n if (signature.length != 132) {\n throw new Error('invalid signature');\n }\n var digest = hash_1.hashMessage(message);\n var recoveryParam = parseInt(signature.substring(130), 16);\n if (recoveryParam >= 27) {\n recoveryParam -= 27;\n }\n if (recoveryParam < 0) {\n throw new Error('invalid signature');\n }\n return signing_key_1.recoverAddress(digest, {\n r: signature.substring(0, 66),\n s: '0x' + signature.substring(66, 130),\n recoveryParam: recoveryParam\n });\n };\n return Wallet;\n}(Signer));\nexports.Wallet = Wallet;\n\n},{\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/hash\":62,\"../utils/keccak256\":64,\"../utils/properties\":65,\"../utils/random-bytes\":44,\"../utils/transaction\":70,\"../utils/utf8\":72,\"./hdnode\":74,\"./secret-storage\":76,\"./signing-key\":77,\"scrypt-js\":36}],79:[function(require,module,exports){\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 });\nvar wordlist_1 = require(\"./wordlist\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar words = \"AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo\";\nvar wordlist = null;\nfunction loadWords() {\n if (wordlist != null) {\n return;\n }\n wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' ');\n}\nvar LangEn = /** @class */ (function (_super) {\n __extends(LangEn, _super);\n function LangEn() {\n return _super.call(this, 'en') || this;\n }\n LangEn.prototype.getWord = function (index) {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n };\n LangEn.prototype.getWordIndex = function (word) {\n loadWords();\n return wordlist.indexOf(word);\n };\n return LangEn;\n}(wordlist_1.Wordlist));\nvar langEn = new LangEn();\nexports.langEn = langEn;\nwordlist_1.register(langEn);\n\n},{\"../utils/errors\":61,\"./wordlist\":80}],80:[function(require,module,exports){\n(function (global){\n\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// This gets overriddenby gulp during bip39-XX\nvar exportWordlist = false;\nvar properties_1 = require(\"../utils/properties\");\nvar Wordlist = /** @class */ (function () {\n function Wordlist(locale) {\n properties_1.defineReadOnly(this, 'locale', locale);\n }\n // Subclasses may override this\n Wordlist.prototype.split = function (mnemonic) {\n return mnemonic.toLowerCase().split(/ +/g);\n };\n // Subclasses may override this\n Wordlist.prototype.join = function (words) {\n return words.join(' ');\n };\n return Wordlist;\n}());\nexports.Wordlist = Wordlist;\nfunction register(lang) {\n if (exportWordlist) {\n if (!global['wordlists']) {\n properties_1.defineReadOnly(global, 'wordlists', {});\n }\n properties_1.defineReadOnly(global['wordlists'], lang.locale, lang);\n }\n}\nexports.register = register;\n\n\nexportWordlist = true;\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../utils/properties\":65}],81:[function(require,module,exports){\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 contracts_1 = require(\"./contracts\");\nexports.Contract = contracts_1.Contract;\nexports.Interface = contracts_1.Interface;\nvar providers = __importStar(require(\"./providers\"));\nexports.providers = providers;\nvar errors = __importStar(require(\"./utils/errors\"));\nexports.errors = errors;\nvar networks_1 = require(\"./providers/networks\");\nexports.getNetwork = networks_1.getNetwork;\nvar utils = __importStar(require(\"./utils\"));\nexports.utils = utils;\nvar wallet_1 = require(\"./wallet\");\nexports.HDNode = wallet_1.HDNode;\nexports.SigningKey = wallet_1.SigningKey;\nexports.Wallet = wallet_1.Wallet;\n//import info from '../package.json';\n//console.log(info);\nconsole.log(\"@TODO: Get version\");\nvar version = \"4.0.0\";\nexports.version = version;\n\n},{\"./contracts\":47,\"./providers\":51,\"./providers/networks\":54,\"./utils\":63,\"./utils/errors\":61,\"./wallet\":75}]},{},[81])(81)\n});\n"]} \ No newline at end of file +{"version":3,"sources":["ethers.min.js"],"names":["f","exports","module","define","amd","window","global","self","this","ethers","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","root","checkInt","value","parseInt","checkInts","arrayish","coerceArray","arg","copy","buffer","ArrayBuffer","isView","name","slice","Array","prototype","isArray","Uint8Array","createArray","copyArray","sourceArray","targetArray","targetStart","sourceStart","sourceEnd","set","Hex","convertUtf8","toBytes","text","result","encodeURI","charCodeAt","push","substr","fromBytes","bytes","String","fromCharCode","join","convertHex","v","numberOfRounds","16","24","32","rcon","S","Si","T1","T2","T3","T4","T5","T6","T7","T8","U1","U2","U3","U4","convertToInt32","AES","key","Object","defineProperty","_prepare","rounds","_Ke","_Kd","index","roundKeyCount","KC","tk","tt","rconpointer","encrypt","plaintext","decrypt","ciphertext","ModeOfOperationECB","description","_aes","block","ModeOfOperationCBC","iv","_lastCipherblock","j","ModeOfOperationCFB","segmentSize","_shiftRegister","xorSegment","encrypted","ModeOfOperationOFB","_lastPrecipher","_lastPrecipherIndex","Counter","initialValue","_counter","setValue","setBytes","increment","ModeOfOperationCTR","counter","_remainingCounter","_remainingCounterIndex","aesjs","ModeOfOperation","ecb","cbc","cfb","ofb","ctr","utils","hex","utf8","padding","pkcs7","pad","data","padder","strip","_arrayTest","_aesjs","2","assert","val","msg","inherits","ctor","superCtor","super_","TempCtor","constructor","BN","number","base","endian","isBN","negative","words","red","_init","Buffer","wordSize","parseHex","str","start","end","len","Math","min","parseBase","mul","num","max","left","right","cmp","_initNumber","_initArray","toString","replace","_parseHex","_parseBase","toArray","ceil","w","off","limbLen","limbPow","total","mod","word","imuln","_iaddn","pow","dest","clone","_expand","size","_normSign","inspect","zeros","groupSizes","groupBases","smallMulTo","out","b","lo","carry","k","ncarry","rword","maxJ","groupSize","groupBase","isZero","modn","idivn","toNumber","ret","toJSON","toBuffer","toArrayLike","ArrayType","byteLength","reqLength","littleEndian","res","q","andln","iushrn","_countBits","clz32","_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","mid","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","s","rtwdf","cos","PI","itwdf","sin","rtwdf_","itwdf_","re","ie","ro","io","rx","guessLen13b","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","3","randomBytes","../../src.ts/utils","4","5","elliptic","version","rand","hmacDRBG","curve","curves","ec","eddsa","../package.json","./elliptic/curve","./elliptic/curves","./elliptic/ec","./elliptic/eddsa","./elliptic/hmac-drbg","./elliptic/utils","brorand","6","getNAF","getJSF","BaseCurve","type","conf","zero","two","pointFromJSON","gRed","_wnafT1","_wnafT2","_wnafT3","_wnafT4","adjustCount","redN","_maxwellTrick","BasePoint","precomputed","point","validate","_fixedNafMul","doubles","_getDoubles","naf","I","step","repr","nafW","jpoint","mixedAdd","points","toP","_wnafMul","nafPoints","_getNAFPoints","dblp","_wnafMulAdd","defW","coeffs","jacobianResult","wndWidth","comb","toJ","jsf","ja","jb","decodePoint","enc","pointFromX","encodeCompressed","encode","_encode","compact","getX","getY","concat","precompute","power","beta","_getBeta","_hasDoubles","dbl","../../elliptic","bn.js","7","8","short","edwards","./base","./edwards","./mont","./short","9","arguments","apply","dup","10","Base","ShortCurve","tinv","zeroA","threeA","endo","_getEndomorphism","_endoWnafT1","_endoWnafT2","Point","isRed","inf","JPoint","zOne","lambda","betas","_getEndoRoots","lambdas","basis","map","vec","_getEndoBasis","ntinv","prevR","aprxSqrt","floor","y1","y2","len1","_endoSplit","v1","v2","c1","c2","p1","p2","q1","q2","k1","k2","ax","rhs","_endoWnafMulAdd","npoints","ncoeffs","obj","fromJSON","pre","endoMul","JSON","parse","obj2point","isInfinity","nx","ny","ys1","dyinv","mulAdd","jmulAdd","_precompute","negate","zinv","zinv2","ay","pz2","z2","u1","u2","s1","s2","h2","h3","nz","jx","jy","jz","jz4","jyd","jx2","jyd2","jyd4","t1","t2","dny","_zeroDbl","_threeDbl","_dbl","xx","yy","yyyy","yyyy8","d","c8","gamma","alpha","beta4","beta8","ggamma8","jy2","jxd4","jyd8","trpl","zz","mm","ee","yyu4","kbase","z3","pz3","eqXToP","zs","xc","../curve","11","hash","PresetCurve","options","defineCurve","configurable","enumerable","get","sha256","sha384","sha512","undefined","../elliptic","./precomputed/secp256k1","hash.js","12","KeyPair","Signature","EC","hasOwnProperty","nh","keyPair","keyFromPrivate","priv","fromPrivate","keyFromPublic","pub","fromPublic","genKeyPair","drbg","pers","entropy","hmacStrength","nonce","ns2","generate","_truncateToN","truncOnly","sign","bkey","getPrivate","persEnc","ns1","iter","kp","kpX","recoveryParam","canonical","verify","signature","sinv","getPublic","recoverPubKey","isYOdd","isSecondKey","rInv","getKeyRecoveryParam","Q","Qprime","./key","./signature","13","_importPrivate","privEnc","_importPublic","pubEnc","reason","derive","14","_importDER","Position","place","getLength","buf","initial","octetLen","rmPadding","constructLength","arr","octets","log","LN2","slen","toDER","backHalf","15","HmacDRBG","predResist","outSize","minEntropy","reseed","reseedInterval","K","V","entropyEnc","nonceEnc","seed","_update","_hmac","hmac","kmac","update","digest","addEnc","temp","17","18","zero2","toHex","d1","d2","m8","m14","m24","cachedProperty","computer","parseBytes","intFromLE","19","20","common","sha","ripemd","sha1","sha224","ripemd160","./hash/common","./hash/hmac","./hash/ripemd","./hash/sha","./hash/utils","21","BlockHash","pending","pendingTotal","blockSize","padLength","_delta8","_delta32","join32","_pad","_digest","./utils","minimalistic-assert","22","Hmac","Hash","inner","outer","23","./sha/1","./sha/224","./sha/256","./sha/384","./sha/512","25","26","27","shaCommon","sum32","sum32_4","sum32_5","ch32","maj32","s0_256","s1_256","g0_256","g1_256","sha256_K","SHA256","W","toHex32","split32","../common","../utils","./common","28","29","rotr64_hi","rotr64_lo","shr64_hi","shr64_lo","sum64","sum64_hi","sum64_lo","sum64_4_hi","sum64_4_lo","sum64_5_hi","sum64_5_lo","sha512_K","SHA512","ch64_hi","xh","xl","yh","yl","zh","ch64_lo","zl","maj64_hi","maj64_lo","s0_512_hi","s0_512_lo","s1_512_hi","s1_512_lo","g0_512_hi","g0_512_lo","g1_512_hi","g1_512_lo","_prepareBlock","c0_hi","c0_lo","c1_hi","c1_lo","c2_hi","c2_lo","c3_hi","c3_lo","ah","al","bh","bl","ch","cl","dh","dl","eh","el","fh","fl","gh","gl","hh","hl","c4_hi","c4_lo","T1_hi","T1_lo","T2_hi","T2_lo","30","rotr32","p32","ft_1","31","htonl","zero8","rotl32","sum32_3","pos","create","writable","33","process","JS_SHA3_NO_NODE_JS","versions","node","COMMON_JS","JS_SHA3_NO_COMMON_JS","HEX_CHARS","SHIFT","RC","BITS","OUTPUT_TYPES","createOutputMethod","outputType","message","Keccak","createShakeOutputMethod","outputBits","createMethod","method","algorithms","methods","methodNames","algorithm","methodName","blocks","reset","blockCount","byteCount","outputBlocks","extraBytes","notString","lastByteIndex","finalize","arrayBuffer","array","Uint32Array","offset","c0","c3","c4","c5","c6","c7","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","_process","34","equal","35","setImmediate","setImmedaite","setTimeout","36","MAX_VALUE","h0","h1","h4","h5","h6","h7","bytesLeft","bitLenHi","bitLenLo","numZeros","PBKDF2_HMAC_SHA256_OneIter","password","salt","dkLen","innerLen","outerKey","dk","incrementCounter","blockmix_salsa8","BY","Yi","_X","arraycopy","blockxor","salsa20_8","R","src","srcPos","destPos","checkBufferish","ensureInteger","intValue","scrypt","callback","i1","Bi","XY","totalOps","currentOp","lastPercent10","stop","state","i0","limit","nextTick","incrementalSMix","steps","percent10","derivedKey","_scrypt","timers","37","38","rng","crypto","getRandomValues","_rnds8","_rnds","random","39","_rng","_byteToHex","_hexToByte","unparse","bth","_seedBytes","_nodeId","_clockseq","_lastMSecs","_lastNSecs","v4","rnds","ii","uuid","clockseq","msecs","Date","getTime","nsecs","dt","tl","tmh","toLowerCase","oct","./rng","40","bytes_1","decode","textData","atob","arrayify","btoa","../src.ts/utils/bytes","41","42","__importStar","__esModule","errors","supportedAlgorithms","computeHmac","throwError","UNSUPPORTED_OPERATION","operation","../src.ts/utils/errors","43","hmac_1","pbkdf2","iterations","keylen","hashAlgorithm","hLen","T","DK","block1","U","../src.ts/utils/hmac","44","properties_1","console","trunc","_weakCrypto","defineReadOnly","../src.ts/utils/properties","45","XMLHttpRequest","error","46","interface_1","provider_1","wallet_1","address_1","bignumber_1","allowedTransactionKeys","from","gasLimit","gasPrice","to","runMethod","contract","functionName","estimateOnly","interface","functions","params","_i","tx","inputs","shallowCopy","pop","forEach","addressPromise","resolveAddresses","provider","paramType","promises","Promise","all","resolveName","components","resolve","then","ConstantZero","signer","getAddress","outputs","CALL_EXCEPTION","address","estimateGas","sendTransaction","Contract","addressOrName","contractInterface","signerOrProvider","_this","checkNew","Interface","Signer","Provider","INVALID_ARGUMENT","keys","run","estimate","events","eventName","eventInfo","eventCallback","handleEvent","topics","args","event","removeListener","topic","getBlock","blockHash","getTransaction","transactionHash","getTransactionReceipt","eventSignature","property","on","propertyName","connect","deploy","bytecode","isHexString","deployFunction","getContractAddress","../providers/provider","../utils/address","../utils/bignumber","../utils/bytes","../utils/errors","../utils/properties","../wallet/wallet","./interface","47","contract_1","./contract","48","extendStatics","__extends","setPrototypeOf","__proto__","__","abi_coder_1","keccak256_1","utf8_1","parseParams","names","types","param","substring","suffix","arrayBracket","indexOf","Description","info","defineFrozen","Indexed","_super","DeployDescription","MISSING_ARGUMENT","count","expectedCount","UNEXPECTED_ARGUMENT","defaultAbiCoder","FunctionDescription","sighash","errorArg","errorValue","Result","EventDescription","anonymous","inputIndexed","inputNonIndexed","inputDynamic","indexed","resultIndexed","resultNonIndexed","nonIndexedIndex","indexedIndex","TransactionDescription","LogDescription","addMethod","payable","keccak256","toUtf8Bytes","abi","errorMessage","_abi","fragment","parseSignature","parseTransaction","func","bigNumberify","parseLog","values","../utils/abi-coder","../utils/keccak256","../utils/utf8","49","web_1","getTransactionString","transaction","hexlify","hexStripZeros","getResult","status","stringify","getJsonResult","jsonrpc","checkLogTag","blockTag","EtherscanProvider","network","apiKey","baseUrl","perform","url","fetchJson","position","signedTransaction","filter","fromBlock","toBlock","topic0","reject","logs","txs","seq","parseFloat","ethusd","getHistory","startBlock","endBlock","creates","contractAddress","item","checkTransactionResponse","timeStamp","timestamp","../utils/web","./provider","50","checkNetworks","networks","check","chainId","ensAddress","FallbackProvider","providers","ready_1","getNetwork","UNKNOWN_ERROR","_providers","firstError","51","ProviderSigner","etherscan_provider_1","fallback_provider_1","ipc_provider_1","IpcProvider","infura_provider_1","InfuraProvider","json_rpc_provider_1","JsonRpcProvider","web3_provider_1","Web3Provider","getDefaultProvider","./etherscan-provider","./fallback-provider","./infura-provider","./ipc-provider","./json-rpc-provider","./web3-provider","52","networks_1","apiAccessToken","host","_startPending","getSigner","listAccounts","./networks","53","payload","hexlifyTransaction","getLowerCase","JsonRpcSigner","_address","send","accounts","getBalance","getTransactionCount","resolveProperties","signMessage","unlock","ready","connection","request","id","NOT_IMPLEMENTED","_pendingFilter","pendingFilter","filterId","poll","hashes","_emitted","emit","timeout","_stopPending","54","homestead","ropsten","unspecified","mainnet","morden","testnet","rinkeby","kovan","classic","n_1","n_2","55","rlp_1","hash_1","transaction_1","format","object","checkKey","checkValue","allowNull","nullValue","arrayOf","checkHash","hexDataLength","checkNumber","checkUint256","uint256","checkBlockTag","formatBlock","parentHash","difficulty","gasUsed","miner","extraData","transactions","checkBlock","author","formatTransaction","blockNumber","transactionIndex","raw","gas","stripZeros","networkId","formatTransactionRequest","checkTransactionRequest","formatTransactionReceiptLog","transactionLogIndex","logIndex","formatTransactionReceipt","logsBloom","cumulativeGasUsed","formatFilter","checkTopics","replaceValue","formatLog","removed","checkLog","stallPromise","allowNullFunc","executeFunc","attempt","recurse","convertFunc","getEventString","stack","signDigest","_addressPromise","joinSignature","hashMessage","getGasPrice","signedTx","expectedAddress","knownNetwork","_network","_lastBlockNumber","_balances","_events","_pollingInterval","_doPoll","getBlockNumber","newBalances","string","parseEventString","balance","lastBalance","getLogs","doPoll","resetEventsBlock","_poller","setInterval","bind","pollingInterval","clearInterval","waitForTransaction","timer","complete","clearTimeout","once","_a","getCode","getStorageAt","expectedHash","returnedHash","wait","_resolveNames","blockHashOrBlockTag","transactionReceipt","entry","byzantium","getEtherPrice","copyObject","_getResolver","namehash","hexDataSlice","nodeHash","resolverAddress","lookupAddress","nodehash","toUtf8String","addr","listener","polling","listeners","splice","listenerCount","removeAllListeners","eventNameString","../utils/hash","../utils/rlp","../utils/transaction","56","web3Provider","sendAsync","path","_web3Provider","isMetaMask","57","paramTypeBytes","RegExp","paramTypeNumber","paramTypeArray","defaultCoerceFunc","match","regexParen","regexIdentifier","verifyType","parseParam","allowIndexed","parent","allowType","allowParams","child","allowName","allowArray","sibling","readArray","parseParamType","trim","splitNesting","modifier","parseSignatureEvent","constant","stateMutability","comps","parseSignatureFunction","Coder","coerceFunc","localName","dynamic","CoderNull","consumed","CoderNumber","signed","padZeros","coderType","junkLength","uint256Coder","CoderBoolean","CoderFixedBytes","CoderAddress","_encodeDynamicBytes","dataLength","_decodeDynamicBytes","CoderDynamicBytes","CoderString","alignSize","pack","coders","arrayValues","coder","parts","staticSize","dynamicSize","part","dynamicOffset","unpack","baseOffset","CoderArray","decodedLength","CoderTuple","accum","depth","paramTypeSimple","bool","getParamCoder","component","getTupleParamCoder","AbiCoder","typeObject","jsonCopy","./address","./bignumber","./bytes","./errors","./properties","./utf8","58","getChecksumAddress","chars","hashed","i_1","toUpperCase","ibanLookup","safeDigits","log10","LN10","ibanChecksum","expanded","checksum","getIcapAddress","base36","./keccak256","./rlp","59","__importDefault","default","bn_js_1","_isBigNumber","isBigNumber","BigNumber","ConstantNegativeOne","_bn","NUMERIC_FAULT","fault","outputValue","details","isArrayish","other","toHexString","ConstantOne","ConstantTwo","ConstantWeiPerEther","60","addSlice","objects","arrays","HexCharacters","hexZeroPad","splitSignature","61","messageDetails","MISSING_NEW","kind","62","Zeros","Partition","UseSTD3ASCIIRules","partition","label","63","base64","sha2_1","solidity_1","solidityKeccak256","solidityPack","soliditySha256","random_bytes_1","RLP","units_1","formatEther","parseEther","formatUnits","parseUnits","etherSymbol","./abi-coder","./base64","./hash","./random-bytes","./sha2","./solidity","./transaction","./units","./web","64","sha3","keccak_256","js-sha3","65","frozen","66","arrayifyInteger","unshift","unarrayifyInteger","_decodeChildren","childOffset","decoded","_decode","lengthLength","67","privateKey","recoverPublicKey","sig","computePublicKey","compressed","compressedPublicKey","publicKey","computeAddress","recoverAddress","68","_hash","_sha256","_sha512","69","regexBytes","regexNumber","regexArray","tight","_pack","baseType","70","secp256k1_1","handleNumber","transactionFields","maxLength","fieldInfo","rawTransaction","./secp256k1","71","getUnitInfo","unitInfos","decimals","tenPower","unitType","unitInfo","fraction","whole","commify","wholeValue","fractionValue","wei","ether","72","UnicodeNormalizationForm","form","normalize","extraLength","nextChar","73","xmlhttprequest_1","base64_1","json","processFunc","headers","user","allowInsecure","authorization","open","header","setRequestHeader","onreadystatechange","readyState","responseText","jsonError","orginialError","body","statusCode","onerror","connectionError","xmlhttprequest","74","lang_en_1","pbkdf2_1","MasterSecret","HardenedBit","getUpperMask","defaultPath","HDNode","chainCode","mnemonic","_derive","publicKeyBytes","IL","IR","ki","derivePath","_fromSeed","seedArray","mnemonicToSeed","NFKD","mnemonicToEntropy","wordlist","langEn","getWordIndex","entropyBits","checksumMask","fromMnemonic","fromSeed","entropyToMnemonic","indices","remainingBits","checksumBits","getWord","isValidMnemonic","../utils/hmac","../utils/pbkdf2","../utils/secp256k1","../utils/sha2","../wordlists/lang-en","75","Wallet","signing_key_1","SigningKey","./hdnode","./signing-key","./wallet","76","aes","looseArrayify","hexString","zpad","getPassword","NFKC","searchPath","currentChild","matchingChild","isCrowdsaleWallet","encseed","ethaddr","isValidWallet","decryptCrowdsale","encryptedSeed","aesCbc","seedHex","seedHexBytes","signingKey","progressCallback","getSigningKey","derivedHalf","aesCtr","mnemonicKey","mnemonicCiphertext","mnemonicIv","mnemonicCounter","mnemonicAesCtr","kdf","progress","prfFunc","prf","privateKeyBytes","client","uuidRandom","macPrefix","mac","Crypto","cipher","cipherparams","kdfparams","dklen","now","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","gethFilename","../utils/random-bytes","aes-js","scrypt-js","77","hdnode_1","78","scrypt_js_1","secretStorage","amountWei","safeOptions","createRandom","extraEntropy","locale","fromEncryptedWallet","wallet","fromBrainWallet","username","isEncryptedWallet","verifyMessage","./secret-storage","79","wordlist_1","loadWords","LangEn","Wordlist","register","./wordlist","80","exportWordlist","lang","81","contracts_1","./contracts","./providers","./providers/networks","./utils/errors"],"mappings":"CAAA,SAAUA,GAAG,GAAoB,iBAAVC,SAAoC,oBAATC,OAAsBA,OAAOD,QAAQD,SAAS,GAAmB,mBAATG,QAAqBA,OAAOC,IAAKD,OAAO,GAAGH,OAAO,EAA0B,oBAATK,OAAwBA,OAA+B,oBAATC,OAAwBA,OAA6B,oBAAPC,KAAsBA,KAAYC,MAAOC,OAAST,KAA3T,CAAkU,WAAqC,OAAmB,SAASU,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEf,GAAG,IAAIY,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIC,EAAE,mBAAmBC,SAASA,QAAQ,IAAIjB,GAAGgB,EAAE,OAAOA,EAAED,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,GAAG,CAACd,QAAQ,IAAIU,EAAEI,GAAG,GAAGQ,KAAKD,EAAErB,QAAQ,SAASS,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIY,EAAEA,EAAErB,QAAQS,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGd,QAAQ,IAAI,IAAIiB,EAAE,mBAAmBD,SAASA,QAAQF,EAAE,EAAEA,EAAEF,EAAEW,OAAOT,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAA7b,CAA4c,CAACW,EAAE,CAAC,SAASR,EAAQf,EAAOD,GACt1B,cAEA,SAAUyB,GAEN,SAASC,EAASC,GACd,OAAQC,SAASD,KAAWA,EA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,KAAyB,oBAAXF,OAAyBA,OAAS,KAClI,CAAC8xC,sBAAsB,KAAK8qB,GAAG,CAAC,SAASh8D,EAAQf,EAAOD,GAC1D,aACA,IAAI6qC,EAAgBtqC,MAAQA,KAAKsqC,cAAiB,SAAUx+B,GACxD,GAAIA,GAAOA,EAAIy+B,WAAY,OAAOz+B,EAClC,IAAI9I,EAAS,GACb,GAAW,MAAP8I,EAAa,IAAK,IAAImB,KAAKnB,EAAS5G,OAAO8qB,eAAejvB,KAAK+K,EAAKmB,KAAIjK,EAAOiK,GAAKnB,EAAImB,IAE5F,OADAjK,EAAgB,QAAI8I,EACb9I,GAEXkC,OAAOC,eAAe1F,EAAS,aAAc,CAAE2B,OAAO,IACtD,IAAIs7D,EAAcj8D,EAAQ,eAC1BhB,EAAQuvC,SAAW0tB,EAAY1tB,SAC/BvvC,EAAQ6vC,UAAYotB,EAAYptB,UAChC,IAAI2J,EAAY3O,EAAa7pC,EAAQ,gBACrChB,EAAQw5C,UAAYA,EACpB,IAAIzO,EAASF,EAAa7pC,EAAQ,mBAClChB,EAAQ+qC,OAASA,EACjB,IAAImQ,EAAal6C,EAAQ,wBACzBhB,EAAQ05C,WAAawB,EAAWxB,WAChC,IAAIhxC,EAAQmiC,EAAa7pC,EAAQ,YACjChB,EAAQ0I,MAAQA,EAChB,IAAIqkC,EAAW/rC,EAAQ,YACvBhB,EAAQw1D,OAASzoB,EAASyoB,OAC1Bx1D,EAAQ23D,WAAa5qB,EAAS4qB,WAC9B33D,EAAQy3D,OAAS1qB,EAAS0qB,OAG1BrrB,QAAQhY,IAAI,sBAEZp0B,EAAQsiB,QADM,SAGZ,CAAC46C,cAAc,GAAGC,cAAc,GAAGC,uBAAuB,GAAGllC,UAAU,GAAGmlC,iBAAiB,GAAGvF,WAAW,MAAM,GAAG,CAAC,IA58dyP,CA48dpP","file":"ethers.min.js","sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i 255) {\n return false;\n }\n }\n\n return true;\n }\n\n function coerceArray(arg, copy) {\n\n // ArrayBuffer view\n if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === 'Uint8Array') {\n\n if (copy) {\n if (arg.slice) {\n arg = arg.slice();\n } else {\n arg = Array.prototype.slice.call(arg);\n }\n }\n\n return arg;\n }\n\n // It's an array; check it is a valid representation of a byte\n if (Array.isArray(arg)) {\n if (!checkInts(arg)) {\n throw new Error('Array contains invalid value: ' + arg);\n }\n\n return new Uint8Array(arg);\n }\n\n // Something else, but behaves like an array (maybe a Buffer? Arguments?)\n if (checkInt(arg.length) && checkInts(arg)) {\n return new Uint8Array(arg);\n }\n\n throw new Error('unsupported array-like object');\n }\n\n function createArray(length) {\n return new Uint8Array(length);\n }\n\n function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {\n if (sourceStart != null || sourceEnd != null) {\n if (sourceArray.slice) {\n sourceArray = sourceArray.slice(sourceStart, sourceEnd);\n } else {\n sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);\n }\n }\n targetArray.set(sourceArray, targetStart);\n }\n\n\n\n var convertUtf8 = (function() {\n function toBytes(text) {\n var result = [], i = 0;\n text = encodeURI(text);\n while (i < text.length) {\n var c = text.charCodeAt(i++);\n\n // if it is a % sign, encode the following 2 bytes as a hex value\n if (c === 37) {\n result.push(parseInt(text.substr(i, 2), 16))\n i += 2;\n\n // otherwise, just the actual byte\n } else {\n result.push(c)\n }\n }\n\n return coerceArray(result);\n }\n\n function fromBytes(bytes) {\n var result = [], i = 0;\n\n while (i < bytes.length) {\n var c = bytes[i];\n\n if (c < 128) {\n result.push(String.fromCharCode(c));\n i++;\n } else if (c > 191 && c < 224) {\n result.push(String.fromCharCode(((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f)));\n i += 2;\n } else {\n result.push(String.fromCharCode(((c & 0x0f) << 12) | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f)));\n i += 3;\n }\n }\n\n return result.join('');\n }\n\n return {\n toBytes: toBytes,\n fromBytes: fromBytes,\n }\n })();\n\n var convertHex = (function() {\n function toBytes(text) {\n var result = [];\n for (var i = 0; i < text.length; i += 2) {\n result.push(parseInt(text.substr(i, 2), 16));\n }\n\n return result;\n }\n\n // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html\n var Hex = '0123456789abcdef';\n\n function fromBytes(bytes) {\n var result = [];\n for (var i = 0; i < bytes.length; i++) {\n var v = bytes[i];\n result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]);\n }\n return result.join('');\n }\n\n return {\n toBytes: toBytes,\n fromBytes: fromBytes,\n }\n })();\n\n\n // Number of rounds by keysize\n var numberOfRounds = {16: 10, 24: 12, 32: 14}\n\n // Round constant words\n var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91];\n\n // S-box and Inverse S-box (S is for Substitution)\n var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0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x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d];\n\n // Transformations for encryption\n var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a];\n var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616];\n var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16];\n var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c];\n\n // Transformations for decryption\n var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742];\n var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857];\n var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8];\n var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0];\n\n // Transformations for decryption key expansion\n var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3];\n var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697];\n var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46];\n var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d];\n\n function convertToInt32(bytes) {\n var result = [];\n for (var i = 0; i < bytes.length; i += 4) {\n result.push(\n (bytes[i ] << 24) |\n (bytes[i + 1] << 16) |\n (bytes[i + 2] << 8) |\n bytes[i + 3]\n );\n }\n return result;\n }\n\n var AES = function(key) {\n if (!(this instanceof AES)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n Object.defineProperty(this, 'key', {\n value: coerceArray(key, true)\n });\n\n this._prepare();\n }\n\n\n AES.prototype._prepare = function() {\n\n var rounds = numberOfRounds[this.key.length];\n if (rounds == null) {\n throw new Error('invalid key size (must be 16, 24 or 32 bytes)');\n }\n\n // encryption round keys\n this._Ke = [];\n\n // decryption round keys\n this._Kd = [];\n\n for (var i = 0; i <= rounds; i++) {\n this._Ke.push([0, 0, 0, 0]);\n this._Kd.push([0, 0, 0, 0]);\n }\n\n var roundKeyCount = (rounds + 1) * 4;\n var KC = this.key.length / 4;\n\n // convert the key into ints\n var tk = convertToInt32(this.key);\n\n // copy values into round key arrays\n var index;\n for (var i = 0; i < KC; i++) {\n index = i >> 2;\n this._Ke[index][i % 4] = tk[i];\n this._Kd[rounds - index][i % 4] = tk[i];\n }\n\n // key expansion (fips-197 section 5.2)\n var rconpointer = 0;\n var t = KC, tt;\n while (t < roundKeyCount) {\n tt = tk[KC - 1];\n tk[0] ^= ((S[(tt >> 16) & 0xFF] << 24) ^\n (S[(tt >> 8) & 0xFF] << 16) ^\n (S[ tt & 0xFF] << 8) ^\n S[(tt >> 24) & 0xFF] ^\n (rcon[rconpointer] << 24));\n rconpointer += 1;\n\n // key expansion (for non-256 bit)\n if (KC != 8) {\n for (var i = 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n\n // key expansion for 256-bit keys is \"slightly different\" (fips-197)\n } else {\n for (var i = 1; i < (KC / 2); i++) {\n tk[i] ^= tk[i - 1];\n }\n tt = tk[(KC / 2) - 1];\n\n tk[KC / 2] ^= (S[ tt & 0xFF] ^\n (S[(tt >> 8) & 0xFF] << 8) ^\n (S[(tt >> 16) & 0xFF] << 16) ^\n (S[(tt >> 24) & 0xFF] << 24));\n\n for (var i = (KC / 2) + 1; i < KC; i++) {\n tk[i] ^= tk[i - 1];\n }\n }\n\n // copy values into round key arrays\n var i = 0, r, c;\n while (i < KC && t < roundKeyCount) {\n r = t >> 2;\n c = t % 4;\n this._Ke[r][c] = tk[i];\n this._Kd[rounds - r][c] = tk[i++];\n t++;\n }\n }\n\n // inverse-cipher-ify the decryption round key (fips-197 section 5.3)\n for (var r = 1; r < rounds; r++) {\n for (var c = 0; c < 4; c++) {\n tt = this._Kd[r][c];\n this._Kd[r][c] = (U1[(tt >> 24) & 0xFF] ^\n U2[(tt >> 16) & 0xFF] ^\n U3[(tt >> 8) & 0xFF] ^\n U4[ tt & 0xFF]);\n }\n }\n }\n\n AES.prototype.encrypt = function(plaintext) {\n if (plaintext.length != 16) {\n throw new Error('invalid plaintext size (must be 16 bytes)');\n }\n\n var rounds = this._Ke.length - 1;\n var a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n var t = convertToInt32(plaintext);\n for (var i = 0; i < 4; i++) {\n t[i] ^= this._Ke[0][i];\n }\n\n // apply round transforms\n for (var r = 1; r < rounds; r++) {\n for (var i = 0; i < 4; i++) {\n a[i] = (T1[(t[ i ] >> 24) & 0xff] ^\n T2[(t[(i + 1) % 4] >> 16) & 0xff] ^\n T3[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T4[ t[(i + 3) % 4] & 0xff] ^\n this._Ke[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n var result = createArray(16), tt;\n for (var i = 0; i < 4; i++) {\n tt = this._Ke[rounds][i];\n result[4 * i ] = (S[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (S[(t[(i + 1) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (S[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (S[ t[(i + 3) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n\n AES.prototype.decrypt = function(ciphertext) {\n if (ciphertext.length != 16) {\n throw new Error('invalid ciphertext size (must be 16 bytes)');\n }\n\n var rounds = this._Kd.length - 1;\n var a = [0, 0, 0, 0];\n\n // convert plaintext to (ints ^ key)\n var t = convertToInt32(ciphertext);\n for (var i = 0; i < 4; i++) {\n t[i] ^= this._Kd[0][i];\n }\n\n // apply round transforms\n for (var r = 1; r < rounds; r++) {\n for (var i = 0; i < 4; i++) {\n a[i] = (T5[(t[ i ] >> 24) & 0xff] ^\n T6[(t[(i + 3) % 4] >> 16) & 0xff] ^\n T7[(t[(i + 2) % 4] >> 8) & 0xff] ^\n T8[ t[(i + 1) % 4] & 0xff] ^\n this._Kd[r][i]);\n }\n t = a.slice();\n }\n\n // the last round is special\n var result = createArray(16), tt;\n for (var i = 0; i < 4; i++) {\n tt = this._Kd[rounds][i];\n result[4 * i ] = (Si[(t[ i ] >> 24) & 0xff] ^ (tt >> 24)) & 0xff;\n result[4 * i + 1] = (Si[(t[(i + 3) % 4] >> 16) & 0xff] ^ (tt >> 16)) & 0xff;\n result[4 * i + 2] = (Si[(t[(i + 2) % 4] >> 8) & 0xff] ^ (tt >> 8)) & 0xff;\n result[4 * i + 3] = (Si[ t[(i + 1) % 4] & 0xff] ^ tt ) & 0xff;\n }\n\n return result;\n }\n\n\n /**\n * Mode Of Operation - Electonic Codebook (ECB)\n */\n var ModeOfOperationECB = function(key) {\n if (!(this instanceof ModeOfOperationECB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Electronic Code Block\";\n this.name = \"ecb\";\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationECB.prototype.encrypt = function(plaintext) {\n plaintext = coerceArray(plaintext);\n\n if ((plaintext.length % 16) !== 0) {\n throw new Error('invalid plaintext size (must be multiple of 16 bytes)');\n }\n\n var ciphertext = createArray(plaintext.length);\n var block = createArray(16);\n\n for (var i = 0; i < plaintext.length; i += 16) {\n copyArray(plaintext, block, 0, i, i + 16);\n block = this._aes.encrypt(block);\n copyArray(block, ciphertext, i);\n }\n\n return ciphertext;\n }\n\n ModeOfOperationECB.prototype.decrypt = function(ciphertext) {\n ciphertext = coerceArray(ciphertext);\n\n if ((ciphertext.length % 16) !== 0) {\n throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');\n }\n\n var plaintext = createArray(ciphertext.length);\n var block = createArray(16);\n\n for (var i = 0; i < ciphertext.length; i += 16) {\n copyArray(ciphertext, block, 0, i, i + 16);\n block = this._aes.decrypt(block);\n copyArray(block, plaintext, i);\n }\n\n return plaintext;\n }\n\n\n /**\n * Mode Of Operation - Cipher Block Chaining (CBC)\n */\n var ModeOfOperationCBC = function(key, iv) {\n if (!(this instanceof ModeOfOperationCBC)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Cipher Block Chaining\";\n this.name = \"cbc\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 bytes)');\n }\n\n this._lastCipherblock = coerceArray(iv, true);\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCBC.prototype.encrypt = function(plaintext) {\n plaintext = coerceArray(plaintext);\n\n if ((plaintext.length % 16) !== 0) {\n throw new Error('invalid plaintext size (must be multiple of 16 bytes)');\n }\n\n var ciphertext = createArray(plaintext.length);\n var block = createArray(16);\n\n for (var i = 0; i < plaintext.length; i += 16) {\n copyArray(plaintext, block, 0, i, i + 16);\n\n for (var j = 0; j < 16; j++) {\n block[j] ^= this._lastCipherblock[j];\n }\n\n this._lastCipherblock = this._aes.encrypt(block);\n copyArray(this._lastCipherblock, ciphertext, i);\n }\n\n return ciphertext;\n }\n\n ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {\n ciphertext = coerceArray(ciphertext);\n\n if ((ciphertext.length % 16) !== 0) {\n throw new Error('invalid ciphertext size (must be multiple of 16 bytes)');\n }\n\n var plaintext = createArray(ciphertext.length);\n var block = createArray(16);\n\n for (var i = 0; i < ciphertext.length; i += 16) {\n copyArray(ciphertext, block, 0, i, i + 16);\n block = this._aes.decrypt(block);\n\n for (var j = 0; j < 16; j++) {\n plaintext[i + j] = block[j] ^ this._lastCipherblock[j];\n }\n\n copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16);\n }\n\n return plaintext;\n }\n\n\n /**\n * Mode Of Operation - Cipher Feedback (CFB)\n */\n var ModeOfOperationCFB = function(key, iv, segmentSize) {\n if (!(this instanceof ModeOfOperationCFB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Cipher Feedback\";\n this.name = \"cfb\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 size)');\n }\n\n if (!segmentSize) { segmentSize = 1; }\n\n this.segmentSize = segmentSize;\n\n this._shiftRegister = coerceArray(iv, true);\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCFB.prototype.encrypt = function(plaintext) {\n if ((plaintext.length % this.segmentSize) != 0) {\n throw new Error('invalid plaintext size (must be segmentSize bytes)');\n }\n\n var encrypted = coerceArray(plaintext, true);\n\n var xorSegment;\n for (var i = 0; i < encrypted.length; i += this.segmentSize) {\n xorSegment = this._aes.encrypt(this._shiftRegister);\n for (var j = 0; j < this.segmentSize; j++) {\n encrypted[i + j] ^= xorSegment[j];\n }\n\n // Shift the register\n copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);\n copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);\n }\n\n return encrypted;\n }\n\n ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {\n if ((ciphertext.length % this.segmentSize) != 0) {\n throw new Error('invalid ciphertext size (must be segmentSize bytes)');\n }\n\n var plaintext = coerceArray(ciphertext, true);\n\n var xorSegment;\n for (var i = 0; i < plaintext.length; i += this.segmentSize) {\n xorSegment = this._aes.encrypt(this._shiftRegister);\n\n for (var j = 0; j < this.segmentSize; j++) {\n plaintext[i + j] ^= xorSegment[j];\n }\n\n // Shift the register\n copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);\n copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize);\n }\n\n return plaintext;\n }\n\n /**\n * Mode Of Operation - Output Feedback (OFB)\n */\n var ModeOfOperationOFB = function(key, iv) {\n if (!(this instanceof ModeOfOperationOFB)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Output Feedback\";\n this.name = \"ofb\";\n\n if (!iv) {\n iv = createArray(16);\n\n } else if (iv.length != 16) {\n throw new Error('invalid initialation vector size (must be 16 bytes)');\n }\n\n this._lastPrecipher = coerceArray(iv, true);\n this._lastPrecipherIndex = 16;\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationOFB.prototype.encrypt = function(plaintext) {\n var encrypted = coerceArray(plaintext, true);\n\n for (var i = 0; i < encrypted.length; i++) {\n if (this._lastPrecipherIndex === 16) {\n this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);\n this._lastPrecipherIndex = 0;\n }\n encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++];\n }\n\n return encrypted;\n }\n\n // Decryption is symetric\n ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;\n\n\n /**\n * Counter object for CTR common mode of operation\n */\n var Counter = function(initialValue) {\n if (!(this instanceof Counter)) {\n throw Error('Counter must be instanitated with `new`');\n }\n\n // We allow 0, but anything false-ish uses the default 1\n if (initialValue !== 0 && !initialValue) { initialValue = 1; }\n\n if (typeof(initialValue) === 'number') {\n this._counter = createArray(16);\n this.setValue(initialValue);\n\n } else {\n this.setBytes(initialValue);\n }\n }\n\n Counter.prototype.setValue = function(value) {\n if (typeof(value) !== 'number' || parseInt(value) != value) {\n throw new Error('invalid counter value (must be an integer)');\n }\n\n for (var index = 15; index >= 0; --index) {\n this._counter[index] = value % 256;\n value = value >> 8;\n }\n }\n\n Counter.prototype.setBytes = function(bytes) {\n bytes = coerceArray(bytes, true);\n\n if (bytes.length != 16) {\n throw new Error('invalid counter bytes size (must be 16 bytes)');\n }\n\n this._counter = bytes;\n };\n\n Counter.prototype.increment = function() {\n for (var i = 15; i >= 0; i--) {\n if (this._counter[i] === 255) {\n this._counter[i] = 0;\n } else {\n this._counter[i]++;\n break;\n }\n }\n }\n\n\n /**\n * Mode Of Operation - Counter (CTR)\n */\n var ModeOfOperationCTR = function(key, counter) {\n if (!(this instanceof ModeOfOperationCTR)) {\n throw Error('AES must be instanitated with `new`');\n }\n\n this.description = \"Counter\";\n this.name = \"ctr\";\n\n if (!(counter instanceof Counter)) {\n counter = new Counter(counter)\n }\n\n this._counter = counter;\n\n this._remainingCounter = null;\n this._remainingCounterIndex = 16;\n\n this._aes = new AES(key);\n }\n\n ModeOfOperationCTR.prototype.encrypt = function(plaintext) {\n var encrypted = coerceArray(plaintext, true);\n\n for (var i = 0; i < encrypted.length; i++) {\n if (this._remainingCounterIndex === 16) {\n this._remainingCounter = this._aes.encrypt(this._counter._counter);\n this._remainingCounterIndex = 0;\n this._counter.increment();\n }\n encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++];\n }\n\n return encrypted;\n }\n\n // Decryption is symetric\n ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;\n\n\n ///////////////////////\n // Padding\n\n // See:https://tools.ietf.org/html/rfc2315\n function pkcs7pad(data) {\n data = coerceArray(data, true);\n var padder = 16 - (data.length % 16);\n var result = createArray(data.length + padder);\n copyArray(data, result);\n for (var i = data.length; i < result.length; i++) {\n result[i] = padder;\n }\n return result;\n }\n\n function pkcs7strip(data) {\n data = coerceArray(data, true);\n if (data.length < 16) { throw new Error('PKCS#7 invalid length'); }\n\n var padder = data[data.length - 1];\n if (padder > 16) { throw new Error('PKCS#7 padding byte out of range'); }\n\n var length = data.length - padder;\n for (var i = 0; i < padder; i++) {\n if (data[length + i] !== padder) {\n throw new Error('PKCS#7 invalid padding byte');\n }\n }\n\n var result = createArray(length);\n copyArray(data, result, 0, 0, length);\n return result;\n }\n\n ///////////////////////\n // Exporting\n\n\n // The block cipher\n var aesjs = {\n AES: AES,\n Counter: Counter,\n\n ModeOfOperation: {\n ecb: ModeOfOperationECB,\n cbc: ModeOfOperationCBC,\n cfb: ModeOfOperationCFB,\n ofb: ModeOfOperationOFB,\n ctr: ModeOfOperationCTR\n },\n\n utils: {\n hex: convertHex,\n utf8: convertUtf8\n },\n\n padding: {\n pkcs7: {\n pad: pkcs7pad,\n strip: pkcs7strip\n }\n },\n\n _arrayTest: {\n coerceArray: coerceArray,\n createArray: createArray,\n copyArray: copyArray,\n }\n };\n\n\n // node.js\n if (typeof exports !== 'undefined') {\n module.exports = aesjs\n\n // RequireJS/AMD\n // http://www.requirejs.org/docs/api.html\n // https://github.com/amdjs/amdjs-api/wiki/AMD\n } else if (typeof(define) === 'function' && define.amd) {\n define(aesjs);\n\n // Web Browsers\n } else {\n\n // If there was an existing library at \"aesjs\" make sure it's still available\n if (root.aesjs) {\n aesjs._aesjs = root.aesjs;\n }\n\n root.aesjs = aesjs;\n }\n\n\n})(this);\n\n},{}],2:[function(require,module,exports){\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\n},{\"buffer\":4}],3:[function(require,module,exports){\nvar randomBytes = require('../../src.ts/utils').randomBytes; module.exports = function(length) { return randomBytes(length); };\n},{\"../../src.ts/utils\":63}],4:[function(require,module,exports){\n\n},{}],5:[function(require,module,exports){\n'use strict';\n\nvar elliptic = exports;\n\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.hmacDRBG = require('./elliptic/hmac-drbg');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves');\n\n// Protocols\nelliptic.ec = require('./elliptic/ec');\nelliptic.eddsa = require('./elliptic/eddsa');\n\n},{\"../package.json\":19,\"./elliptic/curve\":8,\"./elliptic/curves\":11,\"./elliptic/ec\":12,\"./elliptic/eddsa\":15,\"./elliptic/hmac-drbg\":16,\"./elliptic/utils\":18,\"brorand\":3}],6:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar getNAF = utils.getNAF;\nvar getJSF = utils.getJSF;\nvar assert = utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new BN(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);\n\n // Useful for many curves\n this.zero = new BN(0).toRed(this.red);\n this.one = new BN(1).toRed(this.red);\n this.two = new BN(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new BN(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n\n // Generalized Greg Maxwell's trick\n var adjustCount = this.n && this.p.div(this.n);\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n for (var j = 0; j < naf.length; j += doubles.step) {\n var nafW = 0;\n for (var k = j + doubles.step - 1; k >= j; k--)\n nafW = (nafW << 1) + naf[k];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (var j = 0; j < repr.length; j++) {\n var nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var k = 0; i >= 0 && naf[i] === 0; i--)\n k++;\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len,\n jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n for (var i = 0; i < len; i++) {\n var p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (var i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a]);\n naf[b] = getNAF(coeffs[b], wndWidth[b]);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b] /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3 /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (var j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (var i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (var j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (var j = 0; j < len; j++) {\n var z = tmp[j];\n var p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (var i = 0; i < len; i++)\n wnd[i] = null;\n\n if (jacobianResult)\n return acc;\n else\n return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq(/*other*/) {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n\n var len = this.p.byteLength();\n\n // uncompressed, hybrid-odd, hybrid-even\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&\n bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06)\n assert(bytes[bytes.length - 1] % 2 === 0);\n else if (bytes[0] === 0x07)\n assert(bytes[bytes.length - 1] % 2 === 1);\n\n var res = this.point(bytes.slice(1, 1 + len),\n bytes.slice(1 + len, 1 + 2 * len));\n\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&\n bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n\n if (compact)\n return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n\n return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed)\n return false;\n\n var doubles = this.precomputed.doubles;\n if (!doubles)\n return false;\n\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n\n},{\"../../elliptic\":5,\"bn.js\":2}],7:[function(require,module,exports){\nmodule.exports = {};\n},{}],8:[function(require,module,exports){\n'use strict';\n\nvar curve = exports;\n\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');\n\n},{\"./base\":6,\"./edwards\":7,\"./mont\":9,\"./short\":10}],9:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],10:[function(require,module,exports){\n'use strict';\n\nvar curve = require('../curve');\nvar elliptic = require('../../elliptic');\nvar BN = require('bn.js');\nvar inherits = require('inherits');\nvar Base = curve.base;\n\nvar assert = elliptic.utils.assert;\n\nfunction ShortCurve(conf) {\n Base.call(this, 'short', conf);\n\n this.a = new BN(conf.a, 16).toRed(this.red);\n this.b = new BN(conf.b, 16).toRed(this.red);\n this.tinv = this.two.redInvm();\n\n this.zeroA = this.a.fromRed().cmpn(0) === 0;\n this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;\n\n // If the curve is endomorphic, precalculate beta and lambda\n this.endo = this._getEndomorphism(conf);\n this._endoWnafT1 = new Array(4);\n this._endoWnafT2 = new Array(4);\n}\ninherits(ShortCurve, Base);\nmodule.exports = ShortCurve;\n\nShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {\n // No efficient endomorphism\n if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)\n return;\n\n // Compute beta and lambda, that lambda * P = (beta * Px; Py)\n var beta;\n var lambda;\n if (conf.beta) {\n beta = new BN(conf.beta, 16).toRed(this.red);\n } else {\n var betas = this._getEndoRoots(this.p);\n // Choose the smallest beta\n beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];\n beta = beta.toRed(this.red);\n }\n if (conf.lambda) {\n lambda = new BN(conf.lambda, 16);\n } else {\n // Choose the lambda that is matching selected beta\n var lambdas = this._getEndoRoots(this.n);\n if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {\n lambda = lambdas[0];\n } else {\n lambda = lambdas[1];\n assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);\n }\n }\n\n // Get basis vectors, used for balanced length-two representation\n var basis;\n if (conf.basis) {\n basis = conf.basis.map(function(vec) {\n return {\n a: new BN(vec.a, 16),\n b: new BN(vec.b, 16)\n };\n });\n } else {\n basis = this._getEndoBasis(lambda);\n }\n\n return {\n beta: beta,\n lambda: lambda,\n basis: basis\n };\n};\n\nShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {\n // Find roots of for x^2 + x + 1 in F\n // Root = (-1 +- Sqrt(-3)) / 2\n //\n var red = num === this.p ? this.red : BN.mont(num);\n var tinv = new BN(2).toRed(red).redInvm();\n var ntinv = tinv.redNeg();\n\n var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);\n\n var l1 = ntinv.redAdd(s).fromRed();\n var l2 = ntinv.redSub(s).fromRed();\n return [ l1, l2 ];\n};\n\nShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {\n // aprxSqrt >= sqrt(this.n)\n var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));\n\n // 3.74\n // Run EGCD, until r(L + 1) < aprxSqrt\n var u = lambda;\n var v = this.n.clone();\n var x1 = new BN(1);\n var y1 = new BN(0);\n var x2 = new BN(0);\n var y2 = new BN(1);\n\n // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)\n var a0;\n var b0;\n // First vector\n var a1;\n var b1;\n // Second vector\n var a2;\n var b2;\n\n var prevR;\n var i = 0;\n var r;\n var x;\n while (u.cmpn(0) !== 0) {\n var q = v.div(u);\n r = v.sub(q.mul(u));\n x = x2.sub(q.mul(x1));\n var y = y2.sub(q.mul(y1));\n\n if (!a1 && r.cmp(aprxSqrt) < 0) {\n a0 = prevR.neg();\n b0 = x1;\n a1 = r.neg();\n b1 = x;\n } else if (a1 && ++i === 2) {\n break;\n }\n prevR = r;\n\n v = u;\n u = r;\n x2 = x1;\n x1 = x;\n y2 = y1;\n y1 = y;\n }\n a2 = r.neg();\n b2 = x;\n\n var len1 = a1.sqr().add(b1.sqr());\n var len2 = a2.sqr().add(b2.sqr());\n if (len2.cmp(len1) >= 0) {\n a2 = a0;\n b2 = b0;\n }\n\n // Normalize signs\n if (a1.negative) {\n a1 = a1.neg();\n b1 = b1.neg();\n }\n if (a2.negative) {\n a2 = a2.neg();\n b2 = b2.neg();\n }\n\n return [\n { a: a1, b: b1 },\n { a: a2, b: b2 }\n ];\n};\n\nShortCurve.prototype._endoSplit = function _endoSplit(k) {\n var basis = this.endo.basis;\n var v1 = basis[0];\n var v2 = basis[1];\n\n var c1 = v2.b.mul(k).divRound(this.n);\n var c2 = v1.b.neg().mul(k).divRound(this.n);\n\n var p1 = c1.mul(v1.a);\n var p2 = c2.mul(v2.a);\n var q1 = c1.mul(v1.b);\n var q2 = c2.mul(v2.b);\n\n // Calculate answer\n var k1 = k.sub(p1).sub(p2);\n var k2 = q1.add(q2).neg();\n return { k1: k1, k2: k2 };\n};\n\nShortCurve.prototype.pointFromX = function pointFromX(x, odd) {\n x = new BN(x, 16);\n if (!x.red)\n x = x.toRed(this.red);\n\n var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);\n var y = y2.redSqrt();\n if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)\n throw new Error('invalid point');\n\n // XXX Is there any way to tell if the number is odd without converting it\n // to non-red form?\n var isOdd = y.fromRed().isOdd();\n if (odd && !isOdd || !odd && isOdd)\n y = y.redNeg();\n\n return this.point(x, y);\n};\n\nShortCurve.prototype.validate = function validate(point) {\n if (point.inf)\n return true;\n\n var x = point.x;\n var y = point.y;\n\n var ax = this.a.redMul(x);\n var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);\n return y.redSqr().redISub(rhs).cmpn(0) === 0;\n};\n\nShortCurve.prototype._endoWnafMulAdd =\n function _endoWnafMulAdd(points, coeffs, jacobianResult) {\n var npoints = this._endoWnafT1;\n var ncoeffs = this._endoWnafT2;\n for (var i = 0; i < points.length; i++) {\n var split = this._endoSplit(coeffs[i]);\n var p = points[i];\n var beta = p._getBeta();\n\n if (split.k1.negative) {\n split.k1.ineg();\n p = p.neg(true);\n }\n if (split.k2.negative) {\n split.k2.ineg();\n beta = beta.neg(true);\n }\n\n npoints[i * 2] = p;\n npoints[i * 2 + 1] = beta;\n ncoeffs[i * 2] = split.k1;\n ncoeffs[i * 2 + 1] = split.k2;\n }\n var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);\n\n // Clean-up references to points and coefficients\n for (var j = 0; j < i * 2; j++) {\n npoints[j] = null;\n ncoeffs[j] = null;\n }\n return res;\n};\n\nfunction Point(curve, x, y, isRed) {\n Base.BasePoint.call(this, curve, 'affine');\n if (x === null && y === null) {\n this.x = null;\n this.y = null;\n this.inf = true;\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n // Force redgomery representation when loading from JSON\n if (isRed) {\n this.x.forceRed(this.curve.red);\n this.y.forceRed(this.curve.red);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n this.inf = false;\n }\n}\ninherits(Point, Base.BasePoint);\n\nShortCurve.prototype.point = function point(x, y, isRed) {\n return new Point(this, x, y, isRed);\n};\n\nShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {\n return Point.fromJSON(this, obj, red);\n};\n\nPoint.prototype._getBeta = function _getBeta() {\n if (!this.curve.endo)\n return;\n\n var pre = this.precomputed;\n if (pre && pre.beta)\n return pre.beta;\n\n var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);\n if (pre) {\n var curve = this.curve;\n var endoMul = function(p) {\n return curve.point(p.x.redMul(curve.endo.beta), p.y);\n };\n pre.beta = beta;\n beta.precomputed = {\n beta: null,\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(endoMul)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(endoMul)\n }\n };\n }\n return beta;\n};\n\nPoint.prototype.toJSON = function toJSON() {\n if (!this.precomputed)\n return [ this.x, this.y ];\n\n return [ this.x, this.y, this.precomputed && {\n doubles: this.precomputed.doubles && {\n step: this.precomputed.doubles.step,\n points: this.precomputed.doubles.points.slice(1)\n },\n naf: this.precomputed.naf && {\n wnd: this.precomputed.naf.wnd,\n points: this.precomputed.naf.points.slice(1)\n }\n } ];\n};\n\nPoint.fromJSON = function fromJSON(curve, obj, red) {\n if (typeof obj === 'string')\n obj = JSON.parse(obj);\n var res = curve.point(obj[0], obj[1], red);\n if (!obj[2])\n return res;\n\n function obj2point(obj) {\n return curve.point(obj[0], obj[1], red);\n }\n\n var pre = obj[2];\n res.precomputed = {\n beta: null,\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: [ res ].concat(pre.doubles.points.map(obj2point))\n },\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: [ res ].concat(pre.naf.points.map(obj2point))\n }\n };\n return res;\n};\n\nPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nPoint.prototype.isInfinity = function isInfinity() {\n return this.inf;\n};\n\nPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.inf)\n return p;\n\n // P + O = P\n if (p.inf)\n return this;\n\n // P + P = 2P\n if (this.eq(p))\n return this.dbl();\n\n // P + (-P) = O\n if (this.neg().eq(p))\n return this.curve.point(null, null);\n\n // P + Q = O\n if (this.x.cmp(p.x) === 0)\n return this.curve.point(null, null);\n\n var c = this.y.redSub(p.y);\n if (c.cmpn(0) !== 0)\n c = c.redMul(this.x.redSub(p.x).redInvm());\n var nx = c.redSqr().redISub(this.x).redISub(p.x);\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.dbl = function dbl() {\n if (this.inf)\n return this;\n\n // 2P = O\n var ys1 = this.y.redAdd(this.y);\n if (ys1.cmpn(0) === 0)\n return this.curve.point(null, null);\n\n var a = this.curve.a;\n\n var x2 = this.x.redSqr();\n var dyinv = ys1.redInvm();\n var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);\n\n var nx = c.redSqr().redISub(this.x.redAdd(this.x));\n var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);\n return this.curve.point(nx, ny);\n};\n\nPoint.prototype.getX = function getX() {\n return this.x.fromRed();\n};\n\nPoint.prototype.getY = function getY() {\n return this.y.fromRed();\n};\n\nPoint.prototype.mul = function mul(k) {\n k = new BN(k, 16);\n\n if (this._hasDoubles(k))\n return this.curve._fixedNafMul(this, k);\n else if (this.curve.endo)\n return this.curve._endoWnafMulAdd([ this ], [ k ]);\n else\n return this.curve._wnafMul(this, k);\n};\n\nPoint.prototype.mulAdd = function mulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2);\n};\n\nPoint.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {\n var points = [ this, p2 ];\n var coeffs = [ k1, k2 ];\n if (this.curve.endo)\n return this.curve._endoWnafMulAdd(points, coeffs, true);\n else\n return this.curve._wnafMulAdd(1, points, coeffs, 2, true);\n};\n\nPoint.prototype.eq = function eq(p) {\n return this === p ||\n this.inf === p.inf &&\n (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);\n};\n\nPoint.prototype.neg = function neg(_precompute) {\n if (this.inf)\n return this;\n\n var res = this.curve.point(this.x, this.y.redNeg());\n if (_precompute && this.precomputed) {\n var pre = this.precomputed;\n var negate = function(p) {\n return p.neg();\n };\n res.precomputed = {\n naf: pre.naf && {\n wnd: pre.naf.wnd,\n points: pre.naf.points.map(negate)\n },\n doubles: pre.doubles && {\n step: pre.doubles.step,\n points: pre.doubles.points.map(negate)\n }\n };\n }\n return res;\n};\n\nPoint.prototype.toJ = function toJ() {\n if (this.inf)\n return this.curve.jpoint(null, null, null);\n\n var res = this.curve.jpoint(this.x, this.y, this.curve.one);\n return res;\n};\n\nfunction JPoint(curve, x, y, z) {\n Base.BasePoint.call(this, curve, 'jacobian');\n if (x === null && y === null && z === null) {\n this.x = this.curve.one;\n this.y = this.curve.one;\n this.z = new BN(0);\n } else {\n this.x = new BN(x, 16);\n this.y = new BN(y, 16);\n this.z = new BN(z, 16);\n }\n if (!this.x.red)\n this.x = this.x.toRed(this.curve.red);\n if (!this.y.red)\n this.y = this.y.toRed(this.curve.red);\n if (!this.z.red)\n this.z = this.z.toRed(this.curve.red);\n\n this.zOne = this.z === this.curve.one;\n}\ninherits(JPoint, Base.BasePoint);\n\nShortCurve.prototype.jpoint = function jpoint(x, y, z) {\n return new JPoint(this, x, y, z);\n};\n\nJPoint.prototype.toP = function toP() {\n if (this.isInfinity())\n return this.curve.point(null, null);\n\n var zinv = this.z.redInvm();\n var zinv2 = zinv.redSqr();\n var ax = this.x.redMul(zinv2);\n var ay = this.y.redMul(zinv2).redMul(zinv);\n\n return this.curve.point(ax, ay);\n};\n\nJPoint.prototype.neg = function neg() {\n return this.curve.jpoint(this.x, this.y.redNeg(), this.z);\n};\n\nJPoint.prototype.add = function add(p) {\n // O + P = P\n if (this.isInfinity())\n return p;\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 12M + 4S + 7A\n var pz2 = p.z.redSqr();\n var z2 = this.z.redSqr();\n var u1 = this.x.redMul(pz2);\n var u2 = p.x.redMul(z2);\n var s1 = this.y.redMul(pz2.redMul(p.z));\n var s2 = p.y.redMul(z2.redMul(this.z));\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(p.z).redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mixedAdd = function mixedAdd(p) {\n // O + P = P\n if (this.isInfinity())\n return p.toJ();\n\n // P + O = P\n if (p.isInfinity())\n return this;\n\n // 8M + 3S + 7A\n var z2 = this.z.redSqr();\n var u1 = this.x;\n var u2 = p.x.redMul(z2);\n var s1 = this.y;\n var s2 = p.y.redMul(z2).redMul(this.z);\n\n var h = u1.redSub(u2);\n var r = s1.redSub(s2);\n if (h.cmpn(0) === 0) {\n if (r.cmpn(0) !== 0)\n return this.curve.jpoint(null, null, null);\n else\n return this.dbl();\n }\n\n var h2 = h.redSqr();\n var h3 = h2.redMul(h);\n var v = u1.redMul(h2);\n\n var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);\n var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));\n var nz = this.z.redMul(h);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.dblp = function dblp(pow) {\n if (pow === 0)\n return this;\n if (this.isInfinity())\n return this;\n if (!pow)\n return this.dbl();\n\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (var i = 0; i < pow; i++)\n r = r.dbl();\n return r;\n }\n\n // 1M + 2S + 1A + N * (4S + 5M + 8A)\n // N = 1 => 6M + 6S + 9A\n var a = this.curve.a;\n var tinv = this.curve.tinv;\n\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n // Reuse results\n var jyd = jy.redAdd(jy);\n for (var i = 0; i < pow; i++) {\n var jx2 = jx.redSqr();\n var jyd2 = jyd.redSqr();\n var jyd4 = jyd2.redSqr();\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var t1 = jx.redMul(jyd2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n var dny = c.redMul(t2);\n dny = dny.redIAdd(dny).redISub(jyd4);\n var nz = jyd.redMul(jz);\n if (i + 1 < pow)\n jz4 = jz4.redMul(jyd4);\n\n jx = nx;\n jz = nz;\n jyd = dny;\n }\n\n return this.curve.jpoint(jx, jyd.redMul(tinv), jz);\n};\n\nJPoint.prototype.dbl = function dbl() {\n if (this.isInfinity())\n return this;\n\n if (this.curve.zeroA)\n return this._zeroDbl();\n else if (this.curve.threeA)\n return this._threeDbl();\n else\n return this._dbl();\n};\n\nJPoint.prototype._zeroDbl = function _zeroDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 14A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // T = M ^ 2 - 2*S\n var t = m.redSqr().redISub(s).redISub(s);\n\n // 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2*Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html\n // #doubling-dbl-2009-l\n // 2M + 5S + 13A\n\n // A = X1^2\n var a = this.x.redSqr();\n // B = Y1^2\n var b = this.y.redSqr();\n // C = B^2\n var c = b.redSqr();\n // D = 2 * ((X1 + B)^2 - A - C)\n var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);\n d = d.redIAdd(d);\n // E = 3 * A\n var e = a.redAdd(a).redIAdd(a);\n // F = E^2\n var f = e.redSqr();\n\n // 8 * C\n var c8 = c.redIAdd(c);\n c8 = c8.redIAdd(c8);\n c8 = c8.redIAdd(c8);\n\n // X3 = F - 2 * D\n nx = f.redISub(d).redISub(d);\n // Y3 = E * (D - X3) - 8 * C\n ny = e.redMul(d.redISub(nx)).redISub(c8);\n // Z3 = 2 * Y1 * Z1\n nz = this.y.redMul(this.z);\n nz = nz.redIAdd(nz);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._threeDbl = function _threeDbl() {\n var nx;\n var ny;\n var nz;\n // Z = 1\n if (this.zOne) {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html\n // #doubling-mdbl-2007-bl\n // 1M + 5S + 15A\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // S = 2 * ((X1 + YY)^2 - XX - YYYY)\n var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n s = s.redIAdd(s);\n // M = 3 * XX + a\n var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);\n // T = M^2 - 2 * S\n var t = m.redSqr().redISub(s).redISub(s);\n // X3 = T\n nx = t;\n // Y3 = M * (S - T) - 8 * YYYY\n var yyyy8 = yyyy.redIAdd(yyyy);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n yyyy8 = yyyy8.redIAdd(yyyy8);\n ny = m.redMul(s.redISub(t)).redISub(yyyy8);\n // Z3 = 2 * Y1\n nz = this.y.redAdd(this.y);\n } else {\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b\n // 3M + 5S\n\n // delta = Z1^2\n var delta = this.z.redSqr();\n // gamma = Y1^2\n var gamma = this.y.redSqr();\n // beta = X1 * gamma\n var beta = this.x.redMul(gamma);\n // alpha = 3 * (X1 - delta) * (X1 + delta)\n var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));\n alpha = alpha.redAdd(alpha).redIAdd(alpha);\n // X3 = alpha^2 - 8 * beta\n var beta4 = beta.redIAdd(beta);\n beta4 = beta4.redIAdd(beta4);\n var beta8 = beta4.redAdd(beta4);\n nx = alpha.redSqr().redISub(beta8);\n // Z3 = (Y1 + Z1)^2 - gamma - delta\n nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);\n // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2\n var ggamma8 = gamma.redSqr();\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ggamma8 = ggamma8.redIAdd(ggamma8);\n ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);\n }\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype._dbl = function _dbl() {\n var a = this.curve.a;\n\n // 4M + 6S + 10A\n var jx = this.x;\n var jy = this.y;\n var jz = this.z;\n var jz4 = jz.redSqr().redSqr();\n\n var jx2 = jx.redSqr();\n var jy2 = jy.redSqr();\n\n var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));\n\n var jxd4 = jx.redAdd(jx);\n jxd4 = jxd4.redIAdd(jxd4);\n var t1 = jxd4.redMul(jy2);\n var nx = c.redSqr().redISub(t1.redAdd(t1));\n var t2 = t1.redISub(nx);\n\n var jyd8 = jy2.redSqr();\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n jyd8 = jyd8.redIAdd(jyd8);\n var ny = c.redMul(t2).redISub(jyd8);\n var nz = jy.redAdd(jy).redMul(jz);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.trpl = function trpl() {\n if (!this.curve.zeroA)\n return this.dbl().add(this);\n\n // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl\n // 5M + 10S + ...\n\n // XX = X1^2\n var xx = this.x.redSqr();\n // YY = Y1^2\n var yy = this.y.redSqr();\n // ZZ = Z1^2\n var zz = this.z.redSqr();\n // YYYY = YY^2\n var yyyy = yy.redSqr();\n // M = 3 * XX + a * ZZ2; a = 0\n var m = xx.redAdd(xx).redIAdd(xx);\n // MM = M^2\n var mm = m.redSqr();\n // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM\n var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);\n e = e.redIAdd(e);\n e = e.redAdd(e).redIAdd(e);\n e = e.redISub(mm);\n // EE = E^2\n var ee = e.redSqr();\n // T = 16*YYYY\n var t = yyyy.redIAdd(yyyy);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n t = t.redIAdd(t);\n // U = (M + E)^2 - MM - EE - T\n var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);\n // X3 = 4 * (X1 * EE - 4 * YY * U)\n var yyu4 = yy.redMul(u);\n yyu4 = yyu4.redIAdd(yyu4);\n yyu4 = yyu4.redIAdd(yyu4);\n var nx = this.x.redMul(ee).redISub(yyu4);\n nx = nx.redIAdd(nx);\n nx = nx.redIAdd(nx);\n // Y3 = 8 * Y1 * (U * (T - U) - E * EE)\n var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n ny = ny.redIAdd(ny);\n // Z3 = (Z1 + E)^2 - ZZ - EE\n var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);\n\n return this.curve.jpoint(nx, ny, nz);\n};\n\nJPoint.prototype.mul = function mul(k, kbase) {\n k = new BN(k, kbase);\n\n return this.curve._wnafMul(this, k);\n};\n\nJPoint.prototype.eq = function eq(p) {\n if (p.type === 'affine')\n return this.eq(p.toJ());\n\n if (this === p)\n return true;\n\n // x1 * z2^2 == x2 * z1^2\n var z2 = this.z.redSqr();\n var pz2 = p.z.redSqr();\n if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)\n return false;\n\n // y1 * z2^3 == y2 * z1^3\n var z3 = z2.redMul(this.z);\n var pz3 = pz2.redMul(p.z);\n return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;\n};\n\nJPoint.prototype.eqXToP = function eqXToP(x) {\n var zs = this.z.redSqr();\n var rx = x.toRed(this.curve.red).redMul(zs);\n if (this.x.cmp(rx) === 0)\n return true;\n\n var xc = x.clone();\n var t = this.curve.redN.redMul(zs);\n for (;;) {\n xc.iadd(this.curve.n);\n if (xc.cmp(this.curve.p) >= 0)\n return false;\n\n rx.redIAdd(t);\n if (this.x.cmp(rx) === 0)\n return true;\n }\n return false;\n};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '';\n return '';\n};\n\nJPoint.prototype.isInfinity = function isInfinity() {\n // XXX This code assumes that zero is always zero in red\n return this.z.cmpn(0) === 0;\n};\n\n},{\"../../elliptic\":5,\"../curve\":8,\"bn.js\":2,\"inherits\":32}],11:[function(require,module,exports){\n'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar elliptic = require('../elliptic');\n\nvar assert = elliptic.utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new elliptic.curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new elliptic.curve.edwards(options);\n else\n this.curve = new elliptic.curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve\n });\n return curve;\n }\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'\n ]\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'\n ]\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'\n ]\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'\n ]\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650'\n ]\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9'\n ]\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658'\n ]\n});\n\nvar pre;\ntry {\n pre = require('./precomputed/secp256k1');\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3'\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15'\n }\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre\n ]\n});\n\n},{\"../elliptic\":5,\"./precomputed/secp256k1\":17,\"hash.js\":20}],12:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nvar KeyPair = require('./key');\nvar Signature = require('./signature');\n\nfunction EC(options) {\n if (!(this instanceof EC))\n return new EC(options);\n\n // Shortcut `elliptic.ec(curve-name)`\n if (typeof options === 'string') {\n assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);\n\n options = elliptic.curves[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof elliptic.curves.PresetCurve)\n options = { curve: options };\n\n this.curve = options.curve.curve;\n this.n = this.curve.n;\n this.nh = this.n.ushrn(1);\n this.g = this.curve.g;\n\n // Point on curve\n this.g = options.curve.g;\n this.g.precompute(options.curve.n.bitLength() + 1);\n\n // Hash for function for DRBG\n this.hash = options.hash || options.curve.hash;\n}\nmodule.exports = EC;\n\nEC.prototype.keyPair = function keyPair(options) {\n return new KeyPair(this, options);\n};\n\nEC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {\n return KeyPair.fromPrivate(this, priv, enc);\n};\n\nEC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {\n return KeyPair.fromPublic(this, pub, enc);\n};\n\nEC.prototype.genKeyPair = function genKeyPair(options) {\n if (!options)\n options = {};\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n pers: options.pers,\n entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),\n nonce: this.n.toArray()\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new BN(2));\n do {\n var priv = new BN(drbg.generate(bytes));\n if (priv.cmp(ns2) > 0)\n continue;\n\n priv.iaddn(1);\n return this.keyFromPrivate(priv);\n } while (true);\n};\n\nEC.prototype._truncateToN = function truncateToN(msg, truncOnly) {\n var delta = msg.byteLength() * 8 - this.n.bitLength();\n if (delta > 0)\n msg = msg.ushrn(delta);\n if (!truncOnly && msg.cmp(this.n) >= 0)\n return msg.sub(this.n);\n else\n return msg;\n};\n\nEC.prototype.sign = function sign(msg, key, enc, options) {\n if (typeof enc === 'object') {\n options = enc;\n enc = null;\n }\n if (!options)\n options = {};\n\n key = this.keyFromPrivate(key, enc);\n msg = this._truncateToN(new BN(msg, 16));\n\n // Zero-extend key to provide enough entropy\n var bytes = this.n.byteLength();\n var bkey = key.getPrivate().toArray('be', bytes);\n\n // Zero-extend nonce to have the same byte size as N\n var nonce = msg.toArray('be', bytes);\n\n // Instantiate Hmac_DRBG\n var drbg = new elliptic.hmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce,\n pers: options.pers,\n persEnc: options.persEnc\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new BN(1));\n\n for (var iter = 0; true; iter++) {\n var k = options.k ?\n options.k(iter) :\n new BN(drbg.generate(this.n.byteLength()));\n k = this._truncateToN(k, true);\n if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)\n continue;\n\n var kp = this.g.mul(k);\n if (kp.isInfinity())\n continue;\n\n var kpX = kp.getX();\n var r = kpX.umod(this.n);\n if (r.cmpn(0) === 0)\n continue;\n\n var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));\n s = s.umod(this.n);\n if (s.cmpn(0) === 0)\n continue;\n\n var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |\n (kpX.cmp(r) !== 0 ? 2 : 0);\n\n // Use complement of `s`, if it is > `n / 2`\n if (options.canonical && s.cmp(this.nh) > 0) {\n s = this.n.sub(s);\n recoveryParam ^= 1;\n }\n\n return new Signature({ r: r, s: s, recoveryParam: recoveryParam });\n }\n};\n\nEC.prototype.verify = function verify(msg, signature, key, enc) {\n msg = this._truncateToN(new BN(msg, 16));\n key = this.keyFromPublic(key, enc);\n signature = new Signature(signature, 'hex');\n\n // Perform primitive values validation\n var r = signature.r;\n var s = signature.s;\n if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)\n return false;\n if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)\n return false;\n\n // Validate signature\n var sinv = s.invm(this.n);\n var u1 = sinv.mul(msg).umod(this.n);\n var u2 = sinv.mul(r).umod(this.n);\n\n if (!this.curve._maxwellTrick) {\n var p = this.g.mulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n return p.getX().umod(this.n).cmp(r) === 0;\n }\n\n // NOTE: Greg Maxwell's trick, inspired by:\n // https://git.io/vad3K\n\n var p = this.g.jmulAdd(u1, key.getPublic(), u2);\n if (p.isInfinity())\n return false;\n\n // Compare `p.x` of Jacobian point with `r`,\n // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the\n // inverse of `p.z^2`\n return p.eqXToP(r);\n};\n\nEC.prototype.recoverPubKey = function(msg, signature, j, enc) {\n assert((3 & j) === j, 'The recovery param is more than two bits');\n signature = new Signature(signature, enc);\n\n var n = this.n;\n var e = new BN(msg);\n var r = signature.r;\n var s = signature.s;\n\n // A set LSB signifies that the y-coordinate is odd\n var isYOdd = j & 1;\n var isSecondKey = j >> 1;\n if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)\n throw new Error('Unable to find sencond key candinate');\n\n // 1.1. Let x = r + jn.\n if (isSecondKey)\n r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);\n else\n r = this.curve.pointFromX(r, isYOdd);\n\n var rInv = signature.r.invm(n);\n var s1 = n.sub(e).mul(rInv).umod(n);\n var s2 = s.mul(rInv).umod(n);\n\n // 1.6.1 Compute Q = r^-1 (sR - eG)\n // Q = r^-1 (sR + -eG)\n return this.g.mulAdd(s1, r, s2);\n};\n\nEC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {\n signature = new Signature(signature, enc);\n if (signature.recoveryParam !== null)\n return signature.recoveryParam;\n\n for (var i = 0; i < 4; i++) {\n var Qprime;\n try {\n Qprime = this.recoverPubKey(e, signature, i);\n } catch (e) {\n continue;\n }\n\n if (Qprime.eq(Q))\n return i;\n }\n throw new Error('Unable to find valid recovery factor');\n};\n\n},{\"../../elliptic\":5,\"./key\":13,\"./signature\":14,\"bn.js\":2}],13:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction KeyPair(ec, options) {\n this.ec = ec;\n this.priv = null;\n this.pub = null;\n\n // KeyPair(ec, { priv: ..., pub: ... })\n if (options.priv)\n this._importPrivate(options.priv, options.privEnc);\n if (options.pub)\n this._importPublic(options.pub, options.pubEnc);\n}\nmodule.exports = KeyPair;\n\nKeyPair.fromPublic = function fromPublic(ec, pub, enc) {\n if (pub instanceof KeyPair)\n return pub;\n\n return new KeyPair(ec, {\n pub: pub,\n pubEnc: enc\n });\n};\n\nKeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {\n if (priv instanceof KeyPair)\n return priv;\n\n return new KeyPair(ec, {\n priv: priv,\n privEnc: enc\n });\n};\n\nKeyPair.prototype.validate = function validate() {\n var pub = this.getPublic();\n\n if (pub.isInfinity())\n return { result: false, reason: 'Invalid public key' };\n if (!pub.validate())\n return { result: false, reason: 'Public key is not a point' };\n if (!pub.mul(this.ec.curve.n).isInfinity())\n return { result: false, reason: 'Public key * N != O' };\n\n return { result: true, reason: null };\n};\n\nKeyPair.prototype.getPublic = function getPublic(compact, enc) {\n // compact is optional argument\n if (typeof compact === 'string') {\n enc = compact;\n compact = null;\n }\n\n if (!this.pub)\n this.pub = this.ec.g.mul(this.priv);\n\n if (!enc)\n return this.pub;\n\n return this.pub.encode(enc, compact);\n};\n\nKeyPair.prototype.getPrivate = function getPrivate(enc) {\n if (enc === 'hex')\n return this.priv.toString(16, 2);\n else\n return this.priv;\n};\n\nKeyPair.prototype._importPrivate = function _importPrivate(key, enc) {\n this.priv = new BN(key, enc || 16);\n\n // Ensure that the priv won't be bigger than n, otherwise we may fail\n // in fixed multiplication method\n this.priv = this.priv.umod(this.ec.curve.n);\n};\n\nKeyPair.prototype._importPublic = function _importPublic(key, enc) {\n if (key.x || key.y) {\n // Montgomery points only have an `x` coordinate.\n // Weierstrass/Edwards points on the other hand have both `x` and\n // `y` coordinates.\n if (this.ec.curve.type === 'mont') {\n assert(key.x, 'Need x coordinate');\n } else if (this.ec.curve.type === 'short' ||\n this.ec.curve.type === 'edwards') {\n assert(key.x && key.y, 'Need both x and y coordinate');\n }\n this.pub = this.ec.curve.point(key.x, key.y);\n return;\n }\n this.pub = this.ec.curve.decodePoint(key, enc);\n};\n\n// ECDH\nKeyPair.prototype.derive = function derive(pub) {\n return pub.mul(this.priv).getX();\n};\n\n// ECDSA\nKeyPair.prototype.sign = function sign(msg, enc, options) {\n return this.ec.sign(msg, this, enc, options);\n};\n\nKeyPair.prototype.verify = function verify(msg, signature) {\n return this.ec.verify(msg, signature, this);\n};\n\nKeyPair.prototype.inspect = function inspect() {\n return '';\n};\n\n},{\"../../elliptic\":5,\"bn.js\":2}],14:[function(require,module,exports){\n'use strict';\n\nvar BN = require('bn.js');\n\nvar elliptic = require('../../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction Signature(options, enc) {\n if (options instanceof Signature)\n return options;\n\n if (this._importDER(options, enc))\n return;\n\n assert(options.r && options.s, 'Signature without r or s');\n this.r = new BN(options.r, 16);\n this.s = new BN(options.s, 16);\n if (options.recoveryParam === undefined)\n this.recoveryParam = null;\n else\n this.recoveryParam = options.recoveryParam;\n}\nmodule.exports = Signature;\n\nfunction Position() {\n this.place = 0;\n}\n\nfunction getLength(buf, p) {\n var initial = buf[p.place++];\n if (!(initial & 0x80)) {\n return initial;\n }\n var octetLen = initial & 0xf;\n var val = 0;\n for (var i = 0, off = p.place; i < octetLen; i++, off++) {\n val <<= 8;\n val |= buf[off];\n }\n p.place = off;\n return val;\n}\n\nfunction rmPadding(buf) {\n var i = 0;\n var len = buf.length - 1;\n while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {\n i++;\n }\n if (i === 0) {\n return buf;\n }\n return buf.slice(i);\n}\n\nSignature.prototype._importDER = function _importDER(data, enc) {\n data = utils.toArray(data, enc);\n var p = new Position();\n if (data[p.place++] !== 0x30) {\n return false;\n }\n var len = getLength(data, p);\n if ((len + p.place) !== data.length) {\n return false;\n }\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var rlen = getLength(data, p);\n var r = data.slice(p.place, rlen + p.place);\n p.place += rlen;\n if (data[p.place++] !== 0x02) {\n return false;\n }\n var slen = getLength(data, p);\n if (data.length !== slen + p.place) {\n return false;\n }\n var s = data.slice(p.place, slen + p.place);\n if (r[0] === 0 && (r[1] & 0x80)) {\n r = r.slice(1);\n }\n if (s[0] === 0 && (s[1] & 0x80)) {\n s = s.slice(1);\n }\n\n this.r = new BN(r);\n this.s = new BN(s);\n this.recoveryParam = null;\n\n return true;\n};\n\nfunction constructLength(arr, len) {\n if (len < 0x80) {\n arr.push(len);\n return;\n }\n var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);\n arr.push(octets | 0x80);\n while (--octets) {\n arr.push((len >>> (octets << 3)) & 0xff);\n }\n arr.push(len);\n}\n\nSignature.prototype.toDER = function toDER(enc) {\n var r = this.r.toArray();\n var s = this.s.toArray();\n\n // Pad values\n if (r[0] & 0x80)\n r = [ 0 ].concat(r);\n // Pad values\n if (s[0] & 0x80)\n s = [ 0 ].concat(s);\n\n r = rmPadding(r);\n s = rmPadding(s);\n\n while (!s[0] && !(s[1] & 0x80)) {\n s = s.slice(1);\n }\n var arr = [ 0x02 ];\n constructLength(arr, r.length);\n arr = arr.concat(r);\n arr.push(0x02);\n constructLength(arr, s.length);\n var backHalf = arr.concat(s);\n var res = [ 0x30 ];\n constructLength(res, backHalf.length);\n res = res.concat(backHalf);\n return utils.encode(res, enc);\n};\n\n},{\"../../elliptic\":5,\"bn.js\":2}],15:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],16:[function(require,module,exports){\n'use strict';\n\nvar hash = require('hash.js');\nvar elliptic = require('../elliptic');\nvar utils = elliptic.utils;\nvar assert = utils.assert;\n\nfunction HmacDRBG(options) {\n if (!(this instanceof HmacDRBG))\n return new HmacDRBG(options);\n this.hash = options.hash;\n this.predResist = !!options.predResist;\n\n this.outLen = this.hash.outSize;\n this.minEntropy = options.minEntropy || this.hash.hmacStrength;\n\n this.reseed = null;\n this.reseedInterval = null;\n this.K = null;\n this.V = null;\n\n var entropy = utils.toArray(options.entropy, options.entropyEnc);\n var nonce = utils.toArray(options.nonce, options.nonceEnc);\n var pers = utils.toArray(options.pers, options.persEnc);\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n this._init(entropy, nonce, pers);\n}\nmodule.exports = HmacDRBG;\n\nHmacDRBG.prototype._init = function init(entropy, nonce, pers) {\n var seed = entropy.concat(nonce).concat(pers);\n\n this.K = new Array(this.outLen / 8);\n this.V = new Array(this.outLen / 8);\n for (var i = 0; i < this.V.length; i++) {\n this.K[i] = 0x00;\n this.V[i] = 0x01;\n }\n\n this._update(seed);\n this.reseed = 1;\n this.reseedInterval = 0x1000000000000; // 2^48\n};\n\nHmacDRBG.prototype._hmac = function hmac() {\n return new hash.hmac(this.hash, this.K);\n};\n\nHmacDRBG.prototype._update = function update(seed) {\n var kmac = this._hmac()\n .update(this.V)\n .update([ 0x00 ]);\n if (seed)\n kmac = kmac.update(seed);\n this.K = kmac.digest();\n this.V = this._hmac().update(this.V).digest();\n if (!seed)\n return;\n\n this.K = this._hmac()\n .update(this.V)\n .update([ 0x01 ])\n .update(seed)\n .digest();\n this.V = this._hmac().update(this.V).digest();\n};\n\nHmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {\n // Optional entropy enc\n if (typeof entropyEnc !== 'string') {\n addEnc = add;\n add = entropyEnc;\n entropyEnc = null;\n }\n\n entropy = utils.toBuffer(entropy, entropyEnc);\n add = utils.toBuffer(add, addEnc);\n\n assert(entropy.length >= (this.minEntropy / 8),\n 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');\n\n this._update(entropy.concat(add || []));\n this.reseed = 1;\n};\n\nHmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {\n if (this.reseed > this.reseedInterval)\n throw new Error('Reseed is required');\n\n // Optional encoding\n if (typeof enc !== 'string') {\n addEnc = add;\n add = enc;\n enc = null;\n }\n\n // Optional additional data\n if (add) {\n add = utils.toArray(add, addEnc);\n this._update(add);\n }\n\n var temp = [];\n while (temp.length < len) {\n this.V = this._hmac().update(this.V).digest();\n temp = temp.concat(this.V);\n }\n\n var res = temp.slice(0, len);\n this._update(add);\n this.reseed++;\n return utils.encode(res, enc);\n};\n\n},{\"../elliptic\":5,\"hash.js\":20}],17:[function(require,module,exports){\nmodule.exports = undefined;\n},{}],18:[function(require,module,exports){\n'use strict';\n\nvar utils = exports;\nvar BN = require('bn.js');\n\nutils.assert = function assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n};\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w) {\n var naf = [];\n var ws = 1 << (w + 1);\n var k = num.clone();\n while (k.cmpn(1) >= 0) {\n var z;\n if (k.isOdd()) {\n var mod = k.andln(ws - 1);\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n naf.push(z);\n\n // Optimization, shift by word if possible\n var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;\n for (var i = 1; i < shift; i++)\n naf.push(0);\n k.iushrn(shift);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n []\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n var m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n var m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.iushrn(1);\n k2.iushrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\nfunction cachedProperty(obj, name, computer) {\n var key = '_' + name;\n obj.prototype[name] = function cachedProperty() {\n return this[key] !== undefined ? this[key] :\n this[key] = computer.call(this);\n };\n}\nutils.cachedProperty = cachedProperty;\n\nfunction parseBytes(bytes) {\n return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :\n bytes;\n}\nutils.parseBytes = parseBytes;\n\nfunction intFromLE(bytes) {\n return new BN(bytes, 'hex', 'le');\n}\nutils.intFromLE = intFromLE;\n\n\n},{\"bn.js\":2}],19:[function(require,module,exports){\nmodule.exports={\"version\":\"6.3.3\"}\n},{}],20:[function(require,module,exports){\nvar hash = exports;\n\nhash.utils = require('./hash/utils');\nhash.common = require('./hash/common');\nhash.sha = require('./hash/sha');\nhash.ripemd = require('./hash/ripemd');\nhash.hmac = require('./hash/hmac');\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n\n},{\"./hash/common\":21,\"./hash/hmac\":22,\"./hash/ripemd\":23,\"./hash/sha\":24,\"./hash/utils\":31}],21:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n\n},{\"./utils\":31,\"minimalistic-assert\":34}],22:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction Hmac(hash, key, enc) {\n if (!(this instanceof Hmac))\n return new Hmac(hash, key, enc);\n this.Hash = hash;\n this.blockSize = hash.blockSize / 8;\n this.outSize = hash.outSize / 8;\n this.inner = null;\n this.outer = null;\n\n this._init(utils.toArray(key, enc));\n}\nmodule.exports = Hmac;\n\nHmac.prototype._init = function init(key) {\n // Shorten key, if needed\n if (key.length > this.blockSize)\n key = new this.Hash().update(key).digest();\n assert(key.length <= this.blockSize);\n\n // Add padding to key\n for (var i = key.length; i < this.blockSize; i++)\n key.push(0);\n\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x36;\n this.inner = new this.Hash().update(key);\n\n // 0x36 ^ 0x5c = 0x6a\n for (i = 0; i < key.length; i++)\n key[i] ^= 0x6a;\n this.outer = new this.Hash().update(key);\n};\n\nHmac.prototype.update = function update(msg, enc) {\n this.inner.update(msg, enc);\n return this;\n};\n\nHmac.prototype.digest = function digest(enc) {\n this.outer.update(this.inner.digest());\n return this.outer.digest(enc);\n};\n\n},{\"./utils\":31,\"minimalistic-assert\":34}],23:[function(require,module,exports){\nmodule.exports = {ripemd160: null}\n},{}],24:[function(require,module,exports){\n'use strict';\n\nexports.sha1 = require('./sha/1');\nexports.sha224 = require('./sha/224');\nexports.sha256 = require('./sha/256');\nexports.sha384 = require('./sha/384');\nexports.sha512 = require('./sha/512');\n\n},{\"./sha/1\":25,\"./sha/224\":26,\"./sha/256\":27,\"./sha/384\":28,\"./sha/512\":29}],25:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],26:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],27:[function(require,module,exports){\n'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar shaCommon = require('./common');\nvar assert = require('minimalistic-assert');\n\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar ch32 = shaCommon.ch32;\nvar maj32 = shaCommon.maj32;\nvar s0_256 = shaCommon.s0_256;\nvar s1_256 = shaCommon.s1_256;\nvar g0_256 = shaCommon.g0_256;\nvar g1_256 = shaCommon.g1_256;\n\nvar BlockHash = common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nmodule.exports = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\n},{\"../common\":21,\"../utils\":31,\"./common\":30,\"minimalistic-assert\":34}],28:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],29:[function(require,module,exports){\n'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar assert = require('minimalistic-assert');\n\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\n\nvar BlockHash = common.BlockHash;\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nmodule.exports = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n c0_hi = s0_512_hi(ah, al);\n c0_lo = s0_512_lo(ah, al);\n c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\n},{\"../common\":21,\"../utils\":31,\"minimalistic-assert\":34}],30:[function(require,module,exports){\n'use strict';\n\nvar utils = require('../utils');\nvar rotr32 = utils.rotr32;\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\nexports.ft_1 = ft_1;\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\nexports.ch32 = ch32;\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\nexports.maj32 = maj32;\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\nexports.p32 = p32;\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\nexports.s0_256 = s0_256;\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\nexports.s1_256 = s1_256;\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\nexports.g0_256 = g0_256;\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\nexports.g1_256 = g1_256;\n\n},{\"../utils\":31}],31:[function(require,module,exports){\n'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nexports.inherits = inherits;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nexports.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nexports.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nexports.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nexports.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nexports.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nexports.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nexports.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nexports.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nexports.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nexports.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nexports.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nexports.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nexports.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nexports.sum32_5 = sum32_5;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n}\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n}\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n}\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n}\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n}\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n}\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n}\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n}\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.shr64_lo = shr64_lo;\n\n},{\"inherits\":32,\"minimalistic-assert\":34}],32:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function 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 };\n} else {\n // old school shim for old browsers\n module.exports = 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\n},{}],33:[function(require,module,exports){\n(function (process,global){\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\n}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"_process\":35}],34:[function(require,module,exports){\nmodule.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n\n},{}],35:[function(require,module,exports){\n(function (global){\nif (!global.setImmediate) { global.setImmedaite = setTimeout; };\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],36:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\";\n\n(function(root) {\n var MAX_VALUE = 0x7fffffff;\n\n // The SHA256 and PBKDF2 implementation are from scrypt-async-js:\n // See: https://github.com/dchest/scrypt-async-js\n function SHA256(m) {\n var K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,\n 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,\n 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,\n 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,\n 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,\n 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,\n 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n ];\n\n var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a;\n var h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;\n var w = new Array(64);\n\n function blocks(p) {\n var off = 0, len = p.length;\n while (len >= 64) {\n var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i, j, t1, t2;\n\n for (i = 0; i < 16; i++) {\n j = off + i*4;\n w[i] = ((p[j] & 0xff)<<24) | ((p[j+1] & 0xff)<<16) |\n ((p[j+2] & 0xff)<<8) | (p[j+3] & 0xff);\n }\n\n for (i = 16; i < 64; i++) {\n u = w[i-2];\n t1 = ((u>>>17) | (u<<(32-17))) ^ ((u>>>19) | (u<<(32-19))) ^ (u>>>10);\n\n u = w[i-15];\n t2 = ((u>>>7) | (u<<(32-7))) ^ ((u>>>18) | (u<<(32-18))) ^ (u>>>3);\n\n w[i] = (((t1 + w[i-7]) | 0) + ((t2 + w[i-16]) | 0)) | 0;\n }\n\n for (i = 0; i < 64; i++) {\n t1 = ((((((e>>>6) | (e<<(32-6))) ^ ((e>>>11) | (e<<(32-11))) ^\n ((e>>>25) | (e<<(32-25)))) + ((e & f) ^ (~e & g))) | 0) +\n ((h + ((K[i] + w[i]) | 0)) | 0)) | 0;\n\n t2 = ((((a>>>2) | (a<<(32-2))) ^ ((a>>>13) | (a<<(32-13))) ^\n ((a>>>22) | (a<<(32-22)))) + ((a & b) ^ (a & c) ^ (b & c))) | 0;\n\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n\n h0 = (h0 + a) | 0;\n h1 = (h1 + b) | 0;\n h2 = (h2 + c) | 0;\n h3 = (h3 + d) | 0;\n h4 = (h4 + e) | 0;\n h5 = (h5 + f) | 0;\n h6 = (h6 + g) | 0;\n h7 = (h7 + h) | 0;\n\n off += 64;\n len -= 64;\n }\n }\n\n blocks(m);\n\n var i, bytesLeft = m.length % 64,\n bitLenHi = (m.length / 0x20000000) | 0,\n bitLenLo = m.length << 3,\n numZeros = (bytesLeft < 56) ? 56 : 120,\n p = m.slice(m.length - bytesLeft, m.length);\n\n p.push(0x80);\n for (i = bytesLeft + 1; i < numZeros; i++) { p.push(0); }\n p.push((bitLenHi>>>24) & 0xff);\n p.push((bitLenHi>>>16) & 0xff);\n p.push((bitLenHi>>>8) & 0xff);\n p.push((bitLenHi>>>0) & 0xff);\n p.push((bitLenLo>>>24) & 0xff);\n p.push((bitLenLo>>>16) & 0xff);\n p.push((bitLenLo>>>8) & 0xff);\n p.push((bitLenLo>>>0) & 0xff);\n\n blocks(p);\n\n return [\n (h0>>>24) & 0xff, (h0>>>16) & 0xff, (h0>>>8) & 0xff, (h0>>>0) & 0xff,\n (h1>>>24) & 0xff, (h1>>>16) & 0xff, (h1>>>8) & 0xff, (h1>>>0) & 0xff,\n (h2>>>24) & 0xff, (h2>>>16) & 0xff, (h2>>>8) & 0xff, (h2>>>0) & 0xff,\n (h3>>>24) & 0xff, (h3>>>16) & 0xff, (h3>>>8) & 0xff, (h3>>>0) & 0xff,\n (h4>>>24) & 0xff, (h4>>>16) & 0xff, (h4>>>8) & 0xff, (h4>>>0) & 0xff,\n (h5>>>24) & 0xff, (h5>>>16) & 0xff, (h5>>>8) & 0xff, (h5>>>0) & 0xff,\n (h6>>>24) & 0xff, (h6>>>16) & 0xff, (h6>>>8) & 0xff, (h6>>>0) & 0xff,\n (h7>>>24) & 0xff, (h7>>>16) & 0xff, (h7>>>8) & 0xff, (h7>>>0) & 0xff\n ];\n }\n\n function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) {\n // compress password if it's longer than hash block length\n password = password.length <= 64 ? password : SHA256(password);\n\n var i;\n var innerLen = 64 + salt.length + 4;\n var inner = new Array(innerLen);\n var outerKey = new Array(64);\n var dk = [];\n\n // inner = (password ^ ipad) || salt || counter\n for (i = 0; i < 64; i++) inner[i] = 0x36;\n for (i = 0; i < password.length; i++) inner[i] ^= password[i];\n for (i = 0; i < salt.length; i++) inner[64+i] = salt[i];\n for (i = innerLen - 4; i < innerLen; i++) inner[i] = 0;\n\n // outerKey = password ^ opad\n for (i = 0; i < 64; i++) outerKey[i] = 0x5c;\n for (i = 0; i < password.length; i++) outerKey[i] ^= password[i];\n\n // increments counter inside inner\n function incrementCounter() {\n for (var i = innerLen-1; i >= innerLen-4; i--) {\n inner[i]++;\n if (inner[i] <= 0xff) return;\n inner[i] = 0;\n }\n }\n\n // output blocks = SHA256(outerKey || SHA256(inner)) ...\n while (dkLen >= 32) {\n incrementCounter();\n dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))));\n dkLen -= 32;\n }\n if (dkLen > 0) {\n incrementCounter();\n dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0, dkLen));\n }\n\n return dk;\n }\n\n // The following is an adaptation of scryptsy\n // See: https://www.npmjs.com/package/scryptsy\n function blockmix_salsa8(BY, Yi, r, x, _X) {\n var i;\n\n arraycopy(BY, (2 * r - 1) * 16, _X, 0, 16);\n for (i = 0; i < 2 * r; i++) {\n blockxor(BY, i * 16, _X, 16);\n salsa20_8(_X, x);\n arraycopy(_X, 0, BY, Yi + (i * 16), 16);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy(BY, Yi + (i * 2) * 16, BY, (i * 16), 16);\n }\n\n for (i = 0; i < r; i++) {\n arraycopy(BY, Yi + (i * 2 + 1) * 16, BY, (i + r) * 16, 16);\n }\n }\n\n function R(a, b) {\n return (a << b) | (a >>> (32 - b));\n }\n\n function salsa20_8(B, x) {\n arraycopy(B, 0, x, 0, 16);\n\n for (var i = 8; i > 0; i -= 2) {\n x[ 4] ^= R(x[ 0] + x[12], 7);\n x[ 8] ^= R(x[ 4] + x[ 0], 9);\n x[12] ^= R(x[ 8] + x[ 4], 13);\n x[ 0] ^= R(x[12] + x[ 8], 18);\n x[ 9] ^= R(x[ 5] + x[ 1], 7);\n x[13] ^= R(x[ 9] + x[ 5], 9);\n x[ 1] ^= R(x[13] + x[ 9], 13);\n x[ 5] ^= R(x[ 1] + x[13], 18);\n x[14] ^= R(x[10] + x[ 6], 7);\n x[ 2] ^= R(x[14] + x[10], 9);\n x[ 6] ^= R(x[ 2] + x[14], 13);\n x[10] ^= R(x[ 6] + x[ 2], 18);\n x[ 3] ^= R(x[15] + x[11], 7);\n x[ 7] ^= R(x[ 3] + x[15], 9);\n x[11] ^= R(x[ 7] + x[ 3], 13);\n x[15] ^= R(x[11] + x[ 7], 18);\n x[ 1] ^= R(x[ 0] + x[ 3], 7);\n x[ 2] ^= R(x[ 1] + x[ 0], 9);\n x[ 3] ^= R(x[ 2] + x[ 1], 13);\n x[ 0] ^= R(x[ 3] + x[ 2], 18);\n x[ 6] ^= R(x[ 5] + x[ 4], 7);\n x[ 7] ^= R(x[ 6] + x[ 5], 9);\n x[ 4] ^= R(x[ 7] + x[ 6], 13);\n x[ 5] ^= R(x[ 4] + x[ 7], 18);\n x[11] ^= R(x[10] + x[ 9], 7);\n x[ 8] ^= R(x[11] + x[10], 9);\n x[ 9] ^= R(x[ 8] + x[11], 13);\n x[10] ^= R(x[ 9] + x[ 8], 18);\n x[12] ^= R(x[15] + x[14], 7);\n x[13] ^= R(x[12] + x[15], 9);\n x[14] ^= R(x[13] + x[12], 13);\n x[15] ^= R(x[14] + x[13], 18);\n }\n\n for (i = 0; i < 16; ++i) {\n B[i] += x[i];\n }\n }\n\n // naive approach... going back to loop unrolling may yield additional performance\n function blockxor(S, Si, D, len) {\n for (var i = 0; i < len; i++) {\n D[i] ^= S[Si + i]\n }\n }\n\n function arraycopy(src, srcPos, dest, destPos, length) {\n while (length--) {\n dest[destPos++] = src[srcPos++];\n }\n }\n\n function checkBufferish(o) {\n if (!o || typeof(o.length) !== 'number') {\n return false;\n }\n for (var i = 0; i < o.length; i++) {\n if (typeof(o[i]) !== 'number') { return false; }\n\n var v = parseInt(o[i]);\n if (v != o[i] || v < 0 || v >= 256) {\n return false;\n }\n }\n return true;\n }\n\n function ensureInteger(value, name) {\n var intValue = parseInt(value);\n if (value != intValue) { throw new Error('invalid ' + name); }\n return intValue;\n }\n\n // N = Cpu cost, r = Memory cost, p = parallelization cost\n // callback(error, progress, key)\n function scrypt(password, salt, N, r, p, dkLen, callback) {\n\n if (!callback) { throw new Error('missing callback'); }\n\n N = ensureInteger(N, 'N');\n r = ensureInteger(r, 'r');\n p = ensureInteger(p, 'p');\n\n dkLen = ensureInteger(dkLen, 'dkLen');\n\n if (N === 0 || (N & (N - 1)) !== 0) { throw new Error('N must be power of 2'); }\n\n if (N > MAX_VALUE / 128 / r) { throw new Error('N too large'); }\n if (r > MAX_VALUE / 128 / p) { throw new Error('r too large'); }\n\n if (!checkBufferish(password)) {\n throw new Error('password must be an array or buffer');\n }\n\n if (!checkBufferish(salt)) {\n throw new Error('salt must be an array or buffer');\n }\n\n var b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r);\n var B = new Uint32Array(p * 32 * r)\n for (var i = 0; i < B.length; i++) {\n var j = i * 4;\n B[i] = ((b[j + 3] & 0xff) << 24) |\n ((b[j + 2] & 0xff) << 16) |\n ((b[j + 1] & 0xff) << 8) |\n ((b[j + 0] & 0xff) << 0);\n }\n\n var XY = new Uint32Array(64 * r);\n var V = new Uint32Array(32 * r * N);\n\n var Yi = 32 * r;\n\n // scratch space\n var x = new Uint32Array(16); // salsa20_8\n var _X = new Uint32Array(16); // blockmix_salsa8\n\n var totalOps = p * N * 2;\n var currentOp = 0;\n var lastPercent10 = null;\n\n // Set this to true to abandon the scrypt on the next step\n var stop = false;\n\n // State information\n var state = 0;\n var i0 = 0, i1;\n var Bi;\n\n // How many blockmix_salsa8 can we do per step?\n var limit = parseInt(1000 / r);\n\n // Trick from scrypt-async; if there is a setImmediate shim in place, use it\n var nextTick = (typeof(setImmediate) !== 'undefined') ? setImmediate : setTimeout;\n\n // This is really all I changed; making scryptsy a state machine so we occasionally\n // stop and give other evnts on the evnt loop a chance to run. ~RicMoo\n var incrementalSMix = function() {\n if (stop) {\n return callback(new Error('cancelled'), currentOp / totalOps);\n }\n\n switch (state) {\n case 0:\n // for (var i = 0; i < p; i++)...\n Bi = i0 * 32 * r;\n\n arraycopy(B, Bi, XY, 0, Yi); // ROMix - 1\n\n state = 1; // Move to ROMix 2\n i1 = 0;\n\n // Fall through\n\n case 1:\n\n // Run up to 1000 steps of the first inner smix loop\n var steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (var i = 0; i < steps; i++) { // ROMix - 2\n arraycopy(XY, 0, V, (i1 + i) * Yi, Yi) // ROMix - 3\n blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 4\n }\n\n // for (var i = 0; i < N; i++)\n i1 += steps;\n currentOp += steps;\n\n // Call the callback with the progress (optionally stopping us)\n var percent10 = parseInt(1000 * currentOp / totalOps);\n if (percent10 !== lastPercent10) {\n stop = callback(null, currentOp / totalOps);\n if (stop) { break; }\n lastPercent10 = percent10;\n }\n\n if (i1 < N) {\n break;\n }\n\n i1 = 0; // Move to ROMix 6\n state = 2;\n\n // Fall through\n\n case 2:\n\n // Run up to 1000 steps of the second inner smix loop\n var steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (var i = 0; i < steps; i++) { // ROMix - 6\n var offset = (2 * r - 1) * 16; // ROMix - 7\n var j = XY[offset] & (N - 1);\n blockxor(V, j * Yi, XY, Yi); // ROMix - 8 (inner)\n blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 9 (outer)\n }\n\n // for (var i = 0; i < N; i++)...\n i1 += steps;\n currentOp += steps;\n\n // Call the callback with the progress (optionally stopping us)\n var percent10 = parseInt(1000 * currentOp / totalOps);\n if (percent10 !== lastPercent10) {\n stop = callback(null, currentOp / totalOps);\n if (stop) { break; }\n lastPercent10 = percent10;\n }\n\n if (i1 < N) {\n break;\n }\n\n arraycopy(XY, 0, B, Bi, Yi); // ROMix - 10\n\n // for (var i = 0; i < p; i++)...\n i0++;\n if (i0 < p) {\n state = 0;\n break;\n }\n\n b = [];\n for (var i = 0; i < B.length; i++) {\n b.push((B[i] >> 0) & 0xff);\n b.push((B[i] >> 8) & 0xff);\n b.push((B[i] >> 16) & 0xff);\n b.push((B[i] >> 24) & 0xff);\n }\n\n var derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen);\n\n // Done; don't break (which would reschedule)\n return callback(null, 1.0, derivedKey);\n }\n\n // Schedule the next steps\n nextTick(incrementalSMix);\n }\n\n // Bootstrap the incremental smix\n incrementalSMix();\n }\n\n // node.js\n if (typeof(exports) !== 'undefined') {\n module.exports = scrypt;\n\n // RequireJS/AMD\n // http://www.requirejs.org/docs/api.html\n // https://github.com/amdjs/amdjs-api/wiki/AMD\n } else if (typeof(define) === 'function' && define.amd) {\n define(scrypt);\n\n // Web Browsers\n } else if (root) {\n\n // If there was an existing library \"scrypt\", make sure it is still available\n if (root.scrypt) {\n root._scrypt = root.scrypt;\n }\n\n root.scrypt = scrypt;\n }\n\n})(this);\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"timers\":37}],37:[function(require,module,exports){\narguments[4][7][0].apply(exports,arguments)\n},{\"dup\":7}],38:[function(require,module,exports){\n(function (global){\n\nvar rng;\n\nif (global.crypto && crypto.getRandomValues) {\n // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto\n // Moderately fast, high quality\n var _rnds8 = new Uint8Array(16);\n rng = function whatwgRNG() {\n crypto.getRandomValues(_rnds8);\n return _rnds8;\n };\n}\n\nif (!rng) {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var _rnds = new Array(16);\n rng = function() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return _rnds;\n };\n}\n\nmodule.exports = rng;\n\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],39:[function(require,module,exports){\n// uuid.js\n//\n// Copyright (c) 2010-2012 Robert Kieffer\n// MIT License - http://opensource.org/licenses/mit-license.php\n\n// Unique ID creation requires a high quality random # generator. We feature\n// detect to determine the best RNG source, normalizing to a function that\n// returns 128-bits of randomness, since that's what's usually required\nvar _rng = require('./rng');\n\n// Maps for number <-> hex string conversion\nvar _byteToHex = [];\nvar _hexToByte = {};\nfor (var i = 0; i < 256; i++) {\n _byteToHex[i] = (i + 0x100).toString(16).substr(1);\n _hexToByte[_byteToHex[i]] = i;\n}\n\n// **`parse()` - Parse a UUID into it's component bytes**\nfunction parse(s, buf, offset) {\n var i = (buf && offset) || 0, ii = 0;\n\n buf = buf || [];\n s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {\n if (ii < 16) { // Don't overflow!\n buf[i + ii++] = _hexToByte[oct];\n }\n });\n\n // Zero out remaining bytes if string was short\n while (ii < 16) {\n buf[i + ii++] = 0;\n }\n\n return buf;\n}\n\n// **`unparse()` - Convert UUID byte array (ala parse()) into a string**\nfunction unparse(buf, offset) {\n var i = offset || 0, bth = _byteToHex;\n return bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] + '-' +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]] +\n bth[buf[i++]] + bth[buf[i++]];\n}\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\n// random #'s we need to init node and clockseq\nvar _seedBytes = _rng();\n\n// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\nvar _nodeId = [\n _seedBytes[0] | 0x01,\n _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]\n];\n\n// Per 4.2.2, randomize (14 bit) clockseq\nvar _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;\n\n// Previous uuid creation time\nvar _lastMSecs = 0, _lastNSecs = 0;\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n var node = options.node || _nodeId;\n for (var n = 0; n < 6; n++) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : unparse(b);\n}\n\n// **`v4()` - Generate random UUID**\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v4(options, buf, offset) {\n // Deprecated - 'format' argument, as supported in v1.2\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options == 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || _rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ii++) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || unparse(rnds);\n}\n\n// Export public API\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\nuuid.parse = parse;\nuuid.unparse = unparse;\n\nmodule.exports = uuid;\n\n},{\"./rng\":38}],40:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nmodule.exports = {\n decode: function (textData) {\n textData = atob(textData);\n var data = [];\n for (var i = 0; i < textData.length; i++) {\n data.push(textData.charCodeAt(i));\n }\n return bytes_1.arrayify(data);\n },\n encode: function (data) {\n data = bytes_1.arrayify(data);\n var textData = '';\n for (var i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n }\n};\n\n},{\"../src.ts/utils/bytes\":60}],41:[function(require,module,exports){\narguments[4][4][0].apply(exports,arguments)\n},{\"dup\":4}],42:[function(require,module,exports){\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 hash = __importStar(require(\"hash.js\"));\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nvar errors = __importStar(require(\"../src.ts/utils/errors\"));\nvar hmac = hash['hmac'];\nvar supportedAlgorithms = { sha256: true, sha512: true };\nfunction computeHmac(algorithm, key, data) {\n if (!supportedAlgorithms[algorithm]) {\n errors.throwError('unsupported algorithm ' + algorithm, errors.UNSUPPORTED_OPERATION, { operation: 'hmac', algorithm: algorithm });\n }\n return bytes_1.arrayify(hmac(hash[algorithm], bytes_1.arrayify(key)).update(bytes_1.arrayify(data)).digest());\n}\nexports.computeHmac = computeHmac;\n\n},{\"../src.ts/utils/bytes\":60,\"../src.ts/utils/errors\":61,\"hash.js\":20}],43:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nvar hmac_1 = require(\"../src.ts/utils/hmac\");\nfunction pbkdf2(password, salt, iterations, keylen, hashAlgorithm) {\n password = bytes_1.arrayify(password);\n salt = bytes_1.arrayify(salt);\n var hLen;\n var l = 1;\n var DK = new Uint8Array(keylen);\n var block1 = new Uint8Array(salt.length + 4);\n block1.set(salt);\n //salt.copy(block1, 0, 0, salt.length)\n var r;\n var T;\n for (var i = 1; i <= l; i++) {\n //block1.writeUInt32BE(i, salt.length)\n block1[salt.length] = (i >> 24) & 0xff;\n block1[salt.length + 1] = (i >> 16) & 0xff;\n block1[salt.length + 2] = (i >> 8) & 0xff;\n block1[salt.length + 3] = i & 0xff;\n //var U = createHmac(password).update(block1).digest();\n var U = hmac_1.computeHmac(hashAlgorithm, password, block1);\n if (!hLen) {\n hLen = U.length;\n T = new Uint8Array(hLen);\n l = Math.ceil(keylen / hLen);\n r = keylen - (l - 1) * hLen;\n }\n //U.copy(T, 0, 0, hLen)\n T.set(U);\n for (var j = 1; j < iterations; j++) {\n //U = createHmac(password).update(U).digest();\n U = hmac_1.computeHmac(hashAlgorithm, password, U);\n for (var k = 0; k < hLen; k++)\n T[k] ^= U[k];\n }\n var destPos = (i - 1) * hLen;\n var len = (i === l ? r : hLen);\n //T.copy(DK, destPos, 0, len)\n DK.set(bytes_1.arrayify(T).slice(0, len), destPos);\n }\n return bytes_1.arrayify(DK);\n}\nexports.pbkdf2 = pbkdf2;\n\n},{\"../src.ts/utils/bytes\":60,\"../src.ts/utils/hmac\":42}],44:[function(require,module,exports){\n(function (global){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"../src.ts/utils/bytes\");\nvar properties_1 = require(\"../src.ts/utils/properties\");\nvar crypto = global['crypto'] || global['msCrypto'];\nif (!crypto || !crypto.getRandomValues) {\n console.log('WARNING: Missing strong random number source; using weak randomBytes');\n crypto = {\n getRandomValues: function (buffer) {\n for (var round = 0; round < 20; round++) {\n for (var i = 0; i < buffer.length; i++) {\n if (round) {\n buffer[i] ^= Math.trunc(256 * Math.random());\n }\n else {\n buffer[i] = Math.trunc(256 * Math.random());\n }\n }\n }\n return buffer;\n },\n _weakCrypto: true\n };\n}\nfunction randomBytes(length) {\n if (length <= 0 || length > 1024 || parseInt(length) != length) {\n throw new Error('invalid length');\n }\n var result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return bytes_1.arrayify(result);\n}\nexports.randomBytes = randomBytes;\n;\nif (crypto._weakCrypto === true) {\n properties_1.defineReadOnly(randomBytes, '_weakCrypto', true);\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../src.ts/utils/bytes\":60,\"../src.ts/utils/properties\":65}],45:[function(require,module,exports){\n'use strict';\ntry {\n module.exports.XMLHttpRequest = XMLHttpRequest;\n}\ncatch (error) {\n console.log('Warning: XMLHttpRequest is not defined');\n module.exports.XMLHttpRequest = null;\n}\n\n},{}],46:[function(require,module,exports){\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 interface_1 = require(\"./interface\");\nvar provider_1 = require(\"../providers/provider\");\nvar wallet_1 = require(\"../wallet/wallet\");\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar allowedTransactionKeys = {\n data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true\n};\n// Recursively replaces ENS names with promises to resolve the name and\n// stalls until all promises have returned\n// @TODO: Expand this to resolve any promises too\nfunction resolveAddresses(provider, value, paramType) {\n if (Array.isArray(paramType)) {\n var promises = [];\n paramType.forEach(function (paramType, index) {\n var v = null;\n if (Array.isArray(value)) {\n v = value[index];\n }\n else {\n v = value[paramType.name];\n }\n promises.push(resolveAddresses(provider, v, paramType));\n });\n return Promise.all(promises);\n }\n if (paramType.type === 'address') {\n return provider.resolveName(value);\n }\n if (paramType.components) {\n return resolveAddresses(provider, value, paramType.components);\n }\n return Promise.resolve(value);\n}\nfunction runMethod(contract, functionName, estimateOnly) {\n var method = contract.interface.functions[functionName];\n return function () {\n var params = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n params[_i] = arguments[_i];\n }\n var tx = {};\n // If 1 extra parameter was passed in, it contains overrides\n if (params.length === method.inputs.length + 1 && typeof (params[params.length - 1]) === 'object') {\n tx = properties_1.shallowCopy(params.pop());\n // Check for unexpected keys (e.g. using \"gas\" instead of \"gasLimit\")\n for (var key in tx) {\n if (!allowedTransactionKeys[key]) {\n throw new Error('unknown transaction override ' + key);\n }\n }\n }\n if (params.length != method.inputs.length) {\n throw new Error('incorrect number of arguments');\n }\n // Check overrides make sense\n ['data', 'to'].forEach(function (key) {\n if (tx[key] != null) {\n errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });\n }\n });\n // Send to the contract address\n tx.to = contract.addressPromise;\n return resolveAddresses(contract.provider, params, method.inputs).then(function (params) {\n tx.data = method.encode(params);\n if (method.type === 'call') {\n // Call (constant functions) always cost 0 ether\n if (estimateOnly) {\n return Promise.resolve(bignumber_1.ConstantZero);\n }\n if (!contract.provider) {\n errors.throwError('call (constant functions) require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'call' });\n }\n // Check overrides make sense\n ['gasLimit', 'gasPrice', 'value'].forEach(function (key) {\n if (tx[key] != null) {\n throw new Error('call cannot override ' + key);\n }\n });\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress();\n }\n return contract.provider.call(tx).then(function (value) {\n try {\n var result = method.decode(value);\n if (method.outputs.length === 1) {\n result = result[0];\n }\n return result;\n }\n catch (error) {\n if (value === '0x' && method.outputs.length > 0) {\n errors.throwError('call exception', errors.CALL_EXCEPTION, {\n address: contract.address,\n method: method.signature,\n value: params\n });\n }\n throw error;\n }\n });\n }\n else if (method.type === 'transaction') {\n // Only computing the transaction estimate\n if (estimateOnly) {\n if (!contract.provider) {\n errors.throwError('estimate gas require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'estimateGas' });\n }\n if (tx.from == null && contract.signer) {\n tx.from = contract.signer.getAddress();\n }\n return contract.provider.estimateGas(tx);\n }\n if (!contract.signer) {\n errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });\n }\n // Make sure they aren't overriding something they shouldn't\n if (tx.from != null) {\n errors.throwError('cannot override from in a transaction', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });\n }\n return contract.signer.sendTransaction(tx);\n }\n throw new Error('invalid type - ' + method.type);\n return null;\n });\n };\n}\nvar Contract = /** @class */ (function () {\n // https://github.com/Microsoft/TypeScript/issues/5453\n // Once this issue is resolved (there are open PR) we can do this nicer\n // by making addressOrName default to null for 2 operand calls. :)\n function Contract(addressOrName, contractInterface, signerOrProvider) {\n var _this = this;\n errors.checkNew(this, Contract);\n // @TODO: Maybe still check the addressOrName looks like a valid address or name?\n //address = getAddress(address);\n if (contractInterface instanceof interface_1.Interface) {\n properties_1.defineReadOnly(this, 'interface', contractInterface);\n }\n else {\n properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface));\n }\n if (signerOrProvider instanceof wallet_1.Signer) {\n properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider);\n properties_1.defineReadOnly(this, 'signer', signerOrProvider);\n }\n else if (signerOrProvider instanceof provider_1.Provider) {\n properties_1.defineReadOnly(this, 'provider', signerOrProvider);\n properties_1.defineReadOnly(this, 'signer', null);\n }\n else {\n errors.throwError('invalid signer or provider', errors.INVALID_ARGUMENT, { arg: 'signerOrProvider', value: signerOrProvider });\n }\n properties_1.defineReadOnly(this, 'estimate', {});\n properties_1.defineReadOnly(this, 'events', {});\n properties_1.defineReadOnly(this, 'functions', {});\n // Not connected to an on-chain instance, so do not connect functions and events\n if (!addressOrName) {\n properties_1.defineReadOnly(this, 'address', null);\n properties_1.defineReadOnly(this, 'addressPromise', Promise.resolve(null));\n return;\n }\n properties_1.defineReadOnly(this, 'address', addressOrName);\n properties_1.defineReadOnly(this, 'addressPromise', this.provider.resolveName(addressOrName));\n Object.keys(this.interface.functions).forEach(function (name) {\n var run = runMethod(_this, name, false);\n if (_this[name] == null) {\n properties_1.defineReadOnly(_this, name, run);\n }\n else {\n console.log('WARNING: Multiple definitions for ' + name);\n }\n if (_this.functions[name] == null) {\n properties_1.defineReadOnly(_this.functions, name, run);\n properties_1.defineReadOnly(_this.estimate, name, runMethod(_this, name, true));\n }\n });\n Object.keys(this.interface.events).forEach(function (eventName) {\n var eventInfo = _this.interface.events[eventName];\n var eventCallback = null;\n var contract = _this;\n function handleEvent(log) {\n contract.addressPromise.then(function (address) {\n // Not meant for us (the topics just has the same name)\n if (address != log.address) {\n return;\n }\n try {\n var result = eventInfo.decode(log.data, log.topics);\n // Some useful things to have with the log\n log.args = result;\n log.event = eventName;\n log.parse = eventInfo.parse;\n log.removeListener = function () {\n contract.provider.removeListener([eventInfo.topic], handleEvent);\n };\n log.getBlock = function () { return contract.provider.getBlock(log.blockHash); ; };\n log.getTransaction = function () { return contract.provider.getTransaction(log.transactionHash); };\n log.getTransactionReceipt = function () { return contract.provider.getTransactionReceipt(log.transactionHash); };\n log.eventSignature = eventInfo.signature;\n eventCallback.apply(log, Array.prototype.slice.call(result));\n }\n catch (error) {\n console.log(error);\n }\n });\n }\n var property = {\n enumerable: true,\n get: function () {\n return eventCallback;\n },\n set: function (value) {\n if (!value) {\n value = null;\n }\n if (!contract.provider) {\n errors.throwError('events require a provider or a signer with a provider', errors.UNSUPPORTED_OPERATION, { operation: 'events' });\n }\n if (!value && eventCallback) {\n contract.provider.removeListener([eventInfo.topic], handleEvent);\n }\n else if (value && !eventCallback) {\n contract.provider.on([eventInfo.topic], handleEvent);\n }\n eventCallback = value;\n }\n };\n var propertyName = 'on' + eventName.toLowerCase();\n if (_this[propertyName] == null) {\n Object.defineProperty(_this, propertyName, property);\n }\n Object.defineProperty(_this.events, eventName, property);\n }, this);\n }\n // Reconnect to a different signer or provider\n Contract.prototype.connect = function (signerOrProvider) {\n return new Contract(this.address, this.interface, signerOrProvider);\n };\n // Deploy the contract with the bytecode, resolving to the deployed address.\n // Use contract.deployTransaction.wait() to wait until the contract has\n // been mined.\n Contract.prototype.deploy = function (bytecode) {\n var _this = this;\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (this.signer == null) {\n throw new Error('missing signer'); // @TODO: errors.throwError\n }\n if (!bytes_1.isHexString(bytecode)) {\n errors.throwError('bytecode must be a valid hex string', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n if ((bytecode.length % 2) !== 0) {\n errors.throwError('bytecode must be valid data (even length)', errors.INVALID_ARGUMENT, { arg: 'bytecode', value: bytecode });\n }\n // @TODO: overrides of args.length = this.interface.deployFunction.inputs.length + 1\n return this.signer.sendTransaction({\n data: this.interface.deployFunction.encode(bytecode, args)\n }).then(function (tx) {\n var contract = new Contract(address_1.getContractAddress(tx), _this.interface, _this.signer || _this.provider);\n properties_1.defineReadOnly(contract, 'deployTransaction', tx);\n return contract;\n });\n };\n return Contract;\n}());\nexports.Contract = Contract;\n\n},{\"../providers/provider\":55,\"../utils/address\":58,\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/properties\":65,\"../wallet/wallet\":78,\"./interface\":48}],47:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar contract_1 = require(\"./contract\");\nexports.Contract = contract_1.Contract;\nvar interface_1 = require(\"./interface\");\nexports.Interface = interface_1.Interface;\n\n},{\"./contract\":46,\"./interface\":48}],48:[function(require,module,exports){\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 abi_coder_1 = require(\"../utils/abi-coder\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nfunction parseParams(params) {\n var names = [];\n var types = [];\n params.forEach(function (param) {\n if (param.components != null) {\n if (param.type.substring(0, 5) !== 'tuple') {\n throw new Error('internal error; report on GitHub');\n }\n var suffix = '';\n var arrayBracket = param.type.indexOf('[');\n if (arrayBracket >= 0) {\n suffix = param.type.substring(arrayBracket);\n }\n var result = parseParams(param.components);\n names.push({ name: (param.name || null), names: result.names });\n types.push('tuple(' + result.types.join(',') + ')' + suffix);\n }\n else {\n names.push(param.name || null);\n types.push(param.type);\n }\n });\n return {\n names: names,\n types: types\n };\n}\nvar Description = /** @class */ (function () {\n function Description(info) {\n for (var key in info) {\n var value = info[key];\n if (value != null && typeof (value) === 'object') {\n properties_1.defineFrozen(this, key, info[key]);\n }\n else {\n properties_1.defineReadOnly(this, key, info[key]);\n }\n }\n }\n return Description;\n}());\nexports.Description = Description;\n// @TOOD: Make this a description\nvar Indexed = /** @class */ (function (_super) {\n __extends(Indexed, _super);\n function Indexed() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Indexed;\n}(Description));\nexports.Indexed = Indexed;\nvar DeployDescription = /** @class */ (function (_super) {\n __extends(DeployDescription, _super);\n function DeployDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DeployDescription.prototype.encode = function (bytecode, params) {\n if (!bytes_1.isHexString(bytecode)) {\n errors.throwError('invalid contract bytecode', errors.INVALID_ARGUMENT, {\n arg: 'bytecode',\n type: typeof (bytecode),\n value: bytecode\n });\n }\n if (params.length < this.inputs.length) {\n errors.throwError('missing constructor argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n else if (params.length > this.inputs.length) {\n errors.throwError('too many constructor arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n try {\n return (bytecode + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2));\n }\n catch (error) {\n errors.throwError('invalid constructor argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n return null;\n };\n return DeployDescription;\n}(Description));\nexports.DeployDescription = DeployDescription;\nvar FunctionDescription = /** @class */ (function (_super) {\n __extends(FunctionDescription, _super);\n function FunctionDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FunctionDescription.prototype.encode = function (params) {\n if (params.length < this.inputs.length) {\n errors.throwError('missing input argument', errors.MISSING_ARGUMENT, {\n arg: (this.inputs[params.length].name || 'unknown'),\n count: params.length,\n expectedCount: this.inputs.length,\n name: this.name\n });\n }\n else if (params.length > this.inputs.length) {\n errors.throwError('too many input arguments', errors.UNEXPECTED_ARGUMENT, {\n count: params.length,\n expectedCount: this.inputs.length\n });\n }\n try {\n return this.sighash + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2);\n }\n catch (error) {\n errors.throwError('invalid input argument', errors.INVALID_ARGUMENT, {\n arg: error.arg,\n reason: error.reason,\n value: error.value\n });\n }\n return null;\n };\n FunctionDescription.prototype.decode = function (data) {\n try {\n return abi_coder_1.defaultAbiCoder.decode(this.outputs, bytes_1.arrayify(data));\n }\n catch (error) {\n errors.throwError('invalid data for function output', errors.INVALID_ARGUMENT, {\n arg: 'data',\n errorArg: error.arg,\n errorValue: error.value,\n value: data,\n reason: error.reason\n });\n }\n };\n return FunctionDescription;\n}(Description));\nexports.FunctionDescription = FunctionDescription;\nvar Result = /** @class */ (function (_super) {\n __extends(Result, _super);\n function Result() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Result;\n}(Description));\nvar EventDescription = /** @class */ (function (_super) {\n __extends(EventDescription, _super);\n function EventDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n EventDescription.prototype.decode = function (data, topics) {\n // Strip the signature off of non-anonymous topics\n if (topics != null && !this.anonymous) {\n topics = topics.slice(1);\n }\n var inputIndexed = [], inputNonIndexed = [];\n var inputDynamic = [];\n this.inputs.forEach(function (param, index) {\n if (param.indexed) {\n if (param.type === 'string' || param.type === 'bytes' || param.type.indexOf('[') >= 0 || param.type.substring(0, 5) === 'tuple') {\n inputIndexed.push({ type: 'bytes32', name: (param.name || '') });\n inputDynamic.push(true);\n }\n else {\n inputIndexed.push(param);\n inputDynamic.push(false);\n }\n }\n else {\n inputNonIndexed.push(param);\n inputDynamic.push(false);\n }\n });\n if (topics != null) {\n var resultIndexed = abi_coder_1.defaultAbiCoder.decode(inputIndexed, bytes_1.concat(topics));\n }\n var resultNonIndexed = abi_coder_1.defaultAbiCoder.decode(inputNonIndexed, bytes_1.arrayify(data));\n var result = new Result({});\n var nonIndexedIndex = 0, indexedIndex = 0;\n this.inputs.forEach(function (input, index) {\n if (input.indexed) {\n if (topics == null) {\n result[index] = new Indexed({ type: 'indexed', hash: null });\n }\n else if (inputDynamic[index]) {\n result[index] = new Indexed({ type: 'indexed', hash: resultIndexed[indexedIndex++] });\n }\n else {\n result[index] = resultIndexed[indexedIndex++];\n }\n }\n else {\n result[index] = resultNonIndexed[nonIndexedIndex++];\n }\n if (input.name) {\n result[input.name] = result[index];\n }\n });\n result.length = this.inputs.length;\n return result;\n };\n return EventDescription;\n}(Description));\nexports.EventDescription = EventDescription;\nvar TransactionDescription = /** @class */ (function (_super) {\n __extends(TransactionDescription, _super);\n function TransactionDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return TransactionDescription;\n}(Description));\nvar LogDescription = /** @class */ (function (_super) {\n __extends(LogDescription, _super);\n function LogDescription() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LogDescription;\n}(Description));\nfunction addMethod(method) {\n switch (method.type) {\n case 'constructor': {\n var description = new DeployDescription({\n inputs: method.inputs,\n payable: (method.payable == null || !!method.payable),\n type: 'deploy'\n });\n if (!this.deployFunction) {\n this.deployFunction = description;\n }\n break;\n }\n case 'function': {\n // @TODO: See event\n var signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n var sighash = keccak256_1.keccak256(utf8_1.toUtf8Bytes(signature)).substring(0, 10);\n var description = new FunctionDescription({\n inputs: method.inputs,\n outputs: method.outputs,\n payable: (method.payable == null || !!method.payable),\n type: ((method.constant) ? 'call' : 'transaction'),\n signature: signature,\n sighash: sighash,\n });\n // Expose the first (and hopefully unique named function\n if (method.name && this.functions[method.name] == null) {\n properties_1.defineReadOnly(this.functions, method.name, description);\n }\n // Expose all methods by their signature, for overloaded functions\n if (this.functions[description.signature] == null) {\n properties_1.defineReadOnly(this.functions, description.signature, description);\n }\n break;\n }\n case 'event': {\n // @TODO: method.params instead? As well? Different fomrat?\n //let inputParams = parseParams(method.inputs);\n // @TODO: Don't use parseParams (create new function in ABI, formatSignature)\n var signature = '(' + parseParams(method.inputs).types.join(',') + ')';\n signature = signature.replace(/tuple/g, '');\n signature = method.name + signature;\n var description = new EventDescription({\n name: method.name,\n signature: signature,\n inputs: method.inputs,\n topic: keccak256_1.keccak256(utf8_1.toUtf8Bytes(signature)),\n anonymous: (!!method.anonymous),\n type: 'event'\n });\n // Expose the first (and hopefully unique) event name\n if (method.name && this.events[method.name] == null) {\n properties_1.defineReadOnly(this.events, method.name, description);\n }\n // Expose all events by their signature, for overloaded functions\n if (this.events[description.signature] == null) {\n properties_1.defineReadOnly(this.events, description.signature, description);\n }\n break;\n }\n case 'fallback':\n // Nothing to do for fallback\n break;\n default:\n console.log('WARNING: unsupported ABI type - ' + method.type);\n break;\n }\n}\nvar Interface = /** @class */ (function () {\n function Interface(abi) {\n errors.checkNew(this, Interface);\n if (typeof (abi) === 'string') {\n try {\n abi = JSON.parse(abi);\n }\n catch (error) {\n errors.throwError('could not parse ABI JSON', errors.INVALID_ARGUMENT, {\n arg: 'abi',\n errorMessage: error.message,\n value: abi\n });\n }\n if (!Array.isArray(abi)) {\n errors.throwError('invalid abi', errors.INVALID_ARGUMENT, { arg: 'abi', value: abi });\n return null;\n }\n }\n properties_1.defineReadOnly(this, 'functions', {});\n properties_1.defineReadOnly(this, 'events', {});\n // Convert any supported ABI format into a standard ABI format\n var _abi = [];\n abi.forEach(function (fragment) {\n if (typeof (fragment) === 'string') {\n fragment = abi_coder_1.parseSignature(fragment);\n }\n _abi.push(fragment);\n });\n properties_1.defineFrozen(this, 'abi', _abi);\n _abi.forEach(addMethod, this);\n // If there wasn't a constructor, create the default constructor\n if (!this.deployFunction) {\n addMethod.call(this, { type: 'constructor', inputs: [] });\n }\n }\n Interface.prototype.parseTransaction = function (tx) {\n var sighash = tx.data.substring(0, 10).toLowerCase();\n for (var name in this.functions) {\n if (name.indexOf('(') === -1) {\n continue;\n }\n var func = this.functions[name];\n if (func.sighash === sighash) {\n var result = abi_coder_1.defaultAbiCoder.decode(func.inputs, '0x' + tx.data.substring(10));\n return new TransactionDescription({\n args: result,\n decode: func.decode,\n name: name,\n signature: func.signature,\n sighash: func.sighash,\n type: 'transaction',\n value: bignumber_1.bigNumberify(tx.value || 0),\n });\n }\n }\n return null;\n };\n Interface.prototype.parseLog = function (log) {\n for (var name in this.events) {\n if (name.indexOf('(') === -1) {\n continue;\n }\n var event = this.events[name];\n if (event.anonymous) {\n continue;\n }\n if (event.topic !== log.topics[0]) {\n continue;\n }\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse and return it?\n return new LogDescription({\n name: event.name,\n signature: event.signature,\n topic: event.topic,\n type: 'log',\n values: event.decode(log.data, log.topics)\n });\n }\n return null;\n };\n return Interface;\n}());\nexports.Interface = Interface;\n\n},{\"../utils/abi-coder\":57,\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/keccak256\":64,\"../utils/properties\":65,\"../utils/utf8\":72}],49:[function(require,module,exports){\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 });\nvar provider_1 = require(\"./provider\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar properties_1 = require(\"../utils/properties\");\nvar web_1 = require(\"../utils/web\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// The transaction has already been sanitized by the calls in Provider\nfunction getTransactionString(transaction) {\n var result = [];\n for (var key in transaction) {\n if (transaction[key] == null) {\n continue;\n }\n var value = bytes_1.hexlify(transaction[key]);\n if ({ gasLimit: true, gasPrice: true, nonce: true, value: true }[key]) {\n value = bytes_1.hexStripZeros(value);\n }\n result.push(key + '=' + value);\n }\n return result.join('&');\n}\nfunction getResult(result) {\n // getLogs, getHistory have weird success responses\n if (result.status == 0 && (result.message === 'No records found' || result.message === 'No transactions found')) {\n return result.result;\n }\n if (result.status != 1 || result.message != 'OK') {\n // @TODO: not any\n var error = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n return result.result;\n}\nfunction getJsonResult(result) {\n if (result.jsonrpc != '2.0') {\n // @TODO: not any\n var error = new Error('invalid response');\n error.result = JSON.stringify(result);\n throw error;\n }\n if (result.error) {\n // @TODO: not any\n var error = new Error(result.error.message || 'unknown error');\n if (result.error.code) {\n error.code = result.error.code;\n }\n if (result.error.data) {\n error.data = result.error.data;\n }\n throw error;\n }\n return result.result;\n}\n// The blockTag was normalized as a string by the Provider pre-perform operations\nfunction checkLogTag(blockTag) {\n if (blockTag === 'pending') {\n throw new Error('pending not supported');\n }\n if (blockTag === 'latest') {\n return blockTag;\n }\n return parseInt(blockTag.substring(2), 16);\n}\nvar EtherscanProvider = /** @class */ (function (_super) {\n __extends(EtherscanProvider, _super);\n function EtherscanProvider(network, apiKey) {\n var _this = _super.call(this, network) || this;\n errors.checkNew(_this, EtherscanProvider);\n var name = 'invalid';\n if (_this.network) {\n name = _this.network.name;\n }\n var baseUrl = null;\n switch (name) {\n case 'homestead':\n baseUrl = 'https://api.etherscan.io';\n break;\n case 'ropsten':\n baseUrl = 'https://api-ropsten.etherscan.io';\n break;\n case 'rinkeby':\n baseUrl = 'https://api-rinkeby.etherscan.io';\n break;\n case 'kovan':\n baseUrl = 'https://api-kovan.etherscan.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n properties_1.defineReadOnly(_this, 'baseUrl', baseUrl);\n properties_1.defineReadOnly(_this, 'apiKey', apiKey);\n return _this;\n }\n EtherscanProvider.prototype.perform = function (method, params) {\n //if (!params) { params = {}; }\n var url = this.baseUrl;\n var apiKey = '';\n if (this.apiKey) {\n apiKey += '&apikey=' + this.apiKey;\n }\n switch (method) {\n case 'getBlockNumber':\n url += '/api?module=proxy&action=eth_blockNumber' + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getGasPrice':\n url += '/api?module=proxy&action=eth_gasPrice' + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getBalance':\n // Returns base-10 result\n url += '/api?module=account&action=balance&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getResult);\n case 'getTransactionCount':\n url += '/api?module=proxy&action=eth_getTransactionCount&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getCode':\n url += '/api?module=proxy&action=eth_getCode&address=' + params.address;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getStorageAt':\n url += '/api?module=proxy&action=eth_getStorageAt&address=' + params.address;\n url += '&position=' + params.position;\n url += '&tag=' + params.blockTag + apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'sendTransaction':\n url += '/api?module=proxy&action=eth_sendRawTransaction&hex=' + params.signedTransaction;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getBlock':\n if (params.blockTag) {\n url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;\n url += '&boolean=false';\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n }\n throw new Error('getBlock by blockHash not implmeneted');\n case 'getTransaction':\n url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getTransactionReceipt':\n url += '/api?module=proxy&action=eth_getTransactionReceipt&txhash=' + params.transactionHash;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'call':\n var transaction = getTransactionString(params.transaction);\n if (transaction) {\n transaction = '&' + transaction;\n }\n url += '/api?module=proxy&action=eth_call' + transaction;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'estimateGas':\n var transaction = getTransactionString(params.transaction);\n if (transaction) {\n transaction = '&' + transaction;\n }\n url += '/api?module=proxy&action=eth_estimateGas&' + transaction;\n url += apiKey;\n return web_1.fetchJson(url, null, getJsonResult);\n case 'getLogs':\n url += '/api?module=logs&action=getLogs';\n try {\n if (params.filter.fromBlock) {\n url += '&fromBlock=' + checkLogTag(params.filter.fromBlock);\n }\n if (params.filter.toBlock) {\n url += '&toBlock=' + checkLogTag(params.filter.toBlock);\n }\n if (params.filter.address) {\n url += '&address=' + params.filter.address;\n }\n // @TODO: We can handle slightly more complicated logs using the logs API\n if (params.filter.topics && params.filter.topics.length > 0) {\n if (params.filter.topics.length > 1) {\n throw new Error('unsupported topic format');\n }\n var topic0 = params.filter.topics[0];\n if (typeof (topic0) !== 'string' || topic0.length !== 66) {\n throw new Error('unsupported topic0 format');\n }\n url += '&topic0=' + topic0;\n }\n }\n catch (error) {\n return Promise.reject(error);\n }\n url += apiKey;\n var self = this;\n return web_1.fetchJson(url, null, getResult).then(function (logs) {\n var txs = {};\n var seq = Promise.resolve();\n logs.forEach(function (log) {\n seq = seq.then(function () {\n if (log.blockHash != null) {\n return null;\n }\n log.blockHash = txs[log.transactionHash];\n if (log.blockHash == null) {\n return self.getTransaction(log.transactionHash).then(function (tx) {\n txs[log.transactionHash] = tx.blockHash;\n log.blockHash = tx.blockHash;\n });\n }\n return null;\n });\n });\n return seq.then(function () {\n return logs;\n });\n });\n case 'getEtherPrice':\n if (this.network.name !== 'homestead') {\n return Promise.resolve(0.0);\n }\n url += '/api?module=stats&action=ethprice';\n url += apiKey;\n return web_1.fetchJson(url, null, getResult).then(function (result) {\n return parseFloat(result.ethusd);\n });\n default:\n break;\n }\n return _super.prototype.perform.call(this, method, params);\n };\n // @TODO: Allow startBlock and endBlock to be Promises\n EtherscanProvider.prototype.getHistory = function (addressOrName, startBlock, endBlock) {\n var url = this.baseUrl;\n var apiKey = '';\n if (this.apiKey) {\n apiKey += '&apikey=' + this.apiKey;\n }\n if (startBlock == null) {\n startBlock = 0;\n }\n if (endBlock == null) {\n endBlock = 99999999;\n }\n return this.resolveName(addressOrName).then(function (address) {\n url += '/api?module=account&action=txlist&address=' + address;\n url += '&startblock=' + startBlock;\n url += '&endblock=' + endBlock;\n url += '&sort=asc' + apiKey;\n return web_1.fetchJson(url, null, getResult).then(function (result) {\n var output = [];\n result.forEach(function (tx) {\n ['contractAddress', 'to'].forEach(function (key) {\n if (tx[key] == '') {\n delete tx[key];\n }\n });\n if (tx.creates == null && tx.contractAddress != null) {\n tx.creates = tx.contractAddress;\n }\n var item = provider_1.checkTransactionResponse(tx);\n if (tx.timeStamp) {\n item.timestamp = parseInt(tx.timeStamp);\n }\n output.push(item);\n });\n return output;\n });\n });\n };\n return EtherscanProvider;\n}(provider_1.Provider));\nexports.EtherscanProvider = EtherscanProvider;\n\n},{\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/properties\":65,\"../utils/web\":73,\"./provider\":55}],50:[function(require,module,exports){\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 });\nvar provider_1 = require(\"./provider\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// Returns:\n// - true is all networks match\n// - false if any network is null\n// - throws if any 2 networks do not match\nfunction checkNetworks(networks) {\n var result = true;\n var check = null;\n networks.forEach(function (network) {\n // Null\n if (network == null) {\n result = false;\n return;\n }\n // Have nothing to compre to yet\n if (check == null) {\n check = network;\n return;\n }\n // Matches!\n if (check.name === network.name &&\n check.chainId === network.chainId &&\n check.ensAddress === network.ensAddress) {\n return;\n }\n errors.throwError('provider mismatch', errors.INVALID_ARGUMENT, { arg: 'providers', networks: networks });\n });\n return result;\n}\nvar FallbackProvider = /** @class */ (function (_super) {\n __extends(FallbackProvider, _super);\n function FallbackProvider(providers) {\n var _this = this;\n if (providers.length === 0) {\n throw new Error('no providers');\n }\n // All networks are ready, we can know the network for certain\n var ready = checkNetworks(providers.map(function (p) { return p.network; }));\n if (ready) {\n _this = _super.call(this, providers[0].network) || this;\n }\n else {\n // The network won't be known until all child providers know\n var ready_1 = Promise.all(providers.map(function (p) { return p.getNetwork(); })).then(function (networks) {\n if (!checkNetworks(networks)) {\n errors.throwError('getNetwork returned null', errors.UNKNOWN_ERROR, {});\n }\n return networks[0];\n });\n _this = _super.call(this, ready_1) || this;\n }\n errors.checkNew(_this, FallbackProvider);\n // Preserve a copy, so we don't get mutated\n _this._providers = providers.slice(0);\n return _this;\n }\n Object.defineProperty(FallbackProvider.prototype, \"providers\", {\n get: function () {\n // Return a copy, so we don't get mutated\n return this._providers.slice(0);\n },\n enumerable: true,\n configurable: true\n });\n FallbackProvider.prototype.perform = function (method, params) {\n // Creates a copy of the providers array\n var providers = this.providers;\n return new Promise(function (resolve, reject) {\n var firstError = null;\n function next() {\n if (!providers.length) {\n reject(firstError);\n return;\n }\n var provider = providers.shift();\n provider.perform(method, params).then(function (result) {\n resolve(result);\n }, function (error) {\n if (!firstError) {\n firstError = error;\n }\n next();\n });\n }\n next();\n });\n };\n return FallbackProvider;\n}(provider_1.Provider));\nexports.FallbackProvider = FallbackProvider;\n\n},{\"../utils/errors\":61,\"./provider\":55}],51:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar provider_1 = require(\"./provider\");\nexports.Provider = provider_1.Provider;\nexports.ProviderSigner = provider_1.ProviderSigner;\nvar etherscan_provider_1 = require(\"./etherscan-provider\");\nexports.EtherscanProvider = etherscan_provider_1.EtherscanProvider;\nvar fallback_provider_1 = require(\"./fallback-provider\");\nexports.FallbackProvider = fallback_provider_1.FallbackProvider;\nvar ipc_provider_1 = require(\"./ipc-provider\");\nexports.IpcProvider = ipc_provider_1.IpcProvider;\nvar infura_provider_1 = require(\"./infura-provider\");\nexports.InfuraProvider = infura_provider_1.InfuraProvider;\nvar json_rpc_provider_1 = require(\"./json-rpc-provider\");\nexports.JsonRpcProvider = json_rpc_provider_1.JsonRpcProvider;\nvar web3_provider_1 = require(\"./web3-provider\");\nexports.Web3Provider = web3_provider_1.Web3Provider;\nfunction getDefaultProvider(network) {\n return new fallback_provider_1.FallbackProvider([\n new infura_provider_1.InfuraProvider(network),\n new etherscan_provider_1.EtherscanProvider(network),\n ]);\n}\nexports.getDefaultProvider = getDefaultProvider;\n\n},{\"./etherscan-provider\":49,\"./fallback-provider\":50,\"./infura-provider\":52,\"./ipc-provider\":41,\"./json-rpc-provider\":53,\"./provider\":55,\"./web3-provider\":56}],52:[function(require,module,exports){\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 });\nvar json_rpc_provider_1 = require(\"./json-rpc-provider\");\nvar networks_1 = require(\"./networks\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar InfuraProvider = /** @class */ (function (_super) {\n __extends(InfuraProvider, _super);\n function InfuraProvider(network, apiAccessToken) {\n var _this = this;\n network = networks_1.getNetwork((network == null) ? 'homestead' : network);\n var host = null;\n switch (network.name) {\n case 'homestead':\n host = 'mainnet.infura.io';\n break;\n case 'ropsten':\n host = 'ropsten.infura.io';\n break;\n case 'rinkeby':\n host = 'rinkeby.infura.io';\n break;\n case 'kovan':\n host = 'kovan.infura.io';\n break;\n default:\n throw new Error('unsupported network');\n }\n _this = _super.call(this, 'https://' + host + '/' + (apiAccessToken || ''), network) || this;\n errors.checkNew(_this, InfuraProvider);\n properties_1.defineReadOnly(_this, 'apiAccessToken', apiAccessToken || null);\n return _this;\n }\n InfuraProvider.prototype._startPending = function () {\n console.log('WARNING: INFURA does not support pending filters');\n };\n InfuraProvider.prototype.getSigner = function (address) {\n errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });\n return null;\n };\n InfuraProvider.prototype.listAccounts = function () {\n return Promise.resolve([]);\n };\n return InfuraProvider;\n}(json_rpc_provider_1.JsonRpcProvider));\nexports.InfuraProvider = InfuraProvider;\n\n},{\"../utils/errors\":61,\"../utils/properties\":65,\"./json-rpc-provider\":53,\"./networks\":54}],53:[function(require,module,exports){\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/JSON-RPC\nvar networks_1 = require(\"./networks\");\nvar provider_1 = require(\"./provider\");\nvar wallet_1 = require(\"../wallet/wallet\");\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar properties_1 = require(\"../utils/properties\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar web_1 = require(\"../utils/web\");\nvar errors = __importStar(require(\"../utils/errors\"));\nfunction timer(timeout) {\n return new Promise(function (resolve) {\n setTimeout(function () {\n resolve();\n }, timeout);\n });\n}\nfunction getResult(payload) {\n if (payload.error) {\n // @TODO: not any\n var error = new Error(payload.error.message);\n error.code = payload.error.code;\n error.data = payload.error.data;\n throw error;\n }\n return payload.result;\n}\n// Convert an ethers.js transaction into a JSON-RPC transaction\n// - gasLimit => gas\n// - All values hexlified\n// - All numeric values zero-striped\nfunction hexlifyTransaction(transaction) {\n var result = {};\n // Some nodes (INFURA ropsten; INFURA mainnet is fine) don't like extra zeros.\n ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(function (key) {\n if (transaction[key] == null) {\n return;\n }\n var value = bytes_1.hexStripZeros(bytes_1.hexlify(transaction[key]));\n if (key === 'gasLimit') {\n key = 'gas';\n }\n result[key] = value;\n });\n ['from', 'to', 'data'].forEach(function (key) {\n if (transaction[key] == null) {\n return;\n }\n result[key] = bytes_1.hexlify(transaction[key]);\n });\n return result;\n}\nexports.hexlifyTransaction = hexlifyTransaction;\nfunction getLowerCase(value) {\n if (value) {\n return value.toLowerCase();\n }\n return value;\n}\nvar JsonRpcSigner = /** @class */ (function (_super) {\n __extends(JsonRpcSigner, _super);\n function JsonRpcSigner(provider, address) {\n var _this = _super.call(this) || this;\n errors.checkNew(_this, JsonRpcSigner);\n properties_1.defineReadOnly(_this, 'provider', provider);\n // Statically attach to a given address\n if (address) {\n properties_1.defineReadOnly(_this, '_address', address);\n }\n return _this;\n }\n Object.defineProperty(JsonRpcSigner.prototype, \"address\", {\n get: function () {\n if (!this._address) {\n errors.throwError('no sync sync address available; use getAddress', errors.UNSUPPORTED_OPERATION, { operation: 'address' });\n }\n return this._address;\n },\n enumerable: true,\n configurable: true\n });\n JsonRpcSigner.prototype.getAddress = function () {\n if (this._address) {\n return Promise.resolve(this._address);\n }\n return this.provider.send('eth_accounts', []).then(function (accounts) {\n if (accounts.length === 0) {\n errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });\n }\n return address_1.getAddress(accounts[0]);\n });\n };\n JsonRpcSigner.prototype.getBalance = function (blockTag) {\n return this.provider.getBalance(this.getAddress(), blockTag);\n };\n JsonRpcSigner.prototype.getTransactionCount = function (blockTag) {\n return this.provider.getTransactionCount(this.getAddress(), blockTag);\n };\n JsonRpcSigner.prototype.sendTransaction = function (transaction) {\n var _this = this;\n var tx = hexlifyTransaction(transaction);\n if (tx.from == null) {\n tx.from = this.getAddress().then(function (address) {\n if (!address) {\n return null;\n }\n return address.toLowerCase();\n });\n }\n return properties_1.resolveProperties(tx).then(function (tx) {\n return _this.provider.send('eth_sendTransaction', [transaction]);\n });\n };\n JsonRpcSigner.prototype.signMessage = function (message) {\n var _this = this;\n var data = ((typeof (message) === 'string') ? utf8_1.toUtf8Bytes(message) : message);\n return this.getAddress().then(function (address) {\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n return _this.provider.send('eth_sign', [address.toLowerCase(), bytes_1.hexlify(data)]);\n });\n };\n JsonRpcSigner.prototype.unlock = function (password) {\n var provider = this.provider;\n return this.getAddress().then(function (address) {\n return provider.send('personal_unlockAccount', [address.toLowerCase(), password, null]);\n });\n };\n return JsonRpcSigner;\n}(wallet_1.Signer));\nexports.JsonRpcSigner = JsonRpcSigner;\nvar JsonRpcProvider = /** @class */ (function (_super) {\n __extends(JsonRpcProvider, _super);\n function JsonRpcProvider(url, network) {\n var _this = this;\n // One parameter, but it is a network name, so swap it with the URL\n if (typeof (url) === 'string') {\n if (network === null && networks_1.getNetwork(url)) {\n network = url;\n url = null;\n }\n }\n if (network) {\n // The network has been specified explicitly, we can use it\n _this = _super.call(this, network) || this;\n }\n else {\n // The network is unknown, query the JSON-RPC for it\n var ready = new Promise(function (resolve, reject) {\n setTimeout(function () {\n _this.send('net_version', []).then(function (result) {\n var chainId = parseInt(result);\n resolve(networks_1.getNetwork(chainId));\n });\n });\n });\n _this = _super.call(this, ready) || this;\n }\n errors.checkNew(_this, JsonRpcProvider);\n // Default URL\n if (!url) {\n url = 'http://localhost:8545';\n }\n if (typeof (url) === 'string') {\n _this.connection = {\n url: url\n };\n }\n else {\n _this.connection = url;\n }\n return _this;\n }\n JsonRpcProvider.prototype.getSigner = function (address) {\n return new JsonRpcSigner(this, address);\n };\n JsonRpcProvider.prototype.listAccounts = function () {\n return this.send('eth_accounts', []).then(function (accounts) {\n return accounts.map(function (a) { return address_1.getAddress(a); });\n });\n };\n JsonRpcProvider.prototype.send = function (method, params) {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n return web_1.fetchJson(this.connection, JSON.stringify(request), getResult);\n };\n JsonRpcProvider.prototype.perform = function (method, params) {\n switch (method) {\n case 'getBlockNumber':\n return this.send('eth_blockNumber', []);\n case 'getGasPrice':\n return this.send('eth_gasPrice', []);\n case 'getBalance':\n return this.send('eth_getBalance', [getLowerCase(params.address), params.blockTag]);\n case 'getTransactionCount':\n return this.send('eth_getTransactionCount', [getLowerCase(params.address), params.blockTag]);\n case 'getCode':\n return this.send('eth_getCode', [getLowerCase(params.address), params.blockTag]);\n case 'getStorageAt':\n return this.send('eth_getStorageAt', [getLowerCase(params.address), params.position, params.blockTag]);\n case 'sendTransaction':\n return this.send('eth_sendRawTransaction', [params.signedTransaction]);\n case 'getBlock':\n if (params.blockTag) {\n return this.send('eth_getBlockByNumber', [params.blockTag, false]);\n }\n else if (params.blockHash) {\n return this.send('eth_getBlockByHash', [params.blockHash, false]);\n }\n return Promise.reject(new Error('invalid block tag or block hash'));\n case 'getTransaction':\n return this.send('eth_getTransactionByHash', [params.transactionHash]);\n case 'getTransactionReceipt':\n return this.send('eth_getTransactionReceipt', [params.transactionHash]);\n case 'call':\n return this.send('eth_call', [hexlifyTransaction(params.transaction), 'latest']);\n case 'estimateGas':\n return this.send('eth_estimateGas', [hexlifyTransaction(params.transaction)]);\n case 'getLogs':\n if (params.filter && params.filter.address != null) {\n params.filter.address = getLowerCase(params.filter.address);\n }\n return this.send('eth_getLogs', [params.filter]);\n default:\n break;\n }\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n };\n JsonRpcProvider.prototype._startPending = function () {\n if (this._pendingFilter != null) {\n return;\n }\n var self = this;\n var pendingFilter = this.send('eth_newPendingTransactionFilter', []);\n this._pendingFilter = pendingFilter;\n pendingFilter.then(function (filterId) {\n function poll() {\n self.send('eth_getFilterChanges', [filterId]).then(function (hashes) {\n if (self._pendingFilter != pendingFilter) {\n return null;\n }\n var seq = Promise.resolve();\n hashes.forEach(function (hash) {\n self._emitted['t:' + hash.toLowerCase()] = 'pending';\n seq = seq.then(function () {\n return self.getTransaction(hash).then(function (tx) {\n self.emit('pending', tx);\n });\n });\n });\n return seq.then(function () {\n return timer(1000);\n });\n }).then(function () {\n if (self._pendingFilter != pendingFilter) {\n self.send('eth_uninstallFilter', [filterId]);\n return;\n }\n setTimeout(function () { poll(); }, 0);\n });\n }\n poll();\n return filterId;\n });\n };\n JsonRpcProvider.prototype._stopPending = function () {\n this._pendingFilter = null;\n };\n return JsonRpcProvider;\n}(provider_1.Provider));\nexports.JsonRpcProvider = JsonRpcProvider;\n\n},{\"../utils/address\":58,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/properties\":65,\"../utils/utf8\":72,\"../utils/web\":73,\"../wallet/wallet\":78,\"./networks\":54,\"./provider\":55}],54:[function(require,module,exports){\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(\"../utils/errors\"));\nvar homestead = {\n chainId: 1,\n ensAddress: \"0x314159265dd8dbb310642f98f50c066173c1259b\",\n name: \"homestead\"\n};\nvar ropsten = {\n chainId: 3,\n ensAddress: \"0x112234455c3a32fd11230c42e7bccd4a84e02010\",\n name: \"ropsten\"\n};\nvar networks = {\n unspecified: {\n chainId: 0\n },\n homestead: homestead,\n mainnet: homestead,\n morden: {\n chainId: 2\n },\n ropsten: ropsten,\n testnet: ropsten,\n rinkeby: {\n chainId: 4,\n ensAddress: \"0xe7410170f87102DF0055eB195163A03B7F2Bff4A\"\n },\n kovan: {\n chainId: 42\n },\n classic: {\n chainId: 61\n }\n};\n/**\n * getNetwork\n *\n * Converts a named common networks or chain ID (network ID) to a Network\n * and verifies a network is a valid Network..\n */\nfunction getNetwork(network) {\n // No network (null) or unspecified (chainId = 0)\n if (!network) {\n return null;\n }\n if (typeof (network) === 'number') {\n for (var name in networks) {\n var n_1 = networks[name];\n if (n_1.chainId === network) {\n return {\n name: name,\n chainId: n_1.chainId,\n ensAddress: n_1.ensAddress\n };\n }\n }\n return {\n chainId: network,\n name: 'unknown'\n };\n }\n if (typeof (network) === 'string') {\n var n_2 = networks[network];\n if (n_2 == null) {\n return null;\n }\n return {\n name: network,\n chainId: n_2.chainId,\n ensAddress: n_2.ensAddress\n };\n }\n var n = networks[network.name];\n // Not a standard network; check that it is a valid network in general\n if (!n) {\n if (typeof (n.chainId) !== 'number') {\n errors.throwError('invalid network chainId', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n return network;\n }\n // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155)\n if (network.chainId !== 0 && network.chainId !== n.chainId) {\n errors.throwError('network chainId mismatch', errors.INVALID_ARGUMENT, { name: 'network', value: network });\n }\n // Standard Network\n return {\n name: network.name,\n chainId: n.chainId,\n ensAddress: n.ensAddress\n };\n}\nexports.getNetwork = getNetwork;\n\n},{\"../utils/errors\":61}],55:[function(require,module,exports){\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//import inherits = require('inherits');\nvar wallet_1 = require(\"../wallet/wallet\");\nvar address_1 = require(\"../utils/address\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar rlp_1 = require(\"../utils/rlp\");\nvar hash_1 = require(\"../utils/hash\");\nvar networks_1 = require(\"./networks\");\nvar properties_1 = require(\"../utils/properties\");\nvar transaction_1 = require(\"../utils/transaction\");\nvar errors = __importStar(require(\"../utils/errors\"));\nfunction copyObject(obj) {\n var result = {};\n for (var key in obj) {\n result[key] = obj[key];\n }\n return result;\n}\n;\n;\n//////////////////////////////\n// Request and Response Checking\n// @TODO: not any?\nfunction check(format, object) {\n var result = {};\n for (var key in format) {\n try {\n var value = format[key](object[key]);\n if (value !== undefined) {\n result[key] = value;\n }\n }\n catch (error) {\n error.checkKey = key;\n error.checkValue = object[key];\n throw error;\n }\n }\n return result;\n}\nfunction allowNull(check, nullValue) {\n return (function (value) {\n if (value == null) {\n return nullValue;\n }\n return check(value);\n });\n}\nfunction allowFalsish(check, replaceValue) {\n return (function (value) {\n if (!value) {\n return replaceValue;\n }\n return check(value);\n });\n}\nfunction arrayOf(check) {\n return (function (array) {\n if (!Array.isArray(array)) {\n throw new Error('not an array');\n }\n var result = [];\n array.forEach(function (value) {\n result.push(check(value));\n });\n return result;\n });\n}\nfunction checkHash(hash) {\n if (typeof (hash) === 'string' && bytes_1.hexDataLength(hash) === 32) {\n return hash;\n }\n errors.throwError('invalid hash', errors.INVALID_ARGUMENT, { arg: 'hash', value: hash });\n return null;\n}\nfunction checkNumber(number) {\n return bignumber_1.bigNumberify(number).toNumber();\n}\n// Returns the difficulty as a number, or if too large (i.e. PoA network) null\nfunction checkDifficulty(value) {\n var v = bignumber_1.bigNumberify(value);\n try {\n return v.toNumber();\n }\n catch (error) { }\n return null;\n}\nfunction checkBoolean(value) {\n if (typeof (value) === 'boolean') {\n return value;\n }\n if (typeof (value) === 'string') {\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n }\n throw new Error('invaid boolean - ' + value);\n}\nfunction checkUint256(uint256) {\n if (!bytes_1.isHexString(uint256)) {\n throw new Error('invalid uint256');\n }\n while (uint256.length < 66) {\n uint256 = '0x0' + uint256.substring(2);\n }\n return uint256;\n}\n/*\nfunction checkString(string) {\n if (typeof(string) !== 'string') { throw new Error('invalid string'); }\n return string;\n}\n*/\nfunction checkBlockTag(blockTag) {\n if (blockTag == null) {\n return 'latest';\n }\n if (blockTag === 'earliest') {\n return '0x0';\n }\n if (blockTag === 'latest' || blockTag === 'pending') {\n return blockTag;\n }\n if (typeof (blockTag) === 'number') {\n return bytes_1.hexStripZeros(bytes_1.hexlify(blockTag));\n }\n if (bytes_1.isHexString(blockTag)) {\n return bytes_1.hexStripZeros(blockTag);\n }\n throw new Error('invalid blockTag');\n}\nvar formatBlock = {\n hash: checkHash,\n parentHash: checkHash,\n number: checkNumber,\n timestamp: checkNumber,\n nonce: allowNull(bytes_1.hexlify),\n difficulty: checkDifficulty,\n gasLimit: bignumber_1.bigNumberify,\n gasUsed: bignumber_1.bigNumberify,\n miner: address_1.getAddress,\n extraData: bytes_1.hexlify,\n //transactions: allowNull(arrayOf(checkTransaction)),\n transactions: allowNull(arrayOf(checkHash)),\n};\nfunction checkBlock(block) {\n if (block.author != null && block.miner == null) {\n block.miner = block.author;\n }\n return check(formatBlock, block);\n}\nvar formatTransaction = {\n hash: checkHash,\n blockHash: allowNull(checkHash, null),\n blockNumber: allowNull(checkNumber, null),\n transactionIndex: allowNull(checkNumber, null),\n from: address_1.getAddress,\n gasPrice: bignumber_1.bigNumberify,\n gasLimit: bignumber_1.bigNumberify,\n to: allowNull(address_1.getAddress, null),\n value: bignumber_1.bigNumberify,\n nonce: checkNumber,\n data: bytes_1.hexlify,\n r: allowNull(checkUint256),\n s: allowNull(checkUint256),\n v: allowNull(checkNumber),\n creates: allowNull(address_1.getAddress, null),\n raw: allowNull(bytes_1.hexlify),\n};\nfunction checkTransactionResponse(transaction) {\n // Rename gas to gasLimit\n if (transaction.gas != null && transaction.gasLimit == null) {\n transaction.gasLimit = transaction.gas;\n }\n // Some clients (TestRPC) do strange things like return 0x0 for the\n // 0 address; correct this to be a real address\n if (transaction.to && bignumber_1.bigNumberify(transaction.to).isZero()) {\n transaction.to = '0x0000000000000000000000000000000000000000';\n }\n // Rename input to data\n if (transaction.input != null && transaction.data == null) {\n transaction.data = transaction.input;\n }\n // If to and creates are empty, populate the creates from the transaction\n if (transaction.to == null && transaction.creates == null) {\n transaction.creates = address_1.getContractAddress(transaction);\n }\n if (!transaction.raw) {\n // Very loose providers (e.g. TestRPC) don't provide a signature or raw\n if (transaction.v && transaction.r && transaction.s) {\n var raw = [\n bytes_1.stripZeros(bytes_1.hexlify(transaction.nonce)),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.gasPrice)),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.gasLimit)),\n (transaction.to || \"0x\"),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.value || '0x')),\n bytes_1.hexlify(transaction.data || '0x'),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.v || '0x')),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.r)),\n bytes_1.stripZeros(bytes_1.hexlify(transaction.s)),\n ];\n transaction.raw = rlp_1.encode(raw);\n }\n }\n var result = check(formatTransaction, transaction);\n var networkId = transaction.networkId;\n if (bytes_1.isHexString(networkId)) {\n networkId = bignumber_1.bigNumberify(networkId).toNumber();\n }\n if (typeof (networkId) !== 'number' && result.v != null) {\n networkId = (result.v - 35) / 2;\n if (networkId < 0) {\n networkId = 0;\n }\n networkId = parseInt(networkId);\n }\n if (typeof (networkId) !== 'number') {\n networkId = 0;\n }\n result.networkId = networkId;\n // 0x0000... should actually be null\n if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {\n result.blockHash = null;\n }\n return result;\n}\nexports.checkTransactionResponse = checkTransactionResponse;\nvar formatTransactionRequest = {\n from: allowNull(address_1.getAddress),\n nonce: allowNull(checkNumber),\n gasLimit: allowNull(bignumber_1.bigNumberify),\n gasPrice: allowNull(bignumber_1.bigNumberify),\n to: allowNull(address_1.getAddress),\n value: allowNull(bignumber_1.bigNumberify),\n data: allowNull(bytes_1.hexlify),\n};\nfunction checkTransactionRequest(transaction) {\n return check(formatTransactionRequest, transaction);\n}\nvar formatTransactionReceiptLog = {\n transactionLogIndex: allowNull(checkNumber),\n transactionIndex: checkNumber,\n blockNumber: checkNumber,\n transactionHash: checkHash,\n address: address_1.getAddress,\n topics: arrayOf(checkHash),\n data: bytes_1.hexlify,\n logIndex: checkNumber,\n blockHash: checkHash,\n};\nfunction checkTransactionReceiptLog(log) {\n return check(formatTransactionReceiptLog, log);\n}\nvar formatTransactionReceipt = {\n contractAddress: allowNull(address_1.getAddress, null),\n transactionIndex: checkNumber,\n root: allowNull(checkHash),\n gasUsed: bignumber_1.bigNumberify,\n logsBloom: allowNull(bytes_1.hexlify),\n blockHash: checkHash,\n transactionHash: checkHash,\n logs: arrayOf(checkTransactionReceiptLog),\n blockNumber: checkNumber,\n cumulativeGasUsed: bignumber_1.bigNumberify,\n status: allowNull(checkNumber)\n};\nfunction checkTransactionReceipt(transactionReceipt) {\n //var status = transactionReceipt.status;\n //var root = transactionReceipt.root;\n var result = check(formatTransactionReceipt, transactionReceipt);\n result.logs.forEach(function (entry, index) {\n if (entry.transactionLogIndex == null) {\n entry.transactionLogIndex = index;\n }\n });\n if (transactionReceipt.status != null) {\n result.byzantium = true;\n }\n return result;\n}\nfunction checkTopics(topics) {\n if (Array.isArray(topics)) {\n topics.forEach(function (topic) {\n checkTopics(topic);\n });\n }\n else if (topics != null) {\n checkHash(topics);\n }\n return topics;\n}\nvar formatFilter = {\n fromBlock: allowNull(checkBlockTag, undefined),\n toBlock: allowNull(checkBlockTag, undefined),\n address: allowNull(address_1.getAddress, undefined),\n topics: allowNull(checkTopics, undefined),\n};\nfunction checkFilter(filter) {\n return check(formatFilter, filter);\n}\nvar formatLog = {\n blockNumber: allowNull(checkNumber),\n blockHash: allowNull(checkHash),\n transactionIndex: checkNumber,\n removed: allowNull(checkBoolean),\n address: address_1.getAddress,\n data: allowFalsish(bytes_1.hexlify, '0x'),\n topics: arrayOf(checkHash),\n transactionHash: checkHash,\n logIndex: checkNumber,\n};\nfunction checkLog(log) {\n return check(formatLog, log);\n}\nfunction stallPromise(allowNullFunc, executeFunc) {\n return new Promise(function (resolve, reject) {\n var attempt = 0;\n function check() {\n executeFunc().then(function (result) {\n // If we have a result, or are allowed null then we're done\n if (result || allowNullFunc()) {\n resolve(result);\n // Otherwise, exponential back-off (up to 10s) our next request\n }\n else {\n attempt++;\n var timeout = 500 + 250 * Math.trunc(Math.random() * (1 << attempt));\n if (timeout > 10000) {\n timeout = 10000;\n }\n setTimeout(check, timeout);\n }\n }, function (error) {\n reject(error);\n });\n }\n check();\n });\n}\n//////////////////////////////\n// Event Serializeing\nfunction recurse(object, convertFunc) {\n if (Array.isArray(object)) {\n var result = [];\n object.forEach(function (object) {\n result.push(recurse(object, convertFunc));\n });\n return result;\n }\n return convertFunc(object);\n}\nfunction getEventString(object) {\n try {\n return 'address:' + address_1.getAddress(object);\n }\n catch (error) { }\n if (object === 'block') {\n return 'block';\n }\n else if (object === 'pending') {\n return 'pending';\n }\n else if (bytes_1.hexDataLength(object) === 32) {\n return 'tx:' + object;\n }\n else if (Array.isArray(object)) {\n object = recurse(object, function (object) {\n if (object == null) {\n object = '0x';\n }\n return object;\n });\n try {\n return 'topic:' + rlp_1.encode(object);\n }\n catch (error) {\n console.log(error);\n }\n }\n try {\n throw new Error();\n }\n catch (e) {\n console.log(e.stack);\n }\n throw new Error('invalid event - ' + object);\n}\nfunction parseEventString(string) {\n if (string.substring(0, 3) === 'tx:') {\n return { type: 'transaction', hash: string.substring(3) };\n }\n else if (string === 'block') {\n return { type: 'block' };\n }\n else if (string === 'pending') {\n return { type: 'pending' };\n }\n else if (string.substring(0, 8) === 'address:') {\n return { type: 'address', address: string.substring(8) };\n }\n else if (string.substring(0, 6) === 'topic:') {\n try {\n var object = rlp_1.decode(string.substring(6));\n object = recurse(object, function (object) {\n if (object === '0x') {\n object = null;\n }\n return object;\n });\n return { type: 'topic', topic: object };\n }\n catch (error) {\n console.log(error);\n }\n }\n throw new Error('invalid event string');\n}\n//////////////////////////////\n// Provider Object\n/* @TODO:\ntype Event = {\n eventName: string,\n listener: any, // @TODO: Function any: any\n type: string,\n}\n*/\n// @TODO: Perhaps allow a SignDigestAsyncFunc?\n// Enable a simple signing function and provider to provide a full Signer\nvar ProviderSigner = /** @class */ (function (_super) {\n __extends(ProviderSigner, _super);\n function ProviderSigner(address, signDigest, provider) {\n var _this = _super.call(this) || this;\n errors.checkNew(_this, ProviderSigner);\n properties_1.defineReadOnly(_this, '_addressPromise', Promise.resolve(address));\n properties_1.defineReadOnly(_this, 'signDigest', signDigest);\n properties_1.defineReadOnly(_this, 'provider', provider);\n return _this;\n }\n ProviderSigner.prototype.getAddress = function () {\n return this._addressPromise;\n };\n ProviderSigner.prototype.signMessage = function (message) {\n return Promise.resolve(bytes_1.joinSignature(this.signDigest(hash_1.hashMessage(message))));\n };\n ProviderSigner.prototype.sendTransaction = function (transaction) {\n var _this = this;\n transaction = properties_1.shallowCopy(transaction);\n if (transaction.chainId == null) {\n transaction.chainId = this.provider.getNetwork().then(function (network) {\n return network.chainId;\n });\n }\n if (transaction.from == null) {\n transaction.from = this.getAddress();\n }\n if (transaction.gasLimit == null) {\n transaction.gasLimit = this.provider.estimateGas(transaction);\n }\n if (transaction.gasPrice == null) {\n transaction.gasPrice = this.provider.getGasPrice();\n }\n return properties_1.resolveProperties(transaction).then(function (tx) {\n var signedTx = transaction_1.sign(tx, _this.signDigest);\n return _this._addressPromise.then(function (address) {\n if (transaction_1.parse(signedTx).from !== address) {\n errors.throwError('signing address does not match expected address', errors.UNKNOWN_ERROR, { address: transaction_1.parse(signedTx).from, expectedAddress: address, signedTransaction: signedTx });\n }\n return _this.provider.sendTransaction(signedTx);\n });\n });\n };\n return ProviderSigner;\n}(wallet_1.Signer));\nexports.ProviderSigner = ProviderSigner;\nvar Provider = /** @class */ (function () {\n function Provider(network) {\n var _this = this;\n errors.checkNew(this, Provider);\n if (network instanceof Promise) {\n properties_1.defineReadOnly(this, 'ready', network.then(function (network) {\n properties_1.defineReadOnly(_this, '_network', network);\n return network;\n }));\n }\n else {\n var knownNetwork = networks_1.getNetwork((network == null) ? 'homestead' : network);\n if (knownNetwork) {\n properties_1.defineReadOnly(this, '_network', knownNetwork);\n properties_1.defineReadOnly(this, 'ready', Promise.resolve(this._network));\n }\n else {\n errors.throwError('invalid network', errors.INVALID_ARGUMENT, { arg: 'network', value: network });\n }\n }\n this._lastBlockNumber = -2;\n // Balances being watched for changes\n this._balances = {};\n // Events being listened to\n this._events = {};\n this._pollingInterval = 4000;\n // We use this to track recent emitted events; for example, if we emit a \"block\" of 100\n // and we get a `getBlock(100)` request which would result in null, we should retry\n // until we get a response. This provides devs with a consistent view. Similarly for\n // transaction hashes.\n this._emitted = { block: this._lastBlockNumber };\n }\n Provider.prototype._doPoll = function () {\n var _this = this;\n this.getBlockNumber().then(function (blockNumber) {\n // If the block hasn't changed, meh.\n if (blockNumber === _this._lastBlockNumber) {\n return;\n }\n if (_this._lastBlockNumber === -2) {\n _this._lastBlockNumber = blockNumber - 1;\n }\n // Notify all listener for each block that has passed\n for (var i = _this._lastBlockNumber + 1; i <= blockNumber; i++) {\n if (_this._emitted.block < i) {\n _this._emitted.block = i;\n // Evict any transaction hashes or block hashes over 12 blocks\n // old, since they should not return null anyways\n Object.keys(_this._emitted).forEach(function (key) {\n if (key === 'block') {\n return;\n }\n if (_this._emitted[key] > i + 12) {\n delete _this._emitted[key];\n }\n });\n }\n _this.emit('block', i);\n }\n // Sweep balances and remove addresses we no longer have events for\n var newBalances = {};\n // Find all transaction hashes we are waiting on\n Object.keys(_this._events).forEach(function (eventName) {\n var event = parseEventString(eventName);\n if (event.type === 'transaction') {\n _this.getTransaction(event.hash).then(function (transaction) {\n if (!transaction || transaction.blockNumber == null) {\n return;\n }\n _this._emitted['t:' + transaction.hash.toLowerCase()] = transaction.blockNumber;\n _this.emit(event.hash, transaction);\n });\n }\n else if (event.type === 'address') {\n if (_this._balances[event.address]) {\n newBalances[event.address] = _this._balances[event.address];\n }\n _this.getBalance(event.address, 'latest').then(function (balance) {\n var lastBalance = this._balances[event.address];\n if (lastBalance && balance.eq(lastBalance)) {\n return;\n }\n this._balances[event.address] = balance;\n this.emit(event.address, balance);\n });\n }\n else if (event.type === 'topic') {\n _this.getLogs({\n fromBlock: _this._lastBlockNumber + 1,\n toBlock: blockNumber,\n topics: event.topic\n }).then(function (logs) {\n if (logs.length === 0) {\n return;\n }\n logs.forEach(function (log) {\n _this._emitted['b:' + log.blockHash.toLowerCase()] = log.blockNumber;\n _this._emitted['t:' + log.transactionHash.toLowerCase()] = log.blockNumber;\n _this.emit(event.topic, log);\n });\n });\n }\n });\n _this._lastBlockNumber = blockNumber;\n _this._balances = newBalances;\n });\n this.doPoll();\n };\n Provider.prototype.resetEventsBlock = function (blockNumber) {\n this._lastBlockNumber = this.blockNumber;\n this._doPoll();\n };\n Object.defineProperty(Provider.prototype, \"network\", {\n get: function () {\n return this._network;\n },\n enumerable: true,\n configurable: true\n });\n Provider.prototype.getNetwork = function () {\n return this.ready;\n };\n Object.defineProperty(Provider.prototype, \"blockNumber\", {\n get: function () {\n if (this._lastBlockNumber < 0) {\n return null;\n }\n return this._lastBlockNumber;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Provider.prototype, \"polling\", {\n get: function () {\n return (this._poller != null);\n },\n set: function (value) {\n var _this = this;\n setTimeout(function () {\n if (value && !_this._poller) {\n _this._poller = setInterval(_this._doPoll.bind(_this), _this.pollingInterval);\n }\n else if (!value && _this._poller) {\n clearInterval(_this._poller);\n _this._poller = null;\n }\n }, 0);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Provider.prototype, \"pollingInterval\", {\n get: function () {\n return this._pollingInterval;\n },\n set: function (value) {\n var _this = this;\n if (typeof (value) !== 'number' || value <= 0 || Math.trunc(value) != value) {\n throw new Error('invalid polling interval');\n }\n this._pollingInterval = value;\n if (this._poller) {\n clearInterval(this._poller);\n this._poller = setInterval(function () { _this._doPoll(); }, this._pollingInterval);\n }\n },\n enumerable: true,\n configurable: true\n });\n // @TODO: Add .poller which must be an event emitter with a 'start', 'stop' and 'block' event;\n // this will be used once we move to the WebSocket or other alternatives to polling\n Provider.prototype.waitForTransaction = function (transactionHash, timeout) {\n var self = this;\n return new Promise(function (resolve, reject) {\n var timer = null;\n function complete(transaction) {\n if (timer) {\n clearTimeout(timer);\n }\n resolve(transaction);\n }\n self.once(transactionHash, complete);\n if (typeof (timeout) === 'number' && timeout > 0) {\n timer = setTimeout(function () {\n self.removeListener(transactionHash, complete);\n reject(new Error('timeout'));\n }, timeout);\n }\n });\n };\n Provider.prototype.getBlockNumber = function () {\n var _this = this;\n return this.ready.then(function () {\n return _this.perform('getBlockNumber', {}).then(function (result) {\n var value = Math.trunc(result);\n if (value != result) {\n throw new Error('invalid response - getBlockNumber');\n }\n return value;\n });\n });\n };\n Provider.prototype.getGasPrice = function () {\n var _this = this;\n return this.ready.then(function () {\n return _this.perform('getGasPrice', {}).then(function (result) {\n return bignumber_1.bigNumberify(result);\n });\n });\n };\n Provider.prototype.getBalance = function (addressOrName, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return _this.perform('getBalance', params).then(function (result) {\n return bignumber_1.bigNumberify(result);\n });\n });\n });\n });\n };\n Provider.prototype.getTransactionCount = function (addressOrName, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return _this.perform('getTransactionCount', params).then(function (result) {\n var value = parseInt(result);\n if (value != result) {\n throw new Error('invalid response - getTransactionCount');\n }\n return value;\n });\n });\n });\n });\n };\n Provider.prototype.getCode = function (addressOrName, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = { address: address, blockTag: checkBlockTag(blockTag) };\n return _this.perform('getCode', params).then(function (result) {\n return bytes_1.hexlify(result);\n });\n });\n });\n });\n };\n Provider.prototype.getStorageAt = function (addressOrName, position, blockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(function (_a) {\n var addressOrName = _a.addressOrName, position = _a.position, blockTag = _a.blockTag;\n return _this.resolveName(addressOrName).then(function (address) {\n var params = {\n address: address,\n blockTag: checkBlockTag(blockTag),\n position: bytes_1.hexStripZeros(bytes_1.hexlify(position)),\n };\n return _this.perform('getStorageAt', params).then(function (result) {\n return bytes_1.hexlify(result);\n });\n });\n });\n });\n };\n Provider.prototype.sendTransaction = function (signedTransaction) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ signedTransaction: signedTransaction }).then(function (_a) {\n var signedTransaction = _a.signedTransaction;\n var params = { signedTransaction: bytes_1.hexlify(signedTransaction) };\n return _this.perform('sendTransaction', params).then(function (hash) {\n if (bytes_1.hexDataLength(hash) !== 32) {\n throw new Error('invalid response - sendTransaction');\n }\n // A signed transaction always has a from (and we add wait below)\n var tx = transaction_1.parse(signedTransaction);\n // Check the hash we expect is the same as the hash the server reported\n if (tx.hash !== hash) {\n errors.throwError('Transaction hash mismatch from Proivder.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n _this._emitted['t:' + tx.hash.toLowerCase()] = 'pending';\n tx.wait = function (timeout) {\n return _this.waitForTransaction(hash, timeout);\n };\n return tx;\n });\n });\n });\n };\n Provider.prototype.call = function (transaction) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties(transaction).then(function (transaction) {\n return _this._resolveNames(transaction, ['to', 'from']).then(function (transaction) {\n var params = { transaction: checkTransactionRequest(transaction) };\n return _this.perform('call', params).then(function (result) {\n return bytes_1.hexlify(result);\n });\n });\n });\n });\n };\n Provider.prototype.estimateGas = function (transaction) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties(transaction).then(function (transaction) {\n return _this._resolveNames(transaction, ['to', 'from']).then(function (transaction) {\n var params = { transaction: checkTransactionRequest(transaction) };\n return _this.perform('estimateGas', params).then(function (result) {\n return bignumber_1.bigNumberify(result);\n });\n });\n });\n });\n };\n Provider.prototype.getBlock = function (blockHashOrBlockTag) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(function (_a) {\n var blockHashOrBlockTag = _a.blockHashOrBlockTag;\n try {\n var blockHash = bytes_1.hexlify(blockHashOrBlockTag);\n if (bytes_1.hexDataLength(blockHash) === 32) {\n return stallPromise(function () {\n return (_this._emitted['b:' + blockHash.toLowerCase()] == null);\n }, function () {\n return _this.perform('getBlock', { blockHash: blockHash }).then(function (block) {\n if (block == null) {\n return null;\n }\n return checkBlock(block);\n });\n });\n }\n }\n catch (error) { }\n try {\n var blockTag = checkBlockTag(blockHashOrBlockTag);\n return stallPromise(function () {\n if (bytes_1.isHexString(blockTag)) {\n var blockNumber = parseInt(blockTag.substring(2), 16);\n return blockNumber > _this._emitted.block;\n }\n return true;\n }, function () {\n return _this.perform('getBlock', { blockTag: blockTag }).then(function (block) {\n if (block == null) {\n return null;\n }\n return checkBlock(block);\n });\n });\n }\n catch (error) { }\n throw new Error('invalid block hash or block tag');\n });\n });\n };\n Provider.prototype.getTransaction = function (transactionHash) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ transactionHash: transactionHash }).then(function (_a) {\n var transactionHash = _a.transactionHash;\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(function () {\n return (_this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, function () {\n return _this.perform('getTransaction', params).then(function (result) {\n if (result != null) {\n result = checkTransactionResponse(result);\n }\n return result;\n });\n });\n });\n });\n };\n Provider.prototype.getTransactionReceipt = function (transactionHash) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties({ transactionHash: transactionHash }).then(function (_a) {\n var transactionHash = _a.transactionHash;\n var params = { transactionHash: checkHash(transactionHash) };\n return stallPromise(function () {\n return (_this._emitted['t:' + transactionHash.toLowerCase()] == null);\n }, function () {\n return _this.perform('getTransactionReceipt', params).then(function (result) {\n if (result != null) {\n result = checkTransactionReceipt(result);\n }\n return result;\n });\n });\n });\n });\n };\n Provider.prototype.getLogs = function (filter) {\n var _this = this;\n return this.ready.then(function () {\n return properties_1.resolveProperties(filter).then(function (filter) {\n return _this._resolveNames(filter, ['address']).then(function (filter) {\n var params = { filter: checkFilter(filter) };\n return _this.perform('getLogs', params).then(function (result) {\n return arrayOf(checkLog)(result);\n });\n });\n });\n });\n };\n Provider.prototype.getEtherPrice = function () {\n var _this = this;\n return this.ready.then(function () {\n return _this.perform('getEtherPrice', {}).then(function (result) {\n // @TODO: Check valid float\n return result;\n });\n });\n };\n Provider.prototype._resolveNames = function (object, keys) {\n var promises = [];\n var result = copyObject(object);\n keys.forEach(function (key) {\n if (result[key] === undefined) {\n return;\n }\n promises.push(this.resolveName(result[key]).then(function (address) {\n result[key] = address;\n }));\n }, this);\n return Promise.all(promises).then(function () { return result; });\n };\n Provider.prototype._getResolver = function (name) {\n var _this = this;\n // Get the resolver from the blockchain\n return this.getNetwork().then(function (network) {\n // No ENS...\n if (!network.ensAddress) {\n errors.throwError('network does support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });\n }\n // keccak256('resolver(bytes32)')\n var data = '0x0178b8bf' + hash_1.namehash(name).substring(2);\n var transaction = { to: network.ensAddress, data: data };\n return _this.call(transaction).then(function (data) {\n // extract the address from the data\n if (bytes_1.hexDataLength(data) !== 32) {\n return null;\n }\n return address_1.getAddress(bytes_1.hexDataSlice(data, 12));\n });\n });\n };\n Provider.prototype.resolveName = function (name) {\n var _this = this;\n // If it is a promise, resolve it then recurse\n if (name instanceof Promise) {\n return name.then(function (addressOrName) {\n return _this.resolveName(addressOrName);\n });\n }\n // If it is already an address, nothing to resolve\n try {\n return Promise.resolve(address_1.getAddress(name));\n }\n catch (error) { }\n var self = this;\n var nodeHash = hash_1.namehash(name);\n // Get the addr from the resovler\n return this._getResolver(name).then(function (resolverAddress) {\n // keccak256('addr(bytes32)')\n var data = '0x3b3b57de' + nodeHash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n // extract the address from the data\n }).then(function (data) {\n if (bytes_1.hexDataLength(data) !== 32) {\n return null;\n }\n var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));\n if (address === '0x0000000000000000000000000000000000000000') {\n return null;\n }\n return address;\n });\n };\n Provider.prototype.lookupAddress = function (address) {\n var _this = this;\n if (address instanceof Promise) {\n return address.then(function (address) {\n return _this.lookupAddress(address);\n });\n }\n address = address_1.getAddress(address);\n var name = address.substring(2) + '.addr.reverse';\n var nodehash = hash_1.namehash(name);\n var self = this;\n return this._getResolver(name).then(function (resolverAddress) {\n if (!resolverAddress) {\n return null;\n }\n // keccak('name(bytes32)')\n var data = '0x691f3431' + nodehash.substring(2);\n var transaction = { to: resolverAddress, data: data };\n return self.call(transaction);\n }).then(function (data) {\n // Strip off the \"0x\"\n data = data.substring(2);\n // Strip off the dynamic string pointer (0x20)\n if (data.length < 64) {\n return null;\n }\n data = data.substring(64);\n if (data.length < 64) {\n return null;\n }\n var length = bignumber_1.bigNumberify('0x' + data.substring(0, 64)).toNumber();\n data = data.substring(64);\n if (2 * length > data.length) {\n return null;\n }\n var name = utf8_1.toUtf8String('0x' + data.substring(0, 2 * length));\n // Make sure the reverse record matches the foward record\n return self.resolveName(name).then(function (addr) {\n if (addr != address) {\n return null;\n }\n return name;\n });\n });\n };\n Provider.prototype.doPoll = function () {\n };\n Provider.prototype.perform = function (method, params) {\n errors.throwError(method + ' not implemented', errors.NOT_IMPLEMENTED, { operation: method });\n return null;\n };\n Provider.prototype._startPending = function () {\n console.log('WARNING: this provider does not support pending events');\n };\n Provider.prototype._stopPending = function () {\n };\n Provider.prototype.on = function (eventName, listener) {\n var key = getEventString(eventName);\n if (!this._events[key]) {\n this._events[key] = [];\n }\n this._events[key].push({ eventName: eventName, listener: listener, type: 'on' });\n if (key === 'pending') {\n this._startPending();\n }\n this.polling = true;\n return this;\n };\n Provider.prototype.once = function (eventName, listener) {\n var key = getEventString(eventName);\n if (!this._events[key]) {\n this._events[key] = [];\n }\n this._events[key].push({ eventName: eventName, listener: listener, type: 'once' });\n if (key === 'pending') {\n this._startPending();\n }\n this.polling = true;\n return this;\n };\n Provider.prototype.emit = function (eventName) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var result = false;\n var key = getEventString(eventName);\n //var args = Array.prototype.slice.call(arguments, 1);\n var listeners = this._events[key];\n if (!listeners) {\n return result;\n }\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n if (listener.type === 'once') {\n listeners.splice(i, 1);\n i--;\n }\n try {\n listener.listener.apply(this, args);\n result = true;\n }\n catch (error) {\n console.log('Event Listener Error: ' + error.message);\n }\n }\n if (listeners.length === 0) {\n delete this._events[key];\n if (key === 'pending') {\n this._stopPending();\n }\n }\n if (this.listenerCount() === 0) {\n this.polling = false;\n }\n return result;\n };\n // @TODO: type EventName\n Provider.prototype.listenerCount = function (eventName) {\n if (!eventName) {\n var result = 0;\n for (var key in this._events) {\n result += this._events[key].length;\n }\n return result;\n }\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) {\n return 0;\n }\n return listeners.length;\n };\n // @TODO: func\n Provider.prototype.listeners = function (eventName) {\n var listeners = this._events[getEventString(eventName)];\n if (!listeners) {\n return [];\n }\n var result = [];\n for (var i = 0; i < listeners.length; i++) {\n result.push(listeners[i].listener);\n }\n return result;\n };\n Provider.prototype.removeAllListeners = function (eventName) {\n delete this._events[getEventString(eventName)];\n if (this.listenerCount() === 0) {\n this.polling = false;\n }\n return this;\n };\n Provider.prototype.removeListener = function (eventName, listener) {\n var eventNameString = getEventString(eventName);\n var listeners = this._events[eventNameString];\n if (!listeners) {\n return this;\n }\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i].listener === listener) {\n listeners.splice(i, 1);\n break;\n }\n }\n if (listeners.length === 0) {\n this.removeAllListeners(eventName);\n }\n return this;\n };\n return Provider;\n}());\nexports.Provider = Provider;\n\n},{\"../utils/address\":58,\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/hash\":62,\"../utils/properties\":65,\"../utils/rlp\":66,\"../utils/transaction\":70,\"../utils/utf8\":72,\"../wallet/wallet\":78,\"./networks\":54}],56:[function(require,module,exports){\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 });\nvar json_rpc_provider_1 = require(\"./json-rpc-provider\");\nvar properties_1 = require(\"../utils/properties\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar Web3Provider = /** @class */ (function (_super) {\n __extends(Web3Provider, _super);\n function Web3Provider(web3Provider, network) {\n var _this = this;\n if (!web3Provider || !web3Provider.sendAsync) {\n errors.throwError('invalid web3Provider', errors.INVALID_ARGUMENT, { arg: 'web3Provider', value: web3Provider });\n }\n // HTTP has a host; IPC has a path.\n var url = web3Provider.host || web3Provider.path || 'unknown';\n _this = _super.call(this, url, network) || this;\n errors.checkNew(_this, Web3Provider);\n properties_1.defineReadOnly(_this, '_web3Provider', web3Provider);\n return _this;\n }\n Web3Provider.prototype.send = function (method, params) {\n var _this = this;\n // Metamask complains about eth_sign (and on some versions hangs)\n if (method == 'eth_sign' && this._web3Provider.isMetaMask) {\n // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign\n method = 'personal_sign';\n params = [params[1], params[0]];\n }\n return new Promise(function (resolve, reject) {\n var request = {\n method: method,\n params: params,\n id: 42,\n jsonrpc: \"2.0\"\n };\n _this._web3Provider.sendAsync(request, function (error, result) {\n if (error) {\n reject(error);\n return;\n }\n if (result.error) {\n // @TODO: not any\n var error = new Error(result.error.message);\n error.code = result.error.code;\n error.data = result.error.data;\n reject(error);\n return;\n }\n resolve(result.result);\n });\n });\n };\n return Web3Provider;\n}(json_rpc_provider_1.JsonRpcProvider));\nexports.Web3Provider = Web3Provider;\n\n},{\"../utils/errors\":61,\"../utils/properties\":65,\"./json-rpc-provider\":53}],57:[function(require,module,exports){\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 address_1 = require(\"./address\");\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar properties_1 = require(\"./properties\");\nvar errors = __importStar(require(\"./errors\"));\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 function throwError(i) {\n throw new Error('unexpected character \"' + param[i] + '\" at position ' + i + ' in \"' + param + '\"');\n }\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 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 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 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 console.log('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 inputs: [],\n name: '',\n outputs: [],\n payable: false,\n stateMutability: null,\n type: 'function'\n };\n var 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 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 '':\n break;\n default:\n console.log('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 return abi;\n}\nfunction parseParamType(type) {\n return parseParam(type, true);\n}\nexports.parseParamType = parseParamType;\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(/\\(/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}());\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 v = v.toTwos(this.size * 8).maskn(this.size * 8);\n //value = value.toTwos(size * 8).maskn(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 type: typeof (value),\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 > 32) {\n throw new Error();\n }\n result.set(data);\n }\n catch (error) {\n errors.throwError('invalid ' + this.name + ' value', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n type: typeof (value),\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 type: typeof (value),\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 = Math.trunc(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: Math.trunc(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 type: typeof (value),\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 type: typeof (value),\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 Math.trunc(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 type: typeof (values),\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 type: typeof (value),\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 if (count !== value.length) {\n errors.throwError('array value length mismatch', errors.INVALID_ARGUMENT, {\n arg: this.localName,\n coderType: 'array',\n count: value.length,\n expectedCount: count,\n value: value\n });\n }\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(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 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 result.push(accum);\n return result;\n}\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.type = match[1];\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 = properties_1.jsonCopy(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.jsonCopy(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},{\"./address\":58,\"./bignumber\":59,\"./bytes\":60,\"./errors\":61,\"./properties\":65,\"./utf8\":72}],58:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use this for base 36 maths\nvar BN = require(\"bn.js\");\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar rlp_1 = require(\"./rlp\");\nvar errors = require(\"./errors\");\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(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(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\n},{\"./bytes\":60,\"./errors\":61,\"./keccak256\":64,\"./rlp\":66,\"bn.js\":2}],59:[function(require,module,exports){\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(\"../utils/errors\"));\nfunction _isBigNumber(value) {\n return isBigNumber(value);\n}\nvar BigNumber = /** @class */ (function () {\n function BigNumber(value) {\n errors.checkNew(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, '_bn', new bn_js_1.default.BN(value.substring(2), 16));\n }\n else if (value[0] === '-' && bytes_1.isHexString(value.substring(1))) {\n properties_1.defineReadOnly(this, '_bn', (new bn_js_1.default.BN(value.substring(3), 16)).mul(exports.ConstantNegativeOne._bn));\n }\n else if (value.match(/^-?[0-9]*$/)) {\n if (value == '') {\n value = '0';\n }\n properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value));\n }\n }\n else if (typeof (value) === 'number') {\n if (Math.trunc(value) !== value) {\n errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: Math.trunc(value) });\n }\n try {\n properties_1.defineReadOnly(this, '_bn', 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 (bn_js_1.default.BN.isBN(value)) {\n properties_1.defineReadOnly(this, '_bn', value);\n }\n else if (_isBigNumber(value)) {\n properties_1.defineReadOnly(this, '_bn', value._bn);\n }\n else if (bytes_1.isArrayish(value)) {\n properties_1.defineReadOnly(this, '_bn', 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 new BigNumber(this._bn.fromTwos(value));\n };\n BigNumber.prototype.toTwos = function (value) {\n return new BigNumber(this._bn.toTwos(value));\n };\n BigNumber.prototype.add = function (other) {\n return new BigNumber(this._bn.add(bigNumberify(other)._bn));\n };\n BigNumber.prototype.sub = function (other) {\n return new BigNumber(this._bn.sub(bigNumberify(other)._bn));\n };\n BigNumber.prototype.div = function (other) {\n var o = bigNumberify(other)._bn;\n if (o.isZero()) {\n errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });\n }\n return new BigNumber(this._bn.div(o));\n };\n BigNumber.prototype.mul = function (other) {\n return new BigNumber(this._bn.mul(bigNumberify(other)._bn));\n };\n BigNumber.prototype.mod = function (other) {\n return new BigNumber(this._bn.mod(bigNumberify(other)._bn));\n };\n BigNumber.prototype.pow = function (other) {\n return new BigNumber(this._bn.pow(bigNumberify(other)._bn));\n };\n BigNumber.prototype.maskn = function (value) {\n return new BigNumber(this._bn.maskn(value));\n };\n BigNumber.prototype.eq = function (other) {\n return this._bn.eq(bigNumberify(other)._bn);\n };\n BigNumber.prototype.lt = function (other) {\n return this._bn.lt(bigNumberify(other)._bn);\n };\n BigNumber.prototype.lte = function (other) {\n return this._bn.lte(bigNumberify(other)._bn);\n };\n BigNumber.prototype.gt = function (other) {\n return this._bn.gt(bigNumberify(other)._bn);\n };\n BigNumber.prototype.gte = function (other) {\n return this._bn.gte(bigNumberify(other)._bn);\n };\n BigNumber.prototype.isZero = function () {\n return this._bn.isZero();\n };\n BigNumber.prototype.toNumber = function () {\n try {\n return this._bn.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 this._bn.toString(10);\n };\n BigNumber.prototype.toHexString = function () {\n var hex = this._bn.toString(16);\n if (hex.length % 2) {\n hex = '0' + hex;\n }\n return '0x' + hex;\n };\n return BigNumber;\n}());\nexports.BigNumber = BigNumber;\nfunction isBigNumber(value) {\n return (value._bn && value._bn.mod);\n}\nexports.isBigNumber = isBigNumber;\nfunction bigNumberify(value) {\n if (_isBigNumber(value)) {\n return value;\n }\n return new BigNumber(value);\n}\nexports.bigNumberify = bigNumberify;\nexports.ConstantNegativeOne = bigNumberify(-1);\nexports.ConstantZero = bigNumberify(0);\nexports.ConstantOne = bigNumberify(1);\nexports.ConstantTwo = bigNumberify(2);\nexports.ConstantWeiPerEther = bigNumberify(new bn_js_1.default.BN('1000000000000000000'));\n\n},{\"../utils/errors\":61,\"./bytes\":60,\"./properties\":65,\"bn.js\":2}],60:[function(require,module,exports){\n\"use strict\";\n/**\n * Conversion Utilities\n *\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar errors = require(\"./errors\");\nfunction isBigNumber(value) {\n return !!value._bn;\n}\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 new Uint8Array(Array.prototype.slice.apply(array, args));\n };\n return array;\n}\nfunction isArrayish(value) {\n if (!value || parseInt(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(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 (isBigNumber(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 else if (typeof (value) === 'string') {\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 (isBigNumber(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 var hex = '';\n while (value) {\n hex = HexCharacters[value & 0x0f] + hex;\n value = Math.trunc(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, length) {\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 (length != null) {\n return '0x' + data.substring(offset, offset + 2 * length);\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 splitSignature(signature) {\n var bytes = arrayify(signature);\n if (bytes.length !== 65) {\n throw new Error('invalid signature');\n }\n var v = bytes[64];\n if (v !== 27 && v !== 28) {\n v = 27 + (v % 2);\n }\n return {\n r: hexlify(bytes.slice(0, 32)),\n s: hexlify(bytes.slice(32, 64)),\n recoveryParam: (v - 27),\n v: v\n };\n}\nexports.splitSignature = splitSignature;\nfunction joinSignature(signature) {\n return hexlify(concat([\n hexZeroPad(signature.r, 32),\n hexZeroPad(signature.s, 32),\n (signature.recoveryParam ? '0x1c' : '0x1b')\n ]));\n}\nexports.joinSignature = joinSignature;\n\n},{\"./errors\":61}],61:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\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\nexports.CALL_EXCEPTION = 'CALL_EXCEPTION';\n// Response from a server was invalid\n// - response: The body of the response\n//'BAD_RESPONSE',\n// Invalid argument (e.g. type) to a function:\n// - arg: The argument name that was invalid\n// - value: The value of the argument\n// - type: The type of the argument\n// - expected: What was expected\nexports.INVALID_ARGUMENT = 'INVALID_ARGUMENT';\n// Missing argument to a function:\n// - arg: The argument name that is required\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// Unsupported operation\n// - operation\nexports.UNSUPPORTED_OPERATION = 'UNSUPPORTED_OPERATION';\n// @TODO: Enum\nfunction throwError(message, code, params) {\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 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;\n\n},{}],62:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar keccak256_1 = require(\"./keccak256\");\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 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 throw new Error('contains invalid UseSTD3ASCIIRules characters');\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 var payload = 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 return keccak256_1.keccak256(payload);\n}\nexports.hashMessage = hashMessage;\n\n},{\"./bytes\":60,\"./keccak256\":64,\"./utf8\":72}],63:[function(require,module,exports){\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 });\n// This is SUPER useful, but adds 140kb (even zipped, adds 40kb)\n//var unorm = require('unorm');\nvar address_1 = require(\"./address\");\nexports.getAddress = address_1.getAddress;\nexports.getContractAddress = address_1.getContractAddress;\nexports.getIcapAddress = address_1.getIcapAddress;\nvar abi_coder_1 = require(\"./abi-coder\");\nexports.AbiCoder = abi_coder_1.AbiCoder;\nexports.defaultAbiCoder = abi_coder_1.defaultAbiCoder;\nexports.parseSignature = abi_coder_1.parseSignature;\nexports.parseParamType = abi_coder_1.parseParamType;\nvar base64 = __importStar(require(\"./base64\"));\nexports.base64 = base64;\nvar bignumber_1 = require(\"./bignumber\");\nexports.BigNumber = bignumber_1.BigNumber;\nexports.bigNumberify = bignumber_1.bigNumberify;\nvar bytes_1 = require(\"./bytes\");\nexports.arrayify = bytes_1.arrayify;\nexports.concat = bytes_1.concat;\nexports.hexlify = bytes_1.hexlify;\nexports.joinSignature = bytes_1.joinSignature;\nexports.padZeros = bytes_1.padZeros;\nexports.splitSignature = bytes_1.splitSignature;\nexports.stripZeros = bytes_1.stripZeros;\nvar hash_1 = require(\"./hash\");\nexports.hashMessage = hash_1.hashMessage;\nexports.id = hash_1.id;\nexports.namehash = hash_1.namehash;\nvar keccak256_1 = require(\"./keccak256\");\nexports.keccak256 = keccak256_1.keccak256;\nvar sha2_1 = require(\"./sha2\");\nexports.sha256 = sha2_1.sha256;\nvar solidity_1 = require(\"./solidity\");\nexports.solidityKeccak256 = solidity_1.keccak256;\nexports.solidityPack = solidity_1.pack;\nexports.soliditySha256 = solidity_1.sha256;\nvar random_bytes_1 = require(\"./random-bytes\");\nexports.randomBytes = random_bytes_1.randomBytes;\nvar properties_1 = require(\"./properties\");\nexports.defineFrozen = properties_1.defineFrozen;\nexports.defineReadOnly = properties_1.defineReadOnly;\nexports.resolveProperties = properties_1.resolveProperties;\nexports.shallowCopy = properties_1.shallowCopy;\nvar RLP = __importStar(require(\"./rlp\"));\nexports.RLP = RLP;\nvar utf8_1 = require(\"./utf8\");\nexports.toUtf8Bytes = utf8_1.toUtf8Bytes;\nexports.toUtf8String = utf8_1.toUtf8String;\nvar units_1 = require(\"./units\");\nexports.formatEther = units_1.formatEther;\nexports.parseEther = units_1.parseEther;\nexports.formatUnits = units_1.formatUnits;\nexports.parseUnits = units_1.parseUnits;\nvar web_1 = require(\"./web\");\nexports.fetchJson = web_1.fetchJson;\nvar transaction_1 = require(\"./transaction\");\nexports.parseTransaction = transaction_1.parse;\nvar errors = __importStar(require(\"./errors\"));\nexports.errors = errors;\n// NFKD (decomposed)\n//const etherSymbol = '\\uD835\\uDF63';\n// NFKC (composed)\nvar etherSymbol = '\\u039e';\nexports.etherSymbol = etherSymbol;\n\n},{\"./abi-coder\":57,\"./address\":58,\"./base64\":40,\"./bignumber\":59,\"./bytes\":60,\"./errors\":61,\"./hash\":62,\"./keccak256\":64,\"./properties\":65,\"./random-bytes\":44,\"./rlp\":66,\"./sha2\":68,\"./solidity\":69,\"./transaction\":70,\"./units\":71,\"./utf8\":72,\"./web\":73}],64:[function(require,module,exports){\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\n},{\"./bytes\":60,\"js-sha3\":33}],65:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction defineReadOnly(object, name, value) {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\nexports.defineReadOnly = defineReadOnly;\nfunction defineFrozen(object, name, value) {\n var frozen = JSON.stringify(value);\n Object.defineProperty(object, name, {\n enumerable: true,\n get: function () { return JSON.parse(frozen); }\n });\n}\nexports.defineFrozen = defineFrozen;\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) { result[key] = value; }));\n }\n else {\n result[key] = value;\n }\n });\n return Promise.all(promises).then(function () {\n return object;\n });\n}\nexports.resolveProperties = resolveProperties;\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;\nfunction jsonCopy(object) {\n return JSON.parse(JSON.stringify(object));\n}\nexports.jsonCopy = jsonCopy;\n\n},{}],66:[function(require,module,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 else {\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 }\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\n},{\"./bytes\":60}],67:[function(require,module,exports){\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 address_1 = require(\"./address\");\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar properties_1 = require(\"./properties\");\nvar errors = __importStar(require(\"./errors\"));\nvar elliptic = __importStar(require(\"elliptic\"));\nvar curve = new elliptic.ec('secp256k1');\nexports.N = '0x' + curve.n.toString(16);\nvar KeyPair = /** @class */ (function () {\n function KeyPair(privateKey) {\n var keyPair = curve.keyFromPrivate(bytes_1.arrayify(privateKey));\n properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(keyPair.priv.toArray('be', 32)));\n properties_1.defineReadOnly(this, 'publicKey', '0x' + keyPair.getPublic(false, 'hex'));\n properties_1.defineReadOnly(this, 'compressedPublicKey', '0x' + keyPair.getPublic(true, 'hex'));\n properties_1.defineReadOnly(this, 'publicKeyBytes', keyPair.getPublic().encode(null, true));\n }\n KeyPair.prototype.sign = function (digest) {\n var keyPair = curve.keyFromPrivate(bytes_1.arrayify(this.privateKey));\n var signature = keyPair.sign(bytes_1.arrayify(digest), { canonical: true });\n return {\n recoveryParam: signature.recoveryParam,\n r: bytes_1.hexZeroPad('0x' + signature.r.toString(16), 32),\n s: bytes_1.hexZeroPad('0x' + signature.s.toString(16), 32),\n v: 27 + signature.recoveryParam\n };\n };\n return KeyPair;\n}());\nexports.KeyPair = KeyPair;\nfunction recoverPublicKey(digest, signature) {\n var sig = {\n r: bytes_1.arrayify(signature.r),\n s: bytes_1.arrayify(signature.s)\n };\n return '0x' + curve.recoverPubKey(bytes_1.arrayify(digest), sig, signature.recoveryParam).encode('hex', false);\n}\nexports.recoverPublicKey = recoverPublicKey;\nfunction computePublicKey(key, compressed) {\n var bytes = bytes_1.arrayify(key);\n if (bytes.length === 32) {\n var keyPair = new KeyPair(bytes);\n if (compressed) {\n return keyPair.compressedPublicKey;\n }\n return keyPair.publicKey;\n }\n else if (bytes.length === 33) {\n if (compressed) {\n return bytes_1.hexlify(bytes);\n }\n return '0x' + curve.keyFromPublic(bytes).getPublic(false, 'hex');\n }\n else if (bytes.length === 65) {\n if (!compressed) {\n return bytes_1.hexlify(bytes);\n }\n return '0x' + curve.keyFromPublic(bytes).getPublic(true, 'hex');\n }\n errors.throwError('invalid public or private key', errors.INVALID_ARGUMENT, { arg: 'key', value: '[REDACTED]' });\n return null;\n}\nexports.computePublicKey = computePublicKey;\nfunction recoverAddress(digest, signature) {\n return computeAddress(recoverPublicKey(digest, signature));\n}\nexports.recoverAddress = recoverAddress;\nfunction computeAddress(key) {\n // Strip off the leading \"0x04\"\n var publicKey = '0x' + computePublicKey(key).slice(4);\n return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));\n}\nexports.computeAddress = computeAddress;\n\n},{\"./address\":58,\"./bytes\":60,\"./errors\":61,\"./keccak256\":64,\"./properties\":65,\"elliptic\":5}],68:[function(require,module,exports){\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 _hash = __importStar(require(\"hash.js\"));\nvar bytes_1 = require(\"./bytes\");\nvar _sha256 = _hash['sha256'];\nvar _sha512 = _hash['sha512'];\nfunction sha256(data) {\n return '0x' + (_sha256().update(bytes_1.arrayify(data)).digest('hex'));\n}\nexports.sha256 = sha256;\nfunction sha512(data) {\n return '0x' + (_sha512().update(bytes_1.arrayify(data)).digest('hex'));\n}\nexports.sha512 = sha512;\n\n},{\"./bytes\":60,\"hash.js\":20}],69:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar utf8_1 = require(\"./utf8\");\nvar keccak256_1 = require(\"./keccak256\");\nvar sha2_1 = require(\"./sha2\");\nvar regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nvar regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nvar regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\nvar Zeros = '0000000000000000000000000000000000000000000000000000000000000000';\nfunction _pack(type, value, isArray) {\n switch (type) {\n case 'address':\n if (isArray) {\n return bytes_1.padZeros(value, 32);\n }\n return bytes_1.arrayify(value);\n case 'string':\n return utf8_1.toUtf8Bytes(value);\n case 'bytes':\n return bytes_1.arrayify(value);\n case 'bool':\n value = (value ? '0x01' : '0x00');\n if (isArray) {\n return bytes_1.padZeros(value, 32);\n }\n return bytes_1.arrayify(value);\n }\n var match = type.match(regexNumber);\n if (match) {\n //var signed = (match[1] === 'int')\n var size = parseInt(match[2] || \"256\");\n if ((size % 8 != 0) || size === 0 || size > 256) {\n throw new Error('invalid number type - ' + type);\n }\n if (isArray) {\n size = 256;\n }\n value = bignumber_1.bigNumberify(value).toTwos(size);\n return bytes_1.padZeros(value, size / 8);\n }\n match = type.match(regexBytes);\n if (match) {\n var size = parseInt(match[1]);\n if (String(size) != match[1] || size === 0 || size > 32) {\n throw new Error('invalid number type - ' + type);\n }\n if (bytes_1.arrayify(value).byteLength !== size) {\n throw new Error('invalid value for ' + type);\n }\n if (isArray) {\n return bytes_1.arrayify((value + Zeros).substring(0, 66));\n }\n return value;\n }\n match = type.match(regexArray);\n if (match) {\n var baseType = match[1];\n var count = parseInt(match[2] || value.length);\n if (count != value.length) {\n throw new Error('invalid value for ' + type);\n }\n var result = [];\n value.forEach(function (value) {\n value = _pack(baseType, value, true);\n result.push(value);\n });\n return bytes_1.concat(result);\n }\n throw new Error('unknown type - ' + type);\n}\n// @TODO: Array Enum\nfunction pack(types, values) {\n if (types.length != values.length) {\n throw new Error('type/value count mismatch');\n }\n var tight = [];\n types.forEach(function (type, index) {\n tight.push(_pack(type, values[index]));\n });\n return bytes_1.hexlify(bytes_1.concat(tight));\n}\nexports.pack = pack;\nfunction keccak256(types, values) {\n return keccak256_1.keccak256(pack(types, values));\n}\nexports.keccak256 = keccak256;\nfunction sha256(types, values) {\n return sha2_1.sha256(pack(types, values));\n}\nexports.sha256 = sha256;\n\n},{\"./bignumber\":59,\"./bytes\":60,\"./keccak256\":64,\"./sha2\":68,\"./utf8\":72}],70:[function(require,module,exports){\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 address_1 = require(\"./address\");\nvar bignumber_1 = require(\"./bignumber\");\nvar bytes_1 = require(\"./bytes\");\nvar keccak256_1 = require(\"./keccak256\");\nvar secp256k1_1 = require(\"./secp256k1\");\nvar RLP = __importStar(require(\"./rlp\"));\nfunction handleAddress(value) {\n if (value === '0x') {\n return null;\n }\n return address_1.getAddress(value);\n}\nfunction handleNumber(value) {\n if (value === '0x') {\n return bignumber_1.ConstantZero;\n }\n return bignumber_1.bigNumberify(value);\n}\nvar transactionFields = [\n { name: 'nonce', maxLength: 32 },\n { name: 'gasPrice', maxLength: 32 },\n { name: 'gasLimit', maxLength: 32 },\n { name: 'to', length: 20 },\n { name: 'value', maxLength: 32 },\n { name: 'data' },\n];\nfunction sign(transaction, signDigest) {\n var raw = [];\n transactionFields.forEach(function (fieldInfo) {\n var value = transaction[fieldInfo.name] || ([]);\n value = bytes_1.arrayify(bytes_1.hexlify(value));\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n var error = new Error('invalid ' + fieldInfo.name);\n error.reason = 'wrong length';\n error.value = value;\n throw error;\n }\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = bytes_1.stripZeros(value);\n if (value.length > fieldInfo.maxLength) {\n var error = new Error('invalid ' + fieldInfo.name);\n error.reason = 'too long';\n error.value = value;\n throw error;\n }\n }\n raw.push(bytes_1.hexlify(value));\n });\n // @TOOD:\n /*\n // Requesting an unsigned transation\n if (!signDigest) {\n let v = 27 + signature.recoveryParam\n if (transaction.chainId) {\n v += transaction.chainId * 2 + 8;\n }\n //raw.push(hexlify(transaction.chainId));\n raw.push(hexlify(v));\n raw.push('0x');\n raw.push('0x');\n }\n */\n if (transaction.chainId) {\n raw.push(bytes_1.hexlify(transaction.chainId));\n raw.push('0x');\n raw.push('0x');\n }\n var digest = keccak256_1.keccak256(RLP.encode(raw));\n var signature = signDigest(digest);\n var v = 27 + signature.recoveryParam;\n if (transaction.chainId) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += transaction.chainId * 2 + 8;\n }\n raw.push(bytes_1.hexlify(v));\n raw.push(bytes_1.stripZeros(bytes_1.arrayify(signature.r)));\n raw.push(bytes_1.stripZeros(bytes_1.arrayify(signature.s)));\n return RLP.encode(raw);\n}\nexports.sign = sign;\nfunction parse(rawTransaction) {\n var signedTransaction = RLP.decode(rawTransaction);\n if (signedTransaction.length !== 9) {\n throw new Error('invalid transaction');\n }\n var tx = {\n nonce: handleNumber(signedTransaction[0]).toNumber(),\n gasPrice: handleNumber(signedTransaction[1]),\n gasLimit: handleNumber(signedTransaction[2]),\n to: handleAddress(signedTransaction[3]),\n value: handleNumber(signedTransaction[4]),\n data: signedTransaction[5],\n chainId: 0\n };\n var v = bytes_1.arrayify(signedTransaction[6]);\n var r = bytes_1.arrayify(signedTransaction[7]);\n var s = bytes_1.arrayify(signedTransaction[8]);\n if (v.length >= 1 && r.length >= 1 && r.length <= 32 && s.length >= 1 && s.length <= 32) {\n tx.v = bignumber_1.bigNumberify(v).toNumber();\n tx.r = bytes_1.hexZeroPad(signedTransaction[7], 32);\n tx.s = bytes_1.hexZeroPad(signedTransaction[8], 32);\n var chainId = (tx.v - 35) / 2;\n if (chainId < 0) {\n chainId = 0;\n }\n chainId = Math.trunc(chainId);\n tx.chainId = chainId;\n var recoveryParam = tx.v - 27;\n var raw = signedTransaction.slice(0, 6);\n if (chainId) {\n raw.push(bytes_1.hexlify(chainId));\n raw.push('0x');\n raw.push('0x');\n recoveryParam -= chainId * 2 + 8;\n }\n var digest = keccak256_1.keccak256(RLP.encode(raw));\n try {\n tx.from = secp256k1_1.recoverAddress(digest, { r: bytes_1.hexlify(r), s: bytes_1.hexlify(s), recoveryParam: recoveryParam });\n }\n catch (error) {\n console.log(error);\n }\n tx.hash = keccak256_1.keccak256(rawTransaction);\n }\n return tx;\n}\nexports.parse = parse;\n\n},{\"./address\":58,\"./bignumber\":59,\"./bytes\":60,\"./keccak256\":64,\"./rlp\":66,\"./secp256k1\":67}],71:[function(require,module,exports){\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 bignumber_1 = require(\"./bignumber\");\nvar errors = __importStar(require(\"./errors\"));\nvar names = [\n 'wei',\n 'kwei',\n 'Mwei',\n 'Gwei',\n 'szabo',\n 'finny',\n 'ether',\n];\nvar getUnitInfo = (function () {\n var unitInfos = {};\n function getUnitInfo(value) {\n return {\n decimals: value.length - 1,\n tenPower: bignumber_1.bigNumberify(value)\n };\n }\n // Cache the common units\n var value = '1';\n names.forEach(function (name) {\n var info = getUnitInfo(value);\n unitInfos[name.toLowerCase()] = info;\n unitInfos[String(info.decimals)] = info;\n value += '000';\n });\n return function (name) {\n // Try the cache\n var info = unitInfos[String(name).toLowerCase()];\n if (!info && typeof (name) === 'number' && Math.trunc(name) == name && name >= 0 && name <= 256) {\n var value = '1';\n for (var i = 0; i < name; i++) {\n value += '0';\n }\n info = getUnitInfo(value);\n }\n // Make sure we got something\n if (!info) {\n errors.throwError('invalid unitType', errors.INVALID_ARGUMENT, { arg: 'name', value: name });\n }\n return info;\n };\n})();\nfunction formatUnits(value, unitType, options) {\n /*\n if (typeof(unitType) === 'object' && !options) {\n options = unitType;\n unitType = undefined;\n }\n if (unitType == null) { unitType = 18; }\n */\n if (!options) {\n options = {};\n }\n var unitInfo = getUnitInfo(unitType);\n // Make sure wei is a big number (convert as necessary)\n value = bignumber_1.bigNumberify(value);\n var negative = value.lt(bignumber_1.ConstantZero);\n if (negative) {\n value = value.mul(bignumber_1.ConstantNegativeOne);\n }\n var fraction = value.mod(unitInfo.tenPower).toString();\n while (fraction.length < unitInfo.decimals) {\n fraction = '0' + fraction;\n }\n // Strip off trailing zeros (but keep one if would otherwise be bare decimal point)\n if (!options.pad) {\n fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];\n }\n var whole = value.div(unitInfo.tenPower).toString();\n if (options.commify) {\n whole = whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n }\n value = whole + '.' + fraction;\n if (negative) {\n value = '-' + value;\n }\n return value;\n}\nexports.formatUnits = formatUnits;\nfunction parseUnits(value, unitType) {\n if (unitType == null) {\n unitType = 18;\n }\n var unitInfo = getUnitInfo(unitType);\n if (typeof (value) !== 'string' || !value.match(/^-?[0-9.,]+$/)) {\n errors.throwError('invalid decimal value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n // Remove commas\n var value = value.replace(/,/g, '');\n // Is it negative?\n var negative = (value.substring(0, 1) === '-');\n if (negative) {\n value = value.substring(1);\n }\n if (value === '.') {\n errors.throwError('missing value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n // Split it into a whole and fractional part\n var comps = value.split('.');\n if (comps.length > 2) {\n errors.throwError('too many decimal points', errors.INVALID_ARGUMENT, { arg: 'value', value: value });\n }\n var whole = comps[0], fraction = comps[1];\n if (!whole) {\n whole = '0';\n }\n if (!fraction) {\n fraction = '0';\n }\n // Prevent underflow\n if (fraction.length > unitInfo.decimals) {\n errors.throwError('underflow occurred', errors.NUMERIC_FAULT, { operation: 'division', fault: \"underflow\" });\n }\n // Fully pad the string with zeros to get to wei\n while (fraction.length < unitInfo.decimals) {\n fraction += '0';\n }\n var wholeValue = bignumber_1.bigNumberify(whole);\n var fractionValue = bignumber_1.bigNumberify(fraction);\n var wei = (wholeValue.mul(unitInfo.tenPower)).add(fractionValue);\n if (negative) {\n wei = wei.mul(bignumber_1.ConstantNegativeOne);\n }\n return wei;\n}\nexports.parseUnits = parseUnits;\nfunction formatEther(wei, options) {\n return formatUnits(wei, 18, options);\n}\nexports.formatEther = formatEther;\nfunction parseEther(ether) {\n return parseUnits(ether, 18);\n}\nexports.parseEther = parseEther;\n\n},{\"./bignumber\":59,\"./errors\":61}],72:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar bytes_1 = require(\"./bytes\");\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 str = str.normalize(form);\n }\n var result = [];\n var offset = 0;\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c < 128) {\n result[offset++] = c;\n }\n else if (c < 2048) {\n result[offset++] = (c >> 6) | 192;\n result[offset++] = (c & 63) | 128;\n }\n else if (((c & 0xFC00) == 0xD800) && (i + 1) < str.length && ((str.charCodeAt(i + 1) & 0xFC00) == 0xDC00)) {\n // Surrogate Pair\n c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF);\n result[offset++] = (c >> 18) | 240;\n result[offset++] = ((c >> 12) & 63) | 128;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\n }\n else {\n result[offset++] = (c >> 12) | 224;\n result[offset++] = ((c >> 6) & 63) | 128;\n result[offset++] = (c & 63) | 128;\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) {\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 if (c >> 7 == 0) {\n // 0xxx xxxx\n result += String.fromCharCode(c);\n continue;\n }\n // Invalid starting byte\n if (c >> 6 == 0x02) {\n continue;\n }\n // Multibyte; how many bytes left for thus character?\n var extraLength = null;\n if (c >> 5 == 0x06) {\n extraLength = 1;\n }\n else if (c >> 4 == 0x0e) {\n extraLength = 2;\n }\n else if (c >> 3 == 0x1e) {\n extraLength = 3;\n }\n else if (c >> 2 == 0x3e) {\n extraLength = 4;\n }\n else if (c >> 1 == 0x7e) {\n extraLength = 5;\n }\n else {\n continue;\n }\n // Do we have enough bytes in our data?\n if (i + extraLength > bytes.length) {\n // If there is an invalid unprocessed byte, try to continue\n for (; i < bytes.length; i++) {\n if (bytes[i] >> 6 != 0x02) {\n break;\n }\n }\n if (i != bytes.length)\n continue;\n // All leftover bytes are valid.\n return result;\n }\n // Remove the UTF-8 prefix from the char (res)\n var res = c & ((1 << (8 - extraLength - 1)) - 1);\n var count;\n for (count = 0; count < extraLength; count++) {\n var nextChar = bytes[i++];\n // Is the char valid multibyte part?\n if (nextChar >> 6 != 0x02) {\n break;\n }\n ;\n res = (res << 6) | (nextChar & 0x3f);\n }\n if (count != extraLength) {\n i--;\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;\n\n},{\"./bytes\":60}],73:[function(require,module,exports){\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 xmlhttprequest_1 = require(\"xmlhttprequest\");\nvar utf8_1 = require(\"./utf8\");\nvar base64_1 = require(\"./base64\");\nvar errors = __importStar(require(\"./errors\"));\nfunction fetchJson(url, json, processFunc) {\n var headers = [];\n if (typeof (url) === 'object' && url.url != null) {\n if (url.url == null) {\n errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });\n }\n if (url.user != null && url.password != null) {\n if (url.url.substring(0, 6) !== 'https:' && url.allowInsecure !== true) {\n errors.throwError('basic authentication requires a secure https url', errors.INVALID_ARGUMENT, { arg: 'url', url: url.url, user: url.user, password: '[REDACTED]' });\n }\n var authorization = url.user + ':' + url.password;\n headers.push({\n key: 'Authorization',\n value: 'Basic ' + base64_1.encode(utf8_1.toUtf8Bytes(authorization))\n });\n }\n url = url.url;\n }\n return new Promise(function (resolve, reject) {\n var request = new xmlhttprequest_1.XMLHttpRequest();\n if (json) {\n request.open('POST', url, true);\n headers.push({ key: 'Content-Type', value: 'application/json' });\n }\n else {\n request.open('GET', url, true);\n }\n headers.forEach(function (header) {\n request.setRequestHeader(header.key, header.value);\n });\n request.onreadystatechange = function () {\n if (request.readyState !== 4) {\n return;\n }\n try {\n var result = JSON.parse(request.responseText);\n }\n catch (error) {\n // @TODO: not any!\n var jsonError = new Error('invalid json response');\n jsonError.orginialError = error;\n jsonError.responseText = request.responseText;\n jsonError.url = url;\n reject(jsonError);\n return;\n }\n if (processFunc) {\n try {\n result = processFunc(result);\n }\n catch (error) {\n error.url = url;\n error.body = json;\n error.responseText = request.responseText;\n reject(error);\n return;\n }\n }\n if (request.status != 200) {\n // @TODO: not any!\n var error = new Error('invalid response - ' + request.status);\n error.statusCode = request.statusCode;\n reject(error);\n return;\n }\n resolve(result);\n };\n request.onerror = function (error) {\n reject(error);\n };\n try {\n if (json) {\n request.send(json);\n }\n else {\n request.send();\n }\n }\n catch (error) {\n // @TODO: not any!\n var connectionError = new Error('connection error');\n connectionError.error = error;\n reject(connectionError);\n }\n });\n}\nexports.fetchJson = fetchJson;\n\n},{\"./base64\":40,\"./errors\":61,\"./utf8\":72,\"xmlhttprequest\":45}],74:[function(require,module,exports){\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 });\n// See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki\n// See: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\n// The English language word list.\n// For additional word lists, please see /src.tc/wordlists/\nvar lang_en_1 = require(\"../wordlists/lang-en\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar bignumber_1 = require(\"../utils/bignumber\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar pbkdf2_1 = require(\"../utils/pbkdf2\");\nvar hmac_1 = require(\"../utils/hmac\");\nvar properties_1 = require(\"../utils/properties\");\nvar secp256k1_1 = require(\"../utils/secp256k1\");\nvar sha2_1 = require(\"../utils/sha2\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// \"Bitcoin seed\"\nvar MasterSecret = utf8_1.toUtf8Bytes('Bitcoin seed');\nvar HardenedBit = 0x80000000;\n// Returns a byte with the MSB bits set\nfunction getUpperMask(bits) {\n return ((1 << bits) - 1) << (8 - bits);\n}\n// Returns a byte with the LSB bits set\nfunction getLowerMask(bits) {\n return (1 << bits) - 1;\n}\nexports.defaultPath = \"m/44'/60'/0'/0/0\";\nvar HDNode = /** @class */ (function () {\n /**\n * This constructor should not be called directly.\n *\n * Please use:\n * - fromMnemonic\n * - fromSeed\n */\n function HDNode(privateKey, chainCode, index, depth, mnemonic, path) {\n errors.checkNew(this, HDNode);\n properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKey));\n properties_1.defineReadOnly(this, 'privateKey', this.keyPair.privateKey);\n properties_1.defineReadOnly(this, 'publicKey', this.keyPair.compressedPublicKey);\n properties_1.defineReadOnly(this, 'chainCode', bytes_1.hexlify(chainCode));\n properties_1.defineReadOnly(this, 'index', index);\n properties_1.defineReadOnly(this, 'depth', depth);\n properties_1.defineReadOnly(this, 'mnemonic', mnemonic);\n properties_1.defineReadOnly(this, 'path', path);\n }\n HDNode.prototype._derive = function (index) {\n // Public parent key -> public child key\n if (!this.privateKey) {\n if (index >= HardenedBit) {\n throw new Error('cannot derive child of neutered node');\n }\n throw new Error('not implemented');\n }\n var data = new Uint8Array(37);\n // Base path\n var mnemonic = this.mnemonic;\n var path = this.path;\n if (path) {\n path += '/' + index;\n }\n if (index & HardenedBit) {\n // Data = 0x00 || ser_256(k_par)\n data.set(bytes_1.arrayify(this.privateKey), 1);\n // Hardened path\n if (path) {\n path += \"'\";\n }\n }\n else {\n // Data = ser_p(point(k_par))\n data.set(this.keyPair.publicKeyBytes);\n }\n // Data += ser_32(i)\n for (var i = 24; i >= 0; i -= 8) {\n data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);\n }\n var I = hmac_1.computeHmac('sha512', this.chainCode, data);\n var IL = bignumber_1.bigNumberify(I.slice(0, 32));\n var IR = I.slice(32);\n var ki = IL.add(this.keyPair.privateKey).mod(secp256k1_1.N);\n return new HDNode(bytes_1.arrayify(ki), IR, index, this.depth + 1, mnemonic, path);\n };\n HDNode.prototype.derivePath = function (path) {\n var components = path.split('/');\n if (components.length === 0 || (components[0] === 'm' && this.depth !== 0)) {\n throw new Error('invalid path');\n }\n if (components[0] === 'm') {\n components.shift();\n }\n var result = this;\n for (var i = 0; i < components.length; i++) {\n var component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n var index = parseInt(component.substring(0, component.length - 1));\n if (index >= HardenedBit) {\n throw new Error('invalid path index - ' + component);\n }\n result = result._derive(HardenedBit + index);\n }\n else if (component.match(/^[0-9]+$/)) {\n var index = parseInt(component);\n if (index >= HardenedBit) {\n throw new Error('invalid path index - ' + component);\n }\n result = result._derive(index);\n }\n else {\n throw new Error('invlaid path component - ' + component);\n }\n }\n return result;\n };\n return HDNode;\n}());\nexports.HDNode = HDNode;\nfunction _fromSeed(seed, mnemonic) {\n var seedArray = bytes_1.arrayify(seed);\n if (seedArray.length < 16 || seedArray.length > 64) {\n throw new Error('invalid seed');\n }\n var I = bytes_1.arrayify(hmac_1.computeHmac('sha512', MasterSecret, seedArray));\n return new HDNode(I.slice(0, 32), I.slice(32), 0, 0, mnemonic, 'm');\n}\nfunction fromMnemonic(mnemonic, wordlist) {\n // Check that the checksum s valid (will throw an error)\n mnemonicToEntropy(mnemonic, wordlist);\n return _fromSeed(mnemonicToSeed(mnemonic), mnemonic);\n}\nexports.fromMnemonic = fromMnemonic;\nfunction fromSeed(seed) {\n return _fromSeed(seed, null);\n}\nexports.fromSeed = fromSeed;\nfunction mnemonicToSeed(mnemonic, password) {\n if (!password) {\n password = '';\n }\n var salt = utf8_1.toUtf8Bytes('mnemonic' + password, utf8_1.UnicodeNormalizationForm.NFKD);\n return bytes_1.hexlify(pbkdf2_1.pbkdf2(utf8_1.toUtf8Bytes(mnemonic, utf8_1.UnicodeNormalizationForm.NFKD), salt, 2048, 64, 'sha512'));\n}\nexports.mnemonicToSeed = mnemonicToSeed;\nfunction mnemonicToEntropy(mnemonic, wordlist) {\n if (!wordlist) {\n wordlist = lang_en_1.langEn;\n }\n var words = wordlist.split(mnemonic);\n if ((words.length % 3) !== 0) {\n throw new Error('invalid mnemonic');\n }\n var entropy = bytes_1.arrayify(new Uint8Array(Math.ceil(11 * words.length / 8)));\n var offset = 0;\n for (var i = 0; i < words.length; i++) {\n var index = wordlist.getWordIndex(words[i].normalize('NFKD'));\n if (index === -1) {\n throw new Error('invalid mnemonic');\n }\n for (var bit = 0; bit < 11; bit++) {\n if (index & (1 << (10 - bit))) {\n entropy[offset >> 3] |= (1 << (7 - (offset % 8)));\n }\n offset++;\n }\n }\n var entropyBits = 32 * words.length / 3;\n var checksumBits = words.length / 3;\n var checksumMask = getUpperMask(checksumBits);\n var checksum = bytes_1.arrayify(sha2_1.sha256(entropy.slice(0, entropyBits / 8)))[0];\n checksum &= checksumMask;\n if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {\n throw new Error('invalid checksum');\n }\n return bytes_1.hexlify(entropy.slice(0, entropyBits / 8));\n}\nexports.mnemonicToEntropy = mnemonicToEntropy;\nfunction entropyToMnemonic(entropy, wordlist) {\n entropy = bytes_1.arrayify(entropy);\n if ((entropy.length % 4) !== 0 || entropy.length < 16 || entropy.length > 32) {\n throw new Error('invalid entropy');\n }\n var indices = [0];\n var remainingBits = 11;\n for (var i = 0; i < entropy.length; i++) {\n // Consume the whole byte (with still more to go)\n if (remainingBits > 8) {\n indices[indices.length - 1] <<= 8;\n indices[indices.length - 1] |= entropy[i];\n remainingBits -= 8;\n // This byte will complete an 11-bit index\n }\n else {\n indices[indices.length - 1] <<= remainingBits;\n indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits);\n // Start the next word\n indices.push(entropy[i] & getLowerMask(8 - remainingBits));\n remainingBits += 3;\n }\n }\n // Compute the checksum bits\n var checksum = bytes_1.arrayify(sha2_1.sha256(entropy))[0];\n var checksumBits = entropy.length / 4;\n checksum &= getUpperMask(checksumBits);\n // Shift the checksum into the word indices\n indices[indices.length - 1] <<= checksumBits;\n indices[indices.length - 1] |= (checksum >> (8 - checksumBits));\n if (!wordlist) {\n wordlist = lang_en_1.langEn;\n }\n return wordlist.join(indices.map(function (index) { return wordlist.getWord(index); }));\n}\nexports.entropyToMnemonic = entropyToMnemonic;\nfunction isValidMnemonic(mnemonic, wordlist) {\n try {\n mnemonicToEntropy(mnemonic, wordlist);\n return true;\n }\n catch (error) { }\n return false;\n}\nexports.isValidMnemonic = isValidMnemonic;\n\n},{\"../utils/bignumber\":59,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/hmac\":42,\"../utils/pbkdf2\":43,\"../utils/properties\":65,\"../utils/secp256k1\":67,\"../utils/sha2\":68,\"../utils/utf8\":72,\"../wordlists/lang-en\":79}],75:[function(require,module,exports){\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 wallet_1 = require(\"./wallet\");\nexports.Wallet = wallet_1.Wallet;\nvar HDNode = __importStar(require(\"./hdnode\"));\nexports.HDNode = HDNode;\nvar signing_key_1 = require(\"./signing-key\");\nexports.SigningKey = signing_key_1.SigningKey;\n\n},{\"./hdnode\":74,\"./signing-key\":77,\"./wallet\":78}],76:[function(require,module,exports){\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 aes = require(\"aes-js\");\nvar scrypt = require(\"scrypt-js\");\nvar uuid = require(\"uuid\");\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar pbkdf2_1 = require(\"../utils/pbkdf2\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar random_bytes_1 = require(\"../utils/random-bytes\");\nvar signing_key_1 = require(\"./signing-key\");\nvar HDNode = __importStar(require(\"./hdnode\"));\n// @TODO: Maybe move this to HDNode?\nvar defaultPath = \"m/44'/60'/0'/0/0\";\nfunction looseArrayify(hexString) {\n if (typeof (hexString) === 'string' && hexString.substring(0, 2) !== '0x') {\n hexString = '0x' + hexString;\n }\n return bytes_1.arrayify(hexString);\n}\nfunction zpad(value, length) {\n value = String(value);\n while (value.length < length) {\n value = '0' + value;\n }\n return value;\n}\nfunction getPassword(password) {\n if (typeof (password) === 'string') {\n return utf8_1.toUtf8Bytes(password, utf8_1.UnicodeNormalizationForm.NFKC);\n }\n return bytes_1.arrayify(password);\n}\n// Search an Object and its children recursively, caselessly.\nfunction searchPath(object, path) {\n var currentChild = object;\n var comps = path.toLowerCase().split('/');\n for (var i = 0; i < comps.length; i++) {\n // Search for a child object with a case-insensitive matching key\n var matchingChild = null;\n for (var key in currentChild) {\n if (key.toLowerCase() === comps[i]) {\n matchingChild = currentChild[key];\n break;\n }\n }\n // Didn't find one. :'(\n if (matchingChild === null) {\n return null;\n }\n // Now check this child...\n currentChild = matchingChild;\n }\n return currentChild;\n}\nfunction isCrowdsaleWallet(json) {\n try {\n var data = JSON.parse(json);\n }\n catch (error) {\n return false;\n }\n return (data.encseed && data.ethaddr);\n}\nexports.isCrowdsaleWallet = isCrowdsaleWallet;\nfunction isValidWallet(json) {\n try {\n var data = JSON.parse(json);\n }\n catch (error) {\n return false;\n }\n if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) {\n return false;\n }\n // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff\n return true;\n}\nexports.isValidWallet = isValidWallet;\n// @TODO: Make a type for string or arrayish\n// See: https://github.com/ethereum/pyethsaletool\nfunction decryptCrowdsale(json, password) {\n var data = JSON.parse(json);\n password = getPassword(password);\n // Ethereum Address\n var ethaddr = address_1.getAddress(searchPath(data, 'ethaddr'));\n // Encrypted Seed\n var encseed = looseArrayify(searchPath(data, 'encseed'));\n if (!encseed || (encseed.length % 16) !== 0) {\n throw new Error('invalid encseed');\n }\n var key = pbkdf2_1.pbkdf2(password, password, 2000, 32, 'sha256').slice(0, 16);\n var iv = encseed.slice(0, 16);\n var encryptedSeed = encseed.slice(16);\n // Decrypt the seed\n var aesCbc = new aes.ModeOfOperation.cbc(key, iv);\n var seed = bytes_1.arrayify(aesCbc.decrypt(encryptedSeed));\n seed = aes.padding.pkcs7.strip(seed);\n // This wallet format is weird... Convert the binary encoded hex to a string.\n var seedHex = '';\n for (var i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n var seedHexBytes = utf8_1.toUtf8Bytes(seedHex);\n var signingKey = new signing_key_1.SigningKey(keccak256_1.keccak256(seedHexBytes));\n if (signingKey.address !== ethaddr) {\n throw new Error('corrupt crowdsale wallet');\n }\n return signingKey;\n}\nexports.decryptCrowdsale = decryptCrowdsale;\n//@TODO: string or arrayish\nfunction decrypt(json, password, progressCallback) {\n var data = JSON.parse(json);\n password = getPassword(password);\n var decrypt = function (key, ciphertext) {\n var cipher = searchPath(data, 'crypto/cipher');\n if (cipher === 'aes-128-ctr') {\n var iv = looseArrayify(searchPath(data, 'crypto/cipherparams/iv'));\n var counter = new aes.Counter(iv);\n var aesCtr = new aes.ModeOfOperation.ctr(key, counter);\n return bytes_1.arrayify(aesCtr.decrypt(ciphertext));\n }\n return null;\n };\n var computeMAC = function (derivedHalf, ciphertext) {\n return keccak256_1.keccak256(bytes_1.concat([derivedHalf, ciphertext]));\n };\n var getSigningKey = function (key, reject) {\n var ciphertext = looseArrayify(searchPath(data, 'crypto/ciphertext'));\n var computedMAC = bytes_1.hexlify(computeMAC(key.slice(16, 32), ciphertext)).substring(2);\n if (computedMAC !== searchPath(data, 'crypto/mac').toLowerCase()) {\n reject(new Error('invalid password'));\n return null;\n }\n var privateKey = decrypt(key.slice(0, 16), ciphertext);\n var mnemonicKey = key.slice(32, 64);\n if (!privateKey) {\n reject(new Error('unsupported cipher'));\n return null;\n }\n var signingKey = new signing_key_1.SigningKey(privateKey);\n if (signingKey.address !== address_1.getAddress(data.address)) {\n reject(new Error('address mismatch'));\n return null;\n }\n // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase\n if (searchPath(data, 'x-ethers/version') === '0.1') {\n var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext'));\n var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter'));\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n var path = searchPath(data, 'x-ethers/path') || defaultPath;\n var entropy = bytes_1.arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext));\n var mnemonic = HDNode.entropyToMnemonic(entropy);\n var node = HDNode.fromMnemonic(mnemonic).derivePath(path);\n if (node.privateKey != bytes_1.hexlify(privateKey)) {\n reject(new Error('mnemonic mismatch'));\n return null;\n }\n signingKey = new signing_key_1.SigningKey(node);\n }\n return signingKey;\n };\n return new Promise(function (resolve, reject) {\n var kdf = searchPath(data, 'crypto/kdf');\n if (kdf && typeof (kdf) === 'string') {\n if (kdf.toLowerCase() === 'scrypt') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n var N = parseInt(searchPath(data, 'crypto/kdfparams/n'));\n var r = parseInt(searchPath(data, 'crypto/kdfparams/r'));\n var p = parseInt(searchPath(data, 'crypto/kdfparams/p'));\n if (!N || !r || !p) {\n reject(new Error('unsupported key-derivation function parameters'));\n return;\n }\n // Make sure N is a power of 2\n if ((N & (N - 1)) !== 0) {\n reject(new Error('unsupported key-derivation function parameter value for N'));\n return;\n }\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject(new Error('unsupported key-derivation derived-key length'));\n return;\n }\n scrypt(password, salt, N, r, p, 64, function (error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n }\n else if (key) {\n key = bytes_1.arrayify(key);\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) {\n return;\n }\n if (progressCallback) {\n progressCallback(1);\n }\n resolve(signingKey);\n }\n else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n }\n else if (kdf.toLowerCase() === 'pbkdf2') {\n var salt = looseArrayify(searchPath(data, 'crypto/kdfparams/salt'));\n var prfFunc = null;\n var prf = searchPath(data, 'crypto/kdfparams/prf');\n if (prf === 'hmac-sha256') {\n prfFunc = 'sha256';\n }\n else if (prf === 'hmac-sha512') {\n prfFunc = 'sha512';\n }\n else {\n reject(new Error('unsupported prf'));\n return;\n }\n var c = parseInt(searchPath(data, 'crypto/kdfparams/c'));\n var dkLen = parseInt(searchPath(data, 'crypto/kdfparams/dklen'));\n if (dkLen !== 32) {\n reject(new Error('unsupported key-derivation derived-key length'));\n return;\n }\n var key = pbkdf2_1.pbkdf2(password, salt, c, dkLen, prfFunc);\n var signingKey = getSigningKey(key, reject);\n if (!signingKey) {\n return;\n }\n resolve(signingKey);\n }\n else {\n reject(new Error('unsupported key-derivation function'));\n }\n }\n else {\n reject(new Error('unsupported key-derivation function'));\n }\n });\n}\nexports.decrypt = decrypt;\n// @TOOD: Options\nfunction encrypt(privateKey, password, options, progressCallback) {\n // the options are optional, so adjust the call as needed\n if (typeof (options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (!options) {\n options = {};\n }\n // Check the private key\n var privateKeyBytes = null;\n if (privateKey instanceof signing_key_1.SigningKey) {\n privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);\n }\n else {\n privateKeyBytes = bytes_1.arrayify(privateKey);\n }\n if (privateKeyBytes.length !== 32) {\n throw new Error('invalid private key');\n }\n password = getPassword(password);\n var entropy = options.entropy;\n if (options.mnemonic) {\n if (entropy) {\n if (HDNode.entropyToMnemonic(entropy) !== options.mnemonic) {\n throw new Error('entropy and mnemonic mismatch');\n }\n }\n else {\n entropy = HDNode.mnemonicToEntropy(options.mnemonic);\n }\n }\n if (entropy) {\n entropy = bytes_1.arrayify(entropy);\n }\n var path = options.path;\n if (entropy && !path) {\n path = defaultPath;\n }\n var client = options.client;\n if (!client) {\n client = \"ethers.js\";\n }\n // Check/generate the salt\n var salt = options.salt;\n if (salt) {\n salt = bytes_1.arrayify(salt);\n }\n else {\n salt = random_bytes_1.randomBytes(32);\n ;\n }\n // Override initialization vector\n var iv = null;\n if (options.iv) {\n iv = bytes_1.arrayify(options.iv);\n if (iv.length !== 16) {\n throw new Error('invalid iv');\n }\n }\n else {\n iv = random_bytes_1.randomBytes(16);\n }\n // Override the uuid\n var uuidRandom = options.uuid;\n if (uuidRandom) {\n uuidRandom = bytes_1.arrayify(uuidRandom);\n if (uuidRandom.length !== 16) {\n throw new Error('invalid uuid');\n }\n }\n else {\n uuidRandom = random_bytes_1.randomBytes(16);\n }\n // Override the scrypt password-based key derivation function parameters\n var N = (1 << 17), r = 8, p = 1;\n if (options.scrypt) {\n if (options.scrypt.N) {\n N = options.scrypt.N;\n }\n if (options.scrypt.r) {\n r = options.scrypt.r;\n }\n if (options.scrypt.p) {\n p = options.scrypt.p;\n }\n }\n return new Promise(function (resolve, reject) {\n // We take 64 bytes:\n // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix)\n // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet)\n scrypt(password, salt, N, r, p, 64, function (error, progress, key) {\n if (error) {\n error.progress = progress;\n reject(error);\n }\n else if (key) {\n key = bytes_1.arrayify(key);\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n var derivedKey = key.slice(0, 16);\n var macPrefix = key.slice(16, 32);\n // This will be used to encrypt the mnemonic phrase (if any)\n var mnemonicKey = key.slice(32, 64);\n // Get the address for this private key\n var address = (new signing_key_1.SigningKey(privateKeyBytes)).address;\n // Encrypt the private key\n var counter = new aes.Counter(iv);\n var aesCtr = new aes.ModeOfOperation.ctr(derivedKey, counter);\n var ciphertext = bytes_1.arrayify(aesCtr.encrypt(privateKeyBytes));\n // Compute the message authentication code, used to check the password\n var mac = keccak256_1.keccak256(bytes_1.concat([macPrefix, ciphertext]));\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n var data = {\n address: address.substring(2).toLowerCase(),\n id: uuid.v4({ random: uuidRandom }),\n version: 3,\n Crypto: {\n cipher: 'aes-128-ctr',\n cipherparams: {\n iv: bytes_1.hexlify(iv).substring(2),\n },\n ciphertext: bytes_1.hexlify(ciphertext).substring(2),\n kdf: 'scrypt',\n kdfparams: {\n salt: bytes_1.hexlify(salt).substring(2),\n n: N,\n dklen: 32,\n p: p,\n r: r\n },\n mac: mac.substring(2)\n }\n };\n // If we have a mnemonic, encrypt it into the JSON wallet\n if (entropy) {\n var mnemonicIv = random_bytes_1.randomBytes(16);\n var mnemonicCounter = new aes.Counter(mnemonicIv);\n var mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n var mnemonicCiphertext = bytes_1.arrayify(mnemonicAesCtr.encrypt(entropy));\n var now = new Date();\n var timestamp = (now.getUTCFullYear() + '-' +\n zpad(now.getUTCMonth() + 1, 2) + '-' +\n zpad(now.getUTCDate(), 2) + 'T' +\n zpad(now.getUTCHours(), 2) + '-' +\n zpad(now.getUTCMinutes(), 2) + '-' +\n zpad(now.getUTCSeconds(), 2) + '.0Z');\n data['x-ethers'] = {\n client: client,\n gethFilename: ('UTC--' + timestamp + '--' + data.address),\n mnemonicCounter: bytes_1.hexlify(mnemonicIv).substring(2),\n mnemonicCiphertext: bytes_1.hexlify(mnemonicCiphertext).substring(2),\n version: \"0.1\"\n };\n }\n if (progressCallback) {\n progressCallback(1);\n }\n resolve(JSON.stringify(data));\n }\n else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n}\nexports.encrypt = encrypt;\n\n},{\"../utils/address\":58,\"../utils/bytes\":60,\"../utils/keccak256\":64,\"../utils/pbkdf2\":43,\"../utils/random-bytes\":44,\"../utils/utf8\":72,\"./hdnode\":74,\"./signing-key\":77,\"aes-js\":1,\"scrypt-js\":36,\"uuid\":39}],77:[function(require,module,exports){\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * SigningKey\n *\n *\n */\nvar address_1 = require(\"../utils/address\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar hdnode_1 = require(\"./hdnode\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar properties_1 = require(\"../utils/properties\");\nvar secp256k1_1 = require(\"../utils/secp256k1\");\nvar errors = require(\"../utils/errors\");\nvar SigningKey = /** @class */ (function () {\n function SigningKey(privateKey) {\n errors.checkNew(this, SigningKey);\n var privateKeyBytes = null;\n if (privateKey instanceof hdnode_1.HDNode) {\n properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic);\n properties_1.defineReadOnly(this, 'path', privateKey.path);\n privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);\n }\n else {\n privateKeyBytes = bytes_1.arrayify(privateKey);\n }\n try {\n if (privateKeyBytes.length !== 32) {\n errors.throwError('exactly 32 bytes required', errors.INVALID_ARGUMENT, { value: privateKey });\n }\n }\n catch (error) {\n var params = { arg: 'privateKey', reason: error.reason, value: '[REDACTED]' };\n if (error.value) {\n if (typeof (error.value.length) === 'number') {\n params.length = error.value.length;\n }\n params.type = typeof (error.value);\n }\n errors.throwError('invalid private key', error.code, params);\n }\n properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(privateKeyBytes));\n properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));\n properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);\n properties_1.defineReadOnly(this, 'address', computeAddress(this.keyPair.publicKey));\n }\n SigningKey.prototype.signDigest = function (digest) {\n return this.keyPair.sign(digest);\n };\n return SigningKey;\n}());\nexports.SigningKey = SigningKey;\nfunction recoverAddress(digest, signature) {\n return computeAddress(secp256k1_1.recoverPublicKey(digest, signature));\n}\nexports.recoverAddress = recoverAddress;\nfunction computeAddress(key) {\n // Strip off the leading \"0x04\"\n var publicKey = '0x' + secp256k1_1.computePublicKey(key).slice(4);\n return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));\n}\nexports.computeAddress = computeAddress;\n\n},{\"../utils/address\":58,\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/keccak256\":64,\"../utils/properties\":65,\"../utils/secp256k1\":67,\"./hdnode\":74}],78:[function(require,module,exports){\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 __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 });\nvar scrypt_js_1 = __importDefault(require(\"scrypt-js\"));\nvar hdnode_1 = require(\"./hdnode\");\nvar secretStorage = __importStar(require(\"./secret-storage\"));\nvar signing_key_1 = require(\"./signing-key\");\nvar bytes_1 = require(\"../utils/bytes\");\nvar hash_1 = require(\"../utils/hash\");\nvar keccak256_1 = require(\"../utils/keccak256\");\nvar properties_1 = require(\"../utils/properties\");\nvar random_bytes_1 = require(\"../utils/random-bytes\");\nvar transaction_1 = require(\"../utils/transaction\");\nvar utf8_1 = require(\"../utils/utf8\");\nvar errors = __importStar(require(\"../utils/errors\"));\n// This ensures we inject a setImmediate into the global space, which\n// dramatically improves the performance of the scrypt PBKDF.\nconsole.log(\"Fix this! Setimmediate\");\n//import _setimmediate = require('setimmediate');\nvar Signer = /** @class */ (function () {\n function Signer() {\n }\n return Signer;\n}());\nexports.Signer = Signer;\nvar Wallet = /** @class */ (function (_super) {\n __extends(Wallet, _super);\n function Wallet(privateKey, provider) {\n var _this = _super.call(this) || this;\n errors.checkNew(_this, Wallet);\n // Make sure we have a valid signing key\n if (privateKey instanceof signing_key_1.SigningKey) {\n properties_1.defineReadOnly(_this, 'signingKey', privateKey);\n }\n else {\n properties_1.defineReadOnly(_this, 'signingKey', new signing_key_1.SigningKey(privateKey));\n }\n properties_1.defineReadOnly(_this, 'provider', provider);\n return _this;\n }\n Object.defineProperty(Wallet.prototype, \"address\", {\n get: function () { return this.signingKey.address; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Wallet.prototype, \"mnemonic\", {\n get: function () { return this.signingKey.mnemonic; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Wallet.prototype, \"path\", {\n get: function () { return this.signingKey.mnemonic; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Wallet.prototype, \"privateKey\", {\n get: function () { return this.signingKey.privateKey; },\n enumerable: true,\n configurable: true\n });\n /**\n * Create a new instance of this Wallet connected to provider.\n */\n Wallet.prototype.connect = function (provider) {\n return new Wallet(this.signingKey, provider);\n };\n Wallet.prototype.getAddress = function () {\n return Promise.resolve(this.address);\n };\n Wallet.prototype.sign = function (transaction) {\n var _this = this;\n return properties_1.resolveProperties(transaction).then(function (tx) {\n return transaction_1.sign(tx, _this.signingKey.signDigest.bind(_this.signingKey));\n });\n };\n Wallet.prototype.signMessage = function (message) {\n return Promise.resolve(bytes_1.joinSignature(this.signingKey.signDigest(hash_1.hashMessage(message))));\n };\n Wallet.prototype.getBalance = function (blockTag) {\n if (!this.provider) {\n throw new Error('missing provider');\n }\n return this.provider.getBalance(this.address, blockTag);\n };\n Wallet.prototype.getTransactionCount = function (blockTag) {\n if (!this.provider) {\n throw new Error('missing provider');\n }\n return this.provider.getTransactionCount(this.address, blockTag);\n };\n Wallet.prototype.sendTransaction = function (transaction) {\n var _this = this;\n if (!this.provider) {\n throw new Error('missing provider');\n }\n if (!transaction || typeof (transaction) !== 'object') {\n throw new Error('invalid transaction object');\n }\n var tx = properties_1.shallowCopy(transaction);\n if (tx.to != null) {\n tx.to = this.provider.resolveName(tx.to);\n }\n if (tx.gasLimit == null) {\n tx.gasLimit = this.provider.estimateGas(tx);\n }\n if (tx.gasPrice == null) {\n tx.gasPrice = this.provider.getGasPrice();\n }\n if (tx.nonce == null) {\n tx.nonce = this.getTransactionCount();\n }\n if (tx.chainId == null) {\n tx.chainId = this.provider.getNetwork().then(function (network) { return network.chainId; });\n }\n return properties_1.resolveProperties(tx).then(function (tx) {\n console.log('To Sign', tx);\n return _this.provider.sendTransaction(_this.sign(tx));\n });\n };\n Wallet.prototype.send = function (addressOrName, amountWei, options) {\n if (!options) {\n options = {};\n }\n return this.sendTransaction({\n to: addressOrName,\n gasLimit: options.gasLimit,\n gasPrice: options.gasPrice,\n nonce: options.nonce,\n value: amountWei,\n });\n };\n Wallet.prototype.encrypt = function (password, options, progressCallback) {\n if (typeof (options) === 'function' && !progressCallback) {\n progressCallback = options;\n options = {};\n }\n if (progressCallback && typeof (progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n if (!options) {\n options = {};\n }\n if (this.mnemonic) {\n // Make sure we don't accidentally bubble the mnemonic up the call-stack\n var safeOptions = {};\n for (var key in options) {\n safeOptions[key] = options[key];\n }\n options = safeOptions;\n // Set the mnemonic and path\n options.mnemonic = this.mnemonic;\n options.path = this.path;\n }\n return secretStorage.encrypt(this.privateKey, password, options, progressCallback);\n };\n /**\n * Static methods to create Wallet instances.\n */\n Wallet.createRandom = function (options) {\n var entropy = random_bytes_1.randomBytes(16);\n if (!options) {\n options = {};\n }\n if (options.extraEntropy) {\n entropy = bytes_1.arrayify(keccak256_1.keccak256(bytes_1.concat([entropy, options.extraEntropy])).substring(0, 34));\n }\n var mnemonic = hdnode_1.entropyToMnemonic(entropy, options.locale);\n return Wallet.fromMnemonic(mnemonic, options.path, options.locale);\n };\n Wallet.fromEncryptedWallet = function (json, password, progressCallback) {\n if (progressCallback && typeof (progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n return new Promise(function (resolve, reject) {\n if (secretStorage.isCrowdsaleWallet(json)) {\n try {\n var privateKey = secretStorage.decryptCrowdsale(json, password);\n resolve(new Wallet(privateKey));\n }\n catch (error) {\n reject(error);\n }\n }\n else if (secretStorage.isValidWallet(json)) {\n secretStorage.decrypt(json, password, progressCallback).then(function (signingKey) {\n var wallet = new Wallet(signingKey);\n /*\n if (signingKey.mnemonic && signingKey.path) {\n wallet.mnemonic = signingKey.mnemonic;\n wallet.path = signingKey.path;\n }\n */\n resolve(wallet);\n }, function (error) {\n reject(error);\n });\n }\n else {\n reject('invalid wallet JSON');\n }\n });\n };\n Wallet.fromMnemonic = function (mnemonic, path, wordlist) {\n if (!path) {\n path = hdnode_1.defaultPath;\n }\n return new Wallet(hdnode_1.fromMnemonic(mnemonic, wordlist).derivePath(path));\n };\n Wallet.fromBrainWallet = function (username, password, progressCallback) {\n if (progressCallback && typeof (progressCallback) !== 'function') {\n throw new Error('invalid callback');\n }\n if (typeof (username) === 'string') {\n username = utf8_1.toUtf8Bytes(username, utf8_1.UnicodeNormalizationForm.NFKC);\n }\n else {\n username = bytes_1.arrayify(username);\n }\n if (typeof (password) === 'string') {\n password = utf8_1.toUtf8Bytes(password, utf8_1.UnicodeNormalizationForm.NFKC);\n }\n else {\n password = bytes_1.arrayify(password);\n }\n return new Promise(function (resolve, reject) {\n scrypt_js_1.default(password, username, (1 << 18), 8, 1, 32, function (error, progress, key) {\n if (error) {\n reject(error);\n }\n else if (key) {\n resolve(new Wallet(bytes_1.hexlify(key)));\n }\n else if (progressCallback) {\n return progressCallback(progress);\n }\n });\n });\n };\n /**\n * Determine if this is an encryped JSON wallet.\n */\n Wallet.isEncryptedWallet = function (json) {\n return (secretStorage.isValidWallet(json) || secretStorage.isCrowdsaleWallet(json));\n };\n /**\n * Verify a signed message, returning the address of the signer.\n */\n Wallet.verifyMessage = function (message, signature) {\n signature = bytes_1.hexlify(signature);\n if (signature.length != 132) {\n throw new Error('invalid signature');\n }\n var digest = hash_1.hashMessage(message);\n var recoveryParam = parseInt(signature.substring(130), 16);\n if (recoveryParam >= 27) {\n recoveryParam -= 27;\n }\n if (recoveryParam < 0) {\n throw new Error('invalid signature');\n }\n return signing_key_1.recoverAddress(digest, {\n r: signature.substring(0, 66),\n s: '0x' + signature.substring(66, 130),\n recoveryParam: recoveryParam\n });\n };\n return Wallet;\n}(Signer));\nexports.Wallet = Wallet;\n\n},{\"../utils/bytes\":60,\"../utils/errors\":61,\"../utils/hash\":62,\"../utils/keccak256\":64,\"../utils/properties\":65,\"../utils/random-bytes\":44,\"../utils/transaction\":70,\"../utils/utf8\":72,\"./hdnode\":74,\"./secret-storage\":76,\"./signing-key\":77,\"scrypt-js\":36}],79:[function(require,module,exports){\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 });\nvar wordlist_1 = require(\"./wordlist\");\nvar errors = __importStar(require(\"../utils/errors\"));\nvar words = \"AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo\";\nvar wordlist = null;\nfunction loadWords() {\n if (wordlist != null) {\n return;\n }\n wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' ');\n}\nvar LangEn = /** @class */ (function (_super) {\n __extends(LangEn, _super);\n function LangEn() {\n return _super.call(this, 'en') || this;\n }\n LangEn.prototype.getWord = function (index) {\n loadWords();\n if (index < 0 || index >= wordlist.length || Math.trunc(index) != index) {\n errors.throwError('invalid wordlist index', errors.INVALID_ARGUMENT, { arg: 'index', value: index });\n }\n return wordlist[index];\n };\n LangEn.prototype.getWordIndex = function (word) {\n loadWords();\n return wordlist.indexOf(word);\n };\n return LangEn;\n}(wordlist_1.Wordlist));\nvar langEn = new LangEn();\nexports.langEn = langEn;\nwordlist_1.register(langEn);\n\n},{\"../utils/errors\":61,\"./wordlist\":80}],80:[function(require,module,exports){\n(function (global){\n\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// This gets overriddenby gulp during bip39-XX\nvar exportWordlist = false;\nvar properties_1 = require(\"../utils/properties\");\nvar Wordlist = /** @class */ (function () {\n function Wordlist(locale) {\n properties_1.defineReadOnly(this, 'locale', locale);\n }\n // Subclasses may override this\n Wordlist.prototype.split = function (mnemonic) {\n return mnemonic.toLowerCase().split(/ +/g);\n };\n // Subclasses may override this\n Wordlist.prototype.join = function (words) {\n return words.join(' ');\n };\n return Wordlist;\n}());\nexports.Wordlist = Wordlist;\nfunction register(lang) {\n if (exportWordlist) {\n if (!global['wordlists']) {\n properties_1.defineReadOnly(global, 'wordlists', {});\n }\n properties_1.defineReadOnly(global['wordlists'], lang.locale, lang);\n }\n}\nexports.register = register;\n\n\nexportWordlist = true;\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../utils/properties\":65}],81:[function(require,module,exports){\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 contracts_1 = require(\"./contracts\");\nexports.Contract = contracts_1.Contract;\nexports.Interface = contracts_1.Interface;\nvar providers = __importStar(require(\"./providers\"));\nexports.providers = providers;\nvar errors = __importStar(require(\"./utils/errors\"));\nexports.errors = errors;\nvar networks_1 = require(\"./providers/networks\");\nexports.getNetwork = networks_1.getNetwork;\nvar utils = __importStar(require(\"./utils\"));\nexports.utils = utils;\nvar wallet_1 = require(\"./wallet\");\nexports.HDNode = wallet_1.HDNode;\nexports.SigningKey = wallet_1.SigningKey;\nexports.Wallet = wallet_1.Wallet;\n//import info from '../package.json';\n//console.log(info);\nconsole.log(\"@TODO: Get version\");\nvar version = \"4.0.0\";\nexports.version = version;\n\n},{\"./contracts\":47,\"./providers\":51,\"./providers/networks\":54,\"./utils\":63,\"./utils/errors\":61,\"./wallet\":75}]},{},[81])(81)\n});\n"]} \ No newline at end of file diff --git a/src/utils/transaction.d.ts b/src/utils/transaction.d.ts index 497367a83..110434a78 100644 --- a/src/utils/transaction.d.ts +++ b/src/utils/transaction.d.ts @@ -25,5 +25,5 @@ export interface Transaction { v?: number; } export declare type SignDigestFunc = (digest: Arrayish) => Signature; -export declare function sign(transaction: UnsignedTransaction, signDigest?: SignDigestFunc): string; +export declare function sign(transaction: UnsignedTransaction, signDigest: SignDigestFunc): string; export declare function parse(rawTransaction: Arrayish): Transaction; diff --git a/src/utils/transaction.js b/src/utils/transaction.js index 7994638b2..6d0bbca44 100644 --- a/src/utils/transaction.js +++ b/src/utils/transaction.js @@ -58,18 +58,19 @@ function sign(transaction, signDigest) { raw.push(bytes_1.hexlify(value)); }); // @TOOD: - throw new Error('implement'); + /* // Requesting an unsigned transation if (!signDigest) { - var v_1 = 27 + signature.recoveryParam; + let v = 27 + signature.recoveryParam if (transaction.chainId) { - v_1 += transaction.chainId * 2 + 8; + v += transaction.chainId * 2 + 8; } //raw.push(hexlify(transaction.chainId)); - raw.push(bytes_1.hexlify(v_1)); + raw.push(hexlify(v)); raw.push('0x'); raw.push('0x'); } + */ if (transaction.chainId) { raw.push(bytes_1.hexlify(transaction.chainId)); raw.push('0x');