ethers.js/packages/ethers/dist/ethers.umd.min.js.map
2022-04-13 00:25:25 -04:00

1 line
1.4 MiB

{"version":3,"sources":["../../../node_modules/bn.js/lib/bn.js","../../logger/src.ts/_version.ts","../../logger/src.ts/index.ts","../../bytes/src.ts/_version.ts","../../bytes/src.ts/index.ts","../../bignumber/src.ts/_version.ts","../../bignumber/src.ts/bignumber.ts","../../bignumber/src.ts/fixednumber.ts","../../bignumber/src.ts/index.ts","../../properties/src.ts/_version.ts","../../properties/src.ts/index.ts","../../abi/src.ts/_version.ts","../../abi/src.ts/fragments.ts","../../abi/src.ts/coders/abstract-coder.ts","../../../node_modules/js-sha3/src/sha3.js","../../keccak256/src.ts/index.ts","../../rlp/src.ts/_version.ts","../../rlp/src.ts/index.ts","../../address/src.ts/_version.ts","../../address/src.ts/index.ts","../../abi/src.ts/coders/address.ts","../../abi/src.ts/coders/anonymous.ts","../../abi/src.ts/coders/array.ts","../../abi/src.ts/coders/boolean.ts","../../abi/src.ts/coders/bytes.ts","../../abi/src.ts/coders/fixed-bytes.ts","../../abi/src.ts/coders/null.ts","../../constants/src.ts/addresses.ts","../../constants/src.ts/bignumbers.ts","../../constants/src.ts/hashes.ts","../../constants/src.ts/strings.ts","../../constants/src.ts/index.ts","../../abi/src.ts/coders/number.ts","../../strings/src.ts/_version.ts","../../strings/src.ts/utf8.ts","../../strings/src.ts/bytes32.ts","../../strings/src.ts/idna.ts","../../strings/src.ts/index.ts","../../abi/src.ts/coders/string.ts","../../abi/src.ts/coders/tuple.ts","../../abi/src.ts/abi-coder.ts","../../hash/src.ts/id.ts","../../hash/src.ts/_version.ts","../../hash/src.ts/namehash.ts","../../hash/src.ts/message.ts","../../hash/src.ts/typed-data.ts","../../hash/src.ts/index.ts","../../abi/src.ts/interface.ts","../../abi/src.ts/index.ts","../../abstract-provider/src.ts/_version.ts","../../abstract-provider/src.ts/index.ts","../../abstract-signer/src.ts/_version.ts","../../abstract-signer/src.ts/index.ts","../../../node_modules/minimalistic-assert/index.js","../../../node_modules/minimalistic-crypto-utils/lib/utils.js","../../../node_modules/elliptic/lib/elliptic/utils.js","../../../node_modules/elliptic/lib/elliptic/curve/base.js","../../../node_modules/inherits/inherits_browser.js","../../../node_modules/elliptic/lib/elliptic/curve/short.js","../../../node_modules/elliptic/lib/elliptic/curve/index.js","../../../node_modules/hash.js/lib/hash/utils.js","../../../node_modules/hash.js/lib/hash/common.js","../../../node_modules/hash.js/lib/hash/sha/common.js","../../../node_modules/hash.js/lib/hash/sha/1.js","../../../node_modules/hash.js/lib/hash/sha/256.js","../../../node_modules/hash.js/lib/hash/sha/224.js","../../../node_modules/hash.js/lib/hash/sha/512.js","../../../node_modules/hash.js/lib/hash/sha/384.js","../../../node_modules/hash.js/lib/hash/sha.js","../../../node_modules/hash.js/lib/hash/ripemd.js","../../../node_modules/hash.js/lib/hash/hmac.js","../../../node_modules/hash.js/lib/hash.js","../../../node_modules/elliptic/lib/elliptic/curves.js","../../../node_modules/hmac-drbg/lib/hmac-drbg.js","../../../node_modules/elliptic/lib/elliptic/ec/key.js","../../../node_modules/elliptic/lib/elliptic/ec/signature.js","../../../node_modules/elliptic/lib/elliptic/ec/index.js","../../../node_modules/elliptic/lib/elliptic.js","../../signing-key/src.ts/elliptic.ts","../../signing-key/src.ts/_version.ts","../../signing-key/src.ts/index.ts","../../transactions/src.ts/_version.ts","../../transactions/src.ts/index.ts","../../contracts/src.ts/_version.ts","../../contracts/src.ts/index.ts","../../basex/src.ts/index.ts","../../sha2/src.ts/types.ts","../../sha2/src.ts/_version.ts","../../sha2/src.ts/browser-sha2.ts","../../sha2/src.ts/index.ts","../../pbkdf2/src.ts/browser-pbkdf2.ts","../../pbkdf2/src.ts/index.ts","../../wordlists/src.ts/_version.ts","../../wordlists/src.ts/wordlist.ts","../../wordlists/src.ts/lang-en.ts","../../wordlists/src.ts/browser-wordlists.ts","../../wordlists/src.ts/index.ts","../../hdnode/src.ts/_version.ts","../../hdnode/src.ts/index.ts","../../random/src.ts/_version.ts","../../random/src.ts/browser-random.ts","../../random/src.ts/shuffle.ts","../../random/src.ts/index.ts","../../../node_modules/aes-js/index.js","../../json-wallets/src.ts/_version.ts","../../json-wallets/src.ts/utils.ts","../../json-wallets/src.ts/crowdsale.ts","../../json-wallets/src.ts/inspect.ts","../../../node_modules/scrypt-js/scrypt.js","../../json-wallets/src.ts/keystore.ts","../../json-wallets/src.ts/index.ts","../../wallet/src.ts/_version.ts","../../wallet/src.ts/index.ts","../../networks/src.ts/_version.ts","../../networks/src.ts/index.ts","../../base64/src.ts/browser-base64.ts","../../base64/src.ts/index.ts","../../web/src.ts/_version.ts","../../web/src.ts/browser-geturl.ts","../../web/src.ts/index.ts","../../../node_modules/bech32/index.js","../../providers/src.ts/_version.ts","../../providers/src.ts/formatter.ts","../../providers/src.ts/base-provider.ts","../../providers/src.ts/json-rpc-provider.ts","../../providers/src.ts/browser-ws.ts","../../providers/src.ts/websocket-provider.ts","../../providers/src.ts/url-json-rpc-provider.ts","../../providers/src.ts/alchemy-provider.ts","../../providers/src.ts/ankr-provider.ts","../../providers/src.ts/cloudflare-provider.ts","../../providers/src.ts/etherscan-provider.ts","../../providers/src.ts/fallback-provider.ts","../../providers/src.ts/browser-ipc-provider.ts","../../providers/src.ts/infura-provider.ts","../../providers/src.ts/json-rpc-batch-provider.ts","../../providers/src.ts/nodesmith-provider.ts","../../providers/src.ts/pocket-provider.ts","../../providers/src.ts/web3-provider.ts","../../providers/src.ts/index.ts","../../solidity/src.ts/_version.ts","../../solidity/src.ts/index.ts","../../units/src.ts/_version.ts","../../units/src.ts/index.ts","../src.ts/utils.ts","../src.ts/_version.ts","../src.ts/ethers.ts","../src.ts/index.ts"],"names":["module","exports","assert","val","msg","Error","inherits","ctor","superCtor","super_","TempCtor","prototype","constructor","BN","number","base","endian","isBN","this","negative","words","length","red","_init","wordSize","Buffer","window","e","num","Array","isArray","max","left","right","cmp","min","init","_initNumber","_initArray","toString","replace","start","_parseHex","_parseBase","toArray","Math","ceil","i","j","w","off","strip","parseHex4Bits","string","index","c","charCodeAt","parseHexByte","lowerBound","r","parseLength","parseBase","str","end","mul","len","limbLen","limbPow","total","mod","word","imuln","_iaddn","pow","copy","dest","clone","_expand","size","_normSign","inspect","zeros","groupSizes","groupBases","padding","out","carry","groupSize","groupBase","isZero","modn","idivn","toNumber","ret","toJSON","toBuffer","toArrayLike","ArrayType","byteLength","reqLength","littleEndian","res","b","q","andln","iushrn","clz32","_countBits","t","_zeroBits","bitLength","hi","toBitArray","bit","wbit","zeroBits","toTwos","width","abs","inotn","iaddn","fromTwos","testn","notn","ineg","isNeg","neg","iuor","ior","or","uor","iuand","iand","and","uand","iuxor","a","ixor","xor","uxor","bytesNeeded","bitsLeft","setn","iadd","isub","add","sub","smallMulTo","self","lo","k","ncarry","rword","maxJ","comb10MulTo","o","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","imul","w0","w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18","bigMulTo","hncarry","jumboMulTo","fftm","FFTM","mulp","mulTo","x","y","makeRBT","N","l","revBin","rb","permute","rbt","rws","iws","rtws","itws","transform","s","rtwdf","cos","PI","itwdf","sin","p","rtwdf_","itwdf_","re","ie","ro","io","rx","guessLen13b","n","m","odd","conjugate","normalize13b","ws","round","convert13b","stub","ph","_","rwst","iwst","nrws","nrwst","niwst","rmws","mulf","muln","sqr","isqr","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","bhiBits","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","name","tmp","_tmp","ireduce","rlen","split","imulK","undefined","_strip","input","K256","call","output","outLen","prev","next","P224","P192","P25519","_prime","prime","imod","mod3","one","nOne","lpow","z","inv","windowSize","wnd","current","currentLen","mont","Mont","rinv","minv","u","version","_permanentCensorErrors","_censorErrors","LogLevels","debug","default","info","warning","error","_logLevel","_globalLogger","_checkNormalize","missing_1","forEach","form","normalize","push","join","String","fromCharCode","message","_normalizeError","LogLevel","ErrorCode","HEX","Logger","Object","defineProperty","enumerable","value","writable","_log","logLevel","args","level","toLowerCase","throwArgumentError","console","log","apply","_i","arguments","levels","DEBUG","INFO","warn","WARNING","makeError","code","params","errors","UNKNOWN_ERROR","messageDetails","keys","key","Uint8Array","hex","JSON","stringify","reason","url","NUMERIC_FAULT","fault","CALL_EXCEPTION","INSUFFICIENT_FUNDS","MISSING_NEW","NONCE_EXPIRED","REPLACEMENT_UNDERPRICED","TRANSACTION_REPLACED","UNPREDICTABLE_GAS_LIMIT","throwError","INVALID_ARGUMENT","argument","condition","assertArgument","checkNormalize","UNSUPPORTED_OPERATION","operation","checkSafeUint53","checkArgumentCount","count","expectedCount","MISSING_ARGUMENT","UNEXPECTED_ARGUMENT","checkNew","target","kind","checkAbstract","globalLogger","_version_1","setCensorship","censorship","permanent","setLogLevel","from","logger","logger_1","isHexable","addSlice","array","slice","isBytesLike","isHexString","isBytes","isInteger","v","arrayify","options","result","unshift","parseInt","allowMissingPrefix","substring","toHexString","hexPad","concat","items","objects","map","item","reduce","accum","offset","object","set","stripZeros","zeroPad","match","HexCharacters","hexlify","floor","hexDataLength","data","hexDataSlice","endOffset","hexConcat","hexValue","trimmed","hexStripZeros","hexZeroPad","splitSignature","signature","_vs","recoveryParam","yParityAndS","compact","bytes","vs_1","recId","vs","joinSignature","bn_js_1","__importDefault","bn","_constructorGuard","MAX_SAFE","isBigNumberish","BigNumber","isBigNumber","bytes_1","_warnedToStringRadix","constructorGuard","_newTarget","_hex","_isBigNumber","freeze","toBigNumber","toBN","other","throwFault","isNegative","shr","toBigInt","BigInt","type","toHex","anyValue","_base36To16","_base16To36","Zero","bignumber_1","NegativeOne","getMultiplier","decimals","formatFixed","multiplier","fraction","whole","parseFixed","comps","wholeValue","fractionValue","wei","FixedFormat","signed","_multiplier","check","defaultValue","FixedNumber","format","_value","_isFixedNumber","_checkFormat","addUnsafe","fromValue","subUnsafe","mulUnsafe","divUnsafe","hasFraction","ONE","toFormat","ceiling","factor","bump","BUMP","toUnsafeFloat","parseFloat","fromString","fixedFormat","numeric","decimal","fromBytes","isFixedNumber","get","bignumber","fixednumber","bignumber_2","defineReadOnly","getStatic","getPrototypeOf","resolveProperties","promises","Promise","resolve","then","all","results","_a","sent","checkProperties","properties","shallowCopy","opaque","bigint","boolean","function","_isFrozen","isFrozen","_deepCopy","deepCopy","Description","ModifiersBytes","calldata","memory","storage","ModifiersNest","checkModifier","indexOf","parseParamType","param","allowIndexed","originalParam","newNode","parent","node","state","allowType","indexed","allowParams","verifyType","components","child","allowName","allowArray","sibling","readArray","populate","properties_1","FormatTypes","sighash","minimal","full","json","paramTypeArray","RegExp","ParamType","arrayLength","arrayChildren","fromObject","baseType","_isParamType","result_1","comp","parse","isParamType","ParamTypify","parseParams","allowIndex","splitNesting","Fragment","_isFragment","isFragment","FunctionFragment","EventFragment","ConstructorFragment","ErrorFragment","trim","_super","__extends","anonymous","inputs","isEventFragment","verifyIdentifier","regexParen","modifier","parseGas","gas","parseModifiers","constant","payable","stateMutability","verifyState","isConstructorFragment","parens","outputs","isFunctionFragment","returns","checkForbidden","fragment","sig","isErrorFragment","regexIdentifier","depth","checkResultErrors","checkErrors","path","childPath","Coder","localName","dynamic","_throwError","Writer","_data","_dataLength","_padding","_writeData","appendWriter","writer","writeBytes","paddingOffset","_getValue","BUFFER_OVERRUN","writeValue","writeUpdatableValue","_this","Reader","coerceFunc","allowLoose","_offset","coerce","_coerceFunc","_peekBytes","loose","alignedLength","subReader","readBytes","readValue","INPUT_ERROR","FINALIZE_ERROR","WINDOW","root","JS_SHA3_NO_WINDOW","WEB_WORKER","NODE_JS","JS_SHA3_NO_NODE_JS","process","versions","global","COMMON_JS","JS_SHA3_NO_COMMON_JS","AMD","define","amd","ARRAY_BUFFER","JS_SHA3_NO_ARRAY_BUFFER","ArrayBuffer","HEX_CHARS","SHAKE_PADDING","CSHAKE_PADDING","KECCAK_PADDING","PADDING","SHIFT","RC","BITS","SHAKE_BITS","OUTPUT_TYPES","CSHAKE_BYTEPAD","128","256","obj","JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW","isView","buffer","createOutputMethod","outputType","Keccak","update","createShakeOutputMethod","outputBits","createCshakeOutputMethod","methods","createKmacOutputMethod","createOutputMethods","method","createMethod","create","createShakeMethod","createCshakeMethod","bytepad","createKmacMethod","Kmac","algorithms","methodNames","algorithm","methodName","newMethodName","blocks","reset","finalized","block","blockCount","byteCount","outputBlocks","extraBytes","notString","lastByteIndex","f","encode","encodeString","strs","paddingBytes","finalize","arrayBuffer","Uint32Array","digest","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","b10","b11","b12","b13","b14","b15","b16","b17","b18","b19","b20","b21","b22","b23","b24","b25","b26","b27","b28","b29","b30","b31","b32","b33","b34","b35","b36","b37","b38","b39","b40","b41","b42","b43","b44","b45","b46","b47","b48","b49","js_sha3_1","sha3","keccak256","keccak_256","arrayifyInteger","unarrayifyInteger","_encode","payload_1","length_1","_decodeChildren","childOffset","decoded","_decode","consumed","lengthLength","length_2","length_3","length_4","length_5","decode","getChecksumAddress","address","chars","expanded","hashed","keccak256_1","toUpperCase","MAX_SAFE_INTEGER","log10","LN10","ibanLookup","safeDigits","ibanChecksum","checksum","getAddress","isAddress","getIcapAddress","base36","getContractAddress","transaction","nonce","rlp_1","getCreate2Address","salt","initCodeHash","AddressCoder","address_1","reader","abstract_coder_1","AnonymousCoder","coder","pack","coders","values","arrayValues","unique_1","staticWriter","dynamicWriter","updateFuncs","dynamicOffset_1","updateFunc_1","baseOffset","func","unpack","baseReader","offsetReader","uniqueNames","ArrayCoder","defaultChild","anonymous_1","BooleanCoder","DynamicBytesCoder","BytesCoder","FixedBytesCoder","NullCoder","AddressZero","One","Two","WeiPerEther","MaxUint256","MinInt256","MaxInt256","HashZero","EtherSymbol","addresses","bignumbers","hashes","strings","NumberCoder","maxUintValue","constants_1","bounds","UnicodeNormalizationForm","Utf8ErrorReason","errorFunc","badCodepoint","ignoreFunc","BAD_PREFIX","UNEXPECTED_CONTINUE","OVERRUN","replaceFunc","OVERLONG","Utf8ErrorFuncs","ignore","getUtf8CodePoints","onError","extraLength","overlongMask","nextChar","MISSING_CONTINUE","OUT_OF_RANGE","UTF16_SURROGATE","toUtf8Bytes","pair","escapeChar","_toEscapedUtf8String","codePoint","_toUtf8String","codePoints","toUtf8String","toUtf8CodePoints","formatBytes32String","text","utf8_1","parseBytes32String","bytes2","createTable","createRangeTable","matchMap","ranges","range","d","Table_A_1_ranges","Table_B_1_flags","Table_B_2_ranges","Table_B_2_lut_abs","Table_B_2_lut_rel","Table_B_2_complex","Table_C_ranges","flatten","_nameprepTableA1","codepoint","_nameprepTableB2","codes","complex","_nameprepTableC","nameprep","codesTableB2","NFKC","bytes32_1","idna_1","StringCoder","strings_1","TupleCoder","types","array_1","paramTypeBytes","paramTypeNumber","AbiCoder","_getCoder","boolean_1","string_1","bytes_2","tuple_1","component","null_1","number_1","fixed_bytes_1","_getWordSize","_getReader","_getWriter","getDefaultValue","fragments_1","defaultAbiCoder","id","Zeros","fill","Partition","isValidName","namehash","partition","label","dnsEncode","messagePrefix","hashMessage","hexPadRight","padOffset","hexTrue","hexFalse","domainFieldTypes","chainId","verifyingContract","domainFieldNames","checkString","domainChecks","getBaseEncoder","boundsUpper_1","boundsLower_1","width_1","id_1","encodeType","fields","TypedDataEncoder","links","parents","subtypes","name_1","field","encoder","primaryTypes","filter","checkCircular","found","subtype","primaryType","name_2","st","sort","_types","getEncoder","_encoderCache","_getEncoder","subtype_1","subEncoder_1","encodedType_1","encodeData","hashStruct","hash","_visit","callback","subtype_2","visit","getPrimaryType","hashDomain","domain","domainFields","name_3","EIP712Domain","resolveNames","resolveName","ensCache","_c","_d","name_4","_e","getPayload","domainValues","domainTypes","typesWithDomain","namehash_1","message_1","typed_data_1","LogDescription","TransactionDescription","ErrorDescription","Indexed","isIndexed","_isIndexed","BuiltinErrors","0x08c379a0","0x4e487b71","wrapAccessError","property","wrap","Interface","fragments","abi","bucket","deploy","functions","events","getAbiCoder","abi_coder_1","getSighash","hash_1","getEventTopic","eventFragment","getFunction","nameOrSignatureOrSighash","matching","getEvent","nameOrSignatureOrTopic","topichash","getError","name_5","name_6","_decodeParams","_abiCoder","_encodeParams","encodeDeploy","decodeErrorResult","encodeErrorResult","decodeFunctionData","functionFragment","encodeFunctionData","decodeFunctionResult","errorArgs","errorName","errorSignature","selector","builtin","encodeFunctionResult","encodeFilterTopics","topics","encodeTopic","pop","encodeEventLog","dataTypes","dataValues","decodeEventLog","topicHash","expected","nonIndexed","resultIndexed","resultNonIndexed","nonIndexedIndex","indexedIndex","value_1","parseTransaction","tx","parseLog","topic","parseError","hexData","errorFragment","isInterface","_isInterface","interface_1","ForkEvent","isForkEvent","_isForkEvent","BlockForkEvent","blockHash","expiry","_isBlockForkEvent","TransactionForkEvent","_isTransactionForkEvent","TransactionOrderForkEvent","beforeHash","afterHash","_isTransactionOrderForkEvent","Provider","getFeeData","getBlock","gasPrice","getGasPrice","catch","_b","maxFeePerGas","maxPriorityFeePerGas","baseFeePerGas","addListener","eventName","listener","on","removeListener","isProvider","_isProvider","allowedTransactionKeys","forwardErrors","Signer","getBalance","blockTag","_checkProvider","provider","getTransactionCount","estimateGas","checkTransaction","sendTransaction","populateTransaction","signTransaction","signedTx","getChainId","getNetwork","network","to","__awaiter","hasEip1559","feeData","gasLimit","isSigner","_isSigner","VoidSigner","_fail","signMessage","_signTypedData","connect","minimalisticAssert","equal","assertEqual","utils","enc","zero2","arr","minAssert","minUtils","getNAF","naf","getJSF","k1","k2","jsf","d1","d2","m8","m14","m24","u1","u2","cachedProperty","computer","parseBytes","intFromLE","BaseCurve","conf","zero","two","pointFromJSON","gRed","_wnafT1","_wnafT2","_wnafT3","_wnafT4","_bitLength","adjustCount","redN","_maxwellTrick","point","validate","_fixedNafMul","precomputed","doubles","_getDoubles","I","step","repr","nafW","jpoint","mixedAdd","points","toP","_wnafMul","nafPoints","_getNAFPoints","dblp","_wnafMulAdd","defW","coeffs","jacobianResult","wndWidth","comb","toJ","ja","jb","BasePoint","curve","decodePoint","pointFromX","encodeCompressed","getX","getY","precompute","power","beta","_getBeta","_hasDoubles","dbl","configurable","ShortCurve","Base","tinv","zeroA","threeA","endo","_getEndomorphism","_endoWnafT1","_endoWnafT2","short_1","lambda","betas","_getEndoRoots","lambdas","basis","vec","_getEndoBasis","ntinv","l1","l2","aprxSqrt","y1","y2","prevR","len1","len2","_endoSplit","v1","v2","p1","p2","q1","q2","inf","ax","rhs","_endoWnafMulAdd","npoints","ncoeffs","Point","isRed","fromJSON","pre","endoMul","obj2point","isInfinity","nx","ny","ys1","dyinv","mulAdd","jmulAdd","_precompute","negate","JPoint","zOne","zinv","zinv2","ay","pz2","z2","s1","s2","h2","h3","nz","jx","jy","jz","jz4","jyd","jx2","jyd2","jyd4","t1","t2","dny","_zeroDbl","_threeDbl","_dbl","xx","yy","yyyy","yyyy8","gamma","alpha","beta4","beta8","ggamma8","jy2","jxd4","jyd8","trpl","zz","mm","ee","yyu4","kbase","z3","pz3","eqXToP","zs","xc","require$$0","short","require$$1","edwards","inherits_1","isSurrogatePair","toArray_1","toHex_1","htonl","htonl_1","toHex32","zero8","toHex32_1","zero2_1","zero8_1","join32","join32_1","split32","split32_1","rotr32","rotr32_1","rotl32","rotl32_1","sum32","sum32_1","sum32_3","sum32_3_1","sum32_4","sum32_4_1","sum32_5","sum32_5_1","sum64","buf","pos","ah","al","bh","bl","sum64_1","sum64_hi","sum64_hi_1","sum64_lo","sum64_lo_1","sum64_4_hi","ch","cl","dh","dl","sum64_4_hi_1","sum64_4_lo","sum64_4_lo_1","sum64_5_hi","eh","el","sum64_5_hi_1","sum64_5_lo","sum64_5_lo_1","rotr64_hi","rotr64_hi_1","rotr64_lo","rotr64_lo_1","shr64_hi","shr64_hi_1","shr64_lo","shr64_lo_1","BlockHash","pending","pendingTotal","blockSize","outSize","hmacStrength","padLength","_delta8","_delta32","BlockHash_1","_update","_pad","_digest","pad","ft_1","ch32","p32","maj32","ft_1_1","ch32_1","maj32_1","p32_1","s0_256","s0_256_1","s1_256","s1_256_1","g0_256","g0_256_1","g1_256","g1_256_1","shaCommon","common","sha1_K","SHA1","W","_1","sha256_K","SHA256","_256","T1","T2","SHA224","_224","sha512_K","SHA512","_512","_prepareBlock","c0_hi","g1_512_hi","c0_lo","g1_512_lo","c1_hi","c1_lo","c2_hi","g0_512_hi","c2_lo","g0_512_lo","c3_hi","c3_lo","fh","fl","gh","gl","hh","hl","s1_512_hi","s1_512_lo","ch64_hi","ch64_lo","c4_hi","c4_lo","T1_hi","T1_lo","s0_512_hi","s0_512_lo","maj64_hi","maj64_lo","T2_hi","T2_lo","xh","xl","yh","yl","zh","zl","SHA384","_384","sha1","sha224","sha256","require$$2","sha384","require$$3","sha512","require$$4","RIPEMD160","ripemd160","E","Ah","Bh","Ch","Dh","Eh","T","K","rh","Kh","sh","Hmac","Hash","inner","outer","hmac","sha","ripemd","curves","PresetCurve","defineCurve","crash","HmacDRBG","predResist","minEntropy","_reseed","reseedInterval","V","entropy","entropyEnc","nonceEnc","pers","persEnc","hmacDrbg","seed","_hmac","kmac","reseed","addEnc","generate","temp","KeyPair","ec","priv","pub","_importPrivate","privEnc","_importPublic","pubEnc","fromPublic","fromPrivate","getPublic","getPrivate","derive","sign","verify","Signature","_importDER","Position","place","getLength","initial","octetLen","rmPadding","slen","constructLength","octets","LN2","toDER","backHalf","rand","EC","hasOwnProperty","nh","keyPair","keyFromPrivate","keyFromPublic","genKeyPair","drbg","ns2","_truncateToN","truncOnly","bkey","ns1","iter","kp","kpX","canonical","sinv","recoverPubKey","isYOdd","isSecondKey","rInv","getKeyRecoveryParam","Q","Qprime","elliptic","eddsa","elliptic_1$1","elliptic_1","_curve","getCurve","SigningKey","privateKey","_addPoint","p0","publicKey","signDigest","digestBytes","computeSharedSecret","otherKey","otherKeyPair","computePublicKey","isSigningKey","_isSigningKey","recoverPublicKey","rs","compressed","signingKey","RLP","__importStar","lib$5","TransactionTypes","handleAddress","handleNumber","transactionFields","maxLength","computeAddress","signing_key_1","recoverAddress","formatNumber","accessSetify","addr","storageKeys","storageKey","accessListify","localeCompare","formatAccessList","_serializeEip1559","accessList","_serializeEip2930","_serialize","raw","fieldInfo","serialize","transactionType","_parseEipSignature","recid","_parseEip1559","payload","_parseEip2930","_parse","rawTransaction","customData","ccipReadEnabled","resolver","nameOrPromise","resolveAddresses","paramType","reject","contract","overrides","signer","override","resolvedAddress","resolved","interface","transactions_1","intrinsic","roValue","leftovers","buildPopulate","buildEstimate","signerOrProvider","addContractWait","wait","bind","confirmations","receipt","logs","event","parsed","eventSignature","getTransaction","transactionHash","getTransactionReceipt","buildCall","collapseSimple","deployTransaction","_deployed","buildSend","txRequest","buildDefault","getEventTag","RunningEvent","tag","_listeners","once","done","removeAllListeners","listeners","listenerCount","run","argsCopy","setTimeout","prepareEvent","getEmit","ErrorRunningEvent","FragmentRunningEvent","contractInterface","decodeError","abi_1","WildcardRunningEvent","parsed_1","BaseContract","addressOrName","Contract","abstract_signer_1","abstract_provider_1","uniqueFilters_1","filters","uniqueSignatures","callStatic","signatures","getInterface","deployed","_deployedPromise","getCode","contractAddress","fallback","attach","_normalizeRunningEvent","runningEvent","_runningEvents","_getRunningEvent","_checkRunningEvents","emit","_wrappedEmits","_wrapEvent","_addEventListener","wrappedEmit","__spreadArray","queryFilter","fromBlockOrBlockhash","toBlock","fromBlock","getLogs","runningEvent_1","ContractFactory","bytecode","bytecodeHex","getDeployTransaction","unsignedTx","getContract","fromSolidity","compilerOutput","evm","BaseX","alphabet","charAt","_alphabetMap","source","digits","_leader","TypeError","byte","reverse","Base32","Base58","SupportedAlgorithm","hash_js_1","computeHmac","types_1","sha2_1","pbkdf2","password","iterations","keylen","hashAlgorithm","hLen","DK","block1","U","destPos","browserPbkdf2","exportWordlist","Wordlist","locale","mnemonic","wordlist","getWord","getWordIndex","register","lang","anyGlobal","_ethers","wordlists","loadWords","wordlist_1","LangEn","langEn","en","lang_en_1","wordlists_1","MasterSecret","HardenedBit","getUpperMask","getLowerMask","bytes32","base58check","basex_1","getWordlist","defaultPath","HDNode","parentFingerprint","chainCode","mnemonicOrPath","compressedPublicKey","neuter","_derive","IL","IR","ki","Ki","ek","srcMnemonic","phrase","fingerprint","derivePath","_fromSeed","seedArray","fromMnemonic","entropyToMnemonic","mnemonicToEntropy","mnemonicToSeed","fromSeed","fromExtendedKey","extendedKey","NFKD","pbkdf2_1","entropyBits","checksumBits","checksumMask","indices","remainingBits","isValidMnemonic","getAccountPath","getGlobal","crypto","msCrypto","getRandomValues","randomBytes","shuffled","random","browserRandom","shuffle","checkInt","checkInts","arrayish","coerceArray","arg","createArray","copyArray","sourceArray","targetArray","targetStart","sourceStart","sourceEnd","convertUtf8","toBytes","encodeURI","substr","convertHex","Hex","numberOfRounds","16","24","32","rcon","S","Si","T3","T4","T5","T6","T7","T8","U1","U2","U3","U4","convertToInt32","AES","_prepare","rounds","_Ke","_Kd","roundKeyCount","KC","tk","rconpointer","tt","encrypt","plaintext","decrypt","ciphertext","ModeOfOperationECB","description","_aes","ModeOfOperationCBC","iv","_lastCipherblock","ModeOfOperationCFB","segmentSize","_shiftRegister","encrypted","xorSegment","ModeOfOperationOFB","_lastPrecipher","_lastPrecipherIndex","Counter","initialValue","_counter","setValue","setBytes","increment","ModeOfOperationCTR","counter","_remainingCounter","_remainingCounterIndex","pkcs7pad","padder","pkcs7strip","aesjs","ModeOfOperation","ecb","cbc","cfb","ofb","ctr","utf8","pkcs7","_arrayTest","_aesjs","looseArrayify","hexString","zpad","getPassword","searchPath","currentChild","matchingChild","uuidV4","aes_js_1","aesJs","CrowdsaleAccount","isCrowdsaleAccount","_isCrowdsaleAccount","utils_1","ethaddr","encseed","encryptedSeed","aesCbc","seedHex","seedHexBytes","isCrowdsaleWallet","isKeystoreWallet","getJsonWalletAddress","MAX_VALUE","h0","h1","h4","h5","h6","h7","bytesLeft","bitLenHi","bitLenLo","numZeros","PBKDF2_HMAC_SHA256_OneIter","dkLen","innerLen","outerKey","dk","incrementCounter","blockmix_salsa8","BY","Yi","_X","arraycopy","blockxor","salsa20_8","R","src","srcPos","checkBufferish","ensureInteger","_scrypt","XY","totalOps","currentOp","lastPercent10","stop","i0","i1","Bi","limit","nextTick","setImmediate","incrementalSMix","steps","percent10","derivedKey","lib","scrypt","progressCallback","lastProgress","progress","syncScrypt","scrypt_js_1","hasMnemonic","KeystoreAccount","isKeystoreAccount","_isKeystoreAccount","_decrypt","cipher","aesCtr","_getAccount","computedMAC","mnemonicKey","account","mnemonicCiphertext","mnemonicIv","mnemonicCounter","mnemonicAesCtr","hdnode_1","pbkdf2Sync","passwordBytes","prfFunc","_computeKdfKey","pbkdf2Func","scryptFunc","kdf","prf","decryptSync","client","random_1","uuidRandom","uuid","macPrefix","mac","Crypto","cipherparams","kdfparams","dklen","now","Date","timestamp","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","gethFilename","crowdsale_1","inspect_1","keystore_1","decryptJsonWallet","decryptJsonWalletSync","isAccount","Wallet","signingKey_1","srcMnemonic_1","signingKey_2","_mnemonic","_signingKey","populated","json_wallets_1","createRandom","extraEntropy","fromEncryptedJson","fromEncryptedJsonSync","verifyMessage","verifyTypedData","isRenetworkable","ethDefaultProvider","providers","providerList","InfuraProvider","infura","EtherscanProvider","etherscan","AlchemyProvider","alchemy","PocketProvider","pocket","skip","CloudflareProvider","cloudflare","AnkrProvider","ankr","FallbackProvider","quorum","renetwork","etcDefaultProvider","JsonRpcProvider","homestead","ensAddress","_defaultProvider","ropsten","classicMordor","networks","unspecified","mainnet","morden","testnet","rinkeby","kovan","goerli","kintsugi","classic","classicMorden","classicTestnet","classicKotti","xdai","matic","maticmum","optimism","optimism-kovan","optimism-goerli","arbitrum","arbitrum-rinkeby","bnb","bnbt","standard_1","standard_2","standard","defaultProvider","textData","atob","btoa","browserBase64","getUrl","href","request","headers","body","skipFetchSetup","cache","credentials","redirect","referrer","fetch","response","statusCode","status","statusMessage","statusText","staller","duration","bodyify","_fetchData","connection","processFunc","attemptLimit","throttleLimit","throttleCallback","throttleSlotInterval","errorPassThrough","allow304","timeout","allowGzip","user","allowInsecureAuthentication","authorization","base64_1","reData","dataMatch","content-type","SERVER_ERROR","requestBody","requestMethod","flatHeaders","header","runningTimeout","timer","promise","TIMEOUT","cancel","clearTimeout","runningFetch","attempt","geturl_1","location_1","location","tryAgain","stall","retryAfter","error_1","serverError","body_1","error_2","throttleRetry","timeout_1","race","fetchJson","processJsonFunc","updated","hasContentType","poll","interval","retryLimit","oncePoll","onceBlock","ALPHABET","ALPHABET_MAP","polymodStep","prefixChk","prefix","chk","LIMIT","__decode","lowered","uppered","lastIndexOf","wordChars","decodeUnsafe","convert","inBits","outBits","maxV","toWordsUnsafe","toWords","fromWordsUnsafe","fromWords","bech32","Formatter","formats","getDefaultFormats","bigNumber","strictData","allowNull","blockNumber","transactionIndex","uint256","creates","transactionRequest","receiptLog","arrayOf","logIndex","gasUsed","logsBloom","cumulativeGasUsed","effectiveGasPrice","parentHash","difficulty","miner","extraData","transactions","blockWithTransactions","transactionResponse","filterLog","removed","allowFalsish","strict","callAddress","_block","author","_difficulty","networkId","byzantium","checkKey","checkValue","nullValue","replaceValue","isCommunityResourcable","isCommunityResource","throttleMessage","showThrottleMessage","bech32_1","MAX_CCIP_REDIRECTS","checkTopic","serializeTopics","sorted","deserializeTopics","getTime","PollableEvents","Event","_lastBlockNumber","_inflight","pollable","coinInfos","0","symbol","p2pkh","p2sh","2","3","60","ilk","61","700","bytes32ify","base58Encode","matcherIpfs","matchers","_parseString","_parseBytes","getIpfsLink","link","numPad","padded","bytesPad","encodeBytes","datas","Resolver","formatter","supportsWildcard","_supportsEip2544","_fetch","parameters","_fetchBytes","_getAddress","coinType","hexBytes","coinInfo","version_1","getAvatar","linkage","content","getText","avatar","_h","scheme","_resolvedAddress","owner","tokenId","tokenOwner","_f","balance","_g","metadataUrl","web_1","metadata","imageUrl","image","ipfs","getContentHash","ipns","swarm","keyBytes","defaultFormatter","nextPollId","BaseProvider","_events","_emitted","disableCcipRead","getFormatter","anyNetwork","detectNetwork","_networkPromise","_ready","knownNetwork","_maxInternalBlockNumber","_maxFilterBlockRange","_pollingInterval","_fastQueryDate","_network","NETWORK_ERROR","formatter_1","networks_1","ccipReadFetch","urls","sender","errorMessages","errorMessage","_getInternalBlockNumber","maxAge","_internalBlockNumber","internalBlockNumber","respTime","reqTime","checkInternalBlockNumber","perform","networkError","_setFastBlockNumber","pollId","runners","pollingInterval","error_6","previousBlockNumber","eventBlockNumber","hash_2","runner","filter_1","resetEventsBlock","polling","currentNetwork","_fastBlockNumber","_fastBlockNumberPromise","detectedNetwork","_poller","setInterval","_bootstrapPoll","clearInterval","_getFastBlockNumber","getBlockNumber","waitForTransaction","_waitForTransaction","replaceable","cancelFuncs","alreadyDone","minedHandler","lastBlockNumber_1","startBlock","scannedBlock_1","replaceHandler_1","mined","getBlockWithTransactions","ti","receipt_1","cancelled","replacement","_wrapTransaction","timer_1","unref","_getBlockTag","getStorageAt","position","expectedHash","returnedHash","confirms","signedTransaction","hexTx","error_7","_getTransactionRequest","_getFilter","_call","redirects","txSender","urlsOffset","urlsLength","urlsData","callbackSelector","ccipResult","error_8","_getBlock","blockHashOrBlockTag","includeTransactions","blockNumber_1","blockWithTxs","getEtherPrice","getResolver","currentName","_getResolver","addrData","lookupAddress","resolverAddr","nameOrAddress","resolverAddress","avatar_1","error_11","error_12","NOT_IMPLEMENTED","_startEvent","_stopEvent","stopped","eventTag","eventTag_1","errorGas","spelunk","checkError","responseText","getResult","getLowerCase","JsonRpcSigner","addressOrIndex","connectUnchecked","UncheckedJsonRpcSigner","_address","_index","send","accounts","sendUncheckedTransaction","fromAddress","estimate","hexlifyTransaction","_legacySignMessage","unlock","networkOrReady","_nextId","_eventLoopCache","defaultUrl","_cache","_uncachedDetectNetwork","getSigner","getUncheckedSigner","listAccounts","jsonrpc","action","prepareRequest","error_4","_startPending","_pendingFilter","pendingFilter","filterId","seq","allowExtra","allowed","base_provider_1","WS","WebSocket","logger_2","NextId","WebSocketProvider","_wsReady","ws_1","websocket","onopen","_requests","onmessage","messageEvent","_subs","subscription","fauxPoll","_websocket","_detectNetwork","rid","_subscribe","subIdPromise","_subIds","subId","emitReceipt_1","destroy","readyState","CONNECTING","onerror","close","json_rpc_provider_1","StaticJsonRpcProvider","UrlJsonRpcProvider","apiKey","getApiKey","defaultApiKey","AlchemyWebSocketProvider","websocket_provider_1","getWebSocketProvider","host","url_json_rpc_provider_1","getHost","projectSecret","getTransactionPostData","maxFeePerGs","getJsonResult","checkLogTag","getBaseUrl","query","baseUrl","getPostUrl","getPostData","apikey","post","procFunc","payloadStr","txhash","postData","topic0","ethusd","getHistory","endBlock","startblock","endblock","timeStamp","checkNetworks","median","maxDelta","middle","nextRid","getPromise","ForwardErrors","ForwardProperties","exposeDebugConfig","config","weight","normalizedTally","configs","tally","getProcessFunc","_highestBlockNumber","waitForSync","getRunner","currentBlockNumber","providerConfigs","configOrProvider","stallTimeout","priority","i_1","first","t0","inflightWeight","backend","this_1","waiting","errorCode","props","IpcProvider","defaultProjectId","InfuraWebSocketProvider","projectId","apiKeyObj","JsonRpcBatchProvider","_pendingBatch","inflightRequest","_pendingBatchAggregator","batch","inflight","NodesmithProvider","defaultApplicationIds","applicationId","loadBalancer","applicationSecretKey","buildWeb3LegacyFetcher","sendFunc","fetcher","buildEip1193Fetcher","Web3Provider","jsonRpcFetchFunc","subprovider","isMetaMask","sendAsync","alchemy_provider_1","ankr_provider_1","cloudflare_provider_1","etherscan_provider_1","fallback_provider_1","ipc_provider_1","infura_provider_1","json_rpc_batch_provider_1","nodesmith_provider_1","pocket_provider_1","web3_provider_1","getDefaultProvider","fallbackProvider","alchemyProvider","ankrProvider","cloudflareProvider","etherscanProvider","infuraProvider","jsonRpcProvider","nodesmithProvider","pocketProvider","web3Provider","browserIpcProvider","regexBytes","regexNumber","regexArray","_pack","baseType_1","tight","names","commify","suffix","formatted","formatUnits","unitName","parseUnits","formatEther","parseEther","ether","base64","lib$p","solidity_1","units_1","wallet_1","sha2_2","lib$h","strings_2","lib$8","contracts_1","constants","lib$7","lib$r","providers_1","utils$3","ethers$1","ethers","ethers_1"],"mappings":"kgDAAA,SAAWA,OAAQC,SACjB,aAGA,SAASC,OAAQC,IAAKC,KACpB,IAAKD,IAAK,MAAM,IAAIE,MAAMD,KAAO,oBAKnC,SAASE,SAAUC,KAAMC,WACvBD,KAAKE,OAASD,UACd,IAAIE,SAAW,aACfA,SAASC,UAAYH,UAAUG,UAC/BJ,KAAKI,UAAY,IAAID,SACrBH,KAAKI,UAAUC,YAAcL,KAK/B,SAASM,GAAIC,OAAQC,KAAMC,QACzB,GAAIH,GAAGI,KAAKH,QAAS,CACnB,OAAOA,OAGTI,KAAKC,SAAW,EAChBD,KAAKE,MAAQ,KACbF,KAAKG,OAAS,EAGdH,KAAKI,IAAM,KAEX,GAAIR,SAAW,KAAM,CACnB,GAAIC,OAAS,MAAQA,OAAS,KAAM,CAClCC,OAASD,KACTA,KAAO,GAGTG,KAAKK,MAAMT,Q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AA1c,QAAA,aAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAAxlB,aAEA5vD,OAAAC,eAAA1c,QAAA,gBAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAA58B,gBACAx4C,OAAAC,eAAA1c,QAAA,YAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAA18B,YACA14C,OAAAC,eAAA1c,QAAA,mBAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAA16B,mBAEA16C,OAAAC,eAAA1c,QAAA,aAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAAjtE,aACAnI,OAAAC,eAAA1c,QAAA,eAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAAxqE,eAEA5K,OAAAC,eAAA1c,QAAA,aAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAAP,aACA70E,OAAAC,eAAA1c,QAAA,UAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAA5zE,UAEAxB,OAAAC,eAAA1c,QAAA,UAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAA/wE,UAEArE,OAAAC,eAAA1c,QAAA,SAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAAz/C,SAEA31B,OAAAC,eAAA1c,QAAA,aAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAA13B,aAMA19C,OAAAC,eAAA1c,QAAA,WAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAA92E,WA8BA0B,OAAAC,eAAA1c,QAAA,YAAA2c,WAAA,KAAAmM,IAAA,WAAA,OAAA+oE,SAAAp4B","sourcesContent":["(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 if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\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 this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\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 parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // 'A' - 'F'\n if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n // '0' - '9'\n } else {\n return (c - 48) & 0xf;\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\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 // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\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 this.strip();\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 ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';\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 if (r.strip !== undefined) {\n // r is BN v4 instance\n r.strip();\n } else {\n // r is BN v5 instance\n r._strip();\n }\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","export const version = \"logger/5.6.0\";\n","\"use strict\";\n\nlet _permanentCensorErrors = false;\nlet _censorErrors = false;\n\nconst LogLevels: { [ name: string ]: number } = { debug: 1, \"default\": 2, info: 2, warning: 3, error: 4, off: 5 };\nlet _logLevel = LogLevels[\"default\"];\n\nimport { version } from \"./_version\";\n\nlet _globalLogger: Logger = null;\n\nfunction _checkNormalize(): string {\n try {\n const missing: Array<string> = [ ];\n\n // Make sure all forms of normalization are supported\n [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].forEach((form) => {\n try {\n if (\"test\".normalize(form) !== \"test\") {\n throw new Error(\"bad normalize\");\n };\n } catch(error) {\n missing.push(form);\n }\n });\n\n if (missing.length) {\n throw new Error(\"missing \" + missing.join(\", \"));\n }\n\n if (String.fromCharCode(0xe9).normalize(\"NFD\") !== String.fromCharCode(0x65, 0x0301)) {\n throw new Error(\"broken implementation\")\n }\n } catch (error) {\n return error.message;\n }\n\n return null;\n}\n\nconst _normalizeError = _checkNormalize();\n\nexport enum LogLevel {\n DEBUG = \"DEBUG\",\n INFO = \"INFO\",\n WARNING = \"WARNING\",\n ERROR = \"ERROR\",\n OFF = \"OFF\"\n}\n\n\nexport enum ErrorCode {\n\n ///////////////////\n // Generic Errors\n\n // Unknown Error\n UNKNOWN_ERROR = \"UNKNOWN_ERROR\",\n\n // Not Implemented\n NOT_IMPLEMENTED = \"NOT_IMPLEMENTED\",\n\n // Unsupported Operation\n // - operation\n UNSUPPORTED_OPERATION = \"UNSUPPORTED_OPERATION\",\n\n // Network Error (i.e. Ethereum Network, such as an invalid chain ID)\n // - event (\"noNetwork\" is not re-thrown in provider.ready; otherwise thrown)\n NETWORK_ERROR = \"NETWORK_ERROR\",\n\n // Some sort of bad response from the server\n SERVER_ERROR = \"SERVER_ERROR\",\n\n // Timeout\n TIMEOUT = \"TIMEOUT\",\n\n ///////////////////\n // Operational Errors\n\n // Buffer Overrun\n BUFFER_OVERRUN = \"BUFFER_OVERRUN\",\n\n // Numeric Fault\n // - operation: the operation being executed\n // - fault: the reason this faulted\n NUMERIC_FAULT = \"NUMERIC_FAULT\",\n\n\n ///////////////////\n // Argument Errors\n\n // Missing new operator to an object\n // - name: The name of the class\n MISSING_NEW = \"MISSING_NEW\",\n\n // Invalid argument (e.g. value is incompatible with type) to a function:\n // - argument: The argument name that was invalid\n // - value: The value of the argument\n INVALID_ARGUMENT = \"INVALID_ARGUMENT\",\n\n // Missing argument to a function:\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n MISSING_ARGUMENT = \"MISSING_ARGUMENT\",\n\n // Too many arguments\n // - count: The number of arguments received\n // - expectedCount: The number of arguments expected\n UNEXPECTED_ARGUMENT = \"UNEXPECTED_ARGUMENT\",\n\n\n ///////////////////\n // Blockchain Errors\n\n // Call exception\n // - transaction: the transaction\n // - address?: the contract address\n // - args?: The arguments passed into the function\n // - method?: The Solidity method signature\n // - errorSignature?: The EIP848 error signature\n // - errorArgs?: The EIP848 error parameters\n // - reason: The reason (only for EIP848 \"Error(string)\")\n CALL_EXCEPTION = \"CALL_EXCEPTION\",\n\n // Insufficient funds (< value + gasLimit * gasPrice)\n // - transaction: the transaction attempted\n INSUFFICIENT_FUNDS = \"INSUFFICIENT_FUNDS\",\n\n // Nonce has already been used\n // - transaction: the transaction attempted\n NONCE_EXPIRED = \"NONCE_EXPIRED\",\n\n // The replacement fee for the transaction is too low\n // - transaction: the transaction attempted\n REPLACEMENT_UNDERPRICED = \"REPLACEMENT_UNDERPRICED\",\n\n // The gas limit could not be estimated\n // - transaction: the transaction passed to estimateGas\n UNPREDICTABLE_GAS_LIMIT = \"UNPREDICTABLE_GAS_LIMIT\",\n\n // The transaction was replaced by one with a higher gas price\n // - reason: \"cancelled\", \"replaced\" or \"repriced\"\n // - cancelled: true if reason == \"cancelled\" or reason == \"replaced\")\n // - hash: original transaction hash\n // - replacement: the full TransactionsResponse for the replacement\n // - receipt: the receipt of the replacement\n TRANSACTION_REPLACED = \"TRANSACTION_REPLACED\",\n};\n\nconst HEX = \"0123456789abcdef\";\n\nexport class Logger {\n readonly version: string;\n\n static errors = ErrorCode;\n\n static levels = LogLevel;\n\n constructor(version: string) {\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n value: version,\n writable: false\n });\n }\n\n _log(logLevel: LogLevel, args: Array<any>): void {\n const level = logLevel.toLowerCase();\n if (LogLevels[level] == null) {\n this.throwArgumentError(\"invalid log level name\", \"logLevel\", logLevel);\n }\n if (_logLevel > LogLevels[level]) { return; }\n console.log.apply(console, args);\n }\n\n debug(...args: Array<any>): void {\n this._log(Logger.levels.DEBUG, args);\n }\n\n info(...args: Array<any>): void {\n this._log(Logger.levels.INFO, args);\n }\n\n warn(...args: Array<any>): void {\n this._log(Logger.levels.WARNING, args);\n }\n\n makeError(message: string, code?: ErrorCode, params?: any): Error {\n // Errors are being censored\n if (_censorErrors) {\n return this.makeError(\"censored error\", code, { });\n }\n\n if (!code) { code = Logger.errors.UNKNOWN_ERROR; }\n if (!params) { params = {}; }\n\n const messageDetails: Array<string> = [];\n Object.keys(params).forEach((key) => {\n const value = params[key];\n try {\n if (value instanceof Uint8Array) {\n let hex = \"\";\n for (let i = 0; i < value.length; i++) {\n hex += HEX[value[i] >> 4];\n hex += HEX[value[i] & 0x0f];\n }\n messageDetails.push(key + \"=Uint8Array(0x\" + hex + \")\");\n } else {\n messageDetails.push(key + \"=\" + JSON.stringify(value));\n }\n } catch (error) {\n messageDetails.push(key + \"=\" + JSON.stringify(params[key].toString()));\n }\n });\n messageDetails.push(`code=${ code }`);\n messageDetails.push(`version=${ this.version }`);\n\n const reason = message;\n\n let url = \"\";\n\n switch (code) {\n case ErrorCode.NUMERIC_FAULT: {\n url = \"NUMERIC_FAULT\";\n const fault = message;\n\n switch (fault) {\n case \"overflow\": case \"underflow\": case \"division-by-zero\":\n url += \"-\" + fault;\n break;\n case \"negative-power\": case \"negative-width\":\n url += \"-unsupported\";\n break;\n case \"unbound-bitwise-result\":\n url += \"-unbound-result\";\n break;\n }\n break;\n }\n case ErrorCode.CALL_EXCEPTION:\n case ErrorCode.INSUFFICIENT_FUNDS:\n case ErrorCode.MISSING_NEW:\n case ErrorCode.NONCE_EXPIRED:\n case ErrorCode.REPLACEMENT_UNDERPRICED:\n case ErrorCode.TRANSACTION_REPLACED:\n case ErrorCode.UNPREDICTABLE_GAS_LIMIT:\n url = code;\n break;\n }\n\n if (url) {\n message += \" [ See: https:/\\/links.ethers.org/v5-errors-\" + url + \" ]\";\n }\n\n if (messageDetails.length) {\n message += \" (\" + messageDetails.join(\", \") + \")\";\n }\n\n // @TODO: Any??\n const 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 return error;\n }\n\n throwError(message: string, code?: ErrorCode, params?: any): never {\n throw this.makeError(message, code, params);\n }\n\n throwArgumentError(message: string, name: string, value: any): never {\n return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {\n argument: name,\n value: value\n });\n }\n\n assert(condition: any, message: string, code?: ErrorCode, params?: any): void {\n if (!!condition) { return; }\n this.throwError(message, code, params);\n }\n\n assertArgument(condition: any, message: string, name: string, value: any): void {\n if (!!condition) { return; }\n this.throwArgumentError(message, name, value);\n }\n\n checkNormalize(message?: string): void {\n if (message == null) { message = \"platform missing String.prototype.normalize\"; }\n if (_normalizeError) {\n this.throwError(\"platform missing String.prototype.normalize\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"String.prototype.normalize\", form: _normalizeError\n });\n }\n }\n\n checkSafeUint53(value: number, message?: string): void {\n if (typeof(value) !== \"number\") { return; }\n\n if (message == null) { message = \"value not safe\"; }\n\n if (value < 0 || value >= 0x1fffffffffffff) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"out-of-safe-range\",\n value: value\n });\n }\n\n if (value % 1) {\n this.throwError(message, Logger.errors.NUMERIC_FAULT, {\n operation: \"checkSafeInteger\",\n fault: \"non-integer\",\n value: value\n });\n }\n }\n\n checkArgumentCount(count: number, expectedCount: number, message?: string): void {\n if (message) {\n message = \": \" + message;\n } else {\n message = \"\";\n }\n\n if (count < expectedCount) {\n this.throwError(\"missing argument\" + message, Logger.errors.MISSING_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n\n if (count > expectedCount) {\n this.throwError(\"too many arguments\" + message, Logger.errors.UNEXPECTED_ARGUMENT, {\n count: count,\n expectedCount: expectedCount\n });\n }\n }\n\n checkNew(target: any, kind: any): void {\n if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n\n checkAbstract(target: any, kind: any): void {\n if (target === kind) {\n this.throwError(\n \"cannot instantiate abstract class \" + JSON.stringify(kind.name) + \" directly; use a sub-class\",\n Logger.errors.UNSUPPORTED_OPERATION,\n { name: target.name, operation: \"new\" }\n );\n } else if (target === Object || target == null) {\n this.throwError(\"missing new\", Logger.errors.MISSING_NEW, { name: kind.name });\n }\n }\n\n static globalLogger(): Logger {\n if (!_globalLogger) { _globalLogger = new Logger(version); }\n return _globalLogger;\n }\n\n static setCensorship(censorship: boolean, permanent?: boolean): void {\n if (!censorship && permanent) {\n this.globalLogger().throwError(\"cannot permanently disable censorship\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n\n if (_permanentCensorErrors) {\n if (!censorship) { return; }\n this.globalLogger().throwError(\"error censorship permanent\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setCensorship\"\n });\n }\n\n _censorErrors = !!censorship;\n _permanentCensorErrors = !!permanent;\n }\n\n static setLogLevel(logLevel: LogLevel): void {\n const level = LogLevels[logLevel.toLowerCase()];\n if (level == null) {\n Logger.globalLogger().warn(\"invalid log level - \" + logLevel);\n return;\n }\n _logLevel = level;\n }\n\n static from(version: string): Logger {\n return new Logger(version);\n }\n}\n","export const version = \"bytes/5.6.1\";\n","\"use strict\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n///////////////////////////////\n// Exported Types\n\nexport type Bytes = ArrayLike<number>;\n\nexport type BytesLike = Bytes | string;\n\nexport type DataOptions = {\n allowMissingPrefix?: boolean;\n hexPad?: \"left\" | \"right\" | null;\n};\n\nexport interface Hexable {\n toHexString(): string;\n}\n\n\n/*\nexport interface HexString {\n length: number;\n substring: (start: number, end?: number) => string;\n\n [index: number]: string;\n}\n*/\n\nexport type SignatureLike = {\n r: string;\n s?: string;\n _vs?: string,\n recoveryParam?: number;\n v?: number;\n} | BytesLike;\n\nexport interface Signature {\n r: string;\n\n s: string;\n _vs: string,\n\n recoveryParam: number;\n v: number;\n\n yParityAndS: string\n compact: string;\n}\n\n///////////////////////////////\n\n\nfunction isHexable(value: any): value is Hexable {\n return !!(value.toHexString);\n}\n\nfunction addSlice(array: Uint8Array): Uint8Array {\n if (array.slice) { return array; }\n\n array.slice = function() {\n const args = Array.prototype.slice.call(arguments);\n return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));\n }\n\n return array;\n}\n\nexport function isBytesLike(value: any): value is BytesLike {\n return ((isHexString(value) && !(value.length % 2)) || isBytes(value));\n}\n\nfunction isInteger(value: number) {\n return (typeof(value) === \"number\" && value == value && (value % 1) === 0);\n}\n\nexport function isBytes(value: any): value is Bytes {\n if (value == null) { return false; }\n\n if (value.constructor === Uint8Array) { return true; }\n if (typeof(value) === \"string\") { return false; }\n if (!isInteger(value.length) || value.length < 0) { return false; }\n\n for (let i = 0; i < value.length; i++) {\n const v = value[i];\n if (!isInteger(v) || v < 0 || v >= 256) { return false; }\n }\n return true;\n}\n\n\nexport function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array {\n if (!options) { options = { }; }\n\n if (typeof(value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid arrayify value\");\n\n const result = [];\n while (value) {\n result.unshift(value & 0xff);\n value = parseInt(String(value / 256));\n }\n if (result.length === 0) { result.push(0); }\n\n return addSlice(new Uint8Array(result));\n }\n\n if (options.allowMissingPrefix && typeof(value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n\n if (isHexable(value)) { value = value.toHexString(); }\n\n if (isHexString(value)) {\n let hex = (<string>value).substring(2);\n if (hex.length % 2) {\n if (options.hexPad === \"left\") {\n hex = \"0\" + hex;\n } else if (options.hexPad === \"right\") {\n hex += \"0\";\n } else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n\n const result = [];\n for (let i = 0; i < hex.length; i += 2) {\n result.push(parseInt(hex.substring(i, i + 2), 16));\n }\n\n return addSlice(new Uint8Array(result));\n }\n\n if (isBytes(value)) {\n return addSlice(new Uint8Array(value));\n }\n\n return logger.throwArgumentError(\"invalid arrayify value\", \"value\", value);\n}\n\nexport function concat(items: ReadonlyArray<BytesLike>): Uint8Array {\n const objects = items.map(item => arrayify(item));\n const length = objects.reduce((accum, item) => (accum + item.length), 0);\n\n const result = new Uint8Array(length);\n\n objects.reduce((offset, object) => {\n result.set(object, offset);\n return offset + object.length;\n }, 0);\n\n return addSlice(result);\n}\n\nexport function stripZeros(value: BytesLike): Uint8Array {\n let result: Uint8Array = arrayify(value);\n\n if (result.length === 0) { return result; }\n\n // Find the first non-zero entry\n let start = 0;\n while (start < result.length && 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 zeroPad(value: BytesLike, length: number): Uint8Array {\n value = arrayify(value);\n\n if (value.length > length) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[0]);\n }\n\n const 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: BytesLike | Hexable | number | bigint, options?: DataOptions): string {\n if (!options) { options = { }; }\n\n if (typeof(value) === \"number\") {\n logger.checkSafeUint53(value, \"invalid hexlify value\");\n\n let hex = \"\";\n while (value) {\n hex = HexCharacters[value & 0xf] + hex;\n value = Math.floor(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) === \"bigint\") {\n value = value.toString(16);\n if (value.length % 2) { return (\"0x0\" + value); }\n return \"0x\" + value;\n }\n\n if (options.allowMissingPrefix && typeof(value) === \"string\" && value.substring(0, 2) !== \"0x\") {\n value = \"0x\" + value;\n }\n\n if (isHexable(value)) { return value.toHexString(); }\n\n if (isHexString(value)) {\n if ((<string>value).length % 2) {\n if (options.hexPad === \"left\") {\n value = \"0x0\" + (<string>value).substring(2);\n } else if (options.hexPad === \"right\") {\n value += \"0\";\n } else {\n logger.throwArgumentError(\"hex data is odd-length\", \"value\", value);\n }\n }\n return (<string>value).toLowerCase();\n }\n\n if (isBytes(value)) {\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n let v = value[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n }\n\n return logger.throwArgumentError(\"invalid hexlify value\", \"value\", value);\n}\n\n/*\nfunction unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {\n if (typeof(value) === \"string\" && value.length % 2 && value.substring(0, 2) === \"0x\") {\n return \"0x0\" + value.substring(2);\n }\n return value;\n}\n*/\nexport function hexDataLength(data: BytesLike) {\n if (typeof(data) !== \"string\") {\n data = hexlify(data);\n } else if (!isHexString(data) || (data.length % 2)) {\n return null;\n }\n\n return (data.length - 2) / 2;\n}\n\nexport function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string {\n if (typeof(data) !== \"string\") {\n data = hexlify(data);\n } else if (!isHexString(data) || (data.length % 2)) {\n logger.throwArgumentError(\"invalid hexData\", \"value\", data );\n }\n\n offset = 2 + 2 * offset;\n\n if (endOffset != null) {\n return \"0x\" + data.substring(offset, 2 + 2 * endOffset);\n }\n\n return \"0x\" + data.substring(offset);\n}\n\nexport function hexConcat(items: ReadonlyArray<BytesLike>): string {\n let result = \"0x\";\n items.forEach((item) => {\n result += hexlify(item).substring(2);\n });\n return result;\n}\n\nexport function hexValue(value: BytesLike | Hexable | number | bigint): string {\n const trimmed = hexStripZeros(hexlify(value, { hexPad: \"left\" }));\n if (trimmed === \"0x\") { return \"0x0\"; }\n return trimmed;\n}\n\nexport function hexStripZeros(value: BytesLike): string {\n if (typeof(value) !== \"string\") { value = hexlify(value); }\n\n if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n value = value.substring(2);\n let offset = 0;\n while (offset < value.length && value[offset] === \"0\") { offset++; }\n return \"0x\" + value.substring(offset);\n}\n\nexport function hexZeroPad(value: BytesLike, length: number): string {\n if (typeof(value) !== \"string\") {\n value = hexlify(value);\n } else if (!isHexString(value)) {\n logger.throwArgumentError(\"invalid hex string\", \"value\", value);\n }\n\n if (value.length > 2 * length + 2) {\n logger.throwArgumentError(\"value out of range\", \"value\", arguments[1]);\n }\n\n while (value.length < 2 * length + 2) {\n value = \"0x0\" + value.substring(2);\n }\n\n return value;\n}\n\nexport function splitSignature(signature: SignatureLike): Signature {\n\n const result = {\n r: \"0x\",\n s: \"0x\",\n _vs: \"0x\",\n recoveryParam: 0,\n v: 0,\n yParityAndS: \"0x\",\n compact: \"0x\"\n };\n\n if (isBytesLike(signature)) {\n let bytes: Uint8Array = arrayify(signature);\n\n // Get the r, s and v\n if (bytes.length === 64) {\n // EIP-2098; pull the v from the top bit of s and clear it\n result.v = 27 + (bytes[32] >> 7);\n bytes[32] &= 0x7f;\n\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n\n } else if (bytes.length === 65) {\n result.r = hexlify(bytes.slice(0, 32));\n result.s = hexlify(bytes.slice(32, 64));\n result.v = bytes[64];\n } else {\n\n logger.throwArgumentError(\"invalid signature string\", \"signature\", signature);\n }\n\n\n // Allow a recid to be used as the v\n if (result.v < 27) {\n if (result.v === 0 || result.v === 1) {\n result.v += 27;\n } else {\n logger.throwArgumentError(\"signature invalid v byte\", \"signature\", signature);\n }\n }\n\n // Compute recoveryParam from v\n result.recoveryParam = 1 - (result.v % 2);\n\n // Compute _vs from recoveryParam and s\n if (result.recoveryParam) { bytes[32] |= 0x80; }\n result._vs = hexlify(bytes.slice(32, 64))\n\n } else {\n result.r = signature.r;\n result.s = signature.s;\n result.v = signature.v;\n result.recoveryParam = signature.recoveryParam;\n result._vs = signature._vs;\n\n // If the _vs is available, use it to populate missing s, v and recoveryParam\n // and verify non-missing s, v and recoveryParam\n if (result._vs != null) {\n const vs = zeroPad(arrayify(result._vs), 32);\n result._vs = hexlify(vs);\n\n // Set or check the recid\n const recoveryParam = ((vs[0] >= 128) ? 1: 0);\n if (result.recoveryParam == null) {\n result.recoveryParam = recoveryParam;\n } else if (result.recoveryParam !== recoveryParam) {\n logger.throwArgumentError(\"signature recoveryParam mismatch _vs\", \"signature\", signature);\n }\n\n // Set or check the s\n vs[0] &= 0x7f;\n const s = hexlify(vs);\n if (result.s == null) {\n result.s = s;\n } else if (result.s !== s) {\n logger.throwArgumentError(\"signature v mismatch _vs\", \"signature\", signature);\n }\n }\n\n // Use recid and v to populate each other\n if (result.recoveryParam == null) {\n if (result.v == null) {\n logger.throwArgumentError(\"signature missing v and recoveryParam\", \"signature\", signature);\n } else if (result.v === 0 || result.v === 1) {\n result.recoveryParam = result.v;\n } else {\n result.recoveryParam = 1 - (result.v % 2);\n }\n } else {\n if (result.v == null) {\n result.v = 27 + result.recoveryParam;\n } else {\n const recId = (result.v === 0 || result.v === 1) ? result.v :(1 - (result.v % 2));\n if (result.recoveryParam !== recId) {\n logger.throwArgumentError(\"signature recoveryParam mismatch v\", \"signature\", signature);\n }\n }\n }\n\n if (result.r == null || !isHexString(result.r)) {\n logger.throwArgumentError(\"signature missing or invalid r\", \"signature\", signature);\n } else {\n result.r = hexZeroPad(result.r, 32);\n }\n\n if (result.s == null || !isHexString(result.s)) {\n logger.throwArgumentError(\"signature missing or invalid s\", \"signature\", signature);\n } else {\n result.s = hexZeroPad(result.s, 32);\n }\n\n const vs = arrayify(result.s);\n if (vs[0] >= 128) {\n logger.throwArgumentError(\"signature s out of range\", \"signature\", signature);\n }\n if (result.recoveryParam) { vs[0] |= 0x80; }\n const _vs = hexlify(vs);\n\n if (result._vs) {\n if (!isHexString(result._vs)) {\n logger.throwArgumentError(\"signature invalid _vs\", \"signature\", signature);\n }\n result._vs = hexZeroPad(result._vs, 32);\n }\n\n // Set or check the _vs\n if (result._vs == null) {\n result._vs = _vs;\n } else if (result._vs !== _vs) {\n logger.throwArgumentError(\"signature _vs mismatch v and s\", \"signature\", signature);\n }\n }\n\n result.yParityAndS = result._vs;\n result.compact = result.r + result.yParityAndS.substring(2);\n\n return result;\n}\n\nexport function joinSignature(signature: SignatureLike): string {\n signature = splitSignature(signature);\n\n return hexlify(concat([\n signature.r,\n signature.s,\n (signature.recoveryParam ? \"0x1c\": \"0x1b\")\n ]));\n}\n\n","export const version = \"bignumber/5.6.0\";\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 regardless.\n *\n */\n\nimport _BN from \"bn.js\";\nimport BN = _BN.BN;\n\nimport { Bytes, Hexable, hexlify, isBytes, isHexString } from \"@ethersproject/bytes\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nconst _constructorGuard = { };\n\nconst MAX_SAFE = 0x1fffffffffffff;\n\n\nexport type BigNumberish = BigNumber | Bytes | bigint | string | number;\n\nexport function isBigNumberish(value: any): value is BigNumberish {\n return (value != null) && (\n BigNumber.isBigNumber(value) ||\n (typeof(value) === \"number\" && (value % 1) === 0) ||\n (typeof(value) === \"string\" && !!value.match(/^-?[0-9]+$/)) ||\n isHexString(value) ||\n (typeof(value) === \"bigint\") ||\n isBytes(value)\n );\n}\n\n// Only warn about passing 10 into radix once\nlet _warnedToStringRadix = false;\n\nexport class BigNumber implements Hexable {\n readonly _hex: string;\n readonly _isBigNumber: boolean;\n\n constructor(constructorGuard: any, hex: string) {\n logger.checkNew(new.target, BigNumber);\n\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot call constructor directly; use BigNumber.from\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new (BigNumber)\"\n });\n }\n\n this._hex = hex;\n this._isBigNumber = true;\n\n Object.freeze(this);\n }\n\n fromTwos(value: number): BigNumber {\n return toBigNumber(toBN(this).fromTwos(value));\n }\n\n toTwos(value: number): BigNumber {\n return toBigNumber(toBN(this).toTwos(value));\n }\n\n abs(): BigNumber {\n if (this._hex[0] === \"-\") {\n return BigNumber.from(this._hex.substring(1));\n }\n return this;\n }\n\n add(other: BigNumberish): BigNumber {\n return toBigNumber(toBN(this).add(toBN(other)));\n }\n\n sub(other: BigNumberish): BigNumber {\n return toBigNumber(toBN(this).sub(toBN(other)));\n }\n\n div(other: BigNumberish): BigNumber {\n const o = BigNumber.from(other);\n if (o.isZero()) {\n throwFault(\"division-by-zero\", \"div\");\n }\n return toBigNumber(toBN(this).div(toBN(other)));\n }\n\n mul(other: BigNumberish): BigNumber {\n return toBigNumber(toBN(this).mul(toBN(other)));\n }\n\n mod(other: BigNumberish): BigNumber {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"division-by-zero\", \"mod\");\n }\n return toBigNumber(toBN(this).umod(value));\n }\n\n pow(other: BigNumberish): BigNumber {\n const value = toBN(other);\n if (value.isNeg()) {\n throwFault(\"negative-power\", \"pow\");\n }\n return toBigNumber(toBN(this).pow(value));\n }\n\n and(other: BigNumberish): BigNumber {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"and\");\n }\n return toBigNumber(toBN(this).and(value));\n }\n\n or(other: BigNumberish): BigNumber {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"or\");\n }\n return toBigNumber(toBN(this).or(value));\n }\n\n xor(other: BigNumberish): BigNumber {\n const value = toBN(other);\n if (this.isNegative() || value.isNeg()) {\n throwFault(\"unbound-bitwise-result\", \"xor\");\n }\n return toBigNumber(toBN(this).xor(value));\n }\n\n mask(value: number): BigNumber {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"mask\");\n }\n return toBigNumber(toBN(this).maskn(value));\n }\n\n shl(value: number): BigNumber {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"shl\");\n }\n return toBigNumber(toBN(this).shln(value));\n }\n\n shr(value: number): BigNumber {\n if (this.isNegative() || value < 0) {\n throwFault(\"negative-width\", \"shr\");\n }\n return toBigNumber(toBN(this).shrn(value));\n }\n\n eq(other: BigNumberish): boolean {\n return toBN(this).eq(toBN(other));\n }\n\n lt(other: BigNumberish): boolean {\n return toBN(this).lt(toBN(other));\n }\n\n lte(other: BigNumberish): boolean {\n return toBN(this).lte(toBN(other));\n }\n\n gt(other: BigNumberish): boolean {\n return toBN(this).gt(toBN(other));\n }\n\n gte(other: BigNumberish): boolean {\n return toBN(this).gte(toBN(other));\n }\n\n isNegative(): boolean {\n return (this._hex[0] === \"-\");\n }\n\n isZero(): boolean {\n return toBN(this).isZero();\n }\n\n toNumber(): number {\n try {\n return toBN(this).toNumber();\n } catch (error) {\n throwFault(\"overflow\", \"toNumber\", this.toString());\n }\n return null;\n }\n\n toBigInt(): bigint {\n try {\n return BigInt(this.toString());\n } catch (e) { }\n\n return logger.throwError(\"this platform does not support BigInt\", Logger.errors.UNSUPPORTED_OPERATION, {\n value: this.toString()\n });\n }\n\n toString(): string {\n // Lots of people expect this, which we do not support, so check (See: #889)\n if (arguments.length > 0) {\n if (arguments[0] === 10) {\n if (!_warnedToStringRadix) {\n _warnedToStringRadix = true;\n logger.warn(\"BigNumber.toString does not accept any parameters; base-10 is assumed\");\n }\n } else if (arguments[0] === 16) {\n logger.throwError(\"BigNumber.toString does not accept any parameters; use bigNumber.toHexString()\", Logger.errors.UNEXPECTED_ARGUMENT, { });\n } else {\n logger.throwError(\"BigNumber.toString does not accept parameters\", Logger.errors.UNEXPECTED_ARGUMENT, { });\n }\n }\n return toBN(this).toString(10);\n }\n\n toHexString(): string {\n return this._hex;\n }\n\n toJSON(key?: string): any {\n return { type: \"BigNumber\", hex: this.toHexString() };\n }\n\n static from(value: any): BigNumber {\n if (value instanceof BigNumber) { return value; }\n\n if (typeof(value) === \"string\") {\n if (value.match(/^-?0x[0-9a-f]+$/i)) {\n return new BigNumber(_constructorGuard, toHex(value));\n }\n\n if (value.match(/^-?[0-9]+$/)) {\n return new BigNumber(_constructorGuard, toHex(new BN(value)));\n }\n\n return logger.throwArgumentError(\"invalid BigNumber string\", \"value\", value);\n }\n\n if (typeof(value) === \"number\") {\n if (value % 1) {\n throwFault(\"underflow\", \"BigNumber.from\", value);\n }\n\n if (value >= MAX_SAFE || value <= -MAX_SAFE) {\n throwFault(\"overflow\", \"BigNumber.from\", value);\n }\n\n return BigNumber.from(String(value));\n }\n\n const anyValue = <any>value;\n\n if (typeof(anyValue) === \"bigint\") {\n return BigNumber.from(anyValue.toString());\n }\n\n if (isBytes(anyValue)) {\n return BigNumber.from(hexlify(anyValue));\n }\n\n if (anyValue) {\n\n // Hexable interface (takes priority)\n if (anyValue.toHexString) {\n const hex = anyValue.toHexString();\n if (typeof(hex) === \"string\") {\n return BigNumber.from(hex);\n }\n\n } else {\n // For now, handle legacy JSON-ified values (goes away in v6)\n let hex = anyValue._hex;\n\n // New-form JSON\n if (hex == null && anyValue.type === \"BigNumber\") {\n hex = anyValue.hex;\n }\n\n if (typeof(hex) === \"string\") {\n if (isHexString(hex) || (hex[0] === \"-\" && isHexString(hex.substring(1)))) {\n return BigNumber.from(hex);\n }\n }\n }\n }\n\n return logger.throwArgumentError(\"invalid BigNumber value\", \"value\", value);\n }\n\n static isBigNumber(value: any): value is BigNumber {\n return !!(value && value._isBigNumber);\n }\n}\n\n// Normalize the hex string\nfunction toHex(value: string | BN): string {\n\n // For BN, call on the hex string\n if (typeof(value) !== \"string\") {\n return toHex(value.toString(16));\n }\n\n // If negative, prepend the negative sign to the normalized positive value\n if (value[0] === \"-\") {\n // Strip off the negative sign\n value = value.substring(1);\n\n // Cannot have multiple negative signs (e.g. \"--0x04\")\n if (value[0] === \"-\") { logger.throwArgumentError(\"invalid hex\", \"value\", value); }\n\n // Call toHex on the positive component\n value = toHex(value);\n\n // Do not allow \"-0x00\"\n if (value === \"0x00\") { return value; }\n\n // Negate the value\n return \"-\" + value;\n }\n\n // Add a \"0x\" prefix if missing\n if (value.substring(0, 2) !== \"0x\") { value = \"0x\" + value; }\n\n // Normalize zero\n if (value === \"0x\") { return \"0x00\"; }\n\n // Make the string even length\n if (value.length % 2) { value = \"0x0\" + value.substring(2); }\n\n // Trim to smallest even-length string\n while (value.length > 4 && value.substring(0, 4) === \"0x00\") {\n value = \"0x\" + value.substring(4);\n }\n\n return value;\n}\n\nfunction toBigNumber(value: BN): BigNumber {\n return BigNumber.from(toHex(value));\n}\n\nfunction toBN(value: BigNumberish): BN {\n const hex = BigNumber.from(value).toHexString();\n if (hex[0] === \"-\") {\n return (new BN(\"-\" + hex.substring(3), 16));\n }\n return new BN(hex.substring(2), 16);\n}\n\nfunction throwFault(fault: string, operation: string, value?: any): never {\n const params: any = { fault: fault, operation: operation };\n if (value != null) { params.value = value; }\n\n return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params);\n}\n\n// value should have no prefix\nexport function _base36To16(value: string): string {\n return (new BN(value, 36)).toString(16);\n}\n\n// value should have no prefix\nexport function _base16To36(value: string): string {\n return (new BN(value, 16)).toString(36);\n}\n","\"use strict\";\n\nimport { arrayify, BytesLike, hexZeroPad, isBytes } from \"@ethersproject/bytes\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { BigNumber, BigNumberish, isBigNumberish } from \"./bignumber\";\n\nconst _constructorGuard = { };\n\nconst Zero = BigNumber.from(0);\nconst NegativeOne = BigNumber.from(-1);\n\nfunction throwFault(message: string, fault: string, operation: string, value?: any): never {\n const params: any = { fault: fault, operation: operation };\n if (value !== undefined) { params.value = value; }\n return logger.throwError(message, Logger.errors.NUMERIC_FAULT, params);\n}\n\n// Constant to pull zeros from for multipliers\nlet zeros = \"0\";\nwhile (zeros.length < 256) { zeros += zeros; }\n\n// Returns a string \"1\" followed by decimal \"0\"s\nfunction getMultiplier(decimals: BigNumberish): string {\n\n if (typeof(decimals) !== \"number\") {\n try {\n decimals = BigNumber.from(decimals).toNumber();\n } catch (e) { }\n }\n\n if (typeof(decimals) === \"number\" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {\n return (\"1\" + zeros.substring(0, decimals));\n }\n\n return logger.throwArgumentError(\"invalid decimal size\", \"decimals\", decimals);\n}\n\nexport function formatFixed(value: BigNumberish, decimals?: string | BigNumberish): string {\n if (decimals == null) { decimals = 0; }\n const multiplier = getMultiplier(decimals);\n\n // Make sure wei is a big number (convert as necessary)\n value = BigNumber.from(value);\n\n const negative = value.lt(Zero);\n if (negative) { value = value.mul(NegativeOne); }\n\n let fraction = value.mod(multiplier).toString();\n while (fraction.length < multiplier.length - 1) { fraction = \"0\" + fraction; }\n\n // Strip training 0\n fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];\n\n const whole = value.div(multiplier).toString();\n if (multiplier.length === 1) {\n value = whole;\n } else {\n value = whole + \".\" + fraction;\n }\n\n if (negative) { value = \"-\" + value; }\n\n return value;\n}\n\nexport function parseFixed(value: string, decimals?: BigNumberish): BigNumber {\n\n if (decimals == null) { decimals = 0; }\n const multiplier = getMultiplier(decimals);\n\n if (typeof(value) !== \"string\" || !value.match(/^-?[0-9.]+$/)) {\n logger.throwArgumentError(\"invalid decimal value\", \"value\", value);\n }\n\n // Is it negative?\n const negative = (value.substring(0, 1) === \"-\");\n if (negative) { value = value.substring(1); }\n\n if (value === \".\") {\n logger.throwArgumentError(\"missing value\", \"value\", value);\n }\n\n // Split it into a whole and fractional part\n const comps = value.split(\".\");\n if (comps.length > 2) {\n logger.throwArgumentError(\"too many decimal points\", \"value\", value);\n }\n\n let whole = comps[0], fraction = comps[1];\n if (!whole) { whole = \"0\"; }\n if (!fraction) { fraction = \"0\"; }\n\n // Trim trailing zeros\n while (fraction[fraction.length - 1] === \"0\") {\n fraction = fraction.substring(0, fraction.length - 1);\n }\n\n // Check the fraction doesn't exceed our decimals size\n if (fraction.length > multiplier.length - 1) {\n throwFault(\"fractional component exceeds decimals\", \"underflow\", \"parseFixed\");\n }\n\n // If decimals is 0, we have an empty string for fraction\n if (fraction === \"\") { fraction = \"0\"; }\n\n // Fully pad the string with zeros to get to wei\n while (fraction.length < multiplier.length - 1) { fraction += \"0\"; }\n\n const wholeValue = BigNumber.from(whole);\n const fractionValue = BigNumber.from(fraction);\n\n let wei = (wholeValue.mul(multiplier)).add(fractionValue);\n\n if (negative) { wei = wei.mul(NegativeOne); }\n\n return wei;\n}\n\n\nexport class FixedFormat {\n readonly signed: boolean;\n readonly width: number;\n readonly decimals: number;\n readonly name: string;\n readonly _multiplier: string;\n\n constructor(constructorGuard: any, signed: boolean, width: number, decimals: number) {\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot use FixedFormat constructor; use FixedFormat.from\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new FixedFormat\"\n });\n }\n\n this.signed = signed;\n this.width = width;\n this.decimals = decimals;\n\n this.name = (signed ? \"\": \"u\") + \"fixed\" + String(width) + \"x\" + String(decimals);\n\n this._multiplier = getMultiplier(decimals);\n\n Object.freeze(this);\n }\n\n static from(value: any): FixedFormat {\n if (value instanceof FixedFormat) { return value; }\n\n if (typeof(value) === \"number\") {\n value = `fixed128x${value}`\n }\n\n let signed = true;\n let width = 128;\n let decimals = 18;\n\n if (typeof(value) === \"string\") {\n if (value === \"fixed\") {\n // defaults...\n } else if (value === \"ufixed\") {\n signed = false;\n } else {\n const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);\n if (!match) { logger.throwArgumentError(\"invalid fixed format\", \"format\", value); }\n signed = (match[1] !== \"u\");\n width = parseInt(match[2]);\n decimals = parseInt(match[3]);\n }\n } else if (value) {\n const check = (key: string, type: string, defaultValue: any): any => {\n if (value[key] == null) { return defaultValue; }\n if (typeof(value[key]) !== type) {\n logger.throwArgumentError(\"invalid fixed format (\" + key + \" not \" + type +\")\", \"format.\" + key, value[key]);\n }\n return value[key];\n }\n signed = check(\"signed\", \"boolean\", signed);\n width = check(\"width\", \"number\", width);\n decimals = check(\"decimals\", \"number\", decimals);\n }\n\n if (width % 8) {\n logger.throwArgumentError(\"invalid fixed format width (not byte aligned)\", \"format.width\", width);\n }\n\n if (decimals > 80) {\n logger.throwArgumentError(\"invalid fixed format (decimals too large)\", \"format.decimals\", decimals);\n }\n\n return new FixedFormat(_constructorGuard, signed, width, decimals);\n }\n}\n\nexport class FixedNumber {\n readonly format: FixedFormat;\n readonly _hex: string;\n readonly _value: string;\n\n readonly _isFixedNumber: boolean;\n\n constructor(constructorGuard: any, hex: string, value: string, format?: FixedFormat) {\n logger.checkNew(new.target, FixedNumber);\n\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"cannot use FixedNumber constructor; use FixedNumber.from\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new FixedFormat\"\n });\n }\n\n this.format = format;\n this._hex = hex;\n this._value = value;\n\n this._isFixedNumber = true;\n\n Object.freeze(this);\n }\n\n _checkFormat(other: FixedNumber): void {\n if (this.format.name !== other.format.name) {\n logger.throwArgumentError(\"incompatible format; use fixedNumber.toFormat\", \"other\", other);\n }\n }\n\n addUnsafe(other: FixedNumber): FixedNumber {\n this._checkFormat(other);\n const a = parseFixed(this._value, this.format.decimals);\n const b = parseFixed(other._value, other.format.decimals);\n return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);\n }\n\n subUnsafe(other: FixedNumber): FixedNumber {\n this._checkFormat(other);\n const a = parseFixed(this._value, this.format.decimals);\n const b = parseFixed(other._value, other.format.decimals);\n return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);\n }\n\n mulUnsafe(other: FixedNumber): FixedNumber {\n this._checkFormat(other);\n const a = parseFixed(this._value, this.format.decimals);\n const b = parseFixed(other._value, other.format.decimals);\n return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);\n }\n\n divUnsafe(other: FixedNumber): FixedNumber {\n this._checkFormat(other);\n const a = parseFixed(this._value, this.format.decimals);\n const b = parseFixed(other._value, other.format.decimals);\n return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);\n }\n\n floor(): FixedNumber {\n const comps = this.toString().split(\".\");\n if (comps.length === 1) { comps.push(\"0\"); }\n\n let result = FixedNumber.from(comps[0], this.format);\n\n const hasFraction = !comps[1].match(/^(0*)$/);\n if (this.isNegative() && hasFraction) {\n result = result.subUnsafe(ONE.toFormat(result.format));\n }\n\n return result;\n }\n\n ceiling(): FixedNumber {\n const comps = this.toString().split(\".\");\n if (comps.length === 1) { comps.push(\"0\"); }\n\n let result = FixedNumber.from(comps[0], this.format);\n\n const hasFraction = !comps[1].match(/^(0*)$/);\n if (!this.isNegative() && hasFraction) {\n result = result.addUnsafe(ONE.toFormat(result.format));\n }\n\n return result;\n }\n\n // @TODO: Support other rounding algorithms\n round(decimals?: number): FixedNumber {\n if (decimals == null) { decimals = 0; }\n\n // If we are already in range, we're done\n const comps = this.toString().split(\".\");\n if (comps.length === 1) { comps.push(\"0\"); }\n\n if (decimals < 0 || decimals > 80 || (decimals % 1)) {\n logger.throwArgumentError(\"invalid decimal count\", \"decimals\", decimals);\n }\n\n if (comps[1].length <= decimals) { return this; }\n\n const factor = FixedNumber.from(\"1\" + zeros.substring(0, decimals), this.format);\n const bump = BUMP.toFormat(this.format);\n\n return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor);\n }\n\n isZero(): boolean {\n return (this._value === \"0.0\" || this._value === \"0\");\n }\n\n isNegative(): boolean {\n return (this._value[0] === \"-\");\n }\n\n toString(): string { return this._value; }\n\n toHexString(width?: number): string {\n if (width == null) { return this._hex; }\n if (width % 8) { logger.throwArgumentError(\"invalid byte width\", \"width\", width); }\n const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();\n return hexZeroPad(hex, width / 8);\n }\n\n toUnsafeFloat(): number { return parseFloat(this.toString()); }\n\n toFormat(format: FixedFormat | string): FixedNumber {\n return FixedNumber.fromString(this._value, format);\n }\n\n\n static fromValue(value: BigNumber, decimals?: BigNumberish, format?: FixedFormat | string | number): FixedNumber {\n // If decimals looks more like a format, and there is no format, shift the parameters\n if (format == null && decimals != null && !isBigNumberish(decimals)) {\n format = decimals;\n decimals = null;\n }\n\n if (decimals == null) { decimals = 0; }\n if (format == null) { format = \"fixed\"; }\n\n return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));\n }\n\n\n static fromString(value: string, format?: FixedFormat | string | number): FixedNumber {\n if (format == null) { format = \"fixed\"; }\n\n const fixedFormat = FixedFormat.from(format);\n\n const numeric = parseFixed(value, fixedFormat.decimals);\n\n if (!fixedFormat.signed && numeric.lt(Zero)) {\n throwFault(\"unsigned value cannot be negative\", \"overflow\", \"value\", value);\n }\n\n let hex: string = null;\n if (fixedFormat.signed) {\n hex = numeric.toTwos(fixedFormat.width).toHexString();\n } else {\n hex = numeric.toHexString();\n hex = hexZeroPad(hex, fixedFormat.width / 8);\n }\n\n const decimal = formatFixed(numeric, fixedFormat.decimals);\n\n return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);\n }\n\n static fromBytes(value: BytesLike, format?: FixedFormat | string | number): FixedNumber {\n if (format == null) { format = \"fixed\"; }\n\n const fixedFormat = FixedFormat.from(format);\n\n if (arrayify(value).length > fixedFormat.width / 8) {\n throw new Error(\"overflow\");\n }\n\n let numeric = BigNumber.from(value);\n if (fixedFormat.signed) { numeric = numeric.fromTwos(fixedFormat.width); }\n\n const hex = numeric.toTwos((fixedFormat.signed ? 0: 1) + fixedFormat.width).toHexString();\n const decimal = formatFixed(numeric, fixedFormat.decimals);\n\n return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);\n }\n\n static from(value: any, format?: FixedFormat | string | number) {\n if (typeof(value) === \"string\") {\n return FixedNumber.fromString(value, format);\n }\n\n if (isBytes(value)) {\n return FixedNumber.fromBytes(value, format);\n }\n\n try {\n return FixedNumber.fromValue(value, 0, format);\n } catch (error) {\n // Allow NUMERIC_FAULT to bubble up\n if (error.code !== Logger.errors.INVALID_ARGUMENT) {\n throw error;\n }\n }\n\n return logger.throwArgumentError(\"invalid FixedNumber value\", \"value\", value);\n }\n\n static isFixedNumber(value: any): value is FixedNumber {\n return !!(value && value._isFixedNumber);\n }\n}\n\nconst ONE = FixedNumber.from(1);\nconst BUMP = FixedNumber.from(\"0.5\");\n","export { BigNumber, BigNumberish } from \"./bignumber\";\nexport { formatFixed, FixedFormat, FixedNumber, parseFixed } from \"./fixednumber\";\n\n// Internal methods used by address\nexport { _base16To36, _base36To16 } from \"./bignumber\";\n","export const version = \"properties/5.6.0\";\n","\"use strict\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nexport function defineReadOnly<T, K extends keyof T>(object: T, name: K, value: T[K]): void {\n Object.defineProperty(object, name, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n\n// Crawl up the constructor chain to find a static method\nexport function getStatic<T>(ctor: any, key: string): T {\n for (let i = 0; i < 32; i++) {\n if (ctor[key]) { return ctor[key]; }\n if (!ctor.prototype || typeof(ctor.prototype) !== \"object\") { break; }\n ctor = Object.getPrototypeOf(ctor.prototype).constructor;\n }\n return null;\n}\n\nexport type Deferrable<T> = {\n [ K in keyof T ]: T[K] | Promise<T[K]>;\n}\n\n\ntype Result = { key: string, value: any};\n\nexport async function resolveProperties<T>(object: Readonly<Deferrable<T>>): Promise<T> {\n const promises: Array<Promise<Result>> = Object.keys(object).map((key) => {\n const value = object[<keyof Deferrable<T>>key];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return results.reduce((accum, result) => {\n accum[<keyof T>(result.key)] = result.value;\n return accum;\n }, <T>{ });\n}\n\nexport function checkProperties(object: any, properties: { [ name: string ]: boolean }): void {\n if (!object || typeof(object) !== \"object\") {\n logger.throwArgumentError(\"invalid object\", \"object\", object);\n }\n\n Object.keys(object).forEach((key) => {\n if (!properties[key]) {\n logger.throwArgumentError(\"invalid object key - \" + key, \"transaction:\" + key, object);\n }\n });\n}\n\nexport function shallowCopy<T>(object: T): T {\n const result: any = {};\n for (const key in object) { result[key] = object[key]; }\n return result;\n}\n\nconst opaque: { [key: string]: boolean } = { bigint: true, boolean: true, \"function\": true, number: true, string: true };\n\nfunction _isFrozen(object: any): boolean {\n\n // Opaque objects are not mutable, so safe to copy by assignment\n if (object === undefined || object === null || opaque[typeof(object)]) { return true; }\n\n if (Array.isArray(object) || typeof(object) === \"object\") {\n if (!Object.isFrozen(object)) { return false; }\n\n const keys = Object.keys(object);\n for (let i = 0; i < keys.length; i++) {\n let value: any = null;\n try {\n value = object[keys[i]];\n } catch (error) {\n // If accessing a value triggers an error, it is a getter\n // designed to do so (e.g. Result) and is therefore \"frozen\"\n continue;\n }\n\n if (!_isFrozen(value)) { return false; }\n }\n\n return true;\n }\n\n return logger.throwArgumentError(`Cannot deepCopy ${ typeof(object) }`, \"object\", object);\n}\n\n// Returns a new copy of object, such that no properties may be replaced.\n// New properties may be added only to objects.\nfunction _deepCopy(object: any): any {\n\n if (_isFrozen(object)) { return object; }\n\n // Arrays are mutable, so we need to create a copy\n if (Array.isArray(object)) {\n return Object.freeze(object.map((item) => deepCopy(item)));\n }\n\n if (typeof(object) === \"object\") {\n const result: { [ key: string ]: any } = {};\n for (const key in object) {\n const value = object[key];\n if (value === undefined) { continue; }\n defineReadOnly(result, key, deepCopy(value));\n }\n\n return result;\n }\n\n return logger.throwArgumentError(`Cannot deepCopy ${ typeof(object) }`, \"object\", object);\n}\n\nexport function deepCopy<T>(object: T): T {\n return _deepCopy(object);\n}\n\nexport class Description<T = any> {\n constructor(info: { [ K in keyof T ]: T[K] }) {\n for (const key in info) {\n (<any>this)[key] = deepCopy(info[key]);\n }\n }\n}\n","export const version = \"abi/5.6.1\";\n","\"use strict\";\n\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nexport interface JsonFragmentType {\n readonly name?: string;\n readonly indexed?: boolean;\n readonly type?: string;\n readonly internalType?: any; // @TODO: in v6 reduce type\n readonly components?: ReadonlyArray<JsonFragmentType>;\n}\n\nexport interface JsonFragment {\n readonly name?: string;\n readonly type?: string;\n\n readonly anonymous?: boolean;\n\n readonly payable?: boolean;\n readonly constant?: boolean;\n readonly stateMutability?: string;\n\n readonly inputs?: ReadonlyArray<JsonFragmentType>;\n readonly outputs?: ReadonlyArray<JsonFragmentType>;\n\n readonly gas?: string;\n};\n\nconst _constructorGuard = { };\n\n// AST Node parser state\ntype ParseState = {\n allowArray?: boolean,\n allowName?: boolean,\n allowParams?: boolean,\n allowType?: boolean,\n readArray?: boolean,\n};\n\n// AST Node\ntype ParseNode = {\n parent?: any,\n type?: string,\n name?: string,\n state?: ParseState,\n indexed?: boolean,\n components?: Array<ParseNode>\n};\n\nlet ModifiersBytes: { [ name: string ]: boolean } = { calldata: true, memory: true, storage: true };\nlet ModifiersNest: { [ name: string ]: boolean } = { calldata: true, memory: true };\nfunction checkModifier(type: string, name: string): boolean {\n if (type === \"bytes\" || type === \"string\") {\n if (ModifiersBytes[name]) { return true; }\n } else if (type === \"address\") {\n if (name === \"payable\") { return true; }\n } else if (type.indexOf(\"[\") >= 0 || type === \"tuple\") {\n if (ModifiersNest[name]) { return true; }\n }\n if (ModifiersBytes[name] || name === \"payable\") {\n logger.throwArgumentError(\"invalid modifier\", \"name\", name);\n }\n return false;\n}\n\n// @TODO: Make sure that children of an indexed tuple are marked with a null indexed\nfunction parseParamType(param: string, allowIndexed: boolean): ParseNode {\n\n let originalParam = param;\n function throwError(i: number) {\n logger.throwArgumentError(`unexpected character at position ${ i }`, \"param\", param);\n }\n param = param.replace(/\\s/g, \" \");\n\n function newNode(parent: ParseNode): ParseNode {\n let node: ParseNode = { type: \"\", name: \"\", parent: parent, state: { allowType: true } };\n if (allowIndexed) { node.indexed = false; }\n return node\n }\n\n let parent: ParseNode = { type: \"\", name: \"\", state: { allowType: true } };\n let node = parent;\n\n for (let i = 0; i < param.length; i++) {\n let c = param[i];\n switch (c) {\n case \"(\":\n if (node.state.allowType && node.type === \"\") {\n node.type = \"tuple\";\n } else if (!node.state.allowParams) {\n throwError(i);\n }\n node.state.allowType = false;\n node.type = verifyType(node.type);\n node.components = [ newNode(node) ];\n node = node.components[0];\n break;\n\n case \")\":\n delete node.state;\n\n if (node.name === \"indexed\") {\n if (!allowIndexed) { throwError(i); }\n node.indexed = true;\n node.name = \"\";\n }\n\n if (checkModifier(node.type, node.name)) { node.name = \"\"; }\n\n node.type = verifyType(node.type);\n\n let 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\n if (node.name === \"indexed\") {\n if (!allowIndexed) { throwError(i); }\n node.indexed = true;\n node.name = \"\";\n }\n\n if (checkModifier(node.type, node.name)) { node.name = \"\"; }\n\n node.type = verifyType(node.type);\n\n let sibling: ParseNode = newNode(node.parent);\n //{ 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 (node.name === \"indexed\") {\n if (!allowIndexed) { throwError(i); }\n if (node.indexed) { throwError(i); }\n node.indexed = true;\n node.name = \"\";\n } else if (checkModifier(node.type, node.name)) {\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) { logger.throwArgumentError(\"unexpected eof\", \"param\", param); }\n\n delete parent.state;\n\n if (node.name === \"indexed\") {\n if (!allowIndexed) { throwError(originalParam.length - 7); }\n if (node.indexed) { throwError(originalParam.length - 7); }\n node.indexed = true;\n node.name = \"\";\n } else if (checkModifier(node.type, node.name)) {\n node.name = \"\";\n }\n\n parent.type = verifyType(parent.type);\n\n return parent;\n}\n\nfunction populate(object: any, params: any) {\n for (let key in params) { defineReadOnly(object, key, params[key]); }\n}\n\nexport const FormatTypes: { [ name: string ]: string } = Object.freeze({\n // Bare formatting, as is needed for computing a sighash of an event or function\n sighash: \"sighash\",\n\n // Human-Readable with Minimal spacing and without names (compact human-readable)\n minimal: \"minimal\",\n\n // Human-Readable with nice spacing, including all names\n full: \"full\",\n\n // JSON-format a la Solidity\n json: \"json\"\n});\n\nconst paramTypeArray = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\n\nexport class ParamType {\n\n // The local name of the parameter (of null if unbound)\n readonly name: string;\n\n // The fully qualified type (e.g. \"address\", \"tuple(address)\", \"uint256[3][]\"\n readonly type: string;\n\n // The base type (e.g. \"address\", \"tuple\", \"array\")\n readonly baseType: string;\n\n // Indexable Paramters ONLY (otherwise null)\n readonly indexed: boolean;\n\n // Tuples ONLY: (otherwise null)\n // - sub-components\n readonly components: Array<ParamType>;\n\n // Arrays ONLY: (otherwise null)\n // - length of the array (-1 for dynamic length)\n // - child type\n readonly arrayLength: number;\n readonly arrayChildren: ParamType;\n\n readonly _isParamType: boolean;\n\n constructor(constructorGuard: any, params: any) {\n if (constructorGuard !== _constructorGuard) { logger.throwError(\"use fromString\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new ParamType()\"\n }); }\n populate(this, params);\n\n let match = this.type.match(paramTypeArray);\n if (match) {\n populate(this, {\n arrayLength: parseInt(match[2] || \"-1\"),\n arrayChildren: ParamType.fromObject({\n type: match[1],\n components: this.components\n }),\n baseType: \"array\"\n });\n } else {\n populate(this, {\n arrayLength: null,\n arrayChildren: null,\n baseType: ((this.components != null) ? \"tuple\": this.type)\n });\n }\n\n this._isParamType = true;\n\n Object.freeze(this);\n }\n\n // Format the parameter fragment\n // - sighash: \"(uint256,address)\"\n // - minimal: \"tuple(uint256,address) indexed\"\n // - full: \"tuple(uint256 foo, address bar) indexed baz\"\n format(format?: string): string {\n if (!format) { format = FormatTypes.sighash; }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n\n if (format === FormatTypes.json) {\n let result: any = {\n type: ((this.baseType === \"tuple\") ? \"tuple\": this.type),\n name: (this.name || undefined)\n };\n if (typeof(this.indexed) === \"boolean\") { result.indexed = this.indexed; }\n if (this.components) {\n result.components = this.components.map((comp) => JSON.parse(comp.format(format)));\n }\n return JSON.stringify(result);\n }\n\n let result = \"\";\n\n // Array\n if (this.baseType === \"array\") {\n result += this.arrayChildren.format(format);\n result += \"[\" + (this.arrayLength < 0 ? \"\": String(this.arrayLength)) + \"]\";\n } else {\n if (this.baseType === \"tuple\") {\n if (format !== FormatTypes.sighash) {\n result += this.type;\n }\n result += \"(\" + this.components.map(\n (comp) => comp.format(format)\n ).join((format === FormatTypes.full) ? \", \": \",\") + \")\";\n } else {\n result += this.type;\n }\n }\n\n if (format !== FormatTypes.sighash) {\n if (this.indexed === true) { result += \" indexed\"; }\n if (format === FormatTypes.full && this.name) {\n result += \" \" + this.name;\n }\n }\n\n return result;\n }\n\n static from(value: string | JsonFragmentType | ParamType, allowIndexed?: boolean): ParamType {\n if (typeof(value) === \"string\") {\n return ParamType.fromString(value, allowIndexed);\n }\n return ParamType.fromObject(value);\n }\n\n static fromObject(value: JsonFragmentType | ParamType): ParamType {\n if (ParamType.isParamType(value)) { return value; }\n\n return new ParamType(_constructorGuard, {\n name: (value.name || null),\n type: verifyType(value.type),\n indexed: ((value.indexed == null) ? null: !!value.indexed),\n components: (value.components ? value.components.map(ParamType.fromObject): null)\n });\n }\n\n static fromString(value: string, allowIndexed?: boolean): ParamType {\n function ParamTypify(node: ParseNode): ParamType {\n return ParamType.fromObject({\n name: node.name,\n type: node.type,\n indexed: node.indexed,\n components: node.components\n });\n }\n\n return ParamTypify(parseParamType(value, !!allowIndexed));\n }\n\n static isParamType(value: any): value is ParamType {\n return !!(value != null && value._isParamType);\n }\n};\n\nfunction parseParams(value: string, allowIndex: boolean): Array<ParamType> {\n return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex));\n}\n\ntype TypeCheck<T> = { -readonly [ K in keyof T ]: T[K] };\n\ninterface _Fragment {\n readonly type: string;\n readonly name: string;\n readonly inputs: ReadonlyArray<ParamType>;\n}\n\nexport abstract class Fragment {\n\n readonly type: string;\n readonly name: string;\n readonly inputs: Array<ParamType>;\n\n readonly _isFragment: boolean;\n\n constructor(constructorGuard: any, params: any) {\n if (constructorGuard !== _constructorGuard) {\n logger.throwError(\"use a static from method\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new Fragment()\"\n });\n }\n populate(this, params);\n\n this._isFragment = true;\n\n Object.freeze(this);\n }\n\n abstract format(format?: string): string;\n\n static from(value: Fragment | JsonFragment | string): Fragment {\n if (Fragment.isFragment(value)) { return value; }\n\n if (typeof(value) === \"string\") {\n return Fragment.fromString(value);\n }\n\n return Fragment.fromObject(value);\n }\n\n static fromObject(value: Fragment | JsonFragment): Fragment {\n if (Fragment.isFragment(value)) { return value; }\n\n switch (value.type) {\n case \"function\":\n return FunctionFragment.fromObject(value);\n case \"event\":\n return EventFragment.fromObject(value);\n case \"constructor\":\n return ConstructorFragment.fromObject(value);\n case \"error\":\n return ErrorFragment.fromObject(value);\n case \"fallback\":\n case \"receive\":\n // @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?\n return null;\n }\n\n return logger.throwArgumentError(\"invalid fragment object\", \"value\", value);\n }\n\n static fromString(value: string): Fragment {\n // Make sure the \"returns\" is surrounded by a space and all whitespace is exactly one space\n value = value.replace(/\\s/g, \" \");\n value = value.replace(/\\(/g, \" (\").replace(/\\)/g, \") \").replace(/\\s+/g, \" \");\n value = value.trim();\n\n if (value.split(\" \")[0] === \"event\") {\n return EventFragment.fromString(value.substring(5).trim());\n } else if (value.split(\" \")[0] === \"function\") {\n return FunctionFragment.fromString(value.substring(8).trim());\n } else if (value.split(\"(\")[0].trim() === \"constructor\") {\n return ConstructorFragment.fromString(value.trim());\n } else if (value.split(\" \")[0] === \"error\") {\n return ErrorFragment.fromString(value.substring(5).trim());\n }\n\n return logger.throwArgumentError(\"unsupported fragment\", \"value\", value);\n }\n\n static isFragment(value: any): value is Fragment {\n return !!(value && value._isFragment);\n }\n}\n\ninterface _EventFragment extends _Fragment {\n readonly anonymous: boolean;\n}\n\nexport class EventFragment extends Fragment {\n readonly anonymous: boolean;\n\n format(format?: string): string {\n if (!format) { format = FormatTypes.sighash; }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format)))\n });\n }\n\n let result = \"\";\n\n if (format !== FormatTypes.sighash) {\n result += \"event \";\n }\n\n result += this.name + \"(\" + this.inputs.map(\n (input) => input.format(format)\n ).join((format === FormatTypes.full) ? \", \": \",\") + \") \";\n\n if (format !== FormatTypes.sighash) {\n if (this.anonymous) {\n result += \"anonymous \";\n }\n }\n\n return result.trim();\n }\n\n static from(value: EventFragment | JsonFragment | string): EventFragment {\n if (typeof(value) === \"string\") {\n return EventFragment.fromString(value);\n }\n return EventFragment.fromObject(value);\n }\n\n static fromObject(value: JsonFragment | EventFragment): EventFragment {\n if (EventFragment.isEventFragment(value)) { return value; }\n\n if (value.type !== \"event\") {\n logger.throwArgumentError(\"invalid event object\", \"value\", value);\n }\n\n const params: TypeCheck<_EventFragment> = {\n name: verifyIdentifier(value.name),\n anonymous: value.anonymous,\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),\n type: \"event\"\n };\n\n return new EventFragment(_constructorGuard, params);\n }\n\n static fromString(value: string): EventFragment {\n\n let match = value.match(regexParen);\n if (!match) {\n logger.throwArgumentError(\"invalid event string\", \"value\", value);\n }\n\n let anonymous = false;\n match[3].split(\" \").forEach((modifier) => {\n switch(modifier.trim()) {\n case \"anonymous\":\n anonymous = true;\n break;\n case \"\":\n break;\n default:\n logger.warn(\"unknown modifier: \" + modifier);\n }\n });\n\n return EventFragment.fromObject({\n name: match[1].trim(),\n anonymous: anonymous,\n inputs: parseParams(match[2], true),\n type: \"event\"\n });\n }\n\n static isEventFragment(value: any): value is EventFragment {\n return (value && value._isFragment && value.type === \"event\");\n }\n}\n\nfunction parseGas(value: string, params: any): string {\n params.gas = null;\n\n let comps = value.split(\"@\");\n if (comps.length !== 1) {\n if (comps.length > 2) {\n logger.throwArgumentError(\"invalid human-readable ABI signature\", \"value\", value);\n }\n if (!comps[1].match(/^[0-9]+$/)) {\n logger.throwArgumentError(\"invalid human-readable ABI signature gas\", \"value\", value);\n }\n params.gas = BigNumber.from(comps[1]);\n return comps[0];\n }\n\n return value;\n}\n\nfunction parseModifiers(value: string, params: any): void {\n params.constant = false;\n params.payable = false;\n params.stateMutability = \"nonpayable\";\n\n value.split(\" \").forEach((modifier) => {\n switch (modifier.trim()) {\n case \"constant\":\n params.constant = true;\n break;\n case \"payable\":\n params.payable = true;\n params.stateMutability = \"payable\";\n break;\n case \"nonpayable\":\n params.payable = false;\n params.stateMutability = \"nonpayable\";\n break;\n case \"pure\":\n params.constant = true;\n params.stateMutability = \"pure\";\n break;\n case \"view\":\n params.constant = true;\n params.stateMutability = \"view\";\n break;\n case \"external\":\n case \"public\":\n case \"\":\n break;\n default:\n console.log(\"unknown modifier: \" + modifier);\n }\n });\n}\n\ntype StateInputValue = {\n constant?: boolean;\n payable?: boolean;\n stateMutability?: string;\n type?: string;\n};\n\ntype StateOutputValue = {\n constant: boolean;\n payable: boolean;\n stateMutability: string;\n};\n\nfunction verifyState(value: StateInputValue): StateOutputValue {\n let result: any = {\n constant: false,\n payable: true,\n stateMutability: \"payable\"\n };\n\n if (value.stateMutability != null) {\n result.stateMutability = value.stateMutability;\n\n // Set (and check things are consistent) the constant property\n result.constant = (result.stateMutability === \"view\" || result.stateMutability === \"pure\");\n if (value.constant != null) {\n if ((!!value.constant) !== result.constant) {\n logger.throwArgumentError(\"cannot have constant function with mutability \" + result.stateMutability, \"value\", value);\n }\n }\n\n // Set (and check things are consistent) the payable property\n result.payable = (result.stateMutability === \"payable\");\n if (value.payable != null) {\n if ((!!value.payable) !== result.payable) {\n logger.throwArgumentError(\"cannot have payable function with mutability \" + result.stateMutability, \"value\", value);\n }\n }\n\n } else if (value.payable != null) {\n result.payable = !!value.payable;\n\n // If payable we can assume non-constant; otherwise we can't assume\n if (value.constant == null && !result.payable && value.type !== \"constructor\") {\n logger.throwArgumentError(\"unable to determine stateMutability\", \"value\", value);\n }\n\n result.constant = !!value.constant;\n\n if (result.constant) {\n result.stateMutability = \"view\";\n } else {\n result.stateMutability = (result.payable ? \"payable\": \"nonpayable\");\n }\n\n if (result.payable && result.constant) {\n logger.throwArgumentError(\"cannot have constant payable function\", \"value\", value);\n }\n\n } else if (value.constant != null) {\n result.constant = !!value.constant;\n result.payable = !result.constant;\n result.stateMutability = (result.constant ? \"view\": \"payable\");\n\n } else if (value.type !== \"constructor\") {\n logger.throwArgumentError(\"unable to determine stateMutability\", \"value\", value);\n }\n\n return result;\n}\n\ninterface _ConstructorFragment extends _Fragment {\n stateMutability: string;\n payable: boolean;\n gas?: BigNumber;\n}\n\nexport class ConstructorFragment extends Fragment {\n stateMutability: string;\n payable: boolean;\n gas?: BigNumber;\n\n format(format?: string): string {\n if (!format) { format = FormatTypes.sighash; }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability: undefined),\n payable: this.payable,\n gas: (this.gas ? this.gas.toNumber(): undefined),\n inputs: this.inputs.map((input) => JSON.parse(input.format(format)))\n });\n }\n\n if (format === FormatTypes.sighash) {\n logger.throwError(\"cannot format a constructor for sighash\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"format(sighash)\"\n });\n }\n\n let result = \"constructor(\" + this.inputs.map(\n (input) => input.format(format)\n ).join((format === FormatTypes.full) ? \", \": \",\") + \") \";\n\n if (this.stateMutability && this.stateMutability !== \"nonpayable\") {\n result += this.stateMutability + \" \";\n }\n\n return result.trim();\n }\n\n static from(value: ConstructorFragment | JsonFragment | string): ConstructorFragment {\n if (typeof(value) === \"string\") {\n return ConstructorFragment.fromString(value);\n }\n return ConstructorFragment.fromObject(value);\n }\n\n static fromObject(value: ConstructorFragment | JsonFragment): ConstructorFragment {\n if (ConstructorFragment.isConstructorFragment(value)) { return value; }\n\n if (value.type !== \"constructor\") {\n logger.throwArgumentError(\"invalid constructor object\", \"value\", value);\n }\n\n let state = verifyState(value);\n if (state.constant) {\n logger.throwArgumentError(\"constructor cannot be constant\", \"value\", value);\n }\n\n const params: TypeCheck<_ConstructorFragment> = {\n name: null,\n type: value.type,\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject): []),\n payable: state.payable,\n stateMutability: state.stateMutability,\n gas: (value.gas ? BigNumber.from(value.gas): null)\n };\n\n return new ConstructorFragment(_constructorGuard, params);\n }\n\n static fromString(value: string): ConstructorFragment {\n let params: any = { type: \"constructor\" };\n\n value = parseGas(value, params);\n\n let parens = value.match(regexParen);\n if (!parens || parens[1].trim() !== \"constructor\") {\n logger.throwArgumentError(\"invalid constructor string\", \"value\", value);\n }\n\n params.inputs = parseParams(parens[2].trim(), false);\n\n parseModifiers(parens[3].trim(), params);\n\n return ConstructorFragment.fromObject(params);\n }\n\n static isConstructorFragment(value: any): value is ConstructorFragment {\n return (value && value._isFragment && value.type === \"constructor\");\n }\n}\n\ninterface _FunctionFragment extends _ConstructorFragment {\n constant: boolean;\n outputs?: Array<ParamType>;\n}\n\nexport class FunctionFragment extends ConstructorFragment {\n constant: boolean;\n outputs?: Array<ParamType>;\n\n format(format?: string): string {\n if (!format) { format = FormatTypes.sighash; }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability: undefined),\n payable: this.payable,\n gas: (this.gas ? this.gas.toNumber(): undefined),\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n outputs: this.outputs.map((output) => JSON.parse(output.format(format))),\n });\n }\n\n let result = \"\";\n\n if (format !== FormatTypes.sighash) {\n result += \"function \";\n }\n\n result += this.name + \"(\" + this.inputs.map(\n (input) => input.format(format)\n ).join((format === FormatTypes.full) ? \", \": \",\") + \") \";\n\n if (format !== FormatTypes.sighash) {\n if (this.stateMutability) {\n if (this.stateMutability !== \"nonpayable\") {\n result += (this.stateMutability + \" \");\n }\n } else if (this.constant) {\n result += \"view \";\n }\n\n if (this.outputs && this.outputs.length) {\n result += \"returns (\" + this.outputs.map(\n (output) => output.format(format)\n ).join(\", \") + \") \";\n }\n\n if (this.gas != null) {\n result += \"@\" + this.gas.toString() + \" \";\n }\n }\n\n return result.trim();\n }\n\n static from(value: FunctionFragment | JsonFragment | string): FunctionFragment {\n if (typeof(value) === \"string\") {\n return FunctionFragment.fromString(value);\n }\n return FunctionFragment.fromObject(value);\n }\n\n static fromObject(value: FunctionFragment | JsonFragment): FunctionFragment {\n if (FunctionFragment.isFunctionFragment(value)) { return value; }\n\n if (value.type !== \"function\") {\n logger.throwArgumentError(\"invalid function object\", \"value\", value);\n }\n\n let state = verifyState(value);\n\n const params: TypeCheck<_FunctionFragment> = {\n type: value.type,\n name: verifyIdentifier(value.name),\n constant: state.constant,\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject): []),\n outputs: (value.outputs ? value.outputs.map(ParamType.fromObject): [ ]),\n payable: state.payable,\n stateMutability: state.stateMutability,\n gas: (value.gas ? BigNumber.from(value.gas): null)\n };\n\n return new FunctionFragment(_constructorGuard, params);\n }\n\n static fromString(value: string): FunctionFragment {\n let params: any = { type: \"function\" };\n value = parseGas(value, params);\n\n let comps = value.split(\" returns \");\n if (comps.length > 2) {\n logger.throwArgumentError(\"invalid function string\", \"value\", value);\n }\n\n let parens = comps[0].match(regexParen);\n if (!parens) {\n logger.throwArgumentError(\"invalid function signature\", \"value\", value);\n }\n\n params.name = parens[1].trim();\n if (params.name) { verifyIdentifier(params.name); }\n\n params.inputs = parseParams(parens[2], false);\n\n parseModifiers(parens[3].trim(), params);\n\n // We have outputs\n if (comps.length > 1) {\n let returns = comps[1].match(regexParen);\n if (returns[1].trim() != \"\" || returns[3].trim() != \"\") {\n logger.throwArgumentError(\"unexpected tokens\", \"value\", value);\n }\n params.outputs = parseParams(returns[2], false);\n } else {\n params.outputs = [ ];\n }\n\n return FunctionFragment.fromObject(params);\n }\n\n static isFunctionFragment(value: any): value is FunctionFragment {\n return (value && value._isFragment && value.type === \"function\");\n }\n}\n\n//export class StructFragment extends Fragment {\n//}\n\nfunction checkForbidden(fragment: ErrorFragment): ErrorFragment {\n const sig = fragment.format();\n if (sig === \"Error(string)\" || sig === \"Panic(uint256)\") {\n logger.throwArgumentError(`cannot specify user defined ${ sig } error`, \"fragment\", fragment);\n }\n return fragment;\n}\n\nexport class ErrorFragment extends Fragment {\n\n format(format?: string): string {\n if (!format) { format = FormatTypes.sighash; }\n if (!FormatTypes[format]) {\n logger.throwArgumentError(\"invalid format type\", \"format\", format);\n }\n\n if (format === FormatTypes.json) {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n\n let result = \"\";\n\n if (format !== FormatTypes.sighash) {\n result += \"error \";\n }\n\n result += this.name + \"(\" + this.inputs.map(\n (input) => input.format(format)\n ).join((format === FormatTypes.full) ? \", \": \",\") + \") \";\n\n return result.trim();\n }\n\n static from(value: ErrorFragment | JsonFragment | string): ErrorFragment {\n if (typeof(value) === \"string\") {\n return ErrorFragment.fromString(value);\n }\n return ErrorFragment.fromObject(value);\n }\n\n static fromObject(value: ErrorFragment | JsonFragment): ErrorFragment {\n if (ErrorFragment.isErrorFragment(value)) { return value; }\n\n if (value.type !== \"error\") {\n logger.throwArgumentError(\"invalid error object\", \"value\", value);\n }\n\n const params: TypeCheck<_Fragment> = {\n type: value.type,\n name: verifyIdentifier(value.name),\n inputs: (value.inputs ? value.inputs.map(ParamType.fromObject): [])\n };\n\n return checkForbidden(new ErrorFragment(_constructorGuard, params));\n }\n\n static fromString(value: string): ErrorFragment {\n let params: any = { type: \"error\" };\n\n let parens = value.match(regexParen);\n if (!parens) {\n logger.throwArgumentError(\"invalid error signature\", \"value\", value);\n }\n\n params.name = parens[1].trim();\n if (params.name) { verifyIdentifier(params.name); }\n\n params.inputs = parseParams(parens[2], false);\n\n return checkForbidden(ErrorFragment.fromObject(params));\n }\n\n static isErrorFragment(value: any): value is ErrorFragment {\n return (value && value._isFragment && value.type === \"error\");\n }\n}\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 // @TODO: more verification\n\n return type;\n}\n\n// See: https://github.com/ethereum/solidity/blob/1f8f1a3db93a548d0555e3e14cfc55a10e25b60e/docs/grammar/SolidityLexer.g4#L234\nconst regexIdentifier = new RegExp(\"^[a-zA-Z$_][a-zA-Z0-9$_]*$\");\nfunction verifyIdentifier(value: string): string {\n if (!value || !value.match(regexIdentifier)) {\n logger.throwArgumentError(`invalid identifier \"${ value }\"`, \"value\", value);\n }\n return value;\n}\n\nconst regexParen = new RegExp(\"^([^)(]*)\\\\((.*)\\\\)([^)(]*)$\");\n\nfunction splitNesting(value: string): Array<any> {\n value = value.trim();\n\n let result = [];\n let accum = \"\";\n let depth = 0;\n for (let offset = 0; offset < value.length; offset++) {\n let 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 logger.throwArgumentError(\"unbalanced parenthesis\", \"value\", value);\n }\n }\n }\n }\n if (accum) { result.push(accum); }\n\n return result;\n}\n\n","\"use strict\";\n\nimport { arrayify, BytesLike, concat, hexConcat, hexlify } from \"@ethersproject/bytes\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"../_version\";\nconst logger = new Logger(version);\n\nexport interface Result extends ReadonlyArray<any> {\n readonly [key: string]: any;\n}\n\nexport function checkResultErrors(result: Result): Array<{ path: Array<string | number>, error: Error }> {\n // Find the first error (if any)\n const errors: Array<{ path: Array<string | number>, error: Error }> = [ ];\n\n const checkErrors = function(path: Array<string | number>, object: any): void {\n if (!Array.isArray(object)) { return; }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n\n try {\n checkErrors(childPath, object[key]);\n } catch (error) {\n errors.push({ path: childPath, error: error });\n }\n }\n }\n checkErrors([ ], result);\n\n return errors;\n\n}\n\nexport type CoerceFunc = (type: string, value: any) => any;\n\nexport abstract class Coder {\n\n // The coder name:\n // - address, uint256, tuple, array, etc.\n readonly name: string;\n\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n readonly type: string;\n\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n readonly localName: string;\n\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n readonly dynamic: boolean;\n\n constructor(name: string, type: string, localName: string, dynamic: boolean) {\n // @TODO: defineReadOnly these\n this.name = name;\n this.type = type;\n this.localName = localName;\n this.dynamic = dynamic;\n }\n\n _throwError(message: string, value: any): void {\n logger.throwArgumentError(message, this.localName, value);\n }\n\n abstract encode(writer: Writer, value: any): number;\n abstract decode(reader: Reader): any;\n\n abstract defaultValue(): any;\n}\n\nexport class Writer {\n readonly wordSize: number;\n\n _data: Array<Uint8Array>;\n _dataLength: number;\n _padding: Uint8Array;\n\n constructor(wordSize?: number) {\n defineReadOnly(this, \"wordSize\", wordSize || 32);\n this._data = [ ];\n this._dataLength = 0;\n this._padding = new Uint8Array(wordSize);\n }\n\n get data(): string {\n return hexConcat(this._data);\n }\n get length(): number { return this._dataLength; }\n\n _writeData(data: Uint8Array): number {\n this._data.push(data);\n this._dataLength += data.length;\n return data.length;\n }\n\n appendWriter(writer: Writer): number {\n return this._writeData(concat(writer._data));\n }\n\n // Arrayish items; padded on the right to wordSize\n writeBytes(value: BytesLike): number {\n let bytes = arrayify(value);\n const paddingOffset = bytes.length % this.wordSize;\n if (paddingOffset) {\n bytes = concat([ bytes, this._padding.slice(paddingOffset) ])\n }\n return this._writeData(bytes);\n }\n\n _getValue(value: BigNumberish): Uint8Array {\n let bytes = arrayify(BigNumber.from(value));\n if (bytes.length > this.wordSize) {\n logger.throwError(\"value out-of-bounds\", Logger.errors.BUFFER_OVERRUN, {\n length: this.wordSize,\n offset: bytes.length\n });\n }\n if (bytes.length % this.wordSize) {\n bytes = concat([ this._padding.slice(bytes.length % this.wordSize), bytes ]);\n }\n return bytes;\n }\n\n // BigNumberish items; padded on the left to wordSize\n writeValue(value: BigNumberish): number {\n return this._writeData(this._getValue(value));\n }\n\n writeUpdatableValue(): (value: BigNumberish) => void {\n const offset = this._data.length;\n this._data.push(this._padding);\n this._dataLength += this.wordSize;\n return (value: BigNumberish) => {\n this._data[offset] = this._getValue(value);\n };\n }\n}\n\nexport class Reader {\n readonly wordSize: number;\n readonly allowLoose: boolean;\n\n readonly _data: Uint8Array;\n readonly _coerceFunc: CoerceFunc;\n\n _offset: number;\n\n constructor(data: BytesLike, wordSize?: number, coerceFunc?: CoerceFunc, allowLoose?: boolean) {\n defineReadOnly(this, \"_data\", arrayify(data));\n defineReadOnly(this, \"wordSize\", wordSize || 32);\n defineReadOnly(this, \"_coerceFunc\", coerceFunc);\n defineReadOnly(this, \"allowLoose\", allowLoose);\n\n this._offset = 0;\n }\n\n get data(): string { return hexlify(this._data); }\n get consumed(): number { return this._offset; }\n\n // The default Coerce function\n static coerce(name: string, value: any): any {\n let match = name.match(\"^u?int([0-9]+)$\");\n if (match && parseInt(match[1]) <= 48) { value = value.toNumber(); }\n return value;\n }\n\n coerce(name: string, value: any): any {\n if (this._coerceFunc) { return this._coerceFunc(name, value); }\n return Reader.coerce(name, value);\n }\n\n _peekBytes(offset: number, length: number, loose?: boolean): Uint8Array {\n let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize;\n if (this._offset + alignedLength > this._data.length) {\n if (this.allowLoose && loose && this._offset + length <= this._data.length) {\n alignedLength = length;\n } else {\n logger.throwError(\"data out-of-bounds\", Logger.errors.BUFFER_OVERRUN, {\n length: this._data.length,\n offset: this._offset + alignedLength\n });\n }\n }\n return this._data.slice(this._offset, this._offset + alignedLength)\n }\n\n subReader(offset: number): Reader {\n return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose);\n }\n\n readBytes(length: number, loose?: boolean): Uint8Array {\n let bytes = this._peekBytes(0, length, !!loose);\n this._offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n\n readValue(): BigNumber {\n return BigNumber.from(this.readBytes(this.wordSize));\n }\n}\n","/**\n * [js-sha3]{@link https://github.com/emn178/js-sha3}\n *\n * @version 0.8.0\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2015-2018\n * @license MIT\n */\n/*jslint bitwise: true */\n(function () {\n 'use strict';\n\n var INPUT_ERROR = 'input is invalid type';\n var FINALIZE_ERROR = 'finalize already called';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA3_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = global;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && typeof module === 'object' && module.exports;\n var AMD = typeof define === 'function' && define.amd;\n var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n var HEX_CHARS = '0123456789abcdef'.split('');\n var SHAKE_PADDING = [31, 7936, 2031616, 520093696];\n var CSHAKE_PADDING = [4, 1024, 262144, 67108864];\n var KECCAK_PADDING = [1, 256, 65536, 16777216];\n var PADDING = [6, 1536, 393216, 100663296];\n var SHIFT = [0, 8, 16, 24];\n var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,\n 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,\n 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,\n 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,\n 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];\n var BITS = [224, 256, 384, 512];\n var SHAKE_BITS = [128, 256];\n var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];\n var CSHAKE_BYTEPAD = {\n '128': 168,\n '256': 136\n };\n\n if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n\n if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n\n var createOutputMethod = function (bits, padding, outputType) {\n return function (message) {\n return new Keccak(bits, padding, bits).update(message)[outputType]();\n };\n };\n\n var createShakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits) {\n return new Keccak(bits, padding, outputBits).update(message)[outputType]();\n };\n };\n\n var createCshakeOutputMethod = function (bits, padding, outputType) {\n return function (message, outputBits, n, s) {\n return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();\n };\n };\n\n var createKmacOutputMethod = function (bits, padding, outputType) {\n return function (key, message, outputBits, s) {\n return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();\n };\n };\n\n var createOutputMethods = function (method, createMethod, bits, padding) {\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createMethod(bits, padding, type);\n }\n return method;\n };\n\n var createMethod = function (bits, padding) {\n var method = createOutputMethod(bits, padding, 'hex');\n method.create = function () {\n return new Keccak(bits, padding, bits);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n return createOutputMethods(method, createOutputMethod, bits, padding);\n };\n\n var createShakeMethod = function (bits, padding) {\n var method = createShakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits) {\n return new Keccak(bits, padding, outputBits);\n };\n method.update = function (message, outputBits) {\n return method.create(outputBits).update(message);\n };\n return createOutputMethods(method, createShakeOutputMethod, bits, padding);\n };\n\n var createCshakeMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createCshakeOutputMethod(bits, padding, 'hex');\n method.create = function (outputBits, n, s) {\n if (!n && !s) {\n return methods['shake' + bits].create(outputBits);\n } else {\n return new Keccak(bits, padding, outputBits).bytepad([n, s], w);\n }\n };\n method.update = function (message, outputBits, n, s) {\n return method.create(outputBits, n, s).update(message);\n };\n return createOutputMethods(method, createCshakeOutputMethod, bits, padding);\n };\n\n var createKmacMethod = function (bits, padding) {\n var w = CSHAKE_BYTEPAD[bits];\n var method = createKmacOutputMethod(bits, padding, 'hex');\n method.create = function (key, outputBits, s) {\n return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);\n };\n method.update = function (key, message, outputBits, s) {\n return method.create(key, outputBits, s).update(message);\n };\n return createOutputMethods(method, createKmacOutputMethod, bits, padding);\n };\n\n var algorithms = [\n { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },\n { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },\n { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },\n { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },\n { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }\n ];\n\n var methods = {}, methodNames = [];\n\n for (var i = 0; i < algorithms.length; ++i) {\n var algorithm = algorithms[i];\n var bits = algorithm.bits;\n for (var j = 0; j < bits.length; ++j) {\n var methodName = algorithm.name + '_' + bits[j];\n methodNames.push(methodName);\n methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);\n if (algorithm.name !== 'sha3') {\n var newMethodName = algorithm.name + bits[j];\n methodNames.push(newMethodName);\n methods[newMethodName] = methods[methodName];\n }\n }\n }\n\n function Keccak(bits, padding, outputBits) {\n this.blocks = [];\n this.s = [];\n this.padding = padding;\n this.outputBits = outputBits;\n this.reset = true;\n this.finalized = false;\n this.block = 0;\n this.start = 0;\n this.blockCount = (1600 - (bits << 1)) >> 5;\n this.byteCount = this.blockCount << 2;\n this.outputBlocks = outputBits >> 5;\n this.extraBytes = (outputBits & 31) >> 3;\n\n for (var i = 0; i < 50; ++i) {\n this.s[i] = 0;\n }\n }\n\n Keccak.prototype.update = function (message) {\n if (this.finalized) {\n throw new Error(FINALIZE_ERROR);\n }\n var notString, type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var blocks = this.blocks, byteCount = this.byteCount, length = message.length,\n blockCount = this.blockCount, index = 0, s = this.s, i, code;\n\n while (index < length) {\n if (this.reset) {\n this.reset = false;\n blocks[0] = this.block;\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n if (notString) {\n for (i = this.start; index < length && i < byteCount; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < byteCount; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n this.lastByteIndex = i;\n if (i >= byteCount) {\n this.start = i - byteCount;\n this.block = blocks[blockCount];\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n this.reset = true;\n } else {\n this.start = i;\n }\n }\n return this;\n };\n\n Keccak.prototype.encode = function (x, right) {\n var o = x & 255, n = 1;\n var bytes = [o];\n x = x >> 8;\n o = x & 255;\n while (o > 0) {\n bytes.unshift(o);\n x = x >> 8;\n o = x & 255;\n ++n;\n }\n if (right) {\n bytes.push(n);\n } else {\n bytes.unshift(n);\n }\n this.update(bytes);\n return bytes.length;\n };\n\n Keccak.prototype.encodeString = function (str) {\n var notString, type = typeof str;\n if (type !== 'string') {\n if (type === 'object') {\n if (str === null) {\n throw new Error(INPUT_ERROR);\n } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {\n str = new Uint8Array(str);\n } else if (!Array.isArray(str)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {\n throw new Error(INPUT_ERROR);\n }\n }\n } else {\n throw new Error(INPUT_ERROR);\n }\n notString = true;\n }\n var bytes = 0, length = str.length;\n if (notString) {\n bytes = length;\n } else {\n for (var i = 0; i < str.length; ++i) {\n var code = str.charCodeAt(i);\n if (code < 0x80) {\n bytes += 1;\n } else if (code < 0x800) {\n bytes += 2;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes += 3;\n } else {\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));\n bytes += 4;\n }\n }\n }\n bytes += this.encode(bytes * 8);\n this.update(str);\n return bytes;\n };\n\n Keccak.prototype.bytepad = function (strs, w) {\n var bytes = this.encode(w);\n for (var i = 0; i < strs.length; ++i) {\n bytes += this.encodeString(strs[i]);\n }\n var paddingBytes = w - bytes % w;\n var zeros = [];\n zeros.length = paddingBytes;\n this.update(zeros);\n return this;\n };\n\n Keccak.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;\n blocks[i >> 2] |= this.padding[i & 3];\n if (this.lastByteIndex === this.byteCount) {\n blocks[0] = blocks[blockCount];\n for (i = 1; i < blockCount + 1; ++i) {\n blocks[i] = 0;\n }\n }\n blocks[blockCount - 1] |= 0x80000000;\n for (i = 0; i < blockCount; ++i) {\n s[i] ^= blocks[i];\n }\n f(s);\n };\n\n Keccak.prototype.toString = Keccak.prototype.hex = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var hex = '', block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +\n HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +\n HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +\n HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];\n }\n if (j % blockCount === 0) {\n f(s);\n i = 0;\n }\n }\n if (extraBytes) {\n block = s[i];\n hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];\n if (extraBytes > 1) {\n hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];\n }\n if (extraBytes > 2) {\n hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];\n }\n }\n return hex;\n };\n\n Keccak.prototype.arrayBuffer = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var bytes = this.outputBits >> 3;\n var buffer;\n if (extraBytes) {\n buffer = new ArrayBuffer((outputBlocks + 1) << 2);\n } else {\n buffer = new ArrayBuffer(bytes);\n }\n var array = new Uint32Array(buffer);\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n array[j] = s[i];\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n array[i] = s[i];\n buffer = buffer.slice(0, bytes);\n }\n return buffer;\n };\n\n Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;\n\n Keccak.prototype.digest = Keccak.prototype.array = function () {\n this.finalize();\n\n var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,\n extraBytes = this.extraBytes, i = 0, j = 0;\n var array = [], offset, block;\n while (j < outputBlocks) {\n for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n array[offset + 1] = (block >> 8) & 0xFF;\n array[offset + 2] = (block >> 16) & 0xFF;\n array[offset + 3] = (block >> 24) & 0xFF;\n }\n if (j % blockCount === 0) {\n f(s);\n }\n }\n if (extraBytes) {\n offset = j << 2;\n block = s[i];\n array[offset] = block & 0xFF;\n if (extraBytes > 1) {\n array[offset + 1] = (block >> 8) & 0xFF;\n }\n if (extraBytes > 2) {\n array[offset + 2] = (block >> 16) & 0xFF;\n }\n }\n return array;\n };\n\n function Kmac(bits, padding, outputBits) {\n Keccak.call(this, bits, padding, outputBits);\n }\n\n Kmac.prototype = new Keccak();\n\n Kmac.prototype.finalize = function () {\n this.encode(this.outputBits, true);\n return Keccak.prototype.finalize.call(this);\n };\n\n var f = function (s) {\n var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,\n b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,\n b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,\n b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;\n for (n = 0; n < 48; n += 2) {\n c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];\n c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];\n c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];\n c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];\n c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];\n c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];\n c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];\n c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];\n c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];\n c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];\n\n h = c8 ^ ((c2 << 1) | (c3 >>> 31));\n l = c9 ^ ((c3 << 1) | (c2 >>> 31));\n s[0] ^= h;\n s[1] ^= l;\n s[10] ^= h;\n s[11] ^= l;\n s[20] ^= h;\n s[21] ^= l;\n s[30] ^= h;\n s[31] ^= l;\n s[40] ^= h;\n s[41] ^= l;\n h = c0 ^ ((c4 << 1) | (c5 >>> 31));\n l = c1 ^ ((c5 << 1) | (c4 >>> 31));\n s[2] ^= h;\n s[3] ^= l;\n s[12] ^= h;\n s[13] ^= l;\n s[22] ^= h;\n s[23] ^= l;\n s[32] ^= h;\n s[33] ^= l;\n s[42] ^= h;\n s[43] ^= l;\n h = c2 ^ ((c6 << 1) | (c7 >>> 31));\n l = c3 ^ ((c7 << 1) | (c6 >>> 31));\n s[4] ^= h;\n s[5] ^= l;\n s[14] ^= h;\n s[15] ^= l;\n s[24] ^= h;\n s[25] ^= l;\n s[34] ^= h;\n s[35] ^= l;\n s[44] ^= h;\n s[45] ^= l;\n h = c4 ^ ((c8 << 1) | (c9 >>> 31));\n l = c5 ^ ((c9 << 1) | (c8 >>> 31));\n s[6] ^= h;\n s[7] ^= l;\n s[16] ^= h;\n s[17] ^= l;\n s[26] ^= h;\n s[27] ^= l;\n s[36] ^= h;\n s[37] ^= l;\n s[46] ^= h;\n s[47] ^= l;\n h = c6 ^ ((c0 << 1) | (c1 >>> 31));\n l = c7 ^ ((c1 << 1) | (c0 >>> 31));\n s[8] ^= h;\n s[9] ^= l;\n s[18] ^= h;\n s[19] ^= l;\n s[28] ^= h;\n s[29] ^= l;\n s[38] ^= h;\n s[39] ^= l;\n s[48] ^= h;\n s[49] ^= l;\n\n b0 = s[0];\n b1 = s[1];\n b32 = (s[11] << 4) | (s[10] >>> 28);\n b33 = (s[10] << 4) | (s[11] >>> 28);\n b14 = (s[20] << 3) | (s[21] >>> 29);\n b15 = (s[21] << 3) | (s[20] >>> 29);\n b46 = (s[31] << 9) | (s[30] >>> 23);\n b47 = (s[30] << 9) | (s[31] >>> 23);\n b28 = (s[40] << 18) | (s[41] >>> 14);\n b29 = (s[41] << 18) | (s[40] >>> 14);\n b20 = (s[2] << 1) | (s[3] >>> 31);\n b21 = (s[3] << 1) | (s[2] >>> 31);\n b2 = (s[13] << 12) | (s[12] >>> 20);\n b3 = (s[12] << 12) | (s[13] >>> 20);\n b34 = (s[22] << 10) | (s[23] >>> 22);\n b35 = (s[23] << 10) | (s[22] >>> 22);\n b16 = (s[33] << 13) | (s[32] >>> 19);\n b17 = (s[32] << 13) | (s[33] >>> 19);\n b48 = (s[42] << 2) | (s[43] >>> 30);\n b49 = (s[43] << 2) | (s[42] >>> 30);\n b40 = (s[5] << 30) | (s[4] >>> 2);\n b41 = (s[4] << 30) | (s[5] >>> 2);\n b22 = (s[14] << 6) | (s[15] >>> 26);\n b23 = (s[15] << 6) | (s[14] >>> 26);\n b4 = (s[25] << 11) | (s[24] >>> 21);\n b5 = (s[24] << 11) | (s[25] >>> 21);\n b36 = (s[34] << 15) | (s[35] >>> 17);\n b37 = (s[35] << 15) | (s[34] >>> 17);\n b18 = (s[45] << 29) | (s[44] >>> 3);\n b19 = (s[44] << 29) | (s[45] >>> 3);\n b10 = (s[6] << 28) | (s[7] >>> 4);\n b11 = (s[7] << 28) | (s[6] >>> 4);\n b42 = (s[17] << 23) | (s[16] >>> 9);\n b43 = (s[16] << 23) | (s[17] >>> 9);\n b24 = (s[26] << 25) | (s[27] >>> 7);\n b25 = (s[27] << 25) | (s[26] >>> 7);\n b6 = (s[36] << 21) | (s[37] >>> 11);\n b7 = (s[37] << 21) | (s[36] >>> 11);\n b38 = (s[47] << 24) | (s[46] >>> 8);\n b39 = (s[46] << 24) | (s[47] >>> 8);\n b30 = (s[8] << 27) | (s[9] >>> 5);\n b31 = (s[9] << 27) | (s[8] >>> 5);\n b12 = (s[18] << 20) | (s[19] >>> 12);\n b13 = (s[19] << 20) | (s[18] >>> 12);\n b44 = (s[29] << 7) | (s[28] >>> 25);\n b45 = (s[28] << 7) | (s[29] >>> 25);\n b26 = (s[38] << 8) | (s[39] >>> 24);\n b27 = (s[39] << 8) | (s[38] >>> 24);\n b8 = (s[48] << 14) | (s[49] >>> 18);\n b9 = (s[49] << 14) | (s[48] >>> 18);\n\n s[0] = b0 ^ (~b2 & b4);\n s[1] = b1 ^ (~b3 & b5);\n s[10] = b10 ^ (~b12 & b14);\n s[11] = b11 ^ (~b13 & b15);\n s[20] = b20 ^ (~b22 & b24);\n s[21] = b21 ^ (~b23 & b25);\n s[30] = b30 ^ (~b32 & b34);\n s[31] = b31 ^ (~b33 & b35);\n s[40] = b40 ^ (~b42 & b44);\n s[41] = b41 ^ (~b43 & b45);\n s[2] = b2 ^ (~b4 & b6);\n s[3] = b3 ^ (~b5 & b7);\n s[12] = b12 ^ (~b14 & b16);\n s[13] = b13 ^ (~b15 & b17);\n s[22] = b22 ^ (~b24 & b26);\n s[23] = b23 ^ (~b25 & b27);\n s[32] = b32 ^ (~b34 & b36);\n s[33] = b33 ^ (~b35 & b37);\n s[42] = b42 ^ (~b44 & b46);\n s[43] = b43 ^ (~b45 & b47);\n s[4] = b4 ^ (~b6 & b8);\n s[5] = b5 ^ (~b7 & b9);\n s[14] = b14 ^ (~b16 & b18);\n s[15] = b15 ^ (~b17 & b19);\n s[24] = b24 ^ (~b26 & b28);\n s[25] = b25 ^ (~b27 & b29);\n s[34] = b34 ^ (~b36 & b38);\n s[35] = b35 ^ (~b37 & b39);\n s[44] = b44 ^ (~b46 & b48);\n s[45] = b45 ^ (~b47 & b49);\n s[6] = b6 ^ (~b8 & b0);\n s[7] = b7 ^ (~b9 & b1);\n s[16] = b16 ^ (~b18 & b10);\n s[17] = b17 ^ (~b19 & b11);\n s[26] = b26 ^ (~b28 & b20);\n s[27] = b27 ^ (~b29 & b21);\n s[36] = b36 ^ (~b38 & b30);\n s[37] = b37 ^ (~b39 & b31);\n s[46] = b46 ^ (~b48 & b40);\n s[47] = b47 ^ (~b49 & b41);\n s[8] = b8 ^ (~b0 & b2);\n s[9] = b9 ^ (~b1 & b3);\n s[18] = b18 ^ (~b10 & b12);\n s[19] = b19 ^ (~b11 & b13);\n s[28] = b28 ^ (~b20 & b22);\n s[29] = b29 ^ (~b21 & b23);\n s[38] = b38 ^ (~b30 & b32);\n s[39] = b39 ^ (~b31 & b33);\n s[48] = b48 ^ (~b40 & b42);\n s[49] = b49 ^ (~b41 & b43);\n\n s[0] ^= RC[n];\n s[1] ^= RC[n + 1];\n }\n };\n\n if (COMMON_JS) {\n module.exports = methods;\n } else {\n for (i = 0; i < methodNames.length; ++i) {\n root[methodNames[i]] = methods[methodNames[i]];\n }\n if (AMD) {\n define(function () {\n return methods;\n });\n }\n }\n})();\n","\"use strict\";\n\nimport sha3 from \"js-sha3\";\n\nimport { arrayify, BytesLike } from \"@ethersproject/bytes\";\n\nexport function keccak256(data: BytesLike): string {\n return '0x' + sha3.keccak_256(arrayify(data));\n}\n","export const version = \"rlp/5.6.0\";\n","\"use strict\";\n\n//See: https://github.com/ethereum/wiki/wiki/RLP\n\nimport { arrayify, BytesLike, hexlify, isBytesLike } from \"@ethersproject/bytes\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nfunction arrayifyInteger(value: number): Array<number> {\n const 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 let result = 0;\n for (let i = 0; i < length; i++) {\n result = (result * 256) + data[offset + i];\n }\n return result;\n}\n\nfunction _encode(object: Array<any> | string): Array<number> {\n if (Array.isArray(object)) {\n let payload: Array<number> = [];\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 const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n\n return length.concat(payload);\n\n }\n\n if (!isBytesLike(object)) {\n logger.throwArgumentError(\"RLP object must be BytesLike\", \"object\", object);\n }\n\n const data: Array<number> = 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 const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n\n return length.concat(data);\n}\n\nexport function encode(object: any): string {\n return hexlify(_encode(object));\n}\n\ntype Decoded = {\n result: any;\n consumed: number;\n};\n\nfunction _decodeChildren(data: Uint8Array, offset: number, childOffset: number, length: number): Decoded {\n const result = [];\n\n while (childOffset < offset + 1 + length) {\n const decoded = _decode(data, childOffset);\n\n result.push(decoded.result);\n\n childOffset += decoded.consumed;\n if (childOffset > offset + 1 + length) {\n logger.throwError(\"child data too short\", Logger.errors.BUFFER_OVERRUN, { });\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) {\n logger.throwError(\"data too short\", Logger.errors.BUFFER_OVERRUN, { });\n }\n\n // Array with extra length prefix\n if (data[offset] >= 0xf8) {\n const lengthLength = data[offset] - 0xf7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data short segment too short\", Logger.errors.BUFFER_OVERRUN, { });\n }\n\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data long segment too short\", Logger.errors.BUFFER_OVERRUN, { });\n }\n\n return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length);\n\n } else if (data[offset] >= 0xc0) {\n const length = data[offset] - 0xc0;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, { });\n }\n\n return _decodeChildren(data, offset, offset + 1, length);\n\n } else if (data[offset] >= 0xb8) {\n const lengthLength = data[offset] - 0xb7;\n if (offset + 1 + lengthLength > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, { });\n }\n\n const length = unarrayifyInteger(data, offset + 1, lengthLength);\n if (offset + 1 + lengthLength + length > data.length) {\n logger.throwError(\"data array too short\", Logger.errors.BUFFER_OVERRUN, { });\n }\n\n const 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 const length = data[offset] - 0x80;\n if (offset + 1 + length > data.length) {\n logger.throwError(\"data too short\", Logger.errors.BUFFER_OVERRUN, { });\n }\n\n const 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: BytesLike): any {\n const bytes = arrayify(data);\n const decoded = _decode(bytes, 0);\n if (decoded.consumed !== bytes.length) {\n logger.throwArgumentError(\"invalid rlp data\", \"data\", data);\n }\n return decoded.result;\n}\n\n","export const version = \"address/5.6.0\";\n","\"use strict\";\n\nimport { arrayify, BytesLike, concat, hexDataLength, hexDataSlice, isHexString, stripZeros } from \"@ethersproject/bytes\";\nimport { BigNumber, BigNumberish, _base16To36, _base36To16 } from \"@ethersproject/bignumber\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { encode } from \"@ethersproject/rlp\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nfunction getChecksumAddress(address: string): string {\n if (!isHexString(address, 20)) {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n\n address = address.toLowerCase();\n\n const chars = address.substring(2).split(\"\");\n\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n\n const hashed = arrayify(keccak256(expanded));\n\n for (let 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\nconst 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\nconst ibanLookup: { [character: string]: string } = { };\nfor (let i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); }\nfor (let 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)\nconst 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 let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits){\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n\n let 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 let result = null;\n\n if (typeof(address) !== \"string\") {\n logger.throwArgumentError(\"invalid address\", \"address\", 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 logger.throwArgumentError(\"bad address checksum\", \"address\", 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 logger.throwArgumentError(\"bad icap checksum\", \"address\", address);\n }\n\n result = _base36To16(address.substring(4));\n while (result.length < 40) { result = \"0\" + result; }\n result = getChecksumAddress(\"0x\" + result);\n\n } else {\n logger.throwArgumentError(\"invalid address\", \"address\", address);\n }\n\n return result;\n}\n\nexport function isAddress(address: string): boolean {\n try {\n getAddress(address);\n return true;\n } catch (error) { }\n return false;\n}\n\nexport function getIcapAddress(address: string): string {\n let base36 = _base16To36(getAddress(address).substring(2)).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: BigNumberish }) {\n let from: string = null;\n try {\n from = getAddress(transaction.from);\n } catch (error) {\n logger.throwArgumentError(\"missing from address\", \"transaction\", transaction);\n }\n\n const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));\n\n return getAddress(hexDataSlice(keccak256(encode([ from, nonce ])), 12));\n}\n\nexport function getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string {\n if (hexDataLength(salt) !== 32) {\n logger.throwArgumentError(\"salt must be 32 bytes\", \"salt\", salt);\n }\n if (hexDataLength(initCodeHash) !== 32) {\n logger.throwArgumentError(\"initCodeHash must be 32 bytes\", \"initCodeHash\", initCodeHash);\n }\n return getAddress(hexDataSlice(keccak256(concat([ \"0xff\", getAddress(from), salt, initCodeHash ])), 12))\n}\n","\"use strict\";\n\nimport { getAddress } from \"@ethersproject/address\";\nimport { hexZeroPad } from \"@ethersproject/bytes\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\n\nexport class AddressCoder extends Coder {\n\n constructor(localName: string) {\n super(\"address\", \"address\", localName, false);\n }\n\n defaultValue(): string {\n return \"0x0000000000000000000000000000000000000000\";\n }\n\n encode(writer: Writer, value: string): number {\n try {\n value = getAddress(value)\n } catch (error) {\n this._throwError(error.message, value);\n }\n return writer.writeValue(value);\n }\n\n decode(reader: Reader): any {\n return getAddress(hexZeroPad(reader.readValue().toHexString(), 20));\n }\n}\n\n","\"use strict\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\n\n// Clones the functionality of an existing Coder, but without a localName\nexport class AnonymousCoder extends Coder {\n private coder: Coder;\n\n constructor(coder: Coder) {\n super(coder.name, coder.type, undefined, coder.dynamic);\n this.coder = coder;\n }\n\n defaultValue(): any {\n return this.coder.defaultValue();\n }\n\n encode(writer: Writer, value: any): number {\n return this.coder.encode(writer, value);\n }\n\n decode(reader: Reader): any {\n return this.coder.decode(reader);\n }\n}\n","\"use strict\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"../_version\";\nconst logger = new Logger(version);\n\nimport { Coder, Reader, Result, Writer } from \"./abstract-coder\";\nimport { AnonymousCoder } from \"./anonymous\";\n\nexport function pack(writer: Writer, coders: ReadonlyArray<Coder>, values: Array<any> | { [ name: string ]: any }): number {\n let arrayValues: Array<any> = null;\n\n if (Array.isArray(values)) {\n arrayValues = values;\n\n } else if (values && typeof(values) === \"object\") {\n let unique: { [ name: string ]: boolean } = { };\n\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n if (!name) {\n logger.throwError(\"cannot encode object for signature with missing names\", Logger.errors.INVALID_ARGUMENT, {\n argument: \"values\",\n coder: coder,\n value: values\n });\n }\n\n if (unique[name]) {\n logger.throwError(\"cannot encode object for signature with duplicate names\", Logger.errors.INVALID_ARGUMENT, {\n argument: \"values\",\n coder: coder,\n value: values\n });\n }\n\n unique[name] = true;\n\n return values[name];\n });\n\n } else {\n logger.throwArgumentError(\"invalid tuple value\", \"tuple\", values);\n }\n\n if (coders.length !== arrayValues.length) {\n logger.throwArgumentError(\"types/value length mismatch\", \"tuple\", values);\n }\n\n let staticWriter = new Writer(writer.wordSize);\n let dynamicWriter = new Writer(writer.wordSize);\n\n let updateFuncs: Array<(baseOffset: number) => void> = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset: number) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n\n } else {\n coder.encode(staticWriter, value);\n }\n });\n\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => { func(staticWriter.length); });\n\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\n\nexport function unpack(reader: Reader, coders: Array<Coder>): Result {\n let values: any = [];\n\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n\n coders.forEach((coder) => {\n let value: any = null;\n\n if (coder.dynamic) {\n let offset = reader.readValue();\n let offsetReader = baseReader.subReader(offset.toNumber());\n try {\n value = coder.decode(offsetReader);\n } catch (error) {\n // Cannot recover from this\n if (error.code === Logger.errors.BUFFER_OVERRUN) { throw error; }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n\n } else {\n try {\n value = coder.decode(reader);\n } catch (error) {\n // Cannot recover from this\n if (error.code === Logger.errors.BUFFER_OVERRUN) { throw error; }\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n\n if (value != undefined) {\n values.push(value);\n }\n });\n\n // We only output named properties for uniquely named coders\n const uniqueNames = coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) { accum[name] = 0; }\n accum[name]++;\n }\n return accum;\n }, <{ [ name: string ]: number }>{ });\n\n // Add any named parameters (i.e. tuples)\n coders.forEach((coder: Coder, index: number) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) { return; }\n\n if (name === \"length\") { name = \"_length\"; }\n\n if (values[name] != null) { return; }\n\n const value = values[index];\n\n if (value instanceof Error) {\n Object.defineProperty(values, name, {\n enumerable: true,\n get: () => { throw value; }\n });\n } else {\n values[name] = value;\n }\n });\n\n for (let i = 0; i < values.length; i++) {\n const value = values[i];\n if (value instanceof Error) {\n Object.defineProperty(values, i, {\n enumerable: true,\n get: () => { throw value; }\n });\n }\n }\n\n return Object.freeze(values);\n}\n\n\nexport class ArrayCoder extends Coder {\n readonly coder: Coder;\n readonly length: number;\n\n constructor(coder: Coder, length: number, localName: string) {\n const type = (coder.type + \"[\" + (length >= 0 ? length: \"\") + \"]\");\n const dynamic = (length === -1 || coder.dynamic);\n super(\"array\", type, localName, dynamic);\n\n this.coder = coder;\n this.length = length;\n }\n\n defaultValue(): Array<any> {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n\n const result: Array<any> = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n\n encode(writer: Writer, value: Array<any>): number {\n if (!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n\n let count = this.length;\n\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n\n logger.checkArgumentCount(value.length, count, \"coder array\" + (this.localName? (\" \"+ this.localName): \"\"));\n\n let coders = [];\n for (let i = 0; i < value.length; i++) { coders.push(this.coder); }\n\n return pack(writer, coders, value);\n }\n\n decode(reader: Reader): any {\n let count = this.length;\n if (count === -1) {\n count = reader.readValue().toNumber();\n\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n if (count * 32 > reader._data.length) {\n logger.throwError(\"insufficient data length\", Logger.errors.BUFFER_OVERRUN, {\n length: reader._data.length,\n count: count\n });\n }\n }\n let coders = [];\n for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); }\n\n return reader.coerce(this.name, unpack(reader, coders));\n }\n}\n\n","\"use strict\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\n\nexport class BooleanCoder extends Coder {\n\n constructor(localName: string) {\n super(\"bool\", \"bool\", localName, false);\n }\n\n defaultValue(): boolean {\n return false;\n }\n\n encode(writer: Writer, value: boolean): number {\n return writer.writeValue(value ? 1: 0);\n }\n\n decode(reader: Reader): any {\n return reader.coerce(this.type, !reader.readValue().isZero());\n }\n}\n\n","\"use strict\";\n\nimport { arrayify, hexlify } from \"@ethersproject/bytes\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\n\nexport class DynamicBytesCoder extends Coder {\n constructor(type: string, localName: string) {\n super(type, type, localName, true);\n }\n\n defaultValue(): string {\n return \"0x\";\n }\n\n encode(writer: Writer, value: any): number {\n value = arrayify(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n\n decode(reader: Reader): any {\n return reader.readBytes(reader.readValue().toNumber(), true);\n }\n}\n\nexport class BytesCoder extends DynamicBytesCoder {\n constructor(localName: string) {\n super(\"bytes\", localName);\n }\n\n decode(reader: Reader): any {\n return reader.coerce(this.name, hexlify(super.decode(reader)));\n }\n}\n\n\n","\"use strict\";\n\nimport { arrayify, BytesLike, hexlify } from \"@ethersproject/bytes\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\n\n// @TODO: Merge this with bytes\nexport class FixedBytesCoder extends Coder {\n readonly size: number;\n\n constructor(size: number, localName: string) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n this.size = size;\n }\n\n defaultValue(): string {\n return (\"0x0000000000000000000000000000000000000000000000000000000000000000\").substring(0, 2 + this.size * 2);\n }\n\n encode(writer: Writer, value: BytesLike): number {\n let data = arrayify(value);\n if (data.length !== this.size) { this._throwError(\"incorrect data length\", value); }\n return writer.writeBytes(data);\n }\n\n decode(reader: Reader): any {\n return reader.coerce(this.name, hexlify(reader.readBytes(this.size)));\n }\n}\n","\"use strict\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\n\nexport class NullCoder extends Coder {\n\n constructor(localName: string) {\n super(\"null\", \"\", localName, false);\n }\n\n defaultValue(): null {\n return null;\n }\n\n encode(writer: Writer, value: any): number {\n if (value != null) { this._throwError(\"not null\", value); }\n return writer.writeBytes([ ]);\n }\n\n decode(reader: Reader): any {\n reader.readBytes(0);\n return reader.coerce(this.name, null);\n }\n}\n","export const AddressZero = \"0x0000000000000000000000000000000000000000\";\n\n","import { BigNumber } from \"@ethersproject/bignumber\";\n\nconst NegativeOne: BigNumber = (/*#__PURE__*/BigNumber.from(-1));\nconst Zero: BigNumber = (/*#__PURE__*/BigNumber.from(0));\nconst One: BigNumber = (/*#__PURE__*/BigNumber.from(1));\nconst Two: BigNumber = (/*#__PURE__*/BigNumber.from(2));\nconst WeiPerEther: BigNumber = (/*#__PURE__*/BigNumber.from(\"1000000000000000000\"));\nconst MaxUint256: BigNumber = (/*#__PURE__*/BigNumber.from(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\n\nconst MinInt256: BigNumber = (/*#__PURE__*/BigNumber.from(\"-0x8000000000000000000000000000000000000000000000000000000000000000\"));\nconst MaxInt256: BigNumber = (/*#__PURE__*/BigNumber.from(\"0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"));\n\nexport {\n NegativeOne,\n Zero,\n One,\n Two,\n WeiPerEther,\n MaxUint256,\n MinInt256,\n MaxInt256,\n};\n","export const HashZero = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\n\n","// NFKC (composed) // (decomposed)\nexport const EtherSymbol = \"\\u039e\"; // \"\\uD835\\uDF63\";\n","\"use strict\";\n\nexport { AddressZero } from \"./addresses\";\nexport {\n NegativeOne,\n Zero,\n One,\n Two,\n WeiPerEther,\n MaxUint256,\n MinInt256,\n MaxInt256\n} from \"./bignumbers\";\nexport { HashZero } from \"./hashes\";\nexport { EtherSymbol } from \"./strings\";\n\n","\"use strict\";\n\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { MaxUint256, NegativeOne, One, Zero } from \"@ethersproject/constants\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\n\nexport class NumberCoder extends Coder {\n readonly size: number;\n readonly signed: boolean;\n\n constructor(size: number, signed: boolean, localName: string) {\n const name = ((signed ? \"int\": \"uint\") + (size * 8));\n super(name, name, localName, false);\n\n this.size = size;\n this.signed = signed;\n }\n\n defaultValue(): number {\n return 0;\n }\n\n encode(writer: Writer, value: BigNumberish): number {\n let v = BigNumber.from(value);\n\n // Check bounds are safe for encoding\n let maxUintValue = MaxUint256.mask(writer.wordSize * 8);\n if (this.signed) {\n let bounds = maxUintValue.mask(this.size * 8 - 1);\n if (v.gt(bounds) || v.lt(bounds.add(One).mul(NegativeOne))) {\n this._throwError(\"value out-of-bounds\", value);\n }\n } else if (v.lt(Zero) || v.gt(maxUintValue.mask(this.size * 8))) {\n this._throwError(\"value out-of-bounds\", value);\n }\n\n v = v.toTwos(this.size * 8).mask(this.size * 8);\n\n if (this.signed) {\n v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize);\n }\n\n return writer.writeValue(v);\n }\n\n decode(reader: Reader): any {\n let value = reader.readValue().mask(this.size * 8);\n\n if (this.signed) {\n value = value.fromTwos(this.size * 8);\n }\n\n return reader.coerce(this.name, value);\n }\n}\n\n","export const version = \"strings/5.6.0\";\n","\"use strict\";\n\nimport { arrayify, BytesLike } from \"@ethersproject/bytes\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n///////////////////////////////\n\nexport enum UnicodeNormalizationForm {\n current = \"\",\n NFC = \"NFC\",\n NFD = \"NFD\",\n NFKC = \"NFKC\",\n NFKD = \"NFKD\"\n};\n\nexport enum Utf8ErrorReason {\n // A continuation byte was present where there was nothing to continue\n // - offset = the index the codepoint began in\n UNEXPECTED_CONTINUE = \"unexpected continuation byte\",\n\n // An invalid (non-continuation) byte to start a UTF-8 codepoint was found\n // - offset = the index the codepoint began in\n BAD_PREFIX = \"bad codepoint prefix\",\n\n // The string is too short to process the expected codepoint\n // - offset = the index the codepoint began in\n OVERRUN = \"string overrun\",\n\n // A missing continuation byte was expected but not found\n // - offset = the index the continuation byte was expected at\n MISSING_CONTINUE = \"missing continuation byte\",\n\n // The computed code point is outside the range for UTF-8\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; outside the UTF-8 range\n OUT_OF_RANGE = \"out of UTF-8 range\",\n\n // UTF-8 strings may not contain UTF-16 surrogate pairs\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range\n UTF16_SURROGATE = \"UTF-16 surrogate\",\n\n // The string is an overlong representation\n // - offset = start of this codepoint\n // - badCodepoint = the computed codepoint; already bounds checked\n OVERLONG = \"overlong representation\",\n};\n\n\nexport type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number) => number;\n\nfunction errorFunc(reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number): number {\n return logger.throwArgumentError(`invalid codepoint at offset ${ offset }; ${ reason }`, \"bytes\", bytes);\n}\n\nfunction ignoreFunc(reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number): number {\n\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) { break; }\n i++;\n }\n return i;\n }\n\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === Utf8ErrorReason.OVERRUN) {\n return bytes.length - offset - 1;\n }\n\n // Nothing to skip\n return 0;\n}\n\nfunction replaceFunc(reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number): number {\n\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === Utf8ErrorReason.OVERLONG) {\n output.push(badCodepoint);\n return 0;\n }\n\n // Put the replacement character into the output\n output.push(0xfffd);\n\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n\n// Common error handing strategies\nexport const Utf8ErrorFuncs: { [ name: string ]: Utf8ErrorFunc } = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(bytes: BytesLike, onError?: Utf8ErrorFunc): Array<number> {\n if (onError == null) { onError = Utf8ErrorFuncs.error; }\n\n bytes = arrayify(bytes);\n\n const result: Array<number> = [];\n let i = 0;\n\n // Invalid bytes are ignored\n while(i < bytes.length) {\n\n const c = bytes[i++];\n\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n\n // Multibyte; how many bytes left for this character?\n let extraLength = null;\n let overlongMask = null;\n\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n\n // 1110 xxxx 10xx xxxx 10xx xxxx\n } else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n } else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n\n } else {\n if ((c & 0xc0) === 0x80) {\n i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);\n } else {\n i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);\n }\n continue;\n }\n\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);\n continue;\n }\n\n // Remove the length prefix from the char\n let res = c & ((1 << (8 - extraLength - 1)) - 1);\n\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);\n res = null;\n break;\n };\n\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n\n // See above loop for invalid continuation byte\n if (res === null) { continue; }\n\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n result.push(res);\n }\n\n return result;\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 logger.checkNormalize();\n str = str.normalize(form);\n }\n\n let result = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n\n if (c < 0x80) {\n result.push(c);\n\n } else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n\n } else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n\n if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) {\n throw new Error(\"invalid utf-8 string\");\n }\n\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n\n } else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n\n return arrayify(result);\n};\n\nfunction escapeChar(value: number) {\n const hex = (\"0000\" + value.toString(16));\n return \"\\\\u\" + hex.substring(hex.length - 4);\n}\n\nexport function _toEscapedUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string {\n return '\"' + getUtf8CodePoints(bytes, onError).map((codePoint) => {\n if (codePoint < 256) {\n switch (codePoint) {\n case 8: return \"\\\\b\";\n case 9: return \"\\\\t\";\n case 10: return \"\\\\n\"\n case 13: return \"\\\\r\";\n case 34: return \"\\\\\\\"\";\n case 92: return \"\\\\\\\\\";\n }\n\n if (codePoint >= 32 && codePoint < 127) {\n return String.fromCharCode(codePoint);\n }\n }\n\n if (codePoint <= 0xffff) {\n return escapeChar(codePoint);\n }\n\n codePoint -= 0x10000;\n return escapeChar(((codePoint >> 10) & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00);\n }).join(\"\") + '\"';\n}\n\nexport function _toUtf8String(codePoints: Array<number>): string {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode(\n (((codePoint >> 10) & 0x3ff) + 0xd800),\n ((codePoint & 0x3ff) + 0xdc00)\n );\n }).join(\"\");\n}\n\nexport function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n\nexport function toUtf8CodePoints(str: string, form: UnicodeNormalizationForm = UnicodeNormalizationForm.current): Array<number> {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n","\"use strict\";\n\nimport { HashZero } from \"@ethersproject/constants\";\nimport { arrayify, BytesLike, concat, hexlify } from \"@ethersproject/bytes\";\n\nimport { toUtf8Bytes, toUtf8String } from \"./utf8\";\n\n\nexport function formatBytes32String(text: string): string {\n\n // Get the bytes\n const bytes = toUtf8Bytes(text);\n\n // Check we have room for null-termination\n if (bytes.length > 31) { throw new Error(\"bytes32 string must be less than 32 bytes\"); }\n\n // Zero-pad (implicitly null-terminates)\n return hexlify(concat([ bytes, HashZero ]).slice(0, 32));\n}\n\nexport function parseBytes32String(bytes: BytesLike): string {\n const data = arrayify(bytes);\n\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) { throw new Error(\"invalid bytes32 - not 32 bytes long\"); }\n if (data[31] !== 0) { throw new Error(\"invalid bytes32 string - no null terminator\"); }\n\n // Find the null termination\n let length = 31;\n while (data[length - 1] === 0) { length--; }\n\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\n\n","\"use strict\";\n\nimport { toUtf8CodePoints, _toUtf8String, UnicodeNormalizationForm } from \"./utf8\";\n\ntype Ranged = {\n l: number, // Lo value\n h: number, // High value (less the lo)\n d?: number, // Delta/stride (default: 1)\n s?: number, // Shift (default: 1)\n e?: Array<number> // Exceptions to skip\n};\n\ntype Table = { [ src: number ]: Array<number> };\n\nfunction bytes2(data: string): Array<number> {\n if ((data.length % 4) !== 0) { throw new Error(\"bad data\"); }\n let result = [];\n for (let i = 0; i < data.length; i += 4) {\n result.push(parseInt(data.substring(i, i + 4), 16));\n }\n return result;\n}\n\nfunction createTable(data: string, func?: (value: string) => Array<number>): Table {\n if (!func) {\n func = function(value: string) { return [ parseInt(value, 16) ]; }\n }\n\n let lo = 0;\n\n let result: Table = { };\n data.split(\",\").forEach((pair) => {\n let comps = pair.split(\":\");\n lo += parseInt(comps[0], 16);\n result[lo] = func(comps[1]);\n });\n\n return result;\n}\n\nfunction createRangeTable(data: string): Array<Ranged> {\n let hi = 0;\n return data.split(\",\").map((v) => {\n let comps = v.split(\"-\");\n if (comps.length === 1) {\n comps[1] = \"0\";\n } else if (comps[1] === \"\") {\n comps[1] = \"1\";\n }\n\n let lo = hi + parseInt(comps[0], 16);\n hi = parseInt(comps[1], 16);\n return { l: lo, h: hi };\n });\n}\n\nfunction matchMap(value: number, ranges: Array<Ranged>): Ranged {\n let lo = 0;\n for (let i = 0; i < ranges.length; i++) {\n let range = ranges[i];\n lo += range.l;\n if (value >= lo && value <= lo + range.h && ((value - lo) % (range.d || 1)) === 0) {\n if (range.e && range.e.indexOf(value - lo) !== -1) { continue; }\n return range;\n }\n }\n return null;\n}\n\nconst Table_A_1_ranges = createRangeTable(\"221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d\");\n\n// @TODO: Make this relative...\nconst Table_B_1_flags = \"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff\".split(\",\").map((v) => parseInt(v, 16));\n\nconst Table_B_2_ranges: Array<Ranged> = [\n { h: 25, s: 32, l: 65 },\n { h: 30, s: 32, e: [ 23 ], l: 127 },\n { h: 54, s: 1, e: [ 48 ], l: 64, d: 2 },\n { h: 14, s: 1, l: 57, d: 2 },\n { h: 44, s: 1, l: 17, d: 2 },\n { h: 10, s: 1, e: [ 2, 6, 8 ], l: 61, d: 2 },\n { h: 16, s: 1, l: 68, d: 2 },\n { h: 84, s: 1, e: [ 18, 24, 66 ], l: 19, d: 2 },\n { h: 26, s: 32, e: [ 17 ], l: 435 },\n { h: 22, s: 1, l: 71, d: 2 },\n { h: 15, s: 80, l: 40 },\n { h: 31, s: 32, l: 16 },\n { h: 32, s: 1, l: 80, d: 2 },\n { h: 52, s: 1, l: 42, d: 2 },\n { h: 12, s: 1, l: 55, d: 2 },\n { h: 40, s: 1, e: [ 38 ], l: 15, d: 2 },\n { h: 14, s: 1, l: 48, d: 2 },\n { h: 37, s: 48, l: 49 },\n { h: 148, s: 1, l: 6351, d: 2 },\n { h: 88, s: 1, l: 160, d: 2 },\n { h: 15, s: 16, l: 704 },\n { h: 25, s: 26, l: 854 },\n { h: 25, s: 32, l: 55915 },\n { h: 37, s: 40, l: 1247 },\n { h: 25, s: -119711, l: 53248 },\n { h: 25, s: -119763, l: 52 },\n { h: 25, s: -119815, l: 52 },\n { h: 25, s: -119867, e: [ 1, 4, 5, 7, 8, 11, 12, 17 ], l: 52 },\n { h: 25, s: -119919, l: 52 },\n { h: 24, s: -119971, e: [ 2, 7, 8, 17 ], l: 52 },\n { h: 24, s: -120023, e: [ 2, 7, 13, 15, 16, 17 ], l: 52 },\n { h: 25, s: -120075, l: 52 },\n { h: 25, s: -120127, l: 52 },\n { h: 25, s: -120179, l: 52 },\n { h: 25, s: -120231, l: 52 },\n { h: 25, s: -120283, l: 52 },\n { h: 25, s: -120335, l: 52 },\n { h: 24, s: -119543, e: [ 17 ], l: 56 },\n { h: 24, s: -119601, e: [ 17 ], l: 58 },\n { h: 24, s: -119659, e: [ 17 ], l: 58 },\n { h: 24, s: -119717, e: [ 17 ], l: 58 },\n { h: 24, s: -119775, e: [ 17 ], l: 58 }\n];\nconst Table_B_2_lut_abs = createTable(\"b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3\");\nconst Table_B_2_lut_rel = createTable(\"179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7\");\nconst Table_B_2_complex = createTable(\"df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D\", bytes2);\n\nconst Table_C_ranges = createRangeTable(\"80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001\");\n\n\nfunction flatten(values: Array<Array<number>>): Array<number> {\n return values.reduce((accum, value) => {\n value.forEach((value) => { accum.push(value); });\n return accum;\n }, [ ]);\n}\n\nexport function _nameprepTableA1(codepoint: number): boolean {\n return !!matchMap(codepoint, Table_A_1_ranges);\n}\n\nexport function _nameprepTableB2(codepoint: number): Array<number> {\n let range = matchMap(codepoint, Table_B_2_ranges);\n if (range) { return [ codepoint + range.s ]; }\n\n let codes = Table_B_2_lut_abs[codepoint];\n if (codes) { return codes; }\n\n let shift = Table_B_2_lut_rel[codepoint];\n if (shift) { return [ codepoint + shift[0] ]; }\n\n let complex = Table_B_2_complex[codepoint];\n if (complex) { return complex; }\n\n return null;\n}\n\nexport function _nameprepTableC(codepoint: number): boolean {\n return !!matchMap(codepoint, Table_C_ranges);\n}\n\nexport function nameprep(value: string): string {\n\n // This allows platforms with incomplete normalize to bypass\n // it for very basic names which the built-in toLowerCase\n // will certainly handle correctly\n if (value.match(/^[a-z0-9-]*$/i) && value.length <= 59) { return value.toLowerCase(); }\n\n // Get the code points (keeping the current normalization)\n let codes = toUtf8CodePoints(value);\n\n codes = flatten(codes.map((code) => {\n // Substitute Table B.1 (Maps to Nothing)\n if (Table_B_1_flags.indexOf(code) >= 0) { return [ ]; }\n if (code >= 0xfe00 && code <= 0xfe0f) { return [ ]; }\n\n // Substitute Table B.2 (Case Folding)\n let codesTableB2 = _nameprepTableB2(code);\n if (codesTableB2) { return codesTableB2; }\n\n // No Substitution\n return [ code ];\n }));\n\n // Normalize using form KC\n codes = toUtf8CodePoints(_toUtf8String(codes), UnicodeNormalizationForm.NFKC);\n\n // Prohibit Tables C.1.2, C.2.2, C.3, C.4, C.5, C.6, C.7, C.8, C.9\n codes.forEach((code) => {\n if (_nameprepTableC(code)) {\n throw new Error(\"STRINGPREP_CONTAINS_PROHIBITED\");\n }\n });\n\n // Prohibit Unassigned Code Points (Table A.1)\n codes.forEach((code) => {\n if (_nameprepTableA1(code)) {\n throw new Error(\"STRINGPREP_CONTAINS_UNASSIGNED\");\n }\n });\n\n // IDNA extras\n let name = _toUtf8String(codes);\n\n // IDNA: 4.2.3.1\n if (name.substring(0, 1) === \"-\" || name.substring(2, 4) === \"--\" || name.substring(name.length - 1) === \"-\") {\n throw new Error(\"invalid hyphen\");\n }\n\n // IDNA: 4.2.4\n if (name.length > 63) { throw new Error(\"too long\"); }\n\n\n\n return name;\n}\n\n","\"use strict\";\n\nimport { formatBytes32String, parseBytes32String } from \"./bytes32\";\nimport { nameprep } from \"./idna\";\nimport { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm, Utf8ErrorFunc, Utf8ErrorFuncs, Utf8ErrorReason } from \"./utf8\";\n\nexport {\n _toEscapedUtf8String,\n toUtf8Bytes,\n toUtf8CodePoints,\n toUtf8String,\n\n Utf8ErrorFunc,\n Utf8ErrorFuncs,\n Utf8ErrorReason,\n\n UnicodeNormalizationForm,\n\n formatBytes32String,\n parseBytes32String,\n\n nameprep\n}\n","\"use strict\";\n\nimport { toUtf8Bytes, toUtf8String } from \"@ethersproject/strings\";\n\nimport { Reader, Writer } from \"./abstract-coder\";\nimport { DynamicBytesCoder } from \"./bytes\";\n\nexport class StringCoder extends DynamicBytesCoder {\n\n constructor(localName: string) {\n super(\"string\", localName);\n }\n\n defaultValue(): string {\n return \"\";\n }\n\n encode(writer: Writer, value: any): number {\n return super.encode(writer, toUtf8Bytes(value));\n }\n\n decode(reader: Reader): any {\n return toUtf8String(super.decode(reader));\n }\n}\n","\"use strict\";\n\nimport { Coder, Reader, Writer } from \"./abstract-coder\";\nimport { pack, unpack } from \"./array\";\n\nexport class TupleCoder extends Coder {\n readonly coders: Array<Coder>;\n\n constructor(coders: Array<Coder>, localName: string) {\n let dynamic = false;\n const types: Array<string> = [];\n coders.forEach((coder) => {\n if (coder.dynamic) { dynamic = true; }\n types.push(coder.type);\n });\n const type = (\"tuple(\" + types.join(\",\") + \")\");\n\n super(\"tuple\", type, localName, dynamic);\n this.coders = coders;\n }\n\n defaultValue(): any {\n const values: any = [ ];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) { accum[name] = 0; }\n accum[name]++;\n }\n return accum;\n }, <{ [ name: string ]: number }>{ });\n\n // Add named values\n this.coders.forEach((coder: Coder, index: number) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) { return; }\n\n if (name === \"length\") { name = \"_length\"; }\n\n if (values[name] != null) { return; }\n\n values[name] = values[index];\n });\n\n return Object.freeze(values);\n }\n\n encode(writer: Writer, value: Array<any> | { [ name: string ]: any }): number {\n return pack(writer, this.coders, value);\n }\n\n decode(reader: Reader): any {\n return reader.coerce(this.name, unpack(reader, this.coders));\n }\n}\n\n","\"use strict\";\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\nimport { arrayify, BytesLike } from \"@ethersproject/bytes\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { Coder, Reader, Result, Writer } from \"./coders/abstract-coder\";\nimport { AddressCoder } from \"./coders/address\";\nimport { ArrayCoder } from \"./coders/array\";\nimport { BooleanCoder } from \"./coders/boolean\";\nimport { BytesCoder } from \"./coders/bytes\";\nimport { FixedBytesCoder } from \"./coders/fixed-bytes\";\nimport { NullCoder } from \"./coders/null\";\nimport { NumberCoder } from \"./coders/number\";\nimport { StringCoder } from \"./coders/string\";\nimport { TupleCoder } from \"./coders/tuple\";\n\nimport { ParamType } from \"./fragments\";\n\n\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\n\n\nexport type CoerceFunc = (type: string, value: any) => any;\n\nexport class AbiCoder {\n readonly coerceFunc: CoerceFunc;\n\n constructor(coerceFunc?: CoerceFunc) {\n logger.checkNew(new.target, AbiCoder);\n defineReadOnly(this, \"coerceFunc\", coerceFunc || null);\n }\n\n _getCoder(param: ParamType): Coder {\n\n switch (param.baseType) {\n case \"address\":\n return new AddressCoder(param.name);\n case \"bool\":\n return new BooleanCoder(param.name);\n case \"string\":\n return new StringCoder(param.name);\n case \"bytes\":\n return new BytesCoder(param.name);\n case \"array\":\n return new ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name);\n case \"tuple\":\n return new TupleCoder((param.components || []).map((component) => {\n return this._getCoder(component);\n }), param.name);\n case \"\":\n return new NullCoder(param.name);\n }\n\n // u?int[0-9]*\n let 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 logger.throwArgumentError(\"invalid \" + match[1] + \" bit length\", \"param\", param);\n }\n return new NumberCoder(size / 8, (match[1] === \"int\"), param.name);\n }\n\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n if (size === 0 || size > 32) {\n logger.throwArgumentError(\"invalid bytes length\", \"param\", param);\n }\n return new FixedBytesCoder(size, param.name);\n }\n\n return logger.throwArgumentError(\"invalid type\", \"type\", param.type);\n }\n\n _getWordSize(): number { return 32; }\n\n _getReader(data: Uint8Array, allowLoose?: boolean): Reader {\n return new Reader(data, this._getWordSize(), this.coerceFunc, allowLoose);\n }\n\n _getWriter(): Writer {\n return new Writer(this._getWordSize());\n }\n\n getDefaultValue(types: ReadonlyArray<string | ParamType>): Result {\n const coders: Array<Coder> = types.map((type) => this._getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n\n encode(types: ReadonlyArray<string | ParamType>, values: ReadonlyArray<any>): string {\n if (types.length !== values.length) {\n logger.throwError(\"types/values length mismatch\", Logger.errors.INVALID_ARGUMENT, {\n count: { types: types.length, values: values.length },\n value: { types: types, values: values }\n });\n }\n\n const coders = types.map((type) => this._getCoder(ParamType.from(type)));\n const coder = (new TupleCoder(coders, \"_\"));\n\n const writer = this._getWriter();\n coder.encode(writer, values);\n return writer.data;\n }\n\n decode(types: ReadonlyArray<string | ParamType>, data: BytesLike, loose?: boolean): Result {\n const coders: Array<Coder> = types.map((type) => this._getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.decode(this._getReader(arrayify(data), loose));\n }\n}\n\nexport const defaultAbiCoder: AbiCoder = new AbiCoder();\n\n","import { keccak256 } from \"@ethersproject/keccak256\";\nimport { toUtf8Bytes } from \"@ethersproject/strings\";\n\nexport function id(text: string): string {\n return keccak256(toUtf8Bytes(text));\n}\n","export const version = \"hash/5.6.0\";\n","import { concat, hexlify } from \"@ethersproject/bytes\";\nimport { nameprep, toUtf8Bytes } from \"@ethersproject/strings\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nconst Zeros = new Uint8Array(32);\nZeros.fill(0);\n\nconst Partition = new RegExp(\"^((.*)\\\\.)?([^.]+)$\");\n\nexport function isValidName(name: string): boolean {\n try {\n const comps = name.split(\".\");\n for (let i = 0; i < comps.length; i++) {\n if (nameprep(comps[i]).length === 0) {\n throw new Error(\"empty\")\n }\n }\n return true;\n } catch (error) { }\n return false;\n}\n\nexport function namehash(name: string): string {\n /* istanbul ignore if */\n if (typeof(name) !== \"string\") {\n logger.throwArgumentError(\"invalid ENS name; not a string\", \"name\", name);\n }\n\n let current = name;\n let result: string | Uint8Array = Zeros;\n while (current.length) {\n const partition = current.match(Partition);\n if (partition == null || partition[2] === \"\") {\n logger.throwArgumentError(\"invalid ENS address; missing component\", \"name\", name);\n }\n const label = toUtf8Bytes(nameprep(partition[3]));\n result = keccak256(concat([result, keccak256(label)]));\n\n current = partition[2] || \"\";\n }\n\n return hexlify(result);\n}\n\nexport function dnsEncode(name: string): string {\n return hexlify(concat(name.split(\".\").map((comp) => {\n // We jam in an _ prefix to fill in with the length later\n // Note: Nameprep throws if the component is over 63 bytes\n const bytes = toUtf8Bytes(\"_\" + nameprep(comp));\n bytes[0] = bytes.length - 1;\n return bytes;\n }))) + \"00\";\n}\n","import { Bytes, concat } from \"@ethersproject/bytes\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { toUtf8Bytes } from \"@ethersproject/strings\";\n\nexport const messagePrefix = \"\\x19Ethereum Signed Message:\\n\";\n\nexport function hashMessage(message: Bytes | string): string {\n if (typeof(message) === \"string\") { message = toUtf8Bytes(message); }\n return keccak256(concat([\n toUtf8Bytes(messagePrefix),\n toUtf8Bytes(String(message.length)),\n message\n ]));\n}\n\n","import { TypedDataDomain, TypedDataField } from \"@ethersproject/abstract-signer\";\nimport { getAddress } from \"@ethersproject/address\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { arrayify, BytesLike, hexConcat, hexlify, hexZeroPad, isHexString } from \"@ethersproject/bytes\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { deepCopy, defineReadOnly, shallowCopy } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { id } from \"./id\";\n\nconst padding = new Uint8Array(32);\npadding.fill(0);\n\nconst NegativeOne: BigNumber = BigNumber.from(-1);\nconst Zero: BigNumber = BigNumber.from(0);\nconst One: BigNumber = BigNumber.from(1);\nconst MaxUint256: BigNumber = BigNumber.from(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n\nfunction hexPadRight(value: BytesLike) {\n const bytes = arrayify(value);\n const padOffset = bytes.length % 32\n if (padOffset) {\n return hexConcat([ bytes, padding.slice(padOffset) ]);\n }\n return hexlify(bytes);\n}\n\nconst hexTrue = hexZeroPad(One.toHexString(), 32);\nconst hexFalse = hexZeroPad(Zero.toHexString(), 32);\n\nconst domainFieldTypes: Record<string, string> = {\n name: \"string\",\n version: \"string\",\n chainId: \"uint256\",\n verifyingContract: \"address\",\n salt: \"bytes32\"\n};\n\nconst domainFieldNames: Array<string> = [\n \"name\", \"version\", \"chainId\", \"verifyingContract\", \"salt\"\n];\n\nfunction checkString(key: string): (value: any) => string {\n return function (value: any){\n if (typeof(value) !== \"string\") {\n logger.throwArgumentError(`invalid domain value for ${ JSON.stringify(key) }`, `domain.${ key }`, value);\n }\n return value;\n }\n}\n\nconst domainChecks: Record<string, (value: any) => any> = {\n name: checkString(\"name\"),\n version: checkString(\"version\"),\n chainId: function(value: any) {\n try {\n return BigNumber.from(value).toString()\n } catch (error) { }\n return logger.throwArgumentError(`invalid domain value for \"chainId\"`, \"domain.chainId\", value);\n },\n verifyingContract: function(value: any) {\n try {\n return getAddress(value).toLowerCase();\n } catch (error) { }\n return logger.throwArgumentError(`invalid domain value \"verifyingContract\"`, \"domain.verifyingContract\", value);\n },\n salt: function(value: any) {\n try {\n const bytes = arrayify(value);\n if (bytes.length !== 32) { throw new Error(\"bad length\"); }\n return hexlify(bytes);\n } catch (error) { }\n return logger.throwArgumentError(`invalid domain value \"salt\"`, \"domain.salt\", value);\n }\n}\n\nfunction getBaseEncoder(type: string): (value: any) => string {\n // intXX and uintXX\n {\n const match = type.match(/^(u?)int(\\d*)$/);\n if (match) {\n const signed = (match[1] === \"\");\n\n const width = parseInt(match[2] || \"256\");\n if (width % 8 !== 0 || width > 256 || (match[2] && match[2] !== String(width))) {\n logger.throwArgumentError(\"invalid numeric width\", \"type\", type);\n }\n\n const boundsUpper = MaxUint256.mask(signed ? (width - 1): width);\n const boundsLower = signed ? boundsUpper.add(One).mul(NegativeOne): Zero;\n\n return function(value: BigNumberish) {\n const v = BigNumber.from(value);\n\n if (v.lt(boundsLower) || v.gt(boundsUpper)) {\n logger.throwArgumentError(`value out-of-bounds for ${ type }`, \"value\", value);\n }\n\n return hexZeroPad(v.toTwos(256).toHexString(), 32);\n };\n }\n }\n\n // bytesXX\n {\n const match = type.match(/^bytes(\\d+)$/);\n if (match) {\n const width = parseInt(match[1]);\n if (width === 0 || width > 32 || match[1] !== String(width)) {\n logger.throwArgumentError(\"invalid bytes width\", \"type\", type);\n }\n\n return function(value: BytesLike) {\n const bytes = arrayify(value);\n if (bytes.length !== width) {\n logger.throwArgumentError(`invalid length for ${ type }`, \"value\", value);\n }\n return hexPadRight(value);\n };\n }\n }\n\n switch (type) {\n case \"address\": return function(value: string) {\n return hexZeroPad(getAddress(value), 32);\n };\n case \"bool\": return function(value: boolean) {\n return ((!value) ? hexFalse: hexTrue);\n };\n case \"bytes\": return function(value: BytesLike) {\n return keccak256(value);\n };\n case \"string\": return function(value: string) {\n return id(value);\n };\n }\n\n return null;\n}\n\nfunction encodeType(name: string, fields: Array<TypedDataField>): string {\n return `${ name }(${ fields.map(({ name, type }) => (type + \" \" + name)).join(\",\") })`;\n}\n\nexport class TypedDataEncoder {\n readonly primaryType: string;\n readonly types: Record<string, Array<TypedDataField>>;\n\n readonly _encoderCache: Record<string, (value: any) => string>;\n readonly _types: Record<string, string>;\n\n constructor(types: Record<string, Array<TypedDataField>>) {\n defineReadOnly(this, \"types\", Object.freeze(deepCopy(types)));\n\n defineReadOnly(this, \"_encoderCache\", { });\n defineReadOnly(this, \"_types\", { });\n\n // Link struct types to their direct child structs\n const links: Record<string, Record<string, boolean>> = { };\n\n // Link structs to structs which contain them as a child\n const parents: Record<string, Array<string>> = { };\n\n // Link all subtypes within a given struct\n const subtypes: Record<string, Record<string, boolean>> = { };\n\n Object.keys(types).forEach((type) => {\n links[type] = { };\n parents[type] = [ ];\n subtypes[type] = { }\n });\n\n for (const name in types) {\n\n const uniqueNames: Record<string, boolean> = { };\n\n types[name].forEach((field) => {\n\n // Check each field has a unique name\n if (uniqueNames[field.name]) {\n logger.throwArgumentError(`duplicate variable name ${ JSON.stringify(field.name) } in ${ JSON.stringify(name) }`, \"types\", types);\n }\n uniqueNames[field.name] = true;\n\n // Get the base type (drop any array specifiers)\n const baseType = field.type.match(/^([^\\x5b]*)(\\x5b|$)/)[1];\n if (baseType === name) {\n logger.throwArgumentError(`circular type reference to ${ JSON.stringify(baseType) }`, \"types\", types);\n }\n\n // Is this a base encoding type?\n const encoder = getBaseEncoder(baseType);\n if (encoder) { return ;}\n\n if (!parents[baseType]) {\n logger.throwArgumentError(`unknown type ${ JSON.stringify(baseType) }`, \"types\", types);\n }\n\n // Add linkage\n parents[baseType].push(name);\n links[name][baseType] = true;\n });\n }\n\n // Deduce the primary type\n const primaryTypes = Object.keys(parents).filter((n) => (parents[n].length === 0));\n\n if (primaryTypes.length === 0) {\n logger.throwArgumentError(\"missing primary type\", \"types\", types);\n } else if (primaryTypes.length > 1) {\n logger.throwArgumentError(`ambiguous primary types or unused types: ${ primaryTypes.map((t) => (JSON.stringify(t))).join(\", \") }`, \"types\", types);\n }\n\n defineReadOnly(this, \"primaryType\", primaryTypes[0]);\n\n // Check for circular type references\n function checkCircular(type: string, found: Record<string, boolean>) {\n if (found[type]) {\n logger.throwArgumentError(`circular type reference to ${ JSON.stringify(type) }`, \"types\", types);\n }\n\n found[type] = true;\n\n Object.keys(links[type]).forEach((child) => {\n if (!parents[child]) { return; }\n\n // Recursively check children\n checkCircular(child, found);\n\n // Mark all ancestors as having this decendant\n Object.keys(found).forEach((subtype) => {\n subtypes[subtype][child] = true;\n });\n });\n\n delete found[type];\n }\n checkCircular(this.primaryType, { });\n\n // Compute each fully describe type\n for (const name in subtypes) {\n const st = Object.keys(subtypes[name]);\n st.sort();\n this._types[name] = encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(\"\");\n }\n }\n\n getEncoder(type: string): (value: any) => string {\n let encoder = this._encoderCache[type];\n if (!encoder) {\n encoder = this._encoderCache[type] = this._getEncoder(type);\n }\n return encoder;\n }\n\n _getEncoder(type: string): (value: any) => string {\n\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) { return encoder; }\n }\n\n // Array\n const match = type.match(/^(.*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n const subtype = match[1];\n const subEncoder = this.getEncoder(subtype);\n const length = parseInt(match[3]);\n return (value: Array<any>) => {\n if (length >= 0 && value.length !== length) {\n logger.throwArgumentError(\"array length mismatch; expected length ${ arrayLength }\", \"value\", value);\n }\n\n let result = value.map(subEncoder);\n if (this._types[subtype]) {\n result = result.map(keccak256);\n }\n\n return keccak256(hexConcat(result));\n };\n }\n\n // Struct\n const fields = this.types[type];\n if (fields) {\n const encodedType = id(this._types[type]);\n return (value: Record<string, any>) => {\n const values = fields.map(({ name, type }) => {\n const result = this.getEncoder(type)(value[name]);\n if (this._types[type]) { return keccak256(result); }\n return result;\n });\n values.unshift(encodedType);\n return hexConcat(values);\n }\n }\n\n return logger.throwArgumentError(`unknown type: ${ type }`, \"type\", type);\n }\n\n encodeType(name: string): string {\n const result = this._types[name];\n if (!result) {\n logger.throwArgumentError(`unknown type: ${ JSON.stringify(name) }`, \"name\", name);\n }\n return result;\n }\n\n encodeData(type: string, value: any): string {\n return this.getEncoder(type)(value);\n }\n\n hashStruct(name: string, value: Record<string, any>): string {\n return keccak256(this.encodeData(name, value));\n }\n\n encode(value: Record<string, any>): string {\n return this.encodeData(this.primaryType, value);\n }\n\n hash(value: Record<string, any>): string {\n return this.hashStruct(this.primaryType, value);\n }\n\n _visit(type: string, value: any, callback: (type: string, data: any) => any): any {\n // Basic encoder type (address, bool, uint256, etc)\n {\n const encoder = getBaseEncoder(type);\n if (encoder) { return callback(type, value); }\n }\n\n // Array\n const match = type.match(/^(.*)(\\x5b(\\d*)\\x5d)$/);\n if (match) {\n const subtype = match[1];\n const length = parseInt(match[3]);\n if (length >= 0 && value.length !== length) {\n logger.throwArgumentError(\"array length mismatch; expected length ${ arrayLength }\", \"value\", value);\n }\n return value.map((v: any) => this._visit(subtype, v, callback));\n }\n\n // Struct\n const fields = this.types[type];\n if (fields) {\n return fields.reduce((accum, { name, type }) => {\n accum[name] = this._visit(type, value[name], callback);\n return accum;\n }, <Record<string, any>>{});\n }\n\n return logger.throwArgumentError(`unknown type: ${ type }`, \"type\", type);\n }\n\n visit(value: Record<string, any>, callback: (type: string, data: any) => any): any {\n return this._visit(this.primaryType, value, callback);\n }\n\n static from(types: Record<string, Array<TypedDataField>>): TypedDataEncoder {\n return new TypedDataEncoder(types);\n }\n\n static getPrimaryType(types: Record<string, Array<TypedDataField>>): string {\n return TypedDataEncoder.from(types).primaryType;\n }\n\n static hashStruct(name: string, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string {\n return TypedDataEncoder.from(types).hashStruct(name, value);\n }\n\n static hashDomain(domain: TypedDataDomain): string {\n const domainFields: Array<TypedDataField> = [ ];\n for (const name in domain) {\n const type = domainFieldTypes[name];\n if (!type) {\n logger.throwArgumentError(`invalid typed-data domain key: ${ JSON.stringify(name) }`, \"domain\", domain);\n }\n domainFields.push({ name, type });\n }\n\n domainFields.sort((a, b) => {\n return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name);\n });\n\n return TypedDataEncoder.hashStruct(\"EIP712Domain\", { EIP712Domain: domainFields }, domain);\n }\n\n static encode(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string {\n return hexConcat([\n \"0x1901\",\n TypedDataEncoder.hashDomain(domain),\n TypedDataEncoder.from(types).hash(value)\n ]);\n }\n\n static hash(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string {\n return keccak256(TypedDataEncoder.encode(domain, types, value));\n }\n\n // Replaces all address types with ENS names with their looked up address\n static async resolveNames(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, resolveName: (name: string) => Promise<string>): Promise<{ domain: TypedDataDomain, value: any }> {\n // Make a copy to isolate it from the object passed in\n domain = shallowCopy(domain);\n\n // Look up all ENS names\n const ensCache: Record<string, string> = { };\n\n // Do we need to look up the domain's verifyingContract?\n if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) {\n ensCache[domain.verifyingContract] = \"0x\";\n }\n\n // We are going to use the encoder to visit all the base values\n const encoder = TypedDataEncoder.from(types);\n\n // Get a list of all the addresses\n encoder.visit(value, (type: string, value: any) => {\n if (type === \"address\" && !isHexString(value, 20)) {\n ensCache[value] = \"0x\";\n }\n return value;\n });\n\n // Lookup each name\n for (const name in ensCache) {\n ensCache[name] = await resolveName(name);\n }\n\n // Replace the domain verifyingContract if needed\n if (domain.verifyingContract && ensCache[domain.verifyingContract]) {\n domain.verifyingContract = ensCache[domain.verifyingContract];\n }\n\n // Replace all ENS names with their address\n value = encoder.visit(value, (type: string, value: any) => {\n if (type === \"address\" && ensCache[value]) { return ensCache[value]; }\n return value;\n });\n\n return { domain, value };\n }\n\n static getPayload(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): any {\n // Validate the domain fields\n TypedDataEncoder.hashDomain(domain);\n\n // Derive the EIP712Domain Struct reference type\n const domainValues: Record<string, any> = { };\n const domainTypes: Array<{ name: string, type:string }> = [ ];\n\n domainFieldNames.forEach((name) => {\n const value = (<any>domain)[name];\n if (value == null) { return; }\n domainValues[name] = domainChecks[name](value);\n domainTypes.push({ name, type: domainFieldTypes[name] });\n });\n\n const encoder = TypedDataEncoder.from(types);\n\n const typesWithDomain = shallowCopy(types);\n if (typesWithDomain.EIP712Domain) {\n logger.throwArgumentError(\"types must not contain EIP712Domain type\", \"types.EIP712Domain\", types);\n } else {\n typesWithDomain.EIP712Domain = domainTypes;\n }\n\n // Validate the data structures and types\n encoder.encode(value);\n\n return {\n types: typesWithDomain,\n domain: domainValues,\n primaryType: encoder.primaryType,\n message: encoder.visit(value, (type: string, value: any) => {\n\n // bytes\n if (type.match(/^bytes(\\d*)/)) {\n return hexlify(arrayify(value));\n }\n\n // uint or int\n if (type.match(/^u?int/)) {\n return BigNumber.from(value).toString();\n }\n\n switch (type) {\n case \"address\":\n return value.toLowerCase();\n case \"bool\":\n return !!value;\n case \"string\":\n if (typeof(value) !== \"string\") {\n logger.throwArgumentError(`invalid string`, \"value\", value);\n }\n return value;\n }\n\n return logger.throwArgumentError(\"unsupported type\", \"type\", type);\n })\n };\n }\n}\n\n","\"use strict\";\n\nimport { id } from \"./id\";\nimport { dnsEncode, isValidName, namehash } from \"./namehash\";\nimport { hashMessage, messagePrefix } from \"./message\";\n\nimport { TypedDataEncoder as _TypedDataEncoder } from \"./typed-data\";\n\nexport {\n id,\n\n dnsEncode,\n namehash,\n isValidName,\n\n messagePrefix,\n hashMessage,\n\n _TypedDataEncoder,\n}\n","\"use strict\";\n\nimport { getAddress } from \"@ethersproject/address\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { arrayify, BytesLike, concat, hexDataSlice, hexlify, hexZeroPad, isHexString } from \"@ethersproject/bytes\";\nimport { id } from \"@ethersproject/hash\";\nimport { keccak256 } from \"@ethersproject/keccak256\"\nimport { defineReadOnly, Description, getStatic } from \"@ethersproject/properties\";\n\nimport { AbiCoder, defaultAbiCoder } from \"./abi-coder\";\nimport { checkResultErrors, Result } from \"./coders/abstract-coder\";\nimport { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, ParamType } from \"./fragments\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nexport { checkResultErrors, Result };\n\nexport class LogDescription extends Description<LogDescription> {\n readonly eventFragment: EventFragment;\n readonly name: string;\n readonly signature: string;\n readonly topic: string;\n readonly args: Result\n}\n\nexport class TransactionDescription extends Description<TransactionDescription> {\n readonly functionFragment: FunctionFragment;\n readonly name: string;\n readonly args: Result;\n readonly signature: string;\n readonly sighash: string;\n readonly value: BigNumber;\n}\n\nexport class ErrorDescription extends Description<ErrorDescription> {\n readonly errorFragment: ErrorFragment;\n readonly name: string;\n readonly args: Result;\n readonly signature: string;\n readonly sighash: string;\n}\n\nexport class Indexed extends Description<Indexed> {\n readonly hash: string;\n readonly _isIndexed: boolean;\n\n static isIndexed(value: any): value is Indexed {\n return !!(value && value._isIndexed);\n }\n}\n\nconst BuiltinErrors: Record<string, { signature: string, inputs: Array<string>, name: string, reason?: boolean }> = {\n \"0x08c379a0\": { signature: \"Error(string)\", name: \"Error\", inputs: [ \"string\" ], reason: true },\n \"0x4e487b71\": { signature: \"Panic(uint256)\", name: \"Panic\", inputs: [ \"uint256\" ] }\n}\n\nfunction wrapAccessError(property: string, error: Error): Error {\n const wrap = new Error(`deferred error during ABI decoding triggered accessing ${ property }`);\n (<any>wrap).error = error;\n return wrap;\n}\n\n/*\nfunction checkNames(fragment: Fragment, type: \"input\" | \"output\", params: Array<ParamType>): void {\n params.reduce((accum, param) => {\n if (param.name) {\n if (accum[param.name]) {\n logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format(\"full\") }`, \"fragment\", fragment);\n }\n accum[param.name] = true;\n }\n return accum;\n }, <{ [ name: string ]: boolean }>{ });\n}\n*/\nexport class Interface {\n readonly fragments: ReadonlyArray<Fragment>;\n\n readonly errors: { [ name: string ]: ErrorFragment };\n readonly events: { [ name: string ]: EventFragment };\n readonly functions: { [ name: string ]: FunctionFragment };\n readonly structs: { [ name: string ]: any };\n\n readonly deploy: ConstructorFragment;\n\n readonly _abiCoder: AbiCoder;\n\n readonly _isInterface: boolean;\n\n constructor(fragments: string | ReadonlyArray<Fragment | JsonFragment | string>) {\n logger.checkNew(new.target, Interface);\n\n let abi: ReadonlyArray<Fragment | JsonFragment | string> = [ ];\n if (typeof(fragments) === \"string\") {\n abi = JSON.parse(fragments);\n } else {\n abi = fragments;\n }\n\n defineReadOnly(this, \"fragments\", abi.map((fragment) => {\n return Fragment.from(fragment);\n }).filter((fragment) => (fragment != null)));\n\n defineReadOnly(this, \"_abiCoder\", getStatic<() => AbiCoder>(new.target, \"getAbiCoder\")());\n\n defineReadOnly(this, \"functions\", { });\n defineReadOnly(this, \"errors\", { });\n defineReadOnly(this, \"events\", { });\n defineReadOnly(this, \"structs\", { });\n\n // Add all fragments by their signature\n this.fragments.forEach((fragment) => {\n let bucket: { [ name: string ]: Fragment } = null;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n logger.warn(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n defineReadOnly(this, \"deploy\", <ConstructorFragment>fragment);\n return;\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (<FunctionFragment>fragment).outputs);\n bucket = this.functions;\n break;\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.events;\n break;\n case \"error\":\n bucket = this.errors;\n break;\n default:\n return;\n }\n\n let signature = fragment.format();\n if (bucket[signature]) {\n logger.warn(\"duplicate definition - \" + signature);\n return;\n }\n\n bucket[signature] = fragment;\n });\n\n // If we do not have a constructor add a default\n if (!this.deploy) {\n defineReadOnly(this, \"deploy\", ConstructorFragment.from({\n payable: false,\n type: \"constructor\"\n }));\n }\n\n defineReadOnly(this, \"_isInterface\", true);\n }\n\n format(format?: string): string | Array<string> {\n if (!format) { format = FormatTypes.full; }\n if (format === FormatTypes.sighash) {\n logger.throwArgumentError(\"interface does not support formatting sighash\", \"format\", format);\n }\n\n const abi = this.fragments.map((fragment) => fragment.format(format));\n\n // We need to re-bundle the JSON fragments a bit\n if (format === FormatTypes.json) {\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n\n return abi;\n }\n\n // Sub-classes can override these to handle other blockchains\n static getAbiCoder(): AbiCoder {\n return defaultAbiCoder;\n }\n\n static getAddress(address: string): string {\n return getAddress(address);\n }\n\n static getSighash(fragment: ErrorFragment | FunctionFragment): string {\n return hexDataSlice(id(fragment.format()), 0, 4);\n }\n\n static getEventTopic(eventFragment: EventFragment): string {\n return id(eventFragment.format());\n }\n\n // Find a function definition by any means necessary (unless it is ambiguous)\n getFunction(nameOrSignatureOrSighash: string): FunctionFragment {\n if (isHexString(nameOrSignatureOrSighash)) {\n for (const name in this.functions) {\n if (nameOrSignatureOrSighash === this.getSighash(name)) {\n return this.functions[name];\n }\n }\n logger.throwArgumentError(\"no matching function\", \"sighash\", nameOrSignatureOrSighash);\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrSighash.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrSighash.trim();\n const matching = Object.keys(this.functions).filter((f) => (f.split(\"(\"/* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching function\", \"name\", name);\n } else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching functions\", \"name\", name);\n }\n\n return this.functions[matching[0]];\n }\n\n // Normalize the signature and lookup the function\n const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching function\", \"signature\", nameOrSignatureOrSighash);\n }\n return result;\n }\n\n // Find an event definition by any means necessary (unless it is ambiguous)\n getEvent(nameOrSignatureOrTopic: string): EventFragment {\n if (isHexString(nameOrSignatureOrTopic)) {\n const topichash = nameOrSignatureOrTopic.toLowerCase();\n for (const name in this.events) {\n if (topichash === this.getEventTopic(name)) {\n return this.events[name];\n }\n }\n logger.throwArgumentError(\"no matching event\", \"topichash\", topichash);\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrTopic.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrTopic.trim();\n const matching = Object.keys(this.events).filter((f) => (f.split(\"(\"/* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching event\", \"name\", name);\n } else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching events\", \"name\", name);\n }\n\n return this.events[matching[0]];\n }\n\n // Normalize the signature and lookup the function\n const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching event\", \"signature\", nameOrSignatureOrTopic);\n }\n return result;\n }\n\n // Find a function definition by any means necessary (unless it is ambiguous)\n getError(nameOrSignatureOrSighash: string): ErrorFragment {\n if (isHexString(nameOrSignatureOrSighash)) {\n const getSighash = getStatic<(f: ErrorFragment | FunctionFragment) => string>(this.constructor, \"getSighash\");\n for (const name in this.errors) {\n const error = this.errors[name];\n if (nameOrSignatureOrSighash === getSighash(error)) {\n return this.errors[name];\n }\n }\n logger.throwArgumentError(\"no matching error\", \"sighash\", nameOrSignatureOrSighash);\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (nameOrSignatureOrSighash.indexOf(\"(\") === -1) {\n const name = nameOrSignatureOrSighash.trim();\n const matching = Object.keys(this.errors).filter((f) => (f.split(\"(\"/* fix:) */)[0] === name));\n if (matching.length === 0) {\n logger.throwArgumentError(\"no matching error\", \"name\", name);\n } else if (matching.length > 1) {\n logger.throwArgumentError(\"multiple matching errors\", \"name\", name);\n }\n\n return this.errors[matching[0]];\n }\n\n // Normalize the signature and lookup the function\n const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];\n if (!result) {\n logger.throwArgumentError(\"no matching error\", \"signature\", nameOrSignatureOrSighash);\n }\n return result;\n }\n\n // Get the sighash (the bytes4 selector) used by Solidity to identify a function\n getSighash(fragment: ErrorFragment | FunctionFragment | string): string {\n if (typeof(fragment) === \"string\") {\n try {\n fragment = this.getFunction(fragment);\n } catch (error) {\n try {\n fragment = this.getError(<string>fragment);\n } catch (_) {\n throw error;\n }\n }\n }\n\n return getStatic<(f: ErrorFragment | FunctionFragment) => string>(this.constructor, \"getSighash\")(fragment);\n }\n\n // Get the topic (the bytes32 hash) used by Solidity to identify an event\n getEventTopic(eventFragment: EventFragment | string): string {\n if (typeof(eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n\n return getStatic<(e: EventFragment) => string>(this.constructor, \"getEventTopic\")(eventFragment);\n }\n\n\n _decodeParams(params: ReadonlyArray<ParamType>, data: BytesLike): Result {\n return this._abiCoder.decode(params, data)\n }\n\n _encodeParams(params: ReadonlyArray<ParamType>, values: ReadonlyArray<any>): string {\n return this._abiCoder.encode(params, values)\n }\n\n encodeDeploy(values?: ReadonlyArray<any>): string {\n return this._encodeParams(this.deploy.inputs, values || [ ]);\n }\n\n decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result {\n if (typeof(fragment) === \"string\") {\n fragment = this.getError(fragment);\n }\n\n const bytes = arrayify(data);\n\n if (hexlify(bytes.slice(0, 4)) !== this.getSighash(fragment)) {\n logger.throwArgumentError(`data signature does not match error ${ fragment.name }.`, \"data\", hexlify(bytes));\n }\n\n return this._decodeParams(fragment.inputs, bytes.slice(4));\n }\n\n encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray<any>): string {\n if (typeof(fragment) === \"string\") {\n fragment = this.getError(fragment);\n }\n\n return hexlify(concat([\n this.getSighash(fragment),\n this._encodeParams(fragment.inputs, values || [ ])\n ]));\n }\n\n // Decode the data for a function call (e.g. tx.data)\n decodeFunctionData(functionFragment: FunctionFragment | string, data: BytesLike): Result {\n if (typeof(functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n\n const bytes = arrayify(data);\n\n if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {\n logger.throwArgumentError(`data signature does not match function ${ functionFragment.name }.`, \"data\", hexlify(bytes));\n }\n\n return this._decodeParams(functionFragment.inputs, bytes.slice(4));\n }\n\n // Encode the data for a function call (e.g. tx.data)\n encodeFunctionData(functionFragment: FunctionFragment | string, values?: ReadonlyArray<any>): string {\n if (typeof(functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n\n return hexlify(concat([\n this.getSighash(functionFragment),\n this._encodeParams(functionFragment.inputs, values || [ ])\n ]));\n }\n\n // Decode the result from a function call (e.g. from eth_call)\n decodeFunctionResult(functionFragment: FunctionFragment | string, data: BytesLike): Result {\n if (typeof(functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n\n let bytes = arrayify(data);\n\n let reason: string = null;\n let message = \"\";\n let errorArgs: Result = null;\n let errorName: string = null;\n let errorSignature: string = null;\n switch (bytes.length % this._abiCoder._getWordSize()) {\n case 0:\n try {\n return this._abiCoder.decode(functionFragment.outputs, bytes);\n } catch (error) { }\n break;\n\n case 4: {\n const selector = hexlify(bytes.slice(0, 4));\n const builtin = BuiltinErrors[selector];\n if (builtin) {\n errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));\n errorName = builtin.name;\n errorSignature = builtin.signature;\n if (builtin.reason) { reason = errorArgs[0]; }\n if (errorName === \"Error\") {\n message = `; VM Exception while processing transaction: reverted with reason string ${ JSON.stringify(errorArgs[0]) }`;\n } else if (errorName === \"Panic\") {\n message = `; VM Exception while processing transaction: reverted with panic code ${ errorArgs[0] }`;\n }\n } else {\n try {\n const error = this.getError(selector);\n errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));\n errorName = error.name;\n errorSignature = error.format();\n } catch (error) { }\n }\n break;\n }\n }\n\n return logger.throwError(\"call revert exception\" + message, Logger.errors.CALL_EXCEPTION, {\n method: functionFragment.format(),\n data: hexlify(data), errorArgs, errorName, errorSignature, reason\n });\n }\n\n // Encode the result for a function call (e.g. for eth_call)\n encodeFunctionResult(functionFragment: FunctionFragment | string, values?: ReadonlyArray<any>): string {\n if (typeof(functionFragment) === \"string\") {\n functionFragment = this.getFunction(functionFragment);\n }\n\n return hexlify(this._abiCoder.encode(functionFragment.outputs, values || [ ]));\n }\n\n // Create the filter for the event with search criteria (e.g. for eth_filterLog)\n encodeFilterTopics(eventFragment: EventFragment, values: ReadonlyArray<any>): Array<string | Array<string>> {\n if (typeof(eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n\n if (values.length > eventFragment.inputs.length) {\n logger.throwError(\"too many arguments for \" + eventFragment.format(), Logger.errors.UNEXPECTED_ARGUMENT, {\n argument: \"values\",\n value: values\n })\n }\n\n let topics: Array<string | Array<string>> = [];\n if (!eventFragment.anonymous) { topics.push(this.getEventTopic(eventFragment)); }\n\n const encodeTopic = (param: ParamType, value: any): string => {\n if (param.type === \"string\") {\n return id(value);\n } else if (param.type === \"bytes\") {\n return keccak256(hexlify(value));\n }\n\n // Check addresses are valid\n if (param.type === \"address\") { this._abiCoder.encode( [ \"address\" ], [ value ]); }\n return hexZeroPad(hexlify(value), 32);\n };\n\n values.forEach((value, index) => {\n\n let param = eventFragment.inputs[index];\n\n if (!param.indexed) {\n if (value != null) {\n logger.throwArgumentError(\"cannot filter non-indexed parameters; must be null\", (\"contract.\" + param.name), value);\n }\n return;\n }\n\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n\n return topics;\n }\n\n encodeEventLog(eventFragment: EventFragment, values: ReadonlyArray<any>): { data: string, topics: Array<string> } {\n if (typeof(eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n\n const topics: Array<string> = [ ];\n\n const dataTypes: Array<ParamType> = [ ];\n const dataValues: Array<string> = [ ];\n\n if (!eventFragment.anonymous) {\n topics.push(this.getEventTopic(eventFragment));\n }\n\n if (values.length !== eventFragment.inputs.length) {\n logger.throwArgumentError(\"event arguments/values mismatch\", \"values\", values);\n }\n\n eventFragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push(id(value))\n } else if (param.type === \"bytes\") {\n topics.push(keccak256(value))\n } else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n } else {\n topics.push(this._abiCoder.encode([ param.type] , [ value ]));\n }\n } else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n\n return {\n data: this._abiCoder.encode(dataTypes , dataValues),\n topics: topics\n };\n }\n\n // Decode a filter for the event and the search criteria\n decodeEventLog(eventFragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray<string>): Result {\n if (typeof(eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n\n if (topics != null && !eventFragment.anonymous) {\n let topicHash = this.getEventTopic(eventFragment);\n if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {\n logger.throwError(\"fragment/topic mismatch\", Logger.errors.INVALID_ARGUMENT, { argument: \"topics[0]\", expected: topicHash, value: topics[0] });\n }\n topics = topics.slice(1);\n }\n\n let indexed: Array<ParamType> = [];\n let nonIndexed: Array<ParamType> = [];\n let dynamic: Array<boolean> = [];\n\n eventFragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" || param.type === \"bytes\" || param.baseType === \"tuple\" || param.baseType === \"array\") {\n indexed.push(ParamType.fromObject({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n } else {\n indexed.push(param);\n dynamic.push(false);\n }\n } else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n\n let resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, concat(topics)): null;\n let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true);\n\n let result: (Array<any> & { [ key: string ]: any }) = [ ];\n let nonIndexedIndex = 0, indexedIndex = 0;\n eventFragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (resultIndexed == null) {\n result[index] = new Indexed({ _isIndexed: true, hash: null });\n\n } else if (dynamic[index]) {\n result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });\n\n } else {\n try {\n result[index] = resultIndexed[indexedIndex++];\n } catch (error) {\n result[index] = error;\n }\n }\n } else {\n try {\n result[index] = resultNonIndexed[nonIndexedIndex++];\n } catch (error) {\n result[index] = error;\n }\n }\n\n // Add the keyword argument if named and safe\n if (param.name && result[param.name] == null) {\n const value = result[index];\n\n // Make error named values throw on access\n if (value instanceof Error) {\n Object.defineProperty(result, param.name, {\n enumerable: true,\n get: () => { throw wrapAccessError(`property ${ JSON.stringify(param.name) }`, value); }\n });\n } else {\n result[param.name] = value;\n }\n }\n });\n\n // Make all error indexed values throw on access\n for (let i = 0; i < result.length; i++) {\n const value = result[i];\n if (value instanceof Error) {\n Object.defineProperty(result, i, {\n enumerable: true,\n get: () => { throw wrapAccessError(`index ${ i }`, value); }\n });\n }\n }\n\n return Object.freeze(result);\n }\n\n // Given a transaction, find the matching function fragment (if any) and\n // determine all its properties and call parameters\n parseTransaction(tx: { data: string, value?: BigNumberish }): TransactionDescription {\n let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase())\n\n if (!fragment) { return null; }\n\n return new TransactionDescription({\n args: this._abiCoder.decode(fragment.inputs, \"0x\" + tx.data.substring(10)),\n functionFragment: fragment,\n name: fragment.name,\n signature: fragment.format(),\n sighash: this.getSighash(fragment),\n value: BigNumber.from(tx.value || \"0\"),\n });\n }\n\n // @TODO\n //parseCallResult(data: BytesLike): ??\n\n // Given an event log, find the matching event fragment (if any) and\n // determine all its properties and values\n parseLog(log: { topics: Array<string>, data: string}): LogDescription {\n let fragment = this.getEvent(log.topics[0]);\n\n if (!fragment || fragment.anonymous) { return null; }\n\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n\n\n return new LogDescription({\n eventFragment: fragment,\n name: fragment.name,\n signature: fragment.format(),\n topic: this.getEventTopic(fragment),\n args: this.decodeEventLog(fragment, log.data, log.topics)\n });\n }\n\n parseError(data: BytesLike): ErrorDescription {\n const hexData = hexlify(data);\n let fragment = this.getError(hexData.substring(0, 10).toLowerCase())\n\n if (!fragment) { return null; }\n\n return new ErrorDescription({\n args: this._abiCoder.decode(fragment.inputs, \"0x\" + hexData.substring(10)),\n errorFragment: fragment,\n name: fragment.name,\n signature: fragment.format(),\n sighash: this.getSighash(fragment),\n });\n }\n\n\n /*\n static from(value: Array<Fragment | string | JsonAbi> | string | Interface) {\n if (Interface.isInterface(value)) {\n return value;\n }\n if (typeof(value) === \"string\") {\n return new Interface(JSON.parse(value));\n }\n return new Interface(value);\n }\n */\n\n static isInterface(value: any): value is Interface {\n return !!(value && value._isInterface);\n }\n}\n\n","\"use strict\";\n\nimport { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from \"./fragments\";\nimport { AbiCoder, CoerceFunc, defaultAbiCoder } from \"./abi-coder\";\nimport { checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription } from \"./interface\";\n\nexport {\n ConstructorFragment,\n ErrorFragment,\n EventFragment,\n Fragment,\n FunctionFragment,\n ParamType,\n FormatTypes,\n\n AbiCoder,\n defaultAbiCoder,\n\n Interface,\n Indexed,\n\n /////////////////////////\n // Types\n\n CoerceFunc,\n JsonFragment,\n JsonFragmentType,\n\n Result,\n checkResultErrors,\n\n LogDescription,\n TransactionDescription\n};\n","export const version = \"abstract-provider/5.6.0\";\n","\"use strict\";\n\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { BytesLike, isHexString } from \"@ethersproject/bytes\";\nimport { Network } from \"@ethersproject/networks\";\nimport { Deferrable, Description, defineReadOnly, resolveProperties } from \"@ethersproject/properties\";\nimport { AccessListish, Transaction } from \"@ethersproject/transactions\";\nimport { OnceBlockable } from \"@ethersproject/web\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n///////////////////////////////\n// Exported Types\n\n\nexport type TransactionRequest = {\n to?: string,\n from?: string,\n nonce?: BigNumberish,\n\n gasLimit?: BigNumberish,\n gasPrice?: BigNumberish,\n\n data?: BytesLike,\n value?: BigNumberish,\n chainId?: number\n\n type?: number;\n accessList?: AccessListish;\n\n maxPriorityFeePerGas?: BigNumberish;\n maxFeePerGas?: BigNumberish;\n\n customData?: Record<string, any>;\n ccipReadEnabled?: boolean;\n}\n\nexport interface TransactionResponse extends Transaction {\n hash: string;\n\n // Only if a transaction has been mined\n blockNumber?: number,\n blockHash?: string,\n timestamp?: number,\n\n confirmations: number,\n\n // Not optional (as it is in Transaction)\n from: string;\n\n // The raw transaction\n raw?: string,\n\n // This function waits until the transaction has been mined\n wait: (confirmations?: number) => Promise<TransactionReceipt>\n};\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 _difficulty: BigNumber;\n\n gasLimit: BigNumber;\n gasUsed: BigNumber;\n\n miner: string;\n extraData: string;\n\n baseFeePerGas?: null | BigNumber;\n}\n\nexport interface Block extends _Block {\n transactions: Array<string>;\n}\n\nexport interface BlockWithTransactions extends _Block {\n transactions: Array<TransactionResponse>;\n}\n\n\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<string>;\n\n transactionHash: string;\n logIndex: number;\n}\n\nexport interface TransactionReceipt {\n to: string;\n from: string;\n contractAddress: string,\n transactionIndex: number,\n root?: string,\n gasUsed: BigNumber,\n logsBloom: string,\n blockHash: string,\n transactionHash: string,\n logs: Array<Log>,\n blockNumber: number,\n confirmations: number,\n cumulativeGasUsed: BigNumber,\n effectiveGasPrice: BigNumber,\n byzantium: boolean,\n type: number;\n status?: number\n};\n\nexport interface FeeData {\n maxFeePerGas: null | BigNumber;\n maxPriorityFeePerGas: null | BigNumber;\n gasPrice: null | BigNumber;\n}\n\nexport interface EventFilter {\n address?: string;\n topics?: Array<string | Array<string> | null>;\n}\n\nexport interface Filter extends EventFilter {\n fromBlock?: BlockTag,\n toBlock?: BlockTag,\n}\n\nexport interface FilterByBlockHash extends EventFilter {\n blockHash?: string;\n}\n\n//export type CallTransactionable = {\n// call(transaction: TransactionRequest): Promise<TransactionResponse>;\n//};\n\nexport abstract class ForkEvent extends Description {\n readonly expiry: number;\n\n readonly _isForkEvent?: boolean;\n\n static isForkEvent(value: any): value is ForkEvent {\n return !!(value && value._isForkEvent);\n }\n}\n\nexport class BlockForkEvent extends ForkEvent {\n readonly blockHash: string;\n\n readonly _isBlockForkEvent?: boolean;\n\n constructor(blockHash: string, expiry?: number) {\n if (!isHexString(blockHash, 32)) {\n logger.throwArgumentError(\"invalid blockHash\", \"blockHash\", blockHash);\n }\n\n super({\n _isForkEvent: true,\n _isBlockForkEvent: true,\n expiry: (expiry || 0),\n blockHash: blockHash\n });\n }\n}\n\nexport class TransactionForkEvent extends ForkEvent {\n readonly hash: string;\n\n readonly _isTransactionOrderForkEvent?: boolean;\n\n constructor(hash: string, expiry?: number) {\n if (!isHexString(hash, 32)) {\n logger.throwArgumentError(\"invalid transaction hash\", \"hash\", hash);\n }\n\n super({\n _isForkEvent: true,\n _isTransactionForkEvent: true,\n expiry: (expiry || 0),\n hash: hash\n });\n }\n}\n\nexport class TransactionOrderForkEvent extends ForkEvent {\n readonly beforeHash: string;\n readonly afterHash: string;\n\n constructor(beforeHash: string, afterHash: string, expiry?: number) {\n if (!isHexString(beforeHash, 32)) {\n logger.throwArgumentError(\"invalid transaction hash\", \"beforeHash\", beforeHash);\n }\n if (!isHexString(afterHash, 32)) {\n logger.throwArgumentError(\"invalid transaction hash\", \"afterHash\", afterHash);\n }\n\n super({\n _isForkEvent: true,\n _isTransactionOrderForkEvent: true,\n expiry: (expiry || 0),\n beforeHash: beforeHash,\n afterHash: afterHash\n });\n }\n}\n\nexport type EventType = string | Array<string | Array<string>> | EventFilter | ForkEvent;\n\nexport type Listener = (...args: Array<any>) => void;\n\n///////////////////////////////\n// Exported Abstracts\nexport abstract class Provider implements OnceBlockable {\n\n // Network\n abstract getNetwork(): Promise<Network>;\n\n // Latest State\n abstract getBlockNumber(): Promise<number>;\n abstract getGasPrice(): Promise<BigNumber>;\n async getFeeData(): Promise<FeeData> {\n const { block, gasPrice } = await resolveProperties({\n block: this.getBlock(\"latest\"),\n gasPrice: this.getGasPrice().catch((error) => {\n // @TODO: Why is this now failing on Calaveras?\n //console.log(error);\n return null;\n })\n });\n\n let maxFeePerGas = null, maxPriorityFeePerGas = null;\n\n if (block && block.baseFeePerGas) {\n // We may want to compute this more accurately in the future,\n // using the formula \"check if the base fee is correct\".\n // See: https://eips.ethereum.org/EIPS/eip-1559\n maxPriorityFeePerGas = BigNumber.from(\"1500000000\");\n maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas);\n }\n\n return { maxFeePerGas, maxPriorityFeePerGas, gasPrice };\n }\n\n // Account\n abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;\n abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;\n abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> ;\n abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;\n\n // Execution\n abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;\n abstract call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;\n abstract estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;\n\n // Queries\n abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;\n abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;\n abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;\n abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;\n\n // Bloom-filter Queries\n abstract getLogs(filter: Filter): Promise<Array<Log>>;\n\n // ENS\n abstract resolveName(name: string | Promise<string>): Promise<null | string>;\n abstract lookupAddress(address: string | Promise<string>): Promise<null | string>;\n\n // Event Emitter (ish)\n abstract on(eventName: EventType, listener: Listener): Provider;\n abstract once(eventName: EventType, listener: Listener): Provider;\n abstract emit(eventName: EventType, ...args: Array<any>): boolean\n abstract listenerCount(eventName?: EventType): number;\n abstract listeners(eventName?: EventType): Array<Listener>;\n abstract off(eventName: EventType, listener?: Listener): Provider;\n abstract removeAllListeners(eventName?: EventType): Provider;\n\n // Alias for \"on\"\n addListener(eventName: EventType, listener: Listener): Provider {\n return this.on(eventName, listener);\n }\n\n // Alias for \"off\"\n removeListener(eventName: EventType, listener: Listener): Provider {\n return this.off(eventName, listener);\n }\n\n // @TODO: This *could* be implemented here, but would pull in events...\n abstract waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;\n\n readonly _isProvider: boolean;\n\n constructor() {\n logger.checkAbstract(new.target, Provider);\n defineReadOnly(this, \"_isProvider\", true);\n }\n\n static isProvider(value: any): value is Provider {\n return !!(value && value._isProvider);\n }\n\n/*\n static getResolver(network: Network, callable: CallTransactionable, namehash: string): string {\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 // Not a namehash\n if (!isHexString(namehash, 32)) {\n errors.throwArgumentError(\"invalid name hash\", \"namehash\", namehash);\n }\n\n // keccak256(\"resolver(bytes32)\")\n let data = \"0x0178b8bf\" + namehash.substring(2);\n let transaction = { to: network.ensAddress, data: data };\n\n return provider.call(transaction).then((data) => {\n return provider.formatter.callAddress(data);\n });\n }\n\n static resolveNamehash(network: Network, callable: CallTransactionable, namehash: string): string {\n return this.getResolver(network, callable, namehash).then((resolverAddress) => {\n if (!resolverAddress) { return null; }\n\n // keccak256(\"addr(bytes32)\")\n let data = \"0x3b3b57de\" + namehash(name).substring(2);\n let transaction = { to: resolverAddress, data: data };\n return callable.call(transaction).then((data) => {\n return this.formatter.callAddress(data);\n });\n\n })\n }\n*/\n}\n","export const version = \"abstract-signer/5.6.0\";\n","\"use strict\";\n\nimport { BlockTag, FeeData, Provider, TransactionRequest, TransactionResponse } from \"@ethersproject/abstract-provider\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { Bytes, BytesLike } from \"@ethersproject/bytes\";\nimport { Deferrable, defineReadOnly, resolveProperties, shallowCopy } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nconst allowedTransactionKeys: Array<string> = [\n \"accessList\", \"ccipReadEnabled\", \"chainId\", \"customData\", \"data\", \"from\", \"gasLimit\", \"gasPrice\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"nonce\", \"to\", \"type\", \"value\"\n];\n\nconst forwardErrors = [\n Logger.errors.INSUFFICIENT_FUNDS,\n Logger.errors.NONCE_EXPIRED,\n Logger.errors.REPLACEMENT_UNDERPRICED,\n];\n\n// EIP-712 Typed Data\n// See: https://eips.ethereum.org/EIPS/eip-712\n\nexport interface TypedDataDomain {\n name?: string;\n version?: string;\n chainId?: BigNumberish;\n verifyingContract?: string;\n salt?: BytesLike;\n};\n\nexport interface TypedDataField {\n name: string;\n type: string;\n};\n\n// Sub-classes of Signer may optionally extend this interface to indicate\n// they have a private key available synchronously\nexport interface ExternallyOwnedAccount {\n readonly address: string;\n readonly privateKey: string;\n}\n\n// Sub-Class Notes:\n// - A Signer MUST always make sure, that if present, the \"from\" field\n// matches the Signer, before sending or signing a transaction\n// - A Signer SHOULD always wrap private information (such as a private\n// key or mnemonic) in a function, so that console.log does not leak\n// the data\n\n// @TODO: This is a temporary measure to preserve backwards compatibility\n// In v6, the method on TypedDataSigner will be added to Signer\nexport interface TypedDataSigner {\n _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;\n}\n\nexport abstract class Signer {\n readonly provider?: Provider;\n\n ///////////////////\n // Sub-classes MUST implement these\n\n // Returns the checksum address\n abstract getAddress(): Promise<string>\n\n // Returns the signed prefixed-message. This MUST treat:\n // - Bytes as a binary message\n // - string as a UTF8-message\n // i.e. \"0x1234\" is a SIX (6) byte string, NOT 2 bytes of data\n abstract signMessage(message: Bytes | string): Promise<string>;\n\n // Signs a transaction and returns the fully serialized, signed transaction.\n // The EXACT transaction MUST be signed, and NO additional properties to be added.\n // - This MAY throw if signing transactions is not supports, but if\n // it does, sentTransaction MUST be overridden.\n abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;\n\n // Returns a new instance of the Signer, connected to provider.\n // This MAY throw if changing providers is not supported.\n abstract connect(provider: Provider): Signer;\n\n readonly _isSigner: boolean;\n\n\n ///////////////////\n // Sub-classes MUST call super\n constructor() {\n logger.checkAbstract(new.target, Signer);\n defineReadOnly(this, \"_isSigner\", true);\n }\n\n\n ///////////////////\n // Sub-classes MAY override these\n\n async getBalance(blockTag?: BlockTag): Promise<BigNumber> {\n this._checkProvider(\"getBalance\");\n return await this.provider.getBalance(this.getAddress(), blockTag);\n }\n\n async getTransactionCount(blockTag?: BlockTag): Promise<number> {\n this._checkProvider(\"getTransactionCount\");\n return await this.provider.getTransactionCount(this.getAddress(), blockTag);\n }\n\n // Populates \"from\" if unspecified, and estimates the gas for the transaction\n async estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber> {\n this._checkProvider(\"estimateGas\");\n const tx = await resolveProperties(this.checkTransaction(transaction));\n return await this.provider.estimateGas(tx);\n }\n\n // Populates \"from\" if unspecified, and calls with the transaction\n async call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string> {\n this._checkProvider(\"call\");\n const tx = await resolveProperties(this.checkTransaction(transaction));\n return await this.provider.call(tx, blockTag);\n }\n\n // Populates all fields in a transaction, signs it and sends it to the network\n async sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> {\n this._checkProvider(\"sendTransaction\");\n const tx = await this.populateTransaction(transaction);\n const signedTx = await this.signTransaction(tx);\n return await this.provider.sendTransaction(signedTx);\n }\n\n async getChainId(): Promise<number> {\n this._checkProvider(\"getChainId\");\n const network = await this.provider.getNetwork();\n return network.chainId;\n }\n\n async getGasPrice(): Promise<BigNumber> {\n this._checkProvider(\"getGasPrice\");\n return await this.provider.getGasPrice();\n }\n\n async getFeeData(): Promise<FeeData> {\n this._checkProvider(\"getFeeData\");\n return await this.provider.getFeeData();\n }\n\n\n async resolveName(name: string): Promise<string> {\n this._checkProvider(\"resolveName\");\n return await this.provider.resolveName(name);\n }\n\n\n\n // Checks a transaction does not contain invalid keys and if\n // no \"from\" is provided, populates it.\n // - does NOT require a provider\n // - adds \"from\" is not present\n // - returns a COPY (safe to mutate the result)\n // By default called from: (overriding these prevents it)\n // - call\n // - estimateGas\n // - populateTransaction (and therefor sendTransaction)\n checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest> {\n for (const key in transaction) {\n if (allowedTransactionKeys.indexOf(key) === -1) {\n logger.throwArgumentError(\"invalid transaction key: \" + key, \"transaction\", transaction);\n }\n }\n\n const tx = shallowCopy(transaction);\n\n if (tx.from == null) {\n tx.from = this.getAddress();\n\n } else {\n // Make sure any provided address matches this signer\n tx.from = Promise.all([\n Promise.resolve(tx.from),\n this.getAddress()\n ]).then((result) => {\n if (result[0].toLowerCase() !== result[1].toLowerCase()) {\n logger.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n return result[0];\n });\n }\n\n return tx;\n }\n\n // Populates ALL keys for a transaction and checks that \"from\" matches\n // this Signer. Should be used by sendTransaction but NOT by signTransaction.\n // By default called from: (overriding these prevents it)\n // - sendTransaction\n //\n // Notes:\n // - We allow gasPrice for EIP-1559 as long as it matches maxFeePerGas\n async populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest> {\n\n const tx: Deferrable<TransactionRequest> = await resolveProperties(this.checkTransaction(transaction))\n\n if (tx.to != null) {\n tx.to = Promise.resolve(tx.to).then(async (to) => {\n if (to == null) { return null; }\n const address = await this.resolveName(to);\n if (address == null) {\n logger.throwArgumentError(\"provided ENS name resolves to null\", \"tx.to\", to);\n }\n return address;\n });\n\n // Prevent this error from causing an UnhandledPromiseException\n tx.to.catch((error) => { });\n }\n\n // Do not allow mixing pre-eip-1559 and eip-1559 properties\n const hasEip1559 = (tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null);\n if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) {\n logger.throwArgumentError(\"eip-1559 transaction do not support gasPrice\", \"transaction\", transaction);\n } else if ((tx.type === 0 || tx.type === 1) && hasEip1559) {\n logger.throwArgumentError(\"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas\", \"transaction\", transaction);\n }\n\n if ((tx.type === 2 || tx.type == null) && (tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) {\n // Fully-formed EIP-1559 transaction (skip getFeeData)\n tx.type = 2;\n\n } else if (tx.type === 0 || tx.type === 1) {\n // Explicit Legacy or EIP-2930 transaction\n\n // Populate missing gasPrice\n if (tx.gasPrice == null) { tx.gasPrice = this.getGasPrice(); }\n\n } else {\n\n // We need to get fee data to determine things\n const feeData = await this.getFeeData();\n\n if (tx.type == null) {\n // We need to auto-detect the intended type of this transaction...\n\n if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) {\n // The network supports EIP-1559!\n\n // Upgrade transaction from null to eip-1559\n tx.type = 2;\n\n if (tx.gasPrice != null) {\n // Using legacy gasPrice property on an eip-1559 network,\n // so use gasPrice as both fee properties\n const gasPrice = tx.gasPrice;\n delete tx.gasPrice;\n tx.maxFeePerGas = gasPrice;\n tx.maxPriorityFeePerGas = gasPrice;\n\n } else {\n // Populate missing fee data\n if (tx.maxFeePerGas == null) { tx.maxFeePerGas = feeData.maxFeePerGas; }\n if (tx.maxPriorityFeePerGas == null) { tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; }\n }\n\n } else if (feeData.gasPrice != null) {\n // Network doesn't support EIP-1559...\n\n // ...but they are trying to use EIP-1559 properties\n if (hasEip1559) {\n logger.throwError(\"network does not support EIP-1559\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"populateTransaction\"\n });\n }\n\n // Populate missing fee data\n if (tx.gasPrice == null) { tx.gasPrice = feeData.gasPrice; }\n\n // Explicitly set untyped transaction to legacy\n tx.type = 0;\n\n } else {\n // getFeeData has failed us.\n logger.throwError(\"failed to get consistent fee data\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"signer.getFeeData\"\n });\n }\n\n } else if (tx.type === 2) {\n // Explicitly using EIP-1559\n\n // Populate missing fee data\n if (tx.maxFeePerGas == null) { tx.maxFeePerGas = feeData.maxFeePerGas; }\n if (tx.maxPriorityFeePerGas == null) { tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; }\n }\n }\n\n if (tx.nonce == null) { tx.nonce = this.getTransactionCount(\"pending\"); }\n\n if (tx.gasLimit == null) {\n tx.gasLimit = this.estimateGas(tx).catch((error) => {\n if (forwardErrors.indexOf(error.code) >= 0) {\n throw error;\n }\n\n return logger.throwError(\"cannot estimate gas; transaction may fail or may require manual gas limit\", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {\n error: error,\n tx: tx\n });\n });\n }\n\n if (tx.chainId == null) {\n tx.chainId = this.getChainId();\n } else {\n tx.chainId = Promise.all([\n Promise.resolve(tx.chainId),\n this.getChainId()\n ]).then((results) => {\n if (results[1] !== 0 && results[0] !== results[1]) {\n logger.throwArgumentError(\"chainId address mismatch\", \"transaction\", transaction);\n }\n return results[0];\n });\n }\n\n return await resolveProperties(tx);\n }\n\n\n ///////////////////\n // Sub-classes SHOULD leave these alone\n\n _checkProvider(operation?: string): void {\n if (!this.provider) { logger.throwError(\"missing provider\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: (operation || \"_checkProvider\") });\n }\n }\n\n static isSigner(value: any): value is Signer {\n return !!(value && value._isSigner);\n }\n}\n\nexport class VoidSigner extends Signer implements TypedDataSigner {\n readonly address: string;\n\n constructor(address: string, provider?: Provider) {\n logger.checkNew(new.target, VoidSigner);\n super();\n defineReadOnly(this, \"address\", address);\n defineReadOnly(this, \"provider\", provider || null);\n }\n\n getAddress(): Promise<string> {\n return Promise.resolve(this.address);\n }\n\n _fail(message: string, operation: string): Promise<any> {\n return Promise.resolve().then(() => {\n logger.throwError(message, Logger.errors.UNSUPPORTED_OPERATION, { operation: operation });\n });\n }\n\n signMessage(message: Bytes | string): Promise<string> {\n return this._fail(\"VoidSigner cannot sign messages\", \"signMessage\");\n }\n\n signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string> {\n return this._fail(\"VoidSigner cannot sign transactions\", \"signTransaction\");\n }\n\n _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string> {\n return this._fail(\"VoidSigner cannot sign typed data\", \"signTypedData\");\n }\n\n connect(provider: Provider): VoidSigner {\n return new VoidSigner(this.address, provider);\n }\n}\n\n","module.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","'use strict';\n\nvar utils = exports;\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 === '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 } else {\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 }\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","'use strict';\n\nvar utils = exports;\nvar BN = require('bn.js');\nvar minAssert = require('minimalistic-assert');\nvar minUtils = require('minimalistic-crypto-utils');\n\nutils.assert = minAssert;\nutils.toArray = minUtils.toArray;\nutils.zero2 = minUtils.zero2;\nutils.toHex = minUtils.toHex;\nutils.encode = minUtils.encode;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w, bits) {\n var naf = new Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n\n var ws = 1 << (w + 1);\n var k = num.clone();\n\n for (var i = 0; i < naf.length; i++) {\n var z;\n var mod = k.andln(ws - 1);\n if (k.isOdd()) {\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\n naf[i] = z;\n k.iushrn(1);\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 var m8;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\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 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 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","'use strict';\n\nvar BN = require('bn.js');\nvar utils = require('../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 this._bitLength = this.n ? this.n.bitLength() : 0;\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, this._bitLength);\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 var j;\n var nafW;\n for (j = 0; j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1; l >= j; l--)\n nafW = (nafW << 1) + naf[l];\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 (j = 0; j < repr.length; j++) {\n 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, this._bitLength);\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 l = 0; i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0)\n l++;\n acc = acc.dblp(l);\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 var i;\n var j;\n var p;\n for (i = 0; i < len; i++) {\n 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 (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], this._bitLength);\n naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);\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 (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 (i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (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 (j = 0; j < len; j++) {\n var z = tmp[j];\n 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 (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","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (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 };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (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","'use strict';\n\nvar utils = require('../utils');\nvar BN = require('bn.js');\nvar inherits = require('inherits');\nvar Base = require('./base');\n\nvar assert = 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 '<EC Point Infinity>';\n return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +\n ' y: ' + this.y.fromRed().toString(16, 2) + '>';\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 if (this.isInfinity())\n return this;\n else 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 var i;\n if (this.curve.zeroA || this.curve.threeA) {\n var r = this;\n for (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 (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};\n\nJPoint.prototype.inspect = function inspect() {\n if (this.isInfinity())\n return '<EC JPoint Infinity>';\n return '<EC JPoint x: ' + this.x.toString(16, 2) +\n ' y: ' + this.y.toString(16, 2) +\n ' z: ' + this.z.toString(16, 2) + '>';\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","'use strict';\n\nvar curve = exports;\n\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nexports.inherits = inherits;\n\nfunction isSurrogatePair(msg, i) {\n if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {\n return false;\n }\n if (i < 0 || i + 1 >= msg.length) {\n return false;\n }\n return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;\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 if (!enc) {\n // Inspired by stringToUtf8ByteArray() in closure-library by Google\n // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143\n // Apache License 2.0\n // https://github.com/google/closure-library/blob/master/LICENSE\n var p = 0;\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n if (c < 128) {\n res[p++] = c;\n } else if (c < 2048) {\n res[p++] = (c >> 6) | 192;\n res[p++] = (c & 63) | 128;\n } else if (isSurrogatePair(msg, i)) {\n c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);\n res[p++] = (c >> 18) | 240;\n res[p++] = ((c >> 12) & 63) | 128;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n } else {\n res[p++] = (c >> 12) | 224;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n }\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","'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","'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","'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar shaCommon = require('./common');\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_5 = utils.sum32_5;\nvar ft_1 = shaCommon.ft_1;\nvar BlockHash = common.BlockHash;\n\nvar sha1_K = [\n 0x5A827999, 0x6ED9EBA1,\n 0x8F1BBCDC, 0xCA62C1D6\n];\n\nfunction SHA1() {\n if (!(this instanceof SHA1))\n return new SHA1();\n\n BlockHash.call(this);\n this.h = [\n 0x67452301, 0xefcdab89, 0x98badcfe,\n 0x10325476, 0xc3d2e1f0 ];\n this.W = new Array(80);\n}\n\nutils.inherits(SHA1, BlockHash);\nmodule.exports = SHA1;\n\nSHA1.blockSize = 512;\nSHA1.outSize = 160;\nSHA1.hmacStrength = 80;\nSHA1.padLength = 64;\n\nSHA1.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\n for(; i < W.length; i++)\n W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);\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\n for (i = 0; i < W.length; i++) {\n var s = ~~(i / 20);\n var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);\n e = d;\n d = c;\n c = rotl32(b, 30);\n b = a;\n a = t;\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};\n\nSHA1.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","'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","'use strict';\n\nvar utils = require('../utils');\nvar SHA256 = require('./256');\n\nfunction SHA224() {\n if (!(this instanceof SHA224))\n return new SHA224();\n\n SHA256.call(this);\n this.h = [\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,\n 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];\n}\nutils.inherits(SHA224, SHA256);\nmodule.exports = SHA224;\n\nSHA224.blockSize = 512;\nSHA224.outSize = 224;\nSHA224.hmacStrength = 192;\nSHA224.padLength = 64;\n\nSHA224.prototype._digest = function digest(enc) {\n // Just truncate output\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 7), 'big');\n else\n return utils.split32(this.h.slice(0, 7), 'big');\n};\n\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","'use strict';\n\nvar utils = require('../utils');\n\nvar SHA512 = require('./512');\n\nfunction SHA384() {\n if (!(this instanceof SHA384))\n return new SHA384();\n\n SHA512.call(this);\n this.h = [\n 0xcbbb9d5d, 0xc1059ed8,\n 0x629a292a, 0x367cd507,\n 0x9159015a, 0x3070dd17,\n 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31,\n 0x8eb44a87, 0x68581511,\n 0xdb0c2e0d, 0x64f98fa7,\n 0x47b5481d, 0xbefa4fa4 ];\n}\nutils.inherits(SHA384, SHA512);\nmodule.exports = SHA384;\n\nSHA384.blockSize = 1024;\nSHA384.outSize = 384;\nSHA384.hmacStrength = 192;\nSHA384.padLength = 128;\n\nSHA384.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h.slice(0, 12), 'big');\n else\n return utils.split32(this.h.slice(0, 12), 'big');\n};\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","'use strict';\n\nvar utils = require('./utils');\nvar common = require('./common');\n\nvar rotl32 = utils.rotl32;\nvar sum32 = utils.sum32;\nvar sum32_3 = utils.sum32_3;\nvar sum32_4 = utils.sum32_4;\nvar BlockHash = common.BlockHash;\n\nfunction RIPEMD160() {\n if (!(this instanceof RIPEMD160))\n return new RIPEMD160();\n\n BlockHash.call(this);\n\n this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];\n this.endian = 'little';\n}\nutils.inherits(RIPEMD160, BlockHash);\nexports.ripemd160 = RIPEMD160;\n\nRIPEMD160.blockSize = 512;\nRIPEMD160.outSize = 160;\nRIPEMD160.hmacStrength = 192;\nRIPEMD160.padLength = 64;\n\nRIPEMD160.prototype._update = function update(msg, start) {\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 Ah = A;\n var Bh = B;\n var Ch = C;\n var Dh = D;\n var Eh = E;\n for (var j = 0; j < 80; j++) {\n var T = sum32(\n rotl32(\n sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),\n s[j]),\n E);\n A = E;\n E = D;\n D = rotl32(C, 10);\n C = B;\n B = T;\n T = sum32(\n rotl32(\n sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),\n sh[j]),\n Eh);\n Ah = Eh;\n Eh = Dh;\n Dh = rotl32(Ch, 10);\n Ch = Bh;\n Bh = T;\n }\n T = sum32_3(this.h[1], C, Dh);\n this.h[1] = sum32_3(this.h[2], D, Eh);\n this.h[2] = sum32_3(this.h[3], E, Ah);\n this.h[3] = sum32_3(this.h[4], A, Bh);\n this.h[4] = sum32_3(this.h[0], B, Ch);\n this.h[0] = T;\n};\n\nRIPEMD160.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'little');\n else\n return utils.split32(this.h, 'little');\n};\n\nfunction f(j, x, y, z) {\n if (j <= 15)\n return x ^ y ^ z;\n else if (j <= 31)\n return (x & y) | ((~x) & z);\n else if (j <= 47)\n return (x | (~y)) ^ z;\n else if (j <= 63)\n return (x & z) | (y & (~z));\n else\n return x ^ (y | (~z));\n}\n\nfunction K(j) {\n if (j <= 15)\n return 0x00000000;\n else if (j <= 31)\n return 0x5a827999;\n else if (j <= 47)\n return 0x6ed9eba1;\n else if (j <= 63)\n return 0x8f1bbcdc;\n else\n return 0xa953fd4e;\n}\n\nfunction Kh(j) {\n if (j <= 15)\n return 0x50a28be6;\n else if (j <= 31)\n return 0x5c4dd124;\n else if (j <= 47)\n return 0x6d703ef3;\n else if (j <= 63)\n return 0x7a6d76e9;\n else\n return 0x00000000;\n}\n\nvar r = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\n];\n\nvar rh = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n];\n\nvar s = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\n];\n\nvar sh = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n];\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","var 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","'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar curve = require('./curve');\nvar utils = require('./utils');\n\nvar assert = utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new curve.edwards(options);\n else\n this.curve = new 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","'use strict';\n\nvar hash = require('hash.js');\nvar utils = require('minimalistic-crypto-utils');\nvar assert = require('minimalistic-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 || 'hex');\n var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');\n var pers = utils.toArray(options.pers, options.persEnc || 'hex');\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.toArray(entropy, entropyEnc);\n add = utils.toArray(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 || 'hex');\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","'use strict';\n\nvar BN = require('bn.js');\nvar utils = require('../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 if(!pub.validate()) {\n assert(pub.validate(), 'public point not validated');\n }\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 '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +\n ' pub: ' + (this.pub && this.pub.inspect()) + ' >';\n};\n","'use strict';\n\nvar BN = require('bn.js');\n\nvar utils = require('../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\n // Indefinite length or overflow\n if (octetLen === 0 || octetLen > 4) {\n return false;\n }\n\n var val = 0;\n for (var i = 0, off = p.place; i < octetLen; i++, off++) {\n val <<= 8;\n val |= buf[off];\n val >>>= 0;\n }\n\n // Leading zeroes\n if (val <= 0x7f) {\n return false;\n }\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 === false) {\n return false;\n }\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 if (rlen === false) {\n return false;\n }\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 (slen === false) {\n return false;\n }\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) {\n if (r[1] & 0x80) {\n r = r.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\n }\n if (s[0] === 0) {\n if (s[1] & 0x80) {\n s = s.slice(1);\n } else {\n // Leading zeroes\n return false;\n }\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","'use strict';\n\nvar BN = require('bn.js');\nvar HmacDRBG = require('hmac-drbg');\nvar utils = require('../utils');\nvar curves = require('../curves');\nvar rand = require('brorand');\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(Object.prototype.hasOwnProperty.call(curves, options),\n 'Unknown curve ' + options);\n\n options = curves[options];\n }\n\n // Shortcut for `elliptic.ec(elliptic.curves.curveName)`\n if (options instanceof 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 HmacDRBG({\n hash: this.hash,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n entropy: options.entropy || rand(this.hash.hmacStrength),\n entropyEnc: options.entropy && options.entropyEnc || 'utf8',\n nonce: this.n.toArray(),\n });\n\n var bytes = this.n.byteLength();\n var ns2 = this.n.sub(new BN(2));\n for (;;) {\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 }\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 HmacDRBG({\n hash: this.hash,\n entropy: bkey,\n nonce: nonce,\n pers: options.pers,\n persEnc: options.persEnc || 'utf8',\n });\n\n // Number of bytes to generate\n var ns1 = this.n.sub(new BN(1));\n\n for (var iter = 0; ; 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 var p;\n\n if (!this.curve._maxwellTrick) {\n 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 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","'use strict';\n\nvar elliptic = exports;\n\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves');\n\n// Protocols\nelliptic.ec = require('./elliptic/ec');\nelliptic.eddsa = require('./elliptic/eddsa');\n","import _ec from \"elliptic\";\nimport EC = _ec.ec;\n\nexport { EC }\n","export const version = \"signing-key/5.6.0\";\n","\"use strict\";\n\nimport { EC } from \"./elliptic\";\n\nimport { arrayify, BytesLike, hexlify, hexZeroPad, Signature, SignatureLike, splitSignature } from \"@ethersproject/bytes\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nlet _curve: EC = null\nfunction getCurve() {\n if (!_curve) {\n _curve = new EC(\"secp256k1\");\n }\n return _curve;\n}\n\nexport class SigningKey {\n\n readonly curve: string;\n\n readonly privateKey: string;\n readonly publicKey: string;\n readonly compressedPublicKey: string;\n\n //readonly address: string;\n\n readonly _isSigningKey: boolean;\n\n constructor(privateKey: BytesLike) {\n defineReadOnly(this, \"curve\", \"secp256k1\");\n\n defineReadOnly(this, \"privateKey\", hexlify(privateKey));\n\n const keyPair = getCurve().keyFromPrivate(arrayify(this.privateKey));\n\n defineReadOnly(this, \"publicKey\", \"0x\" + keyPair.getPublic(false, \"hex\"));\n defineReadOnly(this, \"compressedPublicKey\", \"0x\" + keyPair.getPublic(true, \"hex\"));\n\n defineReadOnly(this, \"_isSigningKey\", true);\n }\n\n _addPoint(other: BytesLike): string {\n const p0 = getCurve().keyFromPublic(arrayify(this.publicKey));\n const p1 = getCurve().keyFromPublic(arrayify(other));\n return \"0x\" + p0.pub.add(p1.pub).encodeCompressed(\"hex\");\n }\n\n signDigest(digest: BytesLike): Signature {\n const keyPair = getCurve().keyFromPrivate(arrayify(this.privateKey));\n const digestBytes = arrayify(digest);\n if (digestBytes.length !== 32) {\n logger.throwArgumentError(\"bad digest length\", \"digest\", digest);\n }\n const signature = keyPair.sign(digestBytes, { canonical: true });\n return splitSignature({\n recoveryParam: signature.recoveryParam,\n r: hexZeroPad(\"0x\" + signature.r.toString(16), 32),\n s: hexZeroPad(\"0x\" + signature.s.toString(16), 32),\n })\n }\n\n computeSharedSecret(otherKey: BytesLike): string {\n const keyPair = getCurve().keyFromPrivate(arrayify(this.privateKey));\n const otherKeyPair = getCurve().keyFromPublic(arrayify(computePublicKey(otherKey)));\n return hexZeroPad(\"0x\" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);\n }\n\n static isSigningKey(value: any): value is SigningKey {\n return !!(value && value._isSigningKey);\n }\n}\n\nexport function recoverPublicKey(digest: BytesLike, signature: SignatureLike): string {\n const sig = splitSignature(signature);\n const rs = { r: arrayify(sig.r), s: arrayify(sig.s) };\n return \"0x\" + getCurve().recoverPubKey(arrayify(digest), rs, sig.recoveryParam).encode(\"hex\", false);\n}\n\nexport function computePublicKey(key: BytesLike, compressed?: boolean): string {\n const bytes = arrayify(key);\n\n if (bytes.length === 32) {\n const signingKey = new SigningKey(bytes);\n if (compressed) {\n return \"0x\" + getCurve().keyFromPrivate(bytes).getPublic(true, \"hex\");\n }\n return signingKey.publicKey;\n\n } else if (bytes.length === 33) {\n if (compressed) { return hexlify(bytes); }\n return \"0x\" + getCurve().keyFromPublic(bytes).getPublic(false, \"hex\");\n\n } else if (bytes.length === 65) {\n if (!compressed) { return hexlify(bytes); }\n return \"0x\" + getCurve().keyFromPublic(bytes).getPublic(true, \"hex\");\n }\n\n return logger.throwArgumentError(\"invalid public or private key\", \"key\", \"[REDACTED]\");\n}\n\n","export const version = \"transactions/5.6.0\";\n","\"use strict\";\n\nimport { getAddress } from \"@ethersproject/address\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { arrayify, BytesLike, DataOptions, hexConcat, hexDataLength, hexDataSlice, hexlify, hexZeroPad, isBytesLike, SignatureLike, splitSignature, stripZeros, } from \"@ethersproject/bytes\";\nimport { Zero } from \"@ethersproject/constants\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { checkProperties } from \"@ethersproject/properties\";\nimport * as RLP from \"@ethersproject/rlp\";\nimport { computePublicKey, recoverPublicKey } from \"@ethersproject/signing-key\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n///////////////////////////////\n// Exported Types\n\nexport type AccessList = Array<{ address: string, storageKeys: Array<string> }>;\n\n// Input allows flexibility in describing an access list\nexport type AccessListish = AccessList |\n Array<[ string, Array<string> ]> |\n Record<string, Array<string>>;\n\nexport enum TransactionTypes {\n legacy = 0,\n eip2930 = 1,\n eip1559 = 2,\n};\n\nexport type UnsignedTransaction = {\n to?: string;\n nonce?: number;\n\n gasLimit?: BigNumberish;\n gasPrice?: BigNumberish;\n\n data?: BytesLike;\n value?: BigNumberish;\n chainId?: number;\n\n // Typed-Transaction features\n type?: number | null;\n\n // EIP-2930; Type 1 & EIP-1559; Type 2\n accessList?: AccessListish;\n\n // EIP-1559; Type 2\n maxPriorityFeePerGas?: BigNumberish;\n maxFeePerGas?: BigNumberish;\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 // Typed-Transaction features\n type?: number | null;\n\n // EIP-2930; Type 1 & EIP-1559; Type 2\n accessList?: AccessList;\n\n // EIP-1559; Type 2\n maxPriorityFeePerGas?: BigNumber;\n maxFeePerGas?: BigNumber;\n}\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 Zero; }\n return BigNumber.from(value);\n}\n\n// Legacy Transaction Fields\nconst transactionFields = [\n { name: \"nonce\", maxLength: 32, numeric: true },\n { name: \"gasPrice\", maxLength: 32, numeric: true },\n { name: \"gasLimit\", maxLength: 32, numeric: true },\n { name: \"to\", length: 20 },\n { name: \"value\", maxLength: 32, numeric: true },\n { name: \"data\" },\n];\n\nconst allowedTransactionKeys: { [ key: string ]: boolean } = {\n chainId: true, data: true, gasLimit: true, gasPrice:true, nonce: true, to: true, type: true, value: true\n}\n\nexport function computeAddress(key: BytesLike | string): string {\n const publicKey = computePublicKey(key);\n return getAddress(hexDataSlice(keccak256(hexDataSlice(publicKey, 1)), 12));\n}\n\nexport function recoverAddress(digest: BytesLike, signature: SignatureLike): string {\n return computeAddress(recoverPublicKey(arrayify(digest), signature));\n}\n\nfunction formatNumber(value: BigNumberish, name: string): Uint8Array {\n const result = stripZeros(BigNumber.from(value).toHexString());\n if (result.length > 32) {\n logger.throwArgumentError(\"invalid length for \" + name, (\"transaction:\" + name), value);\n }\n return result;\n}\n\nfunction accessSetify(addr: string, storageKeys: Array<string>): { address: string,storageKeys: Array<string> } {\n return {\n address: getAddress(addr),\n storageKeys: (storageKeys || []).map((storageKey, index) => {\n if (hexDataLength(storageKey) !== 32) {\n logger.throwArgumentError(\"invalid access list storageKey\", `accessList[${ addr }:${ index }]`, storageKey)\n }\n return storageKey.toLowerCase();\n })\n };\n}\n\nexport function accessListify(value: AccessListish): AccessList {\n if (Array.isArray(value)) {\n return (<Array<[ string, Array<string>] | { address: string, storageKeys: Array<string>}>>value).map((set, index) => {\n if (Array.isArray(set)) {\n if (set.length > 2) {\n logger.throwArgumentError(\"access list expected to be [ address, storageKeys[] ]\", `value[${ index }]`, set);\n }\n return accessSetify(set[0], set[1])\n }\n return accessSetify(set.address, set.storageKeys);\n });\n }\n\n const result: Array<{ address: string, storageKeys: Array<string> }> = Object.keys(value).map((addr) => {\n const storageKeys: Record<string, true> = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, <Record<string, true>>{ });\n return accessSetify(addr, Object.keys(storageKeys).sort())\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\n\nfunction formatAccessList(value: AccessListish): Array<[ string, Array<string> ]> {\n return accessListify(value).map((set) => [ set.address, set.storageKeys ]);\n}\n\nfunction _serializeEip1559(transaction: UnsignedTransaction, signature?: SignatureLike): string {\n // If there is an explicit gasPrice, make sure it matches the\n // EIP-1559 fees; otherwise they may not understand what they\n // think they are setting in terms of fee.\n if (transaction.gasPrice != null) {\n const gasPrice = BigNumber.from(transaction.gasPrice);\n const maxFeePerGas = BigNumber.from(transaction.maxFeePerGas || 0);\n if (!gasPrice.eq(maxFeePerGas)) {\n logger.throwArgumentError(\"mismatch EIP-1559 gasPrice != maxFeePerGas\", \"tx\", {\n gasPrice, maxFeePerGas\n });\n }\n }\n\n const fields: any = [\n formatNumber(transaction.chainId || 0, \"chainId\"),\n formatNumber(transaction.nonce || 0, \"nonce\"),\n formatNumber(transaction.maxPriorityFeePerGas || 0, \"maxPriorityFeePerGas\"),\n formatNumber(transaction.maxFeePerGas || 0, \"maxFeePerGas\"),\n formatNumber(transaction.gasLimit || 0, \"gasLimit\"),\n ((transaction.to != null) ? getAddress(transaction.to): \"0x\"),\n formatNumber(transaction.value || 0, \"value\"),\n (transaction.data || \"0x\"),\n (formatAccessList(transaction.accessList || []))\n ];\n\n if (signature) {\n const sig = splitSignature(signature);\n fields.push(formatNumber(sig.recoveryParam, \"recoveryParam\"));\n fields.push(stripZeros(sig.r));\n fields.push(stripZeros(sig.s));\n }\n\n return hexConcat([ \"0x02\", RLP.encode(fields)]);\n}\n\nfunction _serializeEip2930(transaction: UnsignedTransaction, signature?: SignatureLike): string {\n const fields: any = [\n formatNumber(transaction.chainId || 0, \"chainId\"),\n formatNumber(transaction.nonce || 0, \"nonce\"),\n formatNumber(transaction.gasPrice || 0, \"gasPrice\"),\n formatNumber(transaction.gasLimit || 0, \"gasLimit\"),\n ((transaction.to != null) ? getAddress(transaction.to): \"0x\"),\n formatNumber(transaction.value || 0, \"value\"),\n (transaction.data || \"0x\"),\n (formatAccessList(transaction.accessList || []))\n ];\n\n if (signature) {\n const sig = splitSignature(signature);\n fields.push(formatNumber(sig.recoveryParam, \"recoveryParam\"));\n fields.push(stripZeros(sig.r));\n fields.push(stripZeros(sig.s));\n }\n\n return hexConcat([ \"0x01\", RLP.encode(fields)]);\n}\n\n// Legacy Transactions and EIP-155\nfunction _serialize(transaction: UnsignedTransaction, signature?: SignatureLike): string {\n checkProperties(transaction, allowedTransactionKeys);\n\n const raw: Array<string | Uint8Array> = [];\n\n transactionFields.forEach(function(fieldInfo) {\n let value = (<any>transaction)[fieldInfo.name] || ([]);\n const options: DataOptions = { };\n if (fieldInfo.numeric) { options.hexPad = \"left\"; }\n value = arrayify(hexlify(value, options));\n\n // Fixed-width field\n if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value);\n }\n\n // Variable-width (with a maximum)\n if (fieldInfo.maxLength) {\n value = stripZeros(value);\n if (value.length > fieldInfo.maxLength) {\n logger.throwArgumentError(\"invalid length for \" + fieldInfo.name, (\"transaction:\" + fieldInfo.name), value );\n }\n }\n\n raw.push(hexlify(value));\n });\n\n let chainId = 0;\n if (transaction.chainId != null) {\n // A chainId was provided; if non-zero we'll use EIP-155\n chainId = transaction.chainId;\n\n if (typeof(chainId) !== \"number\") {\n logger.throwArgumentError(\"invalid transaction.chainId\", \"transaction\", transaction);\n }\n\n } else if (signature && !isBytesLike(signature) && signature.v > 28) {\n // No chainId provided, but the signature is signing with EIP-155; derive chainId\n chainId = Math.floor((signature.v - 35) / 2);\n }\n\n // We have an EIP-155 transaction (chainId was specified and non-zero)\n if (chainId !== 0) {\n raw.push(hexlify(chainId)); // @TODO: hexValue?\n raw.push(\"0x\");\n raw.push(\"0x\");\n }\n\n // Requesting an unsigned transaction\n if (!signature) {\n return RLP.encode(raw);\n }\n\n // The splitSignature will ensure the transaction has a recoveryParam in the\n // case that the signTransaction function only adds a v.\n const sig = splitSignature(signature);\n\n // We pushed a chainId and null r, s on for hashing only; remove those\n let v = 27 + sig.recoveryParam\n if (chainId !== 0) {\n raw.pop();\n raw.pop();\n raw.pop();\n v += chainId * 2 + 8;\n\n // If an EIP-155 v (directly or indirectly; maybe _vs) was provided, check it!\n if (sig.v > 28 && sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n } else if (sig.v !== v) {\n logger.throwArgumentError(\"transaction.chainId/signature.v mismatch\", \"signature\", signature);\n }\n\n raw.push(hexlify(v));\n raw.push(stripZeros(arrayify(sig.r)));\n raw.push(stripZeros(arrayify(sig.s)));\n\n return RLP.encode(raw);\n}\n\nexport function serialize(transaction: UnsignedTransaction, signature?: SignatureLike): string {\n // Legacy and EIP-155 Transactions\n if (transaction.type == null || transaction.type === 0) {\n if (transaction.accessList != null) {\n logger.throwArgumentError(\"untyped transactions do not support accessList; include type: 1\", \"transaction\", transaction);\n }\n return _serialize(transaction, signature);\n }\n\n // Typed Transactions (EIP-2718)\n switch (transaction.type) {\n case 1:\n return _serializeEip2930(transaction, signature);\n case 2:\n return _serializeEip1559(transaction, signature);\n default:\n break;\n }\n\n return logger.throwError(`unsupported transaction type: ${ transaction.type }`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"serializeTransaction\",\n transactionType: transaction.type\n });\n}\n\nfunction _parseEipSignature(tx: Transaction, fields: Array<string>, serialize: (tx: UnsignedTransaction) => string): void {\n try {\n const recid = handleNumber(fields[0]).toNumber();\n if (recid !== 0 && recid !== 1) { throw new Error(\"bad recid\"); }\n tx.v = recid;\n } catch (error) {\n logger.throwArgumentError(\"invalid v for transaction type: 1\", \"v\", fields[0]);\n }\n\n tx.r = hexZeroPad(fields[1], 32);\n tx.s = hexZeroPad(fields[2], 32);\n\n try {\n const digest = keccak256(serialize(tx));\n tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v });\n } catch (error) {\n console.log(error);\n }\n}\n\nfunction _parseEip1559(payload: Uint8Array): Transaction {\n const transaction = RLP.decode(payload.slice(1));\n\n if (transaction.length !== 9 && transaction.length !== 12) {\n logger.throwArgumentError(\"invalid component count for transaction type: 2\", \"payload\", hexlify(payload));\n }\n\n const maxPriorityFeePerGas = handleNumber(transaction[2]);\n const maxFeePerGas = handleNumber(transaction[3]);\n const tx: Transaction = {\n type: 2,\n chainId: handleNumber(transaction[0]).toNumber(),\n nonce: handleNumber(transaction[1]).toNumber(),\n maxPriorityFeePerGas: maxPriorityFeePerGas,\n maxFeePerGas: maxFeePerGas,\n gasPrice: null,\n gasLimit: handleNumber(transaction[4]),\n to: handleAddress(transaction[5]),\n value: handleNumber(transaction[6]),\n data: transaction[7],\n accessList: accessListify(transaction[8]),\n };\n\n // Unsigned EIP-1559 Transaction\n if (transaction.length === 9) { return tx; }\n\n tx.hash = keccak256(payload);\n\n _parseEipSignature(tx, transaction.slice(9), _serializeEip1559);\n\n return tx;\n}\n\nfunction _parseEip2930(payload: Uint8Array): Transaction {\n const transaction = RLP.decode(payload.slice(1));\n\n if (transaction.length !== 8 && transaction.length !== 11) {\n logger.throwArgumentError(\"invalid component count for transaction type: 1\", \"payload\", hexlify(payload));\n }\n\n const tx: Transaction = {\n type: 1,\n chainId: handleNumber(transaction[0]).toNumber(),\n nonce: handleNumber(transaction[1]).toNumber(),\n gasPrice: handleNumber(transaction[2]),\n gasLimit: handleNumber(transaction[3]),\n to: handleAddress(transaction[4]),\n value: handleNumber(transaction[5]),\n data: transaction[6],\n accessList: accessListify(transaction[7])\n };\n\n // Unsigned EIP-2930 Transaction\n if (transaction.length === 8) { return tx; }\n\n tx.hash = keccak256(payload);\n\n _parseEipSignature(tx, transaction.slice(8), _serializeEip2930);\n\n return tx;\n}\n\n// Legacy Transactions and EIP-155\nfunction _parse(rawTransaction: Uint8Array): Transaction {\n const transaction = RLP.decode(rawTransaction);\n\n if (transaction.length !== 9 && transaction.length !== 6) {\n logger.throwArgumentError(\"invalid raw transaction\", \"rawTransaction\", rawTransaction);\n }\n\n const tx: Transaction = {\n nonce: handleNumber(transaction[0]).toNumber(),\n gasPrice: handleNumber(transaction[1]),\n gasLimit: handleNumber(transaction[2]),\n to: handleAddress(transaction[3]),\n value: handleNumber(transaction[4]),\n data: transaction[5],\n chainId: 0\n };\n\n // Legacy unsigned transaction\n if (transaction.length === 6) { return tx; }\n\n try {\n tx.v = BigNumber.from(transaction[6]).toNumber();\n\n } catch (error) {\n console.log(error);\n return tx;\n }\n\n tx.r = hexZeroPad(transaction[7], 32);\n tx.s = hexZeroPad(transaction[8], 32);\n\n if (BigNumber.from(tx.r).isZero() && BigNumber.from(tx.s).isZero()) {\n // EIP-155 unsigned transaction\n tx.chainId = tx.v;\n tx.v = 0;\n\n } else {\n // Signed Transaction\n\n tx.chainId = Math.floor((tx.v - 35) / 2);\n if (tx.chainId < 0) { tx.chainId = 0; }\n\n let recoveryParam = tx.v - 27;\n\n const raw = transaction.slice(0, 6);\n\n if (tx.chainId !== 0) {\n raw.push(hexlify(tx.chainId));\n raw.push(\"0x\");\n raw.push(\"0x\");\n recoveryParam -= tx.chainId * 2 + 8;\n }\n\n const digest = keccak256(RLP.encode(raw));\n try {\n tx.from = recoverAddress(digest, { r: hexlify(tx.r), s: hexlify(tx.s), recoveryParam: recoveryParam });\n } catch (error) {\n console.log(error);\n }\n\n tx.hash = keccak256(rawTransaction);\n }\n\n tx.type = null;\n\n return tx;\n}\n\n\nexport function parse(rawTransaction: BytesLike): Transaction {\n const payload = arrayify(rawTransaction);\n\n // Legacy and EIP-155 Transactions\n if (payload[0] > 0x7f) { return _parse(payload); }\n\n // Typed Transaction (EIP-2718)\n switch (payload[0]) {\n case 1:\n return _parseEip2930(payload);\n case 2:\n return _parseEip1559(payload);\n default:\n break;\n }\n\n return logger.throwError(`unsupported transaction type: ${ payload[0] }`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"parseTransaction\",\n transactionType: payload[0]\n });\n}\n\n","export const version = \"contracts/5.6.0\";\n","\"use strict\";\n\nimport { checkResultErrors, EventFragment, Fragment, FunctionFragment, Indexed, Interface, JsonFragment, LogDescription, ParamType, Result } from \"@ethersproject/abi\";\nimport { Block, BlockTag, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from \"@ethersproject/abstract-provider\";\nimport { Signer, VoidSigner } from \"@ethersproject/abstract-signer\";\nimport { getAddress, getContractAddress } from \"@ethersproject/address\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { arrayify, BytesLike, concat, hexlify, isBytes, isHexString } from \"@ethersproject/bytes\";\nimport { Deferrable, defineReadOnly, deepCopy, getStatic, resolveProperties, shallowCopy } from \"@ethersproject/properties\";\nimport { AccessList, accessListify, AccessListish } from \"@ethersproject/transactions\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\n\nconst logger = new Logger(version);\n\nexport interface Overrides {\n gasLimit?: BigNumberish | Promise<BigNumberish>;\n gasPrice?: BigNumberish | Promise<BigNumberish>;\n maxFeePerGas?: BigNumberish | Promise<BigNumberish>;\n maxPriorityFeePerGas?: BigNumberish | Promise<BigNumberish>;\n nonce?: BigNumberish | Promise<BigNumberish>;\n type?: number;\n accessList?: AccessListish;\n customData?: Record<string, any>;\n ccipReadEnabled?: boolean;\n};\n\nexport interface PayableOverrides extends Overrides {\n value?: BigNumberish | Promise<BigNumberish>;\n}\n\nexport interface CallOverrides extends PayableOverrides {\n blockTag?: BlockTag | Promise<BlockTag>;\n from?: string | Promise<string>;\n}\n\n// @TODO: Better hierarchy with: (in v6)\n// - abstract-provider:TransactionRequest\n// - transactions:Transaction\n// - transaction:UnsignedTransaction\n\nexport interface PopulatedTransaction {\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 type?: number;\n accessList?: AccessList;\n\n maxFeePerGas?: BigNumber;\n maxPriorityFeePerGas?: BigNumber;\n\n customData?: Record<string, any>;\n ccipReadEnabled?: boolean;\n};\n\nexport type EventFilter = {\n address?: string;\n topics?: Array<string|Array<string>>;\n};\n\n\nexport type ContractFunction<T = any> = (...args: Array<any>) => Promise<T>;\n\n\n// The (n + 1)th parameter passed to contract event callbacks\nexport interface Event extends Log {\n\n // The event name\n event?: string;\n\n // The event signature\n eventSignature?: string;\n\n // The parsed arguments to the event\n args?: Result;\n\n // If parsing the arguments failed, this is the error\n decodeError?: Error;\n\n // A function that can be used to decode event data and topics\n decode?: (data: string, topics?: Array<string>) => any;\n\n // A function that will remove the listener responsible for this event (if any)\n removeListener: () => void;\n\n // Get blockchain details about this event's block and transaction\n getBlock: () => Promise<Block>;\n getTransaction: () => Promise<TransactionResponse>;\n getTransactionReceipt: () => Promise<TransactionReceipt>;\n}\n\nexport interface ContractReceipt extends TransactionReceipt {\n events?: Array<Event>;\n}\n\nexport interface ContractTransaction extends TransactionResponse {\n wait(confirmations?: number): Promise<ContractReceipt>;\n}\n\n///////////////////////////////\n\nconst allowedTransactionKeys: { [ key: string ]: boolean } = {\n chainId: true, data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true,\n type: true, accessList: true,\n maxFeePerGas: true, maxPriorityFeePerGas: true,\n customData: true,\n ccipReadEnabled: true\n}\n\nasync function resolveName(resolver: Signer | Provider, nameOrPromise: string | Promise<string>): Promise<string> {\n const name = await nameOrPromise;\n\n if (typeof(name) !== \"string\") {\n logger.throwArgumentError(\"invalid address or ENS name\", \"name\", name);\n }\n\n // If it is already an address, just use it (after adding checksum)\n try {\n return getAddress(name);\n } catch (error) { }\n\n if (!resolver) {\n logger.throwError(\"a provider or signer is needed to resolve ENS names\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"resolveName\"\n });\n }\n\n const address = await resolver.resolveName(name);\n\n if (address == null) {\n logger.throwArgumentError(\"resolver or addr is not configured for ENS name\", \"name\", name);\n }\n\n return address;\n}\n\n// Recursively replaces ENS names with promises to resolve the name and resolves all properties\nasync function resolveAddresses(resolver: Signer | Provider, value: any, paramType: ParamType | Array<ParamType>): Promise<any> {\n if (Array.isArray(paramType)) {\n return await Promise.all(paramType.map((paramType, index) => {\n return resolveAddresses(\n resolver,\n ((Array.isArray(value)) ? value[index]: value[paramType.name]),\n paramType\n );\n }));\n }\n\n if (paramType.type === \"address\") {\n return await resolveName(resolver, value);\n }\n\n if (paramType.type === \"tuple\") {\n return await resolveAddresses(resolver, value, paramType.components);\n }\n\n if (paramType.baseType === \"array\") {\n if (!Array.isArray(value)) {\n return Promise.reject(logger.makeError(\"invalid value for array\", Logger.errors.INVALID_ARGUMENT, {\n argument: \"value\",\n value\n }));\n }\n return await Promise.all(value.map((v) => resolveAddresses(resolver, v, paramType.arrayChildren)));\n }\n\n return value;\n}\n\nasync function populateTransaction(contract: Contract, fragment: FunctionFragment, args: Array<any>): Promise<PopulatedTransaction> {\n // If an extra argument is given, it is overrides\n let overrides: CallOverrides = { };\n if (args.length === fragment.inputs.length + 1 && typeof(args[args.length - 1]) === \"object\") {\n overrides = shallowCopy(args.pop());\n }\n\n // Make sure the parameter count matches\n logger.checkArgumentCount(args.length, fragment.inputs.length, \"passed to contract\");\n\n // Populate \"from\" override (allow promises)\n if (contract.signer) {\n if (overrides.from) {\n // Contracts with a Signer are from the Signer's frame-of-reference;\n // but we allow overriding \"from\" if it matches the signer\n overrides.from = resolveProperties({\n override: resolveName(contract.signer, overrides.from),\n signer: contract.signer.getAddress()\n }).then(async (check) => {\n if (getAddress(check.signer) !== check.override) {\n logger.throwError(\"Contract with a Signer cannot override from\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"overrides.from\"\n });\n }\n\n return check.override;\n });\n\n } else {\n overrides.from = contract.signer.getAddress();\n }\n\n } else if (overrides.from) {\n overrides.from = resolveName(contract.provider, overrides.from);\n\n //} else {\n // Contracts without a signer can override \"from\", and if\n // unspecified the zero address is used\n //overrides.from = AddressZero;\n }\n\n // Wait for all dependencies to be resolved (prefer the signer over the provider)\n const resolved = await resolveProperties({\n args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs),\n address: contract.resolvedAddress,\n overrides: (resolveProperties(overrides) || { })\n });\n\n // The ABI coded transaction\n const data = contract.interface.encodeFunctionData(fragment, resolved.args);\n const tx: PopulatedTransaction = {\n data: data,\n to: resolved.address\n };\n\n // Resolved Overrides\n const ro = resolved.overrides;\n\n // Populate simple overrides\n if (ro.nonce != null) { tx.nonce = BigNumber.from(ro.nonce).toNumber(); }\n if (ro.gasLimit != null) { tx.gasLimit = BigNumber.from(ro.gasLimit); }\n if (ro.gasPrice != null) { tx.gasPrice = BigNumber.from(ro.gasPrice); }\n if (ro.maxFeePerGas != null) { tx.maxFeePerGas = BigNumber.from(ro.maxFeePerGas); }\n if (ro.maxPriorityFeePerGas != null) { tx.maxPriorityFeePerGas = BigNumber.from(ro.maxPriorityFeePerGas); }\n if (ro.from != null) { tx.from = ro.from; }\n\n if (ro.type != null) { tx.type = ro.type; }\n if (ro.accessList != null) { tx.accessList = accessListify(ro.accessList); }\n\n // If there was no \"gasLimit\" override, but the ABI specifies a default, use it\n if (tx.gasLimit == null && fragment.gas != null) {\n // Compute the intrinsic gas cost for this transaction\n // @TODO: This is based on the yellow paper as of Petersburg; this is something\n // we may wish to parameterize in v6 as part of the Network object. Since this\n // is always a non-nil to address, we can ignore G_create, but may wish to add\n // similar logic to the ContractFactory.\n let intrinsic = 21000;\n const bytes = arrayify(data);\n for (let i = 0; i < bytes.length; i++) {\n intrinsic += 4;\n if (bytes[i]) { intrinsic += 64; }\n }\n tx.gasLimit = BigNumber.from(fragment.gas).add(intrinsic);\n }\n\n // Populate \"value\" override\n if (ro.value) {\n const roValue = BigNumber.from(ro.value);\n if (!roValue.isZero() && !fragment.payable) {\n logger.throwError(\"non-payable method cannot override value\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"overrides.value\",\n value: overrides.value\n });\n }\n tx.value = roValue;\n }\n\n if (ro.customData) {\n tx.customData = shallowCopy(ro.customData);\n }\n\n if (ro.ccipReadEnabled) {\n tx.ccipReadEnabled = !!ro.ccipReadEnabled;\n }\n\n // Remove the overrides\n delete overrides.nonce;\n delete overrides.gasLimit;\n delete overrides.gasPrice;\n delete overrides.from;\n delete overrides.value;\n\n delete overrides.type;\n delete overrides.accessList;\n\n delete overrides.maxFeePerGas;\n delete overrides.maxPriorityFeePerGas;\n\n delete overrides.customData;\n delete overrides.ccipReadEnabled;\n\n // Make sure there are no stray overrides, which may indicate a\n // typo or using an unsupported key.\n const leftovers = Object.keys(overrides).filter((key) => ((<any>overrides)[key] != null));\n if (leftovers.length) {\n logger.throwError(`cannot override ${ leftovers.map((l) => JSON.stringify(l)).join(\",\") }`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"overrides\",\n overrides: leftovers\n });\n }\n\n return tx;\n}\n\n\nfunction buildPopulate(contract: Contract, fragment: FunctionFragment): ContractFunction<PopulatedTransaction> {\n return function(...args: Array<any>): Promise<PopulatedTransaction> {\n return populateTransaction(contract, fragment, args);\n };\n}\n\nfunction buildEstimate(contract: Contract, fragment: FunctionFragment): ContractFunction<BigNumber> {\n const signerOrProvider = (contract.signer || contract.provider);\n return async function(...args: Array<any>): Promise<BigNumber> {\n if (!signerOrProvider) {\n logger.throwError(\"estimate require a provider or signer\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"estimateGas\"\n })\n }\n\n const tx = await populateTransaction(contract, fragment, args);\n return await signerOrProvider.estimateGas(tx);\n };\n}\n\nfunction addContractWait(contract: Contract, tx: TransactionResponse) {\n const wait = tx.wait.bind(tx);\n tx.wait = (confirmations?: number) => {\n return wait(confirmations).then((receipt: ContractReceipt) => {\n receipt.events = receipt.logs.map((log) => {\n let event: Event = (<Event>deepCopy(log));\n let parsed: LogDescription = null;\n try {\n parsed = contract.interface.parseLog(log);\n } catch (e){ }\n\n // Successfully parsed the event log; include it\n if (parsed) {\n event.args = parsed.args;\n event.decode = (data: BytesLike, topics?: Array<any>) => {\n return contract.interface.decodeEventLog(parsed.eventFragment, data, topics);\n };\n event.event = parsed.name;\n event.eventSignature = parsed.signature;\n }\n\n // Useful operations\n event.removeListener = () => { return contract.provider; }\n event.getBlock = () => {\n return contract.provider.getBlock(receipt.blockHash);\n }\n event.getTransaction = () => {\n return contract.provider.getTransaction(receipt.transactionHash);\n }\n event.getTransactionReceipt = () => {\n return Promise.resolve(receipt);\n }\n\n return event;\n });\n\n return receipt;\n });\n };\n}\n\nfunction buildCall(contract: Contract, fragment: FunctionFragment, collapseSimple: boolean): ContractFunction {\n const signerOrProvider = (contract.signer || contract.provider);\n\n return async function(...args: Array<any>): Promise<any> {\n // Extract the \"blockTag\" override if present\n let blockTag = undefined;\n if (args.length === fragment.inputs.length + 1 && typeof(args[args.length - 1]) === \"object\") {\n const overrides = shallowCopy(args.pop());\n if (overrides.blockTag != null) {\n blockTag = await overrides.blockTag;\n }\n delete overrides.blockTag;\n args.push(overrides);\n }\n\n // If the contract was just deployed, wait until it is mined\n if (contract.deployTransaction != null) {\n await contract._deployed(blockTag);\n }\n\n // Call a node and get the result\n const tx = await populateTransaction(contract, fragment, args);\n const result = await signerOrProvider.call(tx, blockTag);\n\n try {\n let value = contract.interface.decodeFunctionResult(fragment, result);\n if (collapseSimple && fragment.outputs.length === 1) {\n value = value[0];\n }\n return value;\n\n } catch (error) {\n if (error.code === Logger.errors.CALL_EXCEPTION) {\n error.address = contract.address;\n error.args = args;\n error.transaction = tx;\n }\n throw error;\n }\n };\n}\n\nfunction buildSend(contract: Contract, fragment: FunctionFragment): ContractFunction<TransactionResponse> {\n return async function(...args: Array<any>): Promise<TransactionResponse> {\n if (!contract.signer) {\n logger.throwError(\"sending a transaction requires a signer\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"sendTransaction\"\n })\n }\n\n // If the contract was just deployed, wait until it is mined\n if (contract.deployTransaction != null) {\n await contract._deployed();\n }\n\n const txRequest = await populateTransaction(contract, fragment, args);\n\n const tx = await contract.signer.sendTransaction(txRequest);\n\n // Tweak the tx.wait so the receipt has extra properties\n addContractWait(contract, tx);\n\n return tx;\n };\n}\n\nfunction buildDefault(contract: Contract, fragment: FunctionFragment, collapseSimple: boolean): ContractFunction {\n if (fragment.constant) {\n return buildCall(contract, fragment, collapseSimple);\n }\n return buildSend(contract, fragment);\n}\n\nfunction getEventTag(filter: EventFilter): string {\n if (filter.address && (filter.topics == null || filter.topics.length === 0)) {\n return \"*\";\n }\n\n return (filter.address || \"*\") + \"@\" + (filter.topics ? filter.topics.map((topic) => {\n if (Array.isArray(topic)) {\n return topic.join(\"|\");\n }\n return topic;\n }).join(\":\"): \"\");\n}\n\nclass RunningEvent {\n readonly tag: string;\n readonly filter: EventFilter;\n private _listeners: Array<{ listener: Listener, once: boolean }>;\n\n constructor(tag: string, filter: EventFilter) {\n defineReadOnly(this, \"tag\", tag);\n defineReadOnly(this, \"filter\", filter);\n this._listeners = [ ];\n }\n\n addListener(listener: Listener, once: boolean): void {\n this._listeners.push({ listener: listener, once: once });\n }\n\n removeListener(listener: Listener): void {\n let done = false;\n this._listeners = this._listeners.filter((item) => {\n if (done || item.listener !== listener) { return true; }\n done = true;\n return false;\n });\n }\n\n removeAllListeners(): void {\n this._listeners = [];\n }\n\n listeners(): Array<Listener> {\n return this._listeners.map((i) => i.listener);\n }\n\n listenerCount(): number {\n return this._listeners.length;\n }\n\n run(args: Array<any>): number {\n const listenerCount = this.listenerCount();\n this._listeners = this._listeners.filter((item) => {\n\n const argsCopy = args.slice();\n\n // Call the callback in the next event loop\n setTimeout(() => {\n item.listener.apply(this, argsCopy);\n }, 0);\n\n // Reschedule it if it not \"once\"\n return !(item.once);\n });\n\n return listenerCount;\n }\n\n prepareEvent(event: Event): void {\n }\n\n // Returns the array that will be applied to an emit\n getEmit(event: Event): Array<any> {\n return [ event ];\n }\n}\n\nclass ErrorRunningEvent extends RunningEvent {\n constructor() {\n super(\"error\", null);\n }\n}\n\n\n// @TODO Fragment should inherit Wildcard? and just override getEmit?\n// or have a common abstract super class, with enough constructor\n// options to configure both.\n\n// A Fragment Event will populate all the properties that Wildcard\n// will, and additionally dereference the arguments when emitting\nclass FragmentRunningEvent extends RunningEvent {\n readonly address: string;\n readonly interface: Interface;\n readonly fragment: EventFragment;\n\n constructor(address: string, contractInterface: Interface, fragment: EventFragment, topics?: Array<string|Array<string>>) {\n const filter: EventFilter = {\n address: address\n }\n\n let topic = contractInterface.getEventTopic(fragment);\n if (topics) {\n if (topic !== topics[0]) { logger.throwArgumentError(\"topic mismatch\", \"topics\", topics); }\n filter.topics = topics.slice();\n } else {\n filter.topics = [ topic ];\n }\n\n super(getEventTag(filter), filter);\n defineReadOnly(this, \"address\", address);\n defineReadOnly(this, \"interface\", contractInterface);\n defineReadOnly(this, \"fragment\", fragment);\n }\n\n\n prepareEvent(event: Event): void {\n super.prepareEvent(event);\n\n event.event = this.fragment.name;\n event.eventSignature = this.fragment.format();\n\n event.decode = (data: BytesLike, topics?: Array<string>) => {\n return this.interface.decodeEventLog(this.fragment, data, topics);\n };\n\n try {\n event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics);\n } catch (error) {\n event.args = null;\n event.decodeError = error;\n }\n }\n\n getEmit(event: Event): Array<any> {\n const errors = checkResultErrors(event.args);\n if (errors.length) { throw errors[0].error; }\n\n const args = (event.args || []).slice();\n args.push(event);\n return args;\n }\n}\n\n// A Wildcard Event will attempt to populate:\n// - event The name of the event name\n// - eventSignature The full signature of the event\n// - decode A function to decode data and topics\n// - args The decoded data and topics\nclass WildcardRunningEvent extends RunningEvent {\n readonly address: string;\n readonly interface: Interface;\n\n constructor(address: string, contractInterface: Interface) {\n super(\"*\", { address: address });\n defineReadOnly(this, \"address\", address);\n defineReadOnly(this, \"interface\", contractInterface);\n }\n\n prepareEvent(event: Event): void {\n super.prepareEvent(event);\n\n try {\n const parsed = this.interface.parseLog(event);\n event.event = parsed.name;\n event.eventSignature = parsed.signature;\n\n event.decode = (data: BytesLike, topics?: Array<string>) => {\n return this.interface.decodeEventLog(parsed.eventFragment, data, topics);\n };\n\n event.args = parsed.args;\n } catch (error) {\n // No matching event\n }\n }\n}\n\nexport type ContractInterface = string | ReadonlyArray<Fragment | JsonFragment | string> | Interface;\n\ntype InterfaceFunc = (contractInterface: ContractInterface) => Interface;\n\n\nexport class BaseContract {\n readonly address: string;\n readonly interface: Interface;\n\n readonly signer: Signer;\n readonly provider: Provider;\n\n readonly functions: { [ name: string ]: ContractFunction };\n\n readonly callStatic: { [ name: string ]: ContractFunction };\n readonly estimateGas: { [ name: string ]: ContractFunction<BigNumber> };\n readonly populateTransaction: { [ name: string ]: ContractFunction<PopulatedTransaction> };\n\n readonly filters: { [ name: string ]: (...args: Array<any>) => EventFilter };\n\n // This will always be an address. This will only differ from\n // address if an ENS name was used in the constructor\n readonly resolvedAddress: Promise<string>;\n\n // This is only set if the contract was created with a call to deploy\n readonly deployTransaction: TransactionResponse;\n\n _deployedPromise: Promise<Contract>;\n\n // A list of RunningEvents to track listeners for each event tag\n _runningEvents: { [ eventTag: string ]: RunningEvent };\n\n // Wrapped functions to call emit and allow deregistration from the provider\n _wrappedEmits: { [ eventTag: string ]: (...args: Array<any>) => void };\n\n constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider?: Signer | Provider) {\n logger.checkNew(new.target, Contract);\n\n // @TODO: Maybe still check the addressOrName looks like a valid address or name?\n //address = getAddress(address);\n defineReadOnly(this, \"interface\", getStatic<InterfaceFunc>(new.target, \"getInterface\")(contractInterface));\n\n if (signerOrProvider == null) {\n defineReadOnly(this, \"provider\", null);\n defineReadOnly(this, \"signer\", null);\n } else if (Signer.isSigner(signerOrProvider)) {\n defineReadOnly(this, \"provider\", signerOrProvider.provider || null);\n defineReadOnly(this, \"signer\", signerOrProvider);\n } else if (Provider.isProvider(signerOrProvider)) {\n defineReadOnly(this, \"provider\", signerOrProvider);\n defineReadOnly(this, \"signer\", null);\n } else {\n logger.throwArgumentError(\"invalid signer or provider\", \"signerOrProvider\", signerOrProvider);\n }\n\n defineReadOnly(this, \"callStatic\", { });\n defineReadOnly(this, \"estimateGas\", { });\n defineReadOnly(this, \"functions\", { });\n defineReadOnly(this, \"populateTransaction\", { });\n\n defineReadOnly(this, \"filters\", { });\n\n {\n const uniqueFilters: { [ name: string ]: Array<string> } = { };\n Object.keys(this.interface.events).forEach((eventSignature) => {\n const event = this.interface.events[eventSignature];\n defineReadOnly(this.filters, eventSignature, (...args: Array<any>) => {\n return {\n address: this.address,\n topics: this.interface.encodeFilterTopics(event, args)\n }\n });\n if (!uniqueFilters[event.name]) { uniqueFilters[event.name] = [ ]; }\n uniqueFilters[event.name].push(eventSignature);\n });\n\n Object.keys(uniqueFilters).forEach((name) => {\n const filters = uniqueFilters[name];\n if (filters.length === 1) {\n defineReadOnly(this.filters, name, this.filters[filters[0]]);\n } else {\n logger.warn(`Duplicate definition of ${ name } (${ filters.join(\", \")})`);\n }\n });\n }\n\n defineReadOnly(this, \"_runningEvents\", { });\n defineReadOnly(this, \"_wrappedEmits\", { });\n\n if (addressOrName == null) {\n logger.throwArgumentError(\"invalid contract address or ENS name\", \"addressOrName\", addressOrName);\n }\n\n defineReadOnly(this, \"address\", addressOrName);\n if (this.provider) {\n defineReadOnly(this, \"resolvedAddress\", resolveName(this.provider, addressOrName));\n } else {\n try {\n defineReadOnly(this, \"resolvedAddress\", Promise.resolve(getAddress(addressOrName)));\n } catch (error) {\n // Without a provider, we cannot use ENS names\n logger.throwError(\"provider is required to use ENS name as contract address\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new Contract\"\n });\n }\n }\n\n // Swallow bad ENS names to prevent Unhandled Exceptions\n this.resolvedAddress.catch((e) => { });\n\n const uniqueNames: { [ name: string ]: Array<string> } = { };\n const uniqueSignatures: { [ signature: string ]: boolean } = { };\n Object.keys(this.interface.functions).forEach((signature) => {\n const fragment = this.interface.functions[signature];\n\n // Check that the signature is unique; if not the ABI generation has\n // not been cleaned or may be incorrectly generated\n if (uniqueSignatures[signature]) {\n logger.warn(`Duplicate ABI entry for ${ JSON.stringify(signature) }`);\n return;\n }\n uniqueSignatures[signature] = true;\n\n // Track unique names; we only expose bare named functions if they\n // are ambiguous\n {\n const name = fragment.name;\n if (!uniqueNames[`%${ name }`]) { uniqueNames[`%${ name }`] = [ ]; }\n uniqueNames[`%${ name }`].push(signature);\n }\n\n if ((<Contract>this)[signature] == null) {\n defineReadOnly<any, any>(this, signature, buildDefault(this, fragment, true));\n }\n\n // We do not collapse simple calls on this bucket, which allows\n // frameworks to safely use this without introspection as well as\n // allows decoding error recovery.\n if (this.functions[signature] == null) {\n defineReadOnly(this.functions, signature, buildDefault(this, fragment, false));\n }\n\n if (this.callStatic[signature] == null) {\n defineReadOnly(this.callStatic, signature, buildCall(this, fragment, true));\n }\n\n if (this.populateTransaction[signature] == null) {\n defineReadOnly(this.populateTransaction, signature, buildPopulate(this, fragment));\n }\n\n if (this.estimateGas[signature] == null) {\n defineReadOnly(this.estimateGas, signature, buildEstimate(this, fragment));\n }\n });\n\n Object.keys(uniqueNames).forEach((name) => {\n // Ambiguous names to not get attached as bare names\n const signatures = uniqueNames[name];\n if (signatures.length > 1) { return; }\n\n // Strip off the leading \"%\" used for prototype protection\n name = name.substring(1);\n\n const signature = signatures[0];\n\n // If overwriting a member property that is null, swallow the error\n try {\n if ((<Contract>this)[name] == null) {\n defineReadOnly(<Contract>this, name, (<Contract>this)[signature]);\n }\n } catch (e) { }\n\n if (this.functions[name] == null) {\n defineReadOnly(this.functions, name, this.functions[signature]);\n }\n\n if (this.callStatic[name] == null) {\n defineReadOnly(this.callStatic, name, this.callStatic[signature]);\n }\n\n if (this.populateTransaction[name] == null) {\n defineReadOnly(this.populateTransaction, name, this.populateTransaction[signature]);\n }\n\n if (this.estimateGas[name] == null) {\n defineReadOnly(this.estimateGas, name, this.estimateGas[signature]);\n }\n });\n }\n\n static getContractAddress(transaction: { from: string, nonce: BigNumberish }): string {\n return getContractAddress(transaction);\n }\n\n static getInterface(contractInterface: ContractInterface): Interface {\n if (Interface.isInterface(contractInterface)) {\n return contractInterface;\n }\n return new Interface(contractInterface);\n }\n\n // @TODO: Allow timeout?\n deployed(): Promise<Contract> {\n return this._deployed();\n }\n\n _deployed(blockTag?: BlockTag): Promise<Contract> {\n if (!this._deployedPromise) {\n\n // If we were just deployed, we know the transaction we should occur in\n if (this.deployTransaction) {\n this._deployedPromise = this.deployTransaction.wait().then(() => {\n return this;\n });\n\n } else {\n // @TODO: Once we allow a timeout to be passed in, we will wait\n // up to that many blocks for getCode\n\n // Otherwise, poll for our code to be deployed\n this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code) => {\n if (code === \"0x\") {\n logger.throwError(\"contract not deployed\", Logger.errors.UNSUPPORTED_OPERATION, {\n contractAddress: this.address,\n operation: \"getDeployed\"\n });\n }\n return this;\n });\n }\n }\n\n return this._deployedPromise;\n }\n\n // @TODO:\n // estimateFallback(overrides?: TransactionRequest): Promise<BigNumber>\n\n // @TODO:\n // estimateDeploy(bytecode: string, ...args): Promise<BigNumber>\n\n fallback(overrides?: TransactionRequest): Promise<TransactionResponse> {\n if (!this.signer) {\n logger.throwError(\"sending a transactions require a signer\", Logger.errors.UNSUPPORTED_OPERATION, { operation: \"sendTransaction(fallback)\" })\n }\n\n const tx: Deferrable<TransactionRequest> = shallowCopy(overrides || {});\n\n [\"from\", \"to\"].forEach(function(key) {\n if ((<any>tx)[key] == null) { return; }\n logger.throwError(\"cannot override \" + key, Logger.errors.UNSUPPORTED_OPERATION, { operation: key })\n });\n\n tx.to = this.resolvedAddress;\n return this.deployed().then(() => {\n return this.signer.sendTransaction(tx);\n });\n }\n\n // Reconnect to a different signer or provider\n connect(signerOrProvider: Signer | Provider | string): Contract {\n if (typeof(signerOrProvider) === \"string\") {\n signerOrProvider = new VoidSigner(signerOrProvider, this.provider);\n }\n\n const contract = new (<{ new(...args: any[]): Contract }>(this.constructor))(this.address, this.interface, signerOrProvider);\n if (this.deployTransaction) {\n defineReadOnly(contract, \"deployTransaction\", this.deployTransaction);\n }\n\n return contract;\n }\n\n // Re-attach to a different on-chain instance of this contract\n attach(addressOrName: string): Contract {\n return new (<{ new(...args: any[]): Contract }>(this.constructor))(addressOrName, this.interface, this.signer || this.provider);\n }\n\n static isIndexed(value: any): value is Indexed {\n return Indexed.isIndexed(value);\n }\n\n private _normalizeRunningEvent(runningEvent: RunningEvent): RunningEvent {\n // Already have an instance of this event running; we can re-use it\n if (this._runningEvents[runningEvent.tag]) {\n return this._runningEvents[runningEvent.tag];\n }\n return runningEvent\n }\n\n private _getRunningEvent(eventName: EventFilter | string): RunningEvent {\n if (typeof(eventName) === \"string\") {\n\n // Listen for \"error\" events (if your contract has an error event, include\n // the full signature to bypass this special event keyword)\n if (eventName === \"error\") {\n return this._normalizeRunningEvent(new ErrorRunningEvent());\n }\n\n // Listen for any event that is registered\n if (eventName === \"event\") {\n return this._normalizeRunningEvent(new RunningEvent(\"event\", null));\n }\n\n // Listen for any event\n if (eventName === \"*\") {\n return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));\n }\n\n // Get the event Fragment (throws if ambiguous/unknown event)\n const fragment = this.interface.getEvent(eventName)\n return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment));\n }\n\n // We have topics to filter by...\n if (eventName.topics && eventName.topics.length > 0) {\n\n // Is it a known topichash? (throws if no matching topichash)\n try {\n const topic = eventName.topics[0];\n if (typeof(topic) !== \"string\") {\n throw new Error(\"invalid topic\"); // @TODO: May happen for anonymous events\n }\n const fragment = this.interface.getEvent(topic);\n return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics));\n } catch (error) { }\n\n // Filter by the unknown topichash\n const filter: EventFilter = {\n address: this.address,\n topics: eventName.topics\n }\n\n return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter));\n }\n\n return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));\n }\n\n _checkRunningEvents(runningEvent: RunningEvent): void {\n if (runningEvent.listenerCount() === 0) {\n delete this._runningEvents[runningEvent.tag];\n\n // If we have a poller for this, remove it\n const emit = this._wrappedEmits[runningEvent.tag];\n if (emit && runningEvent.filter) {\n this.provider.off(runningEvent.filter, emit);\n delete this._wrappedEmits[runningEvent.tag];\n }\n }\n }\n\n // Subclasses can override this to gracefully recover\n // from parse errors if they wish\n _wrapEvent(runningEvent: RunningEvent, log: Log, listener: Listener): Event {\n const event = <Event>deepCopy(log);\n\n event.removeListener = () => {\n if (!listener) { return; }\n runningEvent.removeListener(listener);\n this._checkRunningEvents(runningEvent);\n };\n\n event.getBlock = () => { return this.provider.getBlock(log.blockHash); }\n event.getTransaction = () => { return this.provider.getTransaction(log.transactionHash); }\n event.getTransactionReceipt = () => { return this.provider.getTransactionReceipt(log.transactionHash); }\n\n // This may throw if the topics and data mismatch the signature\n runningEvent.prepareEvent(event);\n\n return event;\n }\n\n private _addEventListener(runningEvent: RunningEvent, listener: Listener, once: boolean): void {\n if (!this.provider) {\n logger.throwError(\"events require a provider or a signer with a provider\", Logger.errors.UNSUPPORTED_OPERATION, { operation: \"once\" })\n }\n\n runningEvent.addListener(listener, once);\n\n // Track this running event and its listeners (may already be there; but no hard in updating)\n this._runningEvents[runningEvent.tag] = runningEvent;\n\n // If we are not polling the provider, start polling\n if (!this._wrappedEmits[runningEvent.tag]) {\n const wrappedEmit = (log: Log) => {\n let event = this._wrapEvent(runningEvent, log, listener);\n\n // Try to emit the result for the parameterized event...\n if (event.decodeError == null) {\n try {\n const args = runningEvent.getEmit(event);\n this.emit(runningEvent.filter, ...args);\n } catch (error) {\n event.decodeError = error.error;\n }\n }\n\n // Always emit \"event\" for fragment-base events\n if (runningEvent.filter != null) {\n this.emit(\"event\", event);\n }\n\n // Emit \"error\" if there was an error\n if (event.decodeError != null) {\n this.emit(\"error\", event.decodeError, event);\n }\n };\n this._wrappedEmits[runningEvent.tag] = wrappedEmit;\n\n // Special events, like \"error\" do not have a filter\n if (runningEvent.filter != null) {\n this.provider.on(runningEvent.filter, wrappedEmit);\n }\n }\n }\n\n queryFilter(event: EventFilter, fromBlockOrBlockhash?: BlockTag | string, toBlock?: BlockTag): Promise<Array<Event>> {\n const runningEvent = this._getRunningEvent(event);\n const filter = shallowCopy(runningEvent.filter);\n\n if (typeof(fromBlockOrBlockhash) === \"string\" && isHexString(fromBlockOrBlockhash, 32)) {\n if (toBlock != null) {\n logger.throwArgumentError(\"cannot specify toBlock with blockhash\", \"toBlock\", toBlock);\n }\n (<FilterByBlockHash>filter).blockHash = fromBlockOrBlockhash;\n } else {\n (<Filter>filter).fromBlock = ((fromBlockOrBlockhash != null) ? fromBlockOrBlockhash: 0);\n (<Filter>filter).toBlock = ((toBlock != null) ? toBlock: \"latest\");\n }\n\n return this.provider.getLogs(filter).then((logs) => {\n return logs.map((log) => this._wrapEvent(runningEvent, log, null));\n });\n }\n\n on(event: EventFilter | string, listener: Listener): this {\n this._addEventListener(this._getRunningEvent(event), listener, false);\n return this;\n }\n\n once(event: EventFilter | string, listener: Listener): this {\n this._addEventListener(this._getRunningEvent(event), listener, true);\n return this;\n }\n\n emit(eventName: EventFilter | string, ...args: Array<any>): boolean {\n if (!this.provider) { return false; }\n\n const runningEvent = this._getRunningEvent(eventName);\n const result = (runningEvent.run(args) > 0);\n\n // May have drained all the \"once\" events; check for living events\n this._checkRunningEvents(runningEvent);\n\n return result;\n }\n\n listenerCount(eventName?: EventFilter | string): number {\n if (!this.provider) { return 0; }\n if (eventName == null) {\n return Object.keys(this._runningEvents).reduce((accum, key) => {\n return accum + this._runningEvents[key].listenerCount();\n }, 0);\n }\n return this._getRunningEvent(eventName).listenerCount();\n }\n\n listeners(eventName?: EventFilter | string): Array<Listener> {\n if (!this.provider) { return []; }\n\n if (eventName == null) {\n const result: Array<Listener> = [ ];\n for (let tag in this._runningEvents) {\n this._runningEvents[tag].listeners().forEach((listener) => {\n result.push(listener)\n });\n }\n return result;\n }\n\n return this._getRunningEvent(eventName).listeners();\n }\n\n removeAllListeners(eventName?: EventFilter | string): this {\n if (!this.provider) { return this; }\n\n if (eventName == null) {\n for (const tag in this._runningEvents) {\n const runningEvent = this._runningEvents[tag];\n runningEvent.removeAllListeners();\n this._checkRunningEvents(runningEvent);\n }\n return this;\n }\n\n // Delete any listeners\n const runningEvent = this._getRunningEvent(eventName);\n runningEvent.removeAllListeners();\n this._checkRunningEvents(runningEvent);\n\n return this;\n }\n\n off(eventName: EventFilter | string, listener: Listener): this {\n if (!this.provider) { return this; }\n const runningEvent = this._getRunningEvent(eventName);\n runningEvent.removeListener(listener);\n this._checkRunningEvents(runningEvent);\n return this;\n }\n\n removeListener(eventName: EventFilter | string, listener: Listener): this {\n return this.off(eventName, listener);\n }\n\n}\n\nexport class Contract extends BaseContract {\n // The meta-class properties\n readonly [ key: string ]: ContractFunction | any;\n}\n\nexport class ContractFactory {\n\n readonly interface: Interface;\n readonly bytecode: string;\n readonly signer: Signer;\n\n constructor(contractInterface: ContractInterface, bytecode: BytesLike | { object: string }, signer?: Signer) {\n\n let bytecodeHex: string = null;\n\n if (typeof(bytecode) === \"string\") {\n bytecodeHex = bytecode;\n } else if (isBytes(bytecode)) {\n bytecodeHex = hexlify(bytecode);\n } else if (bytecode && typeof(bytecode.object) === \"string\") {\n // Allow the bytecode object from the Solidity compiler\n bytecodeHex = (<any>bytecode).object;\n } else {\n // Crash in the next verification step\n bytecodeHex = \"!\";\n }\n\n // Make sure it is 0x prefixed\n if (bytecodeHex.substring(0, 2) !== \"0x\") { bytecodeHex = \"0x\" + bytecodeHex; }\n\n // Make sure the final result is valid bytecode\n if (!isHexString(bytecodeHex) || (bytecodeHex.length % 2)) {\n logger.throwArgumentError(\"invalid bytecode\", \"bytecode\", bytecode);\n }\n\n // If we have a signer, make sure it is valid\n if (signer && !Signer.isSigner(signer)) {\n logger.throwArgumentError(\"invalid signer\", \"signer\", signer);\n }\n\n defineReadOnly(this, \"bytecode\", bytecodeHex);\n defineReadOnly(this, \"interface\", getStatic<InterfaceFunc>(new.target, \"getInterface\")(contractInterface));\n defineReadOnly(this, \"signer\", signer || null);\n }\n\n // @TODO: Future; rename to populateTransaction?\n getDeployTransaction(...args: Array<any>): TransactionRequest {\n let tx: TransactionRequest = { };\n\n // If we have 1 additional argument, we allow transaction overrides\n if (args.length === this.interface.deploy.inputs.length + 1 && typeof(args[args.length - 1]) === \"object\") {\n tx = shallowCopy(args.pop());\n for (const key in tx) {\n if (!allowedTransactionKeys[key]) {\n throw new Error(\"unknown transaction override \" + key);\n }\n }\n }\n\n // Do not allow these to be overridden in a deployment transaction\n [\"data\", \"from\", \"to\"].forEach((key) => {\n if ((<any>tx)[key] == null) { return; }\n logger.throwError(\"cannot override \" + key, Logger.errors.UNSUPPORTED_OPERATION, { operation: key })\n });\n\n if (tx.value) {\n const value = BigNumber.from(tx.value);\n if (!value.isZero() && !this.interface.deploy.payable) {\n logger.throwError(\"non-payable constructor cannot override value\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"overrides.value\",\n value: tx.value\n });\n }\n }\n\n // Make sure the call matches the constructor signature\n logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, \" in Contract constructor\");\n\n // Set the data to the bytecode + the encoded constructor arguments\n tx.data = hexlify(concat([\n this.bytecode,\n this.interface.encodeDeploy(args)\n ]));\n\n return tx\n }\n\n async deploy(...args: Array<any>): Promise<Contract> {\n\n let overrides: any = { };\n\n // If 1 extra parameter was passed in, it contains overrides\n if (args.length === this.interface.deploy.inputs.length + 1) {\n overrides = args.pop();\n }\n\n // Make sure the call matches the constructor signature\n logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, \" in Contract constructor\");\n\n // Resolve ENS names and promises in the arguments\n const params = await resolveAddresses(this.signer, args, this.interface.deploy.inputs);\n params.push(overrides);\n\n // Get the deployment transaction (with optional overrides)\n const unsignedTx = this.getDeployTransaction(...params);\n\n // Send the deployment transaction\n const tx = await this.signer.sendTransaction(unsignedTx);\n\n const address = getStatic<(tx: TransactionResponse) => string>(this.constructor, \"getContractAddress\")(tx);\n const contract = getStatic<(address: string, contractInterface: ContractInterface, signer?: Signer) => Contract>(this.constructor, \"getContract\")(address, this.interface, this.signer);\n\n // Add the modified wait that wraps events\n addContractWait(contract, tx);\n\n defineReadOnly(contract, \"deployTransaction\", tx);\n return contract;\n }\n\n attach(address: string): Contract {\n return (<any>(this.constructor)).getContract(address, this.interface, this.signer);\n }\n\n connect(signer: Signer) {\n return new (<{ new(...args: any[]): ContractFactory }>(this.constructor))(this.interface, this.bytecode, signer);\n }\n\n static fromSolidity(compilerOutput: any, signer?: Signer): ContractFactory {\n if (compilerOutput == null) {\n logger.throwError(\"missing compiler output\", Logger.errors.MISSING_ARGUMENT, { argument: \"compilerOutput\" });\n }\n\n if (typeof(compilerOutput) === \"string\") {\n compilerOutput = JSON.parse(compilerOutput);\n }\n\n const abi = compilerOutput.abi;\n\n let bytecode: any = null;\n if (compilerOutput.bytecode) {\n bytecode = compilerOutput.bytecode;\n } else if (compilerOutput.evm && compilerOutput.evm.bytecode) {\n bytecode = compilerOutput.evm.bytecode;\n }\n\n return new this(abi, bytecode, signer);\n }\n\n static getInterface(contractInterface: ContractInterface) {\n return Contract.getInterface(contractInterface);\n }\n\n static getContractAddress(tx: { from: string, nonce: BytesLike | BigNumber | number }): string {\n return getContractAddress(tx);\n }\n\n static getContract(address: string, contractInterface: ContractInterface, signer?: Signer): Contract {\n return new Contract(address, contractInterface, signer);\n }\n}\n","/**\n * var basex = require(\"base-x\");\n *\n * This implementation is heavily based on base-x. The main reason to\n * deviate was to prevent the dependency of Buffer.\n *\n * Contributors:\n *\n * base-x encoding\n * Forked from https://github.com/cryptocoinjs/bs58\n * Originally written by Mike Hearn for BitcoinJ\n * Copyright (c) 2011 Google Inc\n * Ported to JavaScript by Stefan Thomas\n * Merged Buffer refactorings from base58-native by Stephen Pair\n * Copyright (c) 2013 BitPay Inc\n *\n * The MIT License (MIT)\n *\n * Copyright base-x contributors (c) 2016\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n *\n */\n\nimport { arrayify, BytesLike } from \"@ethersproject/bytes\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\n\nexport class BaseX {\n readonly alphabet: string;\n readonly base: number;\n\n _alphabetMap: { [ character: string ]: number };\n _leader: string;\n\n constructor(alphabet: string) {\n defineReadOnly(this, \"alphabet\", alphabet);\n defineReadOnly(this, \"base\", alphabet.length);\n\n defineReadOnly(this, \"_alphabetMap\", { });\n defineReadOnly(this, \"_leader\", alphabet.charAt(0));\n\n // pre-compute lookup table\n for (let i = 0; i < alphabet.length; i++) {\n this._alphabetMap[alphabet.charAt(i)] = i;\n }\n }\n\n encode(value: BytesLike): string {\n let source = arrayify(value);\n\n if (source.length === 0) { return \"\"; }\n\n let digits = [ 0 ]\n for (let i = 0; i < source.length; ++i) {\n let carry = source[i];\n for (let j = 0; j < digits.length; ++j) {\n carry += digits[j] << 8;\n digits[j] = carry % this.base;\n carry = (carry / this.base) | 0;\n }\n\n while (carry > 0) {\n digits.push(carry % this.base);\n carry = (carry / this.base) | 0;\n }\n }\n\n let string = \"\"\n\n // deal with leading zeros\n for (let k = 0; source[k] === 0 && k < source.length - 1; ++k) {\n string += this._leader;\n }\n\n // convert digits to a string\n for (let q = digits.length - 1; q >= 0; --q) {\n string += this.alphabet[digits[q]];\n }\n\n return string;\n }\n\n decode(value: string): Uint8Array {\n if (typeof(value) !== \"string\") {\n throw new TypeError(\"Expected String\");\n }\n\n let bytes: Array<number> = [];\n if (value.length === 0) { return new Uint8Array(bytes); }\n\n bytes.push(0);\n for (let i = 0; i < value.length; i++) {\n let byte = this._alphabetMap[value[i]];\n\n if (byte === undefined) {\n throw new Error(\"Non-base\" + this.base + \" character\");\n }\n\n let carry = byte;\n for (let j = 0; j < bytes.length; ++j) {\n carry += bytes[j] * this.base;\n bytes[j] = carry & 0xff;\n carry >>= 8;\n }\n\n while (carry > 0) {\n bytes.push(carry & 0xff);\n carry >>= 8;\n }\n }\n\n // deal with leading zeros\n for (let k = 0; value[k] === this._leader && k < value.length - 1; ++k) {\n bytes.push(0)\n }\n\n return arrayify(new Uint8Array(bytes.reverse()))\n }\n}\n\nconst Base32 = new BaseX(\"abcdefghijklmnopqrstuvwxyz234567\");\nconst Base58 = new BaseX(\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\");\n\nexport { Base32, Base58 };\n\n//console.log(Base58.decode(\"Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj\"))\n//console.log(Base58.encode(Base58.decode(\"Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj\")))\n","export enum SupportedAlgorithm { sha256 = \"sha256\", sha512 = \"sha512\" };\n\n","export const version = \"sha2/5.6.0\";\n","\"use strict\";\n\nimport hash from \"hash.js\";\n//const _ripemd160 = _hash.ripemd160;\n\nimport { arrayify, BytesLike } from \"@ethersproject/bytes\";\n\nimport { SupportedAlgorithm } from \"./types\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nexport function ripemd160(data: BytesLike): string {\n return \"0x\" + (hash.ripemd160().update(arrayify(data)).digest(\"hex\"));\n}\n\nexport function sha256(data: BytesLike): string {\n return \"0x\" + (hash.sha256().update(arrayify(data)).digest(\"hex\"));\n}\n\nexport function sha512(data: BytesLike): string {\n return \"0x\" + (hash.sha512().update(arrayify(data)).digest(\"hex\"));\n}\n\nexport function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string {\n if (!SupportedAlgorithm[algorithm]) {\n logger.throwError(\"unsupported algorithm \" + algorithm, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"hmac\",\n algorithm: algorithm\n });\n }\n\n return \"0x\" + hash.hmac((<any>hash)[algorithm], arrayify(key)).update(arrayify(data)).digest(\"hex\");\n}\n\n","import { computeHmac, ripemd160, sha256, sha512 } from \"./sha2\";\n\nimport { SupportedAlgorithm } from \"./types\";\n\nexport {\n computeHmac,\n\n ripemd160,\n\n sha256,\n sha512,\n\n SupportedAlgorithm\n}\n","\"use strict\";\n\nimport { arrayify, BytesLike, hexlify } from \"@ethersproject/bytes\";\nimport { computeHmac, SupportedAlgorithm } from \"@ethersproject/sha2\";\n\nexport function pbkdf2(password: BytesLike, salt: BytesLike, iterations: number, keylen: number, hashAlgorithm: string): string {\n password = arrayify(password);\n salt = arrayify(salt);\n let hLen;\n let l = 1;\n const DK = new Uint8Array(keylen)\n const block1 = new Uint8Array(salt.length + 4)\n block1.set(salt);\n //salt.copy(block1, 0, 0, salt.length)\n\n let r: number;\n let T: Uint8Array;\n\n for (let 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\n //let U = createHmac(password).update(block1).digest();\n let U = arrayify(computeHmac(<SupportedAlgorithm>hashAlgorithm, password, block1));\n\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\n //U.copy(T, 0, 0, hLen)\n T.set(U);\n\n\n for (let j = 1; j < iterations; j++) {\n //U = createHmac(password).update(U).digest();\n U = arrayify(computeHmac(<SupportedAlgorithm>hashAlgorithm, password, U));\n for (let k = 0; k < hLen; k++) T[k] ^= U[k]\n }\n\n\n const destPos = (i - 1) * hLen\n const len = (i === l ? r : hLen)\n //T.copy(DK, destPos, 0, len)\n DK.set(arrayify(T).slice(0, len), destPos);\n }\n\n return hexlify(DK)\n}\n\n","\nexport { pbkdf2 } from \"./pbkdf2\";\n","export const version = \"wordlists/5.6.0\";\n","\"use strict\";\n\n// This gets overridden by rollup\nconst exportWordlist = false;\n\nimport { id } from \"@ethersproject/hash\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nexport const logger = new Logger(version);\n\nexport abstract class Wordlist {\n readonly locale: string;\n\n constructor(locale: string) {\n logger.checkAbstract(new.target, Wordlist);\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<string> {\n return mnemonic.toLowerCase().split(/ +/g)\n }\n\n // Subclasses may override this\n join(words: Array<string>): string {\n return words.join(\" \");\n }\n\n static check(wordlist: Wordlist): string {\n const words = [];\n for (let i = 0; i < 2048; i++) {\n const word = wordlist.getWord(i);\n /* istanbul ignore if */\n if (i !== wordlist.getWordIndex(word)) { return \"0x\"; }\n words.push(word);\n }\n return id(words.join(\"\\n\") + \"\\n\");\n }\n\n static register(lang: Wordlist, name?: string): void {\n if (!name) { name = lang.locale; }\n\n /* istanbul ignore if */\n if (exportWordlist) {\n try {\n const anyGlobal = (window as any)\n if (anyGlobal._ethers && anyGlobal._ethers.wordlists) {\n if (!anyGlobal._ethers.wordlists[name]) {\n defineReadOnly(anyGlobal._ethers.wordlists, name, lang);\n }\n }\n } catch (error) { }\n }\n }\n\n}\n\n","\"use strict\";\n\nimport { Wordlist } from \"./wordlist\";\n\n\nconst words = \"AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo\";\n\nlet wordlist: Array<string> = null;\n\n\nfunction loadWords(lang: Wordlist): void {\n if (wordlist != null) { return; }\n wordlist = words.replace(/([A-Z])/g, \" $1\").toLowerCase().substring(1).split(\" \");\n\n // Verify the computed list matches the official list\n /* istanbul ignore if */\n if (Wordlist.check(lang) !== \"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60\") {\n wordlist = null;\n throw new Error(\"BIP39 Wordlist for en (English) FAILED\");\n }\n}\n\nclass LangEn extends Wordlist {\n constructor() {\n super(\"en\");\n }\n\n getWord(index: number): string {\n loadWords(this);\n return wordlist[index];\n }\n\n getWordIndex(word: string): number {\n loadWords(this);\n return wordlist.indexOf(word);\n }\n}\n\nconst langEn = new LangEn();\nWordlist.register(langEn);\n\nexport { langEn };\n","\"use strict\";\n\n// Wordlists\n// See: https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md\n\n// Browser; only include English by default\n\nimport { Wordlist } from \"./wordlist\";\n\nimport { langEn as en } from \"./lang-en\";\n\nexport const wordlists: { [ locale: string ]: Wordlist } = {\n en: en\n}\n","\"use strict\";\n\n// Wordlists\n// See: https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md\n\nimport { logger, Wordlist } from \"./wordlist\";\n\nimport { wordlists } from \"./wordlists\";\n\nexport {\n logger,\n Wordlist,\n wordlists\n}\n","export const version = \"hdnode/5.6.0\";\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\nimport { ExternallyOwnedAccount } from \"@ethersproject/abstract-signer\";\nimport { Base58 } from \"@ethersproject/basex\";\nimport { arrayify, BytesLike, concat, hexDataSlice, hexZeroPad, hexlify } from \"@ethersproject/bytes\";\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { toUtf8Bytes, UnicodeNormalizationForm } from \"@ethersproject/strings\";\nimport { pbkdf2 } from \"@ethersproject/pbkdf2\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\nimport { SigningKey } from \"@ethersproject/signing-key\";\nimport { computeHmac, ripemd160, sha256, SupportedAlgorithm } from \"@ethersproject/sha2\";\nimport { computeAddress } from \"@ethersproject/transactions\";\nimport { Wordlist, wordlists } from \"@ethersproject/wordlists\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nconst N = BigNumber.from(\"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141\");\n\n\n// \"Bitcoin seed\"\nconst MasterSecret = toUtf8Bytes(\"Bitcoin seed\");\n\nconst 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\nfunction bytes32(value: BigNumber | Uint8Array): string {\n return hexZeroPad(hexlify(value), 32);\n}\n\nfunction base58check(data: Uint8Array): string {\n return Base58.encode(concat([ data, hexDataSlice(sha256(sha256(data)), 0, 4) ]));\n}\n\nfunction getWordlist(wordlist: string | Wordlist): Wordlist {\n if (wordlist == null) {\n return wordlists[\"en\"];\n }\n\n if (typeof(wordlist) === \"string\") {\n const words = wordlists[wordlist];\n if (words == null) {\n logger.throwArgumentError(\"unknown locale\", \"wordlist\", wordlist);\n }\n return words;\n }\n\n return wordlist;\n}\n\nconst _constructorGuard: any = {};\n\nexport const defaultPath = \"m/44'/60'/0'/0/0\";\n\nexport interface Mnemonic {\n readonly phrase: string;\n readonly path: string;\n readonly locale: string;\n};\n\nexport class HDNode implements ExternallyOwnedAccount {\n readonly privateKey: string;\n readonly publicKey: string;\n\n readonly fingerprint: string;\n readonly parentFingerprint: string;\n\n readonly address: string;\n\n readonly mnemonic?: Mnemonic;\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(constructorGuard: any, privateKey: string, publicKey: string, parentFingerprint: string, chainCode: string, index: number, depth: number, mnemonicOrPath: Mnemonic | string) {\n logger.checkNew(new.target, HDNode);\n\n /* istanbul ignore if */\n if (constructorGuard !== _constructorGuard) {\n throw new Error(\"HDNode constructor cannot be called directly\");\n }\n\n if (privateKey) {\n const signingKey = new SigningKey(privateKey);\n defineReadOnly(this, \"privateKey\", signingKey.privateKey);\n defineReadOnly(this, \"publicKey\", signingKey.compressedPublicKey);\n } else {\n defineReadOnly(this, \"privateKey\", null);\n defineReadOnly(this, \"publicKey\", hexlify(publicKey));\n }\n\n defineReadOnly(this, \"parentFingerprint\", parentFingerprint);\n defineReadOnly(this, \"fingerprint\", hexDataSlice(ripemd160(sha256(this.publicKey)), 0, 4));\n\n defineReadOnly(this, \"address\", computeAddress(this.publicKey));\n\n defineReadOnly(this, \"chainCode\", chainCode);\n\n defineReadOnly(this, \"index\", index);\n defineReadOnly(this, \"depth\", depth);\n\n if (mnemonicOrPath == null) {\n // From a source that does not preserve the path (e.g. extended keys)\n defineReadOnly(this, \"mnemonic\", null);\n defineReadOnly(this, \"path\", null);\n\n } else if (typeof(mnemonicOrPath) === \"string\") {\n // From a source that does not preserve the mnemonic (e.g. neutered)\n defineReadOnly(this, \"mnemonic\", null);\n defineReadOnly(this, \"path\", mnemonicOrPath);\n\n } else {\n // From a fully qualified source\n defineReadOnly(this, \"mnemonic\", mnemonicOrPath);\n defineReadOnly(this, \"path\", mnemonicOrPath.path);\n }\n }\n\n get extendedKey(): string {\n // We only support the mainnet values for now, but if anyone needs\n // testnet values, let me know. I believe current sentiment is that\n // we should always use mainnet, and use BIP-44 to derive the network\n // - Mainnet: public=0x0488B21E, private=0x0488ADE4\n // - Testnet: public=0x043587CF, private=0x04358394\n\n if (this.depth >= 256) { throw new Error(\"Depth too large!\"); }\n\n return base58check(concat([\n ((this.privateKey != null) ? \"0x0488ADE4\": \"0x0488B21E\"),\n hexlify(this.depth),\n this.parentFingerprint,\n hexZeroPad(hexlify(this.index), 4),\n this.chainCode,\n ((this.privateKey != null) ? concat([ \"0x00\", this.privateKey ]): this.publicKey),\n ]));\n }\n\n neuter(): HDNode {\n return new HDNode(_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path);\n }\n\n private _derive(index: number): HDNode {\n if (index > 0xffffffff) { throw new Error(\"invalid index - \" + String(index)); }\n\n // Base path\n let path = this.path;\n if (path) { path += \"/\" + (index & ~HardenedBit); }\n\n const data = new Uint8Array(37);\n\n if (index & HardenedBit) {\n if (!this.privateKey) {\n throw new Error(\"cannot derive child of neutered node\");\n }\n\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(arrayify(this.publicKey));\n }\n\n // Data += ser_32(i)\n for (let i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); }\n\n const I = arrayify(computeHmac(SupportedAlgorithm.sha512, this.chainCode, data));\n const IL = I.slice(0, 32);\n const IR = I.slice(32);\n\n // The private key\n let ki: string = null\n\n // The public key\n let Ki: string = null;\n\n if (this.privateKey) {\n ki = bytes32(BigNumber.from(IL).add(this.privateKey).mod(N));\n } else {\n const ek = new SigningKey(hexlify(IL));\n Ki = ek._addPoint(this.publicKey);\n }\n\n let mnemonicOrPath: Mnemonic | string = path;\n\n const srcMnemonic = this.mnemonic;\n if (srcMnemonic) {\n mnemonicOrPath = Object.freeze({\n phrase: srcMnemonic.phrase,\n path: path,\n locale: (srcMnemonic.locale || \"en\")\n });\n }\n\n return new HDNode(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath);\n }\n\n derivePath(path: string): HDNode {\n const components = path.split(\"/\");\n\n if (components.length === 0 || (components[0] === \"m\" && this.depth !== 0)) {\n throw new Error(\"invalid path - \" + path);\n }\n\n if (components[0] === \"m\") { components.shift(); }\n\n let result: HDNode = this;\n for (let i = 0; i < components.length; i++) {\n const component = components[i];\n if (component.match(/^[0-9]+'$/)) {\n const 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 const 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(\"invalid path component - \" + component);\n }\n }\n\n return result;\n }\n\n\n static _fromSeed(seed: BytesLike, mnemonic: Mnemonic): HDNode {\n const seedArray: Uint8Array = arrayify(seed);\n if (seedArray.length < 16 || seedArray.length > 64) { throw new Error(\"invalid seed\"); }\n\n const I: Uint8Array = arrayify(computeHmac(SupportedAlgorithm.sha512, MasterSecret, seedArray));\n\n return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, \"0x00000000\", bytes32(I.slice(32)), 0, 0, mnemonic);\n }\n\n static fromMnemonic(mnemonic: string, password?: string, wordlist?: string | Wordlist): HDNode {\n\n // If a locale name was passed in, find the associated wordlist\n wordlist = getWordlist(wordlist);\n\n // Normalize the case and spacing in the mnemonic (throws if the mnemonic is invalid)\n mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);\n\n return HDNode._fromSeed(mnemonicToSeed(mnemonic, password), {\n phrase: mnemonic,\n path: \"m\",\n locale: wordlist.locale\n });\n }\n\n static fromSeed(seed: BytesLike): HDNode {\n return HDNode._fromSeed(seed, null);\n }\n\n static fromExtendedKey(extendedKey: string): HDNode {\n const bytes = Base58.decode(extendedKey);\n\n if (bytes.length !== 82 || base58check(bytes.slice(0, 78)) !== extendedKey) {\n logger.throwArgumentError(\"invalid extended key\", \"extendedKey\", \"[REDACTED]\");\n }\n\n const depth = bytes[4];\n const parentFingerprint = hexlify(bytes.slice(5, 9));\n const index = parseInt(hexlify(bytes.slice(9, 13)).substring(2), 16);\n const chainCode = hexlify(bytes.slice(13, 45));\n const key = bytes.slice(45, 78);\n\n switch (hexlify(bytes.slice(0, 4))) {\n // Public Key\n case \"0x0488b21e\": case \"0x043587cf\":\n return new HDNode(_constructorGuard, null, hexlify(key), parentFingerprint, chainCode, index, depth, null);\n\n // Private Key\n case \"0x0488ade4\": case \"0x04358394 \":\n if (key[0] !== 0) { break; }\n return new HDNode(_constructorGuard, hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null);\n }\n\n return logger.throwArgumentError(\"invalid extended key\", \"extendedKey\", \"[REDACTED]\");\n }\n}\n\nexport function mnemonicToSeed(mnemonic: string, password?: string): string {\n if (!password) { password = \"\"; }\n\n const salt = toUtf8Bytes(\"mnemonic\" + password, UnicodeNormalizationForm.NFKD);\n\n return pbkdf2(toUtf8Bytes(mnemonic, UnicodeNormalizationForm.NFKD), salt, 2048, 64, \"sha512\");\n}\n\nexport function mnemonicToEntropy(mnemonic: string, wordlist?: string | Wordlist): string {\n wordlist = getWordlist(wordlist);\n\n logger.checkNormalize();\n\n const words = wordlist.split(mnemonic);\n if ((words.length % 3) !== 0) { throw new Error(\"invalid mnemonic\"); }\n\n const entropy = arrayify(new Uint8Array(Math.ceil(11 * words.length / 8)));\n\n let offset = 0;\n for (let i = 0; i < words.length; i++) {\n let index = wordlist.getWordIndex(words[i].normalize(\"NFKD\"));\n if (index === -1) { throw new Error(\"invalid mnemonic\"); }\n\n for (let 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 const entropyBits = 32 * words.length / 3;\n\n const checksumBits = words.length / 3;\n const checksumMask = getUpperMask(checksumBits);\n\n const checksum = arrayify(sha256(entropy.slice(0, entropyBits / 8)))[0] & 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: BytesLike, wordlist?: string | Wordlist): string {\n wordlist = getWordlist(wordlist);\n\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 const indices: Array<number> = [ 0 ];\n\n let remainingBits = 11;\n for (let 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 const checksumBits = entropy.length / 4;\n const checksum = arrayify(sha256(entropy))[0] & 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 return wordlist.join(indices.map((index) => (<Wordlist>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\nexport function getAccountPath(index: number): string {\n if (typeof(index) !== \"number\" || index < 0 || index >= HardenedBit || index % 1) {\n logger.throwArgumentError(\"invalid account index\", \"index\", index);\n }\n return `m/44'/60'/${ index }'/0/0`;\n}\n","export const version = \"random/5.6.0\";\n","\"use strict\";\n\nimport { arrayify } from \"@ethersproject/bytes\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n// Debugging line for testing browser lib in node\n//const window = { crypto: { getRandomValues: () => { } } };\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis\nfunction getGlobal(): any {\n if (typeof self !== 'undefined') { return self; }\n if (typeof window !== 'undefined') { return window; }\n if (typeof global !== 'undefined') { return global; }\n throw new Error('unable to locate global object');\n};\n\nconst anyGlobal = getGlobal();\n\nlet crypto: any = anyGlobal.crypto || anyGlobal.msCrypto;\nif (!crypto || !crypto.getRandomValues) {\n\n logger.warn(\"WARNING: Missing strong random number source\");\n\n crypto = {\n getRandomValues: function(buffer: Uint8Array): Uint8Array {\n return logger.throwError(\"no secure random source avaialble\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"crypto.getRandomValues\"\n });\n }\n };\n}\n\nexport function randomBytes(length: number): Uint8Array {\n if (length <= 0 || length > 1024 || (length % 1) || length != length) {\n logger.throwArgumentError(\"invalid length\", \"length\", length);\n }\n\n const result = new Uint8Array(length);\n crypto.getRandomValues(result);\n return arrayify(result);\n};\n","\"use strict\";\n\nexport function shuffled(array: Array<any>): Array<any> {\n array = array.slice();\n\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n }\n\n return array;\n}\n","\"use strict\";\n\nexport { randomBytes } from \"./random\";\nexport { shuffled } from \"./shuffle\";\n","\"use strict\";\n\n(function(root) {\n\n function checkInt(value) {\n return (parseInt(value) === value);\n }\n\n function checkInts(arrayish) {\n if (!checkInt(arrayish.length)) { return false; }\n\n for (var i = 0; i < arrayish.length; i++) {\n if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[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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1d, 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","export const version = \"json-wallets/5.6.0\";\n","\"use strict\";\n\nimport { arrayify, Bytes, BytesLike, hexlify } from \"@ethersproject/bytes\";\nimport { toUtf8Bytes, UnicodeNormalizationForm } from '@ethersproject/strings';\n\nexport function 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\nexport function zpad(value: String | number, length: number): String {\n value = String(value);\n while (value.length < length) { value = '0' + value; }\n return value;\n}\n\nexport function getPassword(password: Bytes | string): Uint8Array {\n if (typeof(password) === 'string') {\n return toUtf8Bytes(password, UnicodeNormalizationForm.NFKC);\n }\n return arrayify(password);\n}\n\nexport function searchPath(object: any, path: string): string {\n let currentChild = object;\n\n const comps = path.toLowerCase().split('/');\n for (let i = 0; i < comps.length; i++) {\n\n // Search for a child object with a case-insensitive matching key\n let matchingChild = null;\n for (const 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\n// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4)\nexport function uuidV4(randomBytes: BytesLike): string {\n const bytes = arrayify(randomBytes);\n\n // Section: 4.1.3:\n // - time_hi_and_version[12:16] = 0b0100\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n\n // Section 4.4\n // - clock_seq_hi_and_reserved[6] = 0b0\n // - clock_seq_hi_and_reserved[7] = 0b1\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const value = hexlify(bytes);\n\n return [\n value.substring(2, 10),\n value.substring(10, 14),\n value.substring(14, 18),\n value.substring(18, 22),\n value.substring(22, 34),\n ].join(\"-\");\n}\n\n","\"use strict\";\n\nimport aes from \"aes-js\";\n\nimport { ExternallyOwnedAccount } from \"@ethersproject/abstract-signer\";\nimport { getAddress } from \"@ethersproject/address\";\nimport { arrayify, Bytes } from \"@ethersproject/bytes\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { pbkdf2 } from \"@ethersproject/pbkdf2\";\nimport { toUtf8Bytes } from \"@ethersproject/strings\";\nimport { Description } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { getPassword, looseArrayify, searchPath } from \"./utils\";\n\nexport interface _CrowdsaleAccount {\n address: string;\n privateKey: string;\n\n _isCrowdsaleAccount: boolean;\n}\n\nexport class CrowdsaleAccount extends Description<_CrowdsaleAccount> implements ExternallyOwnedAccount {\n readonly address: string;\n readonly privateKey: string;\n readonly mnemonic?: string;\n readonly path?: string;\n\n readonly _isCrowdsaleAccount: boolean;\n\n isCrowdsaleAccount(value: any): value is CrowdsaleAccount {\n return !!(value && value._isCrowdsaleAccount);\n }\n}\n\n// See: https://github.com/ethereum/pyethsaletool\nexport function decrypt(json: string, password: Bytes | string): ExternallyOwnedAccount {\n const data = JSON.parse(json);\n\n password = getPassword(password);\n\n // Ethereum Address\n const ethaddr = getAddress(searchPath(data, \"ethaddr\"));\n\n // Encrypted Seed\n const encseed = looseArrayify(searchPath(data, \"encseed\"));\n if (!encseed || (encseed.length % 16) !== 0) {\n logger.throwArgumentError(\"invalid encseed\", \"json\", json);\n }\n\n const key = arrayify(pbkdf2(password, password, 2000, 32, \"sha256\")).slice(0, 16);\n\n const iv = encseed.slice(0, 16);\n const encryptedSeed = encseed.slice(16);\n\n // Decrypt the seed\n const aesCbc = new aes.ModeOfOperation.cbc(key, iv);\n const seed = aes.padding.pkcs7.strip(arrayify(aesCbc.decrypt(encryptedSeed)));\n\n // This wallet format is weird... Convert the binary encoded hex to a string.\n let seedHex = \"\";\n for (let i = 0; i < seed.length; i++) {\n seedHex += String.fromCharCode(seed[i]);\n }\n\n const seedHexBytes = toUtf8Bytes(seedHex);\n\n const privateKey = keccak256(seedHexBytes);\n\n return new CrowdsaleAccount ({\n _isCrowdsaleAccount: true,\n address: ethaddr,\n privateKey: privateKey\n });\n}\n\n","\"use strict\";\n\nimport { getAddress } from \"@ethersproject/address\";\n\n\nexport function isCrowdsaleWallet(json: string): boolean {\n let data: any = null;\n try {\n data = JSON.parse(json);\n } catch (error) { return false; }\n\n return (data.encseed && data.ethaddr);\n}\n\nexport function isKeystoreWallet(json: string): boolean {\n let data: any = null;\n try {\n 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//export function isJsonWallet(json: string): boolean {\n// return (isSecretStorageWallet(json) || isCrowdsaleWallet(json));\n//}\n\nexport function getJsonWalletAddress(json: string): string {\n if (isCrowdsaleWallet(json)) {\n try {\n return getAddress(JSON.parse(json).ethaddr);\n } catch (error) { return null; }\n }\n\n if (isKeystoreWallet(json)) {\n try {\n return getAddress(JSON.parse(json).address);\n } catch (error) { return null; }\n }\n\n return null;\n}\n\n","\"use strict\";\n\n(function(root) {\n const 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 const K = new Uint32Array([\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 let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a;\n let h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;\n const w = new Uint32Array(64);\n\n function blocks(p) {\n let off = 0, len = p.length;\n while (len >= 64) {\n let 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 let 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 const innerLen = 64 + salt.length + 4;\n const inner = new Array(innerLen);\n const outerKey = new Array(64);\n\n let i;\n let 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 (let 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 let 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 (let 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 (let 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 (let 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') { return false; }\n\n for (let i = 0; i < o.length; i++) {\n const v = o[i];\n if (typeof(v) !== 'number' || v % 1 || v < 0 || v >= 256) {\n return false;\n }\n }\n\n return true;\n }\n\n function ensureInteger(value, name) {\n if (typeof(value) !== \"number\" || (value % 1)) { throw new Error('invalid ' + name); }\n return value;\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 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 password = Array.prototype.slice.call(password);\n\n if (!checkBufferish(salt)) {\n throw new Error('salt must be an array or buffer');\n }\n salt = Array.prototype.slice.call(salt);\n\n let b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r);\n const B = new Uint32Array(p * 32 * r)\n for (let i = 0; i < B.length; i++) {\n const 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 const XY = new Uint32Array(64 * r);\n const V = new Uint32Array(32 * r * N);\n\n const Yi = 32 * r;\n\n // scratch space\n const x = new Uint32Array(16); // salsa20_8\n const _X = new Uint32Array(16); // blockmix_salsa8\n\n const totalOps = p * N * 2;\n let currentOp = 0;\n let lastPercent10 = null;\n\n // Set this to true to abandon the scrypt on the next step\n let stop = false;\n\n // State information\n let state = 0;\n let i0 = 0, i1;\n let Bi;\n\n // How many blockmix_salsa8 can we do per step?\n const limit = callback ? parseInt(1000 / r): 0xffffffff;\n\n // Trick from scrypt-async; if there is a setImmediate shim in place, use it\n const 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 const incrementalSMix = function() {\n if (stop) {\n return callback(new Error('cancelled'), currentOp / totalOps);\n }\n\n let steps;\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 steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (let 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 if (callback) {\n // Call the callback with the progress (optionally stopping us)\n const 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\n if (i1 < N) { break; }\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 steps = N - i1;\n if (steps > limit) { steps = limit; }\n for (let i = 0; i < steps; i++) { // ROMix - 6\n const offset = (2 * r - 1) * 16; // ROMix - 7\n const 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 if (callback) {\n const 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\n if (i1 < N) { break; }\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 (let 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 const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen);\n\n // Send the result to the callback\n if (callback) { callback(null, 1.0, derivedKey); }\n\n // Done; don't break (which would reschedule)\n return derivedKey;\n }\n\n // Schedule the next steps\n if (callback) { nextTick(incrementalSMix); }\n }\n\n // Run the smix state machine until completion\n if (!callback) {\n while (true) {\n const derivedKey = incrementalSMix();\n if (derivedKey != undefined) { return derivedKey; }\n }\n }\n\n // Bootstrap the async incremental smix\n incrementalSMix();\n }\n\n const lib = {\n scrypt: function(password, salt, N, r, p, dkLen, progressCallback) {\n return new Promise(function(resolve, reject) {\n let lastProgress = 0;\n if (progressCallback) { progressCallback(0); }\n _scrypt(password, salt, N, r, p, dkLen, function(error, progress, key) {\n if (error) {\n reject(error);\n } else if (key) {\n if (progressCallback && lastProgress !== 1) {\n progressCallback(1);\n }\n resolve(new Uint8Array(key));\n } else if (progressCallback && progress !== lastProgress) {\n lastProgress = progress;\n return progressCallback(progress);\n }\n });\n });\n },\n syncScrypt: function(password, salt, N, r, p, dkLen) {\n return new Uint8Array(_scrypt(password, salt, N, r, p, dkLen));\n }\n };\n\n // node.js\n if (typeof(exports) !== 'undefined') {\n module.exports = lib;\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(lib);\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 = lib;\n }\n\n})(this);\n","\"use strict\";\n\nimport aes from \"aes-js\";\nimport scrypt from \"scrypt-js\";\n\nimport { ExternallyOwnedAccount } from \"@ethersproject/abstract-signer\";\nimport { getAddress } from \"@ethersproject/address\";\nimport { arrayify, Bytes, BytesLike, concat, hexlify } from \"@ethersproject/bytes\";\nimport { defaultPath, entropyToMnemonic, HDNode, Mnemonic, mnemonicToEntropy } from \"@ethersproject/hdnode\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { pbkdf2 as _pbkdf2 } from \"@ethersproject/pbkdf2\";\nimport { randomBytes } from \"@ethersproject/random\";\nimport { Description } from \"@ethersproject/properties\";\nimport { computeAddress } from \"@ethersproject/transactions\";\n\nimport { getPassword, looseArrayify, searchPath, uuidV4, zpad } from \"./utils\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n// Exported Types\n\nfunction hasMnemonic(value: any): value is { mnemonic: Mnemonic } {\n return (value != null && value.mnemonic && value.mnemonic.phrase);\n}\n\nexport interface _KeystoreAccount {\n address: string;\n privateKey: string;\n mnemonic?: Mnemonic;\n\n _isKeystoreAccount: boolean;\n}\n\nexport class KeystoreAccount extends Description<_KeystoreAccount> implements ExternallyOwnedAccount {\n readonly address: string;\n readonly privateKey: string;\n readonly mnemonic?: Mnemonic;\n\n readonly _isKeystoreAccount: boolean;\n\n isKeystoreAccount(value: any): value is KeystoreAccount {\n return !!(value && value._isKeystoreAccount);\n }\n}\n\nexport type ProgressCallback = (percent: number) => void;\n\nexport type EncryptOptions = {\n iv?: BytesLike;\n entropy?: BytesLike;\n client?: string;\n salt?: BytesLike;\n uuid?: string;\n scrypt?: {\n N?: number;\n r?: number;\n p?: number;\n }\n}\n\nfunction _decrypt(data: any, key: Uint8Array, ciphertext: Uint8Array): Uint8Array {\n const cipher = searchPath(data, \"crypto/cipher\");\n if (cipher === \"aes-128-ctr\") {\n const iv = looseArrayify(searchPath(data, \"crypto/cipherparams/iv\"))\n const counter = new aes.Counter(iv);\n\n const aesCtr = new aes.ModeOfOperation.ctr(key, counter);\n\n return arrayify(aesCtr.decrypt(ciphertext));\n }\n\n return null;\n}\n\nfunction _getAccount(data: any, key: Uint8Array): KeystoreAccount {\n const ciphertext = looseArrayify(searchPath(data, \"crypto/ciphertext\"));\n\n const computedMAC = hexlify(keccak256(concat([ key.slice(16, 32), ciphertext ]))).substring(2);\n if (computedMAC !== searchPath(data, \"crypto/mac\").toLowerCase()) {\n throw new Error(\"invalid password\");\n }\n\n const privateKey = _decrypt(data, key.slice(0, 16), ciphertext);\n\n if (!privateKey) {\n logger.throwError(\"unsupported cipher\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"decrypt\"\n });\n }\n\n const mnemonicKey = key.slice(32, 64);\n\n const address = computeAddress(privateKey);\n if (data.address) {\n let check = data.address.toLowerCase();\n if (check.substring(0, 2) !== \"0x\") { check = \"0x\" + check; }\n\n if (getAddress(check) !== address) {\n throw new Error(\"address mismatch\");\n }\n }\n\n const account: _KeystoreAccount = {\n _isKeystoreAccount: true,\n address: address,\n privateKey: hexlify(privateKey)\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 const mnemonicCiphertext = looseArrayify(searchPath(data, \"x-ethers/mnemonicCiphertext\"));\n const mnemonicIv = looseArrayify(searchPath(data, \"x-ethers/mnemonicCounter\"));\n\n const mnemonicCounter = new aes.Counter(mnemonicIv);\n const mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n\n const path = searchPath(data, \"x-ethers/path\") || defaultPath;\n const locale = searchPath(data, \"x-ethers/locale\") || \"en\";\n\n const entropy = arrayify(mnemonicAesCtr.decrypt(mnemonicCiphertext));\n\n try {\n const mnemonic = entropyToMnemonic(entropy, locale);\n const node = HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path);\n\n if (node.privateKey != account.privateKey) {\n throw new Error(\"mnemonic mismatch\");\n }\n\n account.mnemonic = node.mnemonic;\n\n } catch (error) {\n // If we don't have the locale wordlist installed to\n // read this mnemonic, just bail and don't set the\n // mnemonic\n if (error.code !== Logger.errors.INVALID_ARGUMENT || error.argument !== \"wordlist\") {\n throw error;\n }\n }\n }\n\n return new KeystoreAccount(account);\n}\n\ntype ScryptFunc<T> = (pw: Uint8Array, salt: Uint8Array, n: number, r: number, p: number, dkLen: number, callback?: ProgressCallback) => T;\ntype Pbkdf2Func<T> = (pw: Uint8Array, salt: Uint8Array, c: number, dkLen: number, prfFunc: string) => T;\n\nfunction pbkdf2Sync(passwordBytes: Uint8Array, salt: Uint8Array, count: number, dkLen: number, prfFunc: string): Uint8Array {\n return arrayify(_pbkdf2(passwordBytes, salt, count, dkLen, prfFunc));\n}\n\nfunction pbkdf2(passwordBytes: Uint8Array, salt: Uint8Array, count: number, dkLen: number, prfFunc: string): Promise<Uint8Array> {\n return Promise.resolve(pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc));\n}\n\nfunction _computeKdfKey<T>(data: any, password: Bytes | string, pbkdf2Func: Pbkdf2Func<T>, scryptFunc: ScryptFunc<T>, progressCallback?: ProgressCallback): T {\n const passwordBytes = getPassword(password);\n\n const kdf = searchPath(data, \"crypto/kdf\");\n\n if (kdf && typeof(kdf) === \"string\") {\n const throwError = function(name: string, value: any): never {\n return logger.throwArgumentError(\"invalid key-derivation function parameters\", name, value);\n }\n\n if (kdf.toLowerCase() === \"scrypt\") {\n const salt = looseArrayify(searchPath(data, \"crypto/kdfparams/salt\"));\n const N = parseInt(searchPath(data, \"crypto/kdfparams/n\"));\n const r = parseInt(searchPath(data, \"crypto/kdfparams/r\"));\n const p = parseInt(searchPath(data, \"crypto/kdfparams/p\"));\n\n // Check for all required parameters\n if (!N || !r || !p) { throwError(\"kdf\", kdf); }\n\n // Make sure N is a power of 2\n if ((N & (N - 1)) !== 0) { throwError(\"N\", N); }\n\n const dkLen = parseInt(searchPath(data, \"crypto/kdfparams/dklen\"));\n if (dkLen !== 32) { throwError(\"dklen\", dkLen); }\n\n return scryptFunc(passwordBytes, salt, N, r, p, 64, progressCallback);\n\n } else if (kdf.toLowerCase() === \"pbkdf2\") {\n\n const salt = looseArrayify(searchPath(data, \"crypto/kdfparams/salt\"));\n\n let prfFunc: string = null;\n const 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 throwError(\"prf\", prf);\n }\n\n const count = parseInt(searchPath(data, \"crypto/kdfparams/c\"));\n\n const dkLen = parseInt(searchPath(data, \"crypto/kdfparams/dklen\"));\n if (dkLen !== 32) { throwError(\"dklen\", dkLen); }\n\n return pbkdf2Func(passwordBytes, salt, count, dkLen, prfFunc);\n }\n }\n\n return logger.throwArgumentError(\"unsupported key-derivation function\", \"kdf\", kdf);\n}\n\n\nexport function decryptSync(json: string, password: Bytes | string): KeystoreAccount {\n const data = JSON.parse(json);\n\n const key = _computeKdfKey(data, password, pbkdf2Sync, scrypt.syncScrypt);\n return _getAccount(data, key);\n}\n\nexport async function decrypt(json: string, password: Bytes | string, progressCallback?: ProgressCallback): Promise<KeystoreAccount> {\n const data = JSON.parse(json);\n\n const key = await _computeKdfKey(data, password, pbkdf2, scrypt.scrypt, progressCallback);\n return _getAccount(data, key);\n}\n\n\nexport function encrypt(account: ExternallyOwnedAccount, password: Bytes | string, options?: EncryptOptions, progressCallback?: ProgressCallback): Promise<string> {\n\n try {\n // Check the address matches the private key\n if (getAddress(account.address) !== computeAddress(account.privateKey)) {\n throw new Error(\"address/privateKey mismatch\");\n }\n\n // Check the mnemonic (if any) matches the private key\n if (hasMnemonic(account)) {\n const mnemonic = account.mnemonic;\n const node = HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || defaultPath);\n\n if (node.privateKey != account.privateKey) {\n throw new Error(\"mnemonic mismatch\");\n }\n }\n\n } catch (e) {\n return Promise.reject(e);\n }\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 const privateKey: Uint8Array = arrayify(account.privateKey);\n const passwordBytes = getPassword(password);\n\n let entropy: Uint8Array = null\n let path: string = null;\n let locale: string = null;\n if (hasMnemonic(account)) {\n const srcMnemonic = account.mnemonic;\n entropy = arrayify(mnemonicToEntropy(srcMnemonic.phrase, srcMnemonic.locale || \"en\"));\n path = srcMnemonic.path || defaultPath;\n locale = srcMnemonic.locale || \"en\";\n }\n\n let client = options.client;\n if (!client) { client = \"ethers.js\"; }\n\n // Check/generate the salt\n let salt: Uint8Array = null;\n if (options.salt) {\n salt = arrayify(options.salt);\n } else {\n salt = randomBytes(32);;\n }\n\n // Override initialization vector\n let iv: Uint8Array = 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 let uuidRandom: Uint8Array = null;\n if (options.uuid) {\n uuidRandom = arrayify(options.uuid);\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 let 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 // 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 return scrypt.scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then((key) => {\n key = arrayify(key);\n\n // This will be used to encrypt the wallet (as per Web3 secret storage)\n const derivedKey = key.slice(0, 16);\n const macPrefix = key.slice(16, 32);\n\n // This will be used to encrypt the mnemonic phrase (if any)\n const mnemonicKey = key.slice(32, 64);\n\n // Encrypt the private key\n const counter = new aes.Counter(iv);\n const aesCtr = new aes.ModeOfOperation.ctr(derivedKey, counter);\n const ciphertext = arrayify(aesCtr.encrypt(privateKey));\n\n // Compute the message authentication code, used to check the password\n const mac = keccak256(concat([macPrefix, ciphertext]))\n\n // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition\n const data: { [key: string]: any } = {\n address: account.address.substring(2).toLowerCase(),\n id: uuidV4(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 const mnemonicIv = randomBytes(16);\n const mnemonicCounter = new aes.Counter(mnemonicIv);\n const mnemonicAesCtr = new aes.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter);\n const mnemonicCiphertext = arrayify(mnemonicAesCtr.encrypt(entropy));\n const now = new Date();\n const 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 path: path,\n locale: locale,\n version: \"0.1\"\n };\n }\n\n return JSON.stringify(data);\n });\n}\n","\"use strict\";\n\nimport { Bytes } from \"@ethersproject/bytes\";\nimport { ExternallyOwnedAccount } from \"@ethersproject/abstract-signer\";\n\nimport { decrypt as decryptCrowdsale } from \"./crowdsale\";\nimport { getJsonWalletAddress, isCrowdsaleWallet, isKeystoreWallet } from \"./inspect\";\nimport { decrypt as decryptKeystore, decryptSync as decryptKeystoreSync, encrypt as encryptKeystore, EncryptOptions, ProgressCallback } from \"./keystore\";\n\nfunction decryptJsonWallet(json: string, password: Bytes | string, progressCallback?: ProgressCallback): Promise<ExternallyOwnedAccount> {\n if (isCrowdsaleWallet(json)) {\n if (progressCallback) { progressCallback(0); }\n const account = decryptCrowdsale(json, password)\n if (progressCallback) { progressCallback(1); }\n return Promise.resolve(account);\n }\n\n if (isKeystoreWallet(json)) {\n return decryptKeystore(json, password, progressCallback);\n }\n\n return Promise.reject(new Error(\"invalid JSON wallet\"));\n}\n\nfunction decryptJsonWalletSync(json: string, password: Bytes | string): ExternallyOwnedAccount {\n if (isCrowdsaleWallet(json)) {\n return decryptCrowdsale(json, password)\n }\n\n if (isKeystoreWallet(json)) {\n return decryptKeystoreSync(json, password);\n }\n\n throw new Error(\"invalid JSON wallet\");\n}\n\nexport {\n decryptCrowdsale,\n\n decryptKeystore,\n decryptKeystoreSync,\n encryptKeystore,\n\n isCrowdsaleWallet,\n isKeystoreWallet,\n getJsonWalletAddress,\n\n decryptJsonWallet,\n decryptJsonWalletSync,\n\n ProgressCallback,\n EncryptOptions,\n};\n","export const version = \"wallet/5.6.0\";\n","\"use strict\";\n\nimport { getAddress } from \"@ethersproject/address\";\nimport { Provider, TransactionRequest } from \"@ethersproject/abstract-provider\";\nimport { ExternallyOwnedAccount, Signer, TypedDataDomain, TypedDataField, TypedDataSigner } from \"@ethersproject/abstract-signer\";\nimport { arrayify, Bytes, BytesLike, concat, hexDataSlice, isHexString, joinSignature, SignatureLike } from \"@ethersproject/bytes\";\nimport { hashMessage, _TypedDataEncoder } from \"@ethersproject/hash\";\nimport { defaultPath, HDNode, entropyToMnemonic, Mnemonic } from \"@ethersproject/hdnode\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { defineReadOnly, resolveProperties } from \"@ethersproject/properties\";\nimport { randomBytes } from \"@ethersproject/random\";\nimport { SigningKey } from \"@ethersproject/signing-key\";\nimport { decryptJsonWallet, decryptJsonWalletSync, encryptKeystore, ProgressCallback } from \"@ethersproject/json-wallets\";\nimport { computeAddress, recoverAddress, serialize, UnsignedTransaction } from \"@ethersproject/transactions\";\nimport { Wordlist } from \"@ethersproject/wordlists\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nfunction isAccount(value: any): value is ExternallyOwnedAccount {\n return (value != null && isHexString(value.privateKey, 32) && value.address != null);\n}\n\nfunction hasMnemonic(value: any): value is { mnemonic: Mnemonic } {\n const mnemonic = value.mnemonic;\n return (mnemonic && mnemonic.phrase);\n}\n\nexport class Wallet extends Signer implements ExternallyOwnedAccount, TypedDataSigner {\n\n readonly address: string;\n readonly provider: Provider;\n\n // Wrapping the _signingKey and _mnemonic in a getter function prevents\n // leaking the private key in console.log; still, be careful! :)\n readonly _signingKey: () => SigningKey;\n readonly _mnemonic: () => Mnemonic;\n\n constructor(privateKey: BytesLike | ExternallyOwnedAccount | SigningKey, provider?: Provider) {\n logger.checkNew(new.target, Wallet);\n\n super();\n\n if (isAccount(privateKey)) {\n const signingKey = new SigningKey(privateKey.privateKey);\n defineReadOnly(this, \"_signingKey\", () => signingKey);\n defineReadOnly(this, \"address\", computeAddress(this.publicKey));\n\n if (this.address !== getAddress(privateKey.address)) {\n logger.throwArgumentError(\"privateKey/address mismatch\", \"privateKey\", \"[REDACTED]\");\n }\n\n if (hasMnemonic(privateKey)) {\n const srcMnemonic = privateKey.mnemonic;\n defineReadOnly(this, \"_mnemonic\", () => (\n {\n phrase: srcMnemonic.phrase,\n path: srcMnemonic.path || defaultPath,\n locale: srcMnemonic.locale || \"en\"\n }\n ));\n const mnemonic = this.mnemonic;\n const node = HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path);\n if (computeAddress(node.privateKey) !== this.address) {\n logger.throwArgumentError(\"mnemonic/address mismatch\", \"privateKey\", \"[REDACTED]\");\n }\n } else {\n defineReadOnly(this, \"_mnemonic\", (): Mnemonic => null);\n }\n\n\n } else {\n if (SigningKey.isSigningKey(privateKey)) {\n /* istanbul ignore if */\n if (privateKey.curve !== \"secp256k1\") {\n logger.throwArgumentError(\"unsupported curve; must be secp256k1\", \"privateKey\", \"[REDACTED]\");\n }\n defineReadOnly(this, \"_signingKey\", () => (<SigningKey>privateKey));\n\n } else {\n // A lot of common tools do not prefix private keys with a 0x (see: #1166)\n if (typeof(privateKey) === \"string\") {\n if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) {\n privateKey = \"0x\" + privateKey;\n }\n }\n\n const signingKey = new SigningKey(privateKey);\n defineReadOnly(this, \"_signingKey\", () => signingKey);\n }\n\n defineReadOnly(this, \"_mnemonic\", (): Mnemonic => null);\n defineReadOnly(this, \"address\", computeAddress(this.publicKey));\n }\n\n /* istanbul ignore if */\n if (provider && !Provider.isProvider(provider)) {\n logger.throwArgumentError(\"invalid provider\", \"provider\", provider);\n }\n\n defineReadOnly(this, \"provider\", provider || null);\n }\n\n get mnemonic(): Mnemonic { return this._mnemonic(); }\n get privateKey(): string { return this._signingKey().privateKey; }\n get publicKey(): string { return this._signingKey().publicKey; }\n\n getAddress(): Promise<string> {\n return Promise.resolve(this.address);\n }\n\n connect(provider: Provider): Wallet {\n return new Wallet(this, provider);\n }\n\n signTransaction(transaction: TransactionRequest): Promise<string> {\n return resolveProperties(transaction).then((tx) => {\n if (tx.from != null) {\n if (getAddress(tx.from) !== this.address) {\n logger.throwArgumentError(\"transaction from address mismatch\", \"transaction.from\", transaction.from);\n }\n delete tx.from;\n }\n\n const signature = this._signingKey().signDigest(keccak256(serialize(<UnsignedTransaction>tx)));\n return serialize(<UnsignedTransaction>tx, signature);\n });\n }\n\n async signMessage(message: Bytes | string): Promise<string> {\n return joinSignature(this._signingKey().signDigest(hashMessage(message)));\n }\n\n async _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string> {\n // Populate any ENS names\n const populated = await _TypedDataEncoder.resolveNames(domain, types, value, (name: string) => {\n if (this.provider == null) {\n logger.throwError(\"cannot resolve ENS names without a provider\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"resolveName\",\n value: name\n });\n }\n return this.provider.resolveName(name);\n });\n\n return joinSignature(this._signingKey().signDigest(_TypedDataEncoder.hash(populated.domain, types, populated.value)));\n }\n\n encrypt(password: Bytes | string, options?: any, progressCallback?: ProgressCallback): Promise<string> {\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 return encryptKeystore(this, password, options, progressCallback);\n }\n\n\n /**\n * Static methods to create Wallet instances.\n */\n static createRandom(options?: any): Wallet {\n let entropy: Uint8Array = randomBytes(16);\n\n if (!options) { options = { }; }\n\n if (options.extraEntropy) {\n entropy = arrayify(hexDataSlice(keccak256(concat([ entropy, options.extraEntropy ])), 0, 16));\n }\n\n const mnemonic = entropyToMnemonic(entropy, options.locale);\n return Wallet.fromMnemonic(mnemonic, options.path, options.locale);\n }\n\n static fromEncryptedJson(json: string, password: Bytes | string, progressCallback?: ProgressCallback): Promise<Wallet> {\n return decryptJsonWallet(json, password, progressCallback).then((account) => {\n return new Wallet(account);\n });\n }\n\n static fromEncryptedJsonSync(json: string, password: Bytes | string): Wallet {\n return new Wallet(decryptJsonWalletSync(json, password));\n }\n\n static fromMnemonic(mnemonic: string, path?: string, wordlist?: Wordlist): Wallet {\n if (!path) { path = defaultPath; }\n return new Wallet(HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(path));\n }\n}\n\nexport function verifyMessage(message: Bytes | string, signature: SignatureLike): string {\n return recoverAddress(hashMessage(message), signature);\n}\n\nexport function verifyTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, signature: SignatureLike): string {\n return recoverAddress(_TypedDataEncoder.hash(domain, types, value), signature);\n}\n","export const version = \"networks/5.6.2\";\n","\"use strict\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { Network, Networkish } from \"./types\";\n\nexport {\n Network,\n Networkish\n};\n\ntype DefaultProviderFunc = (providers: any, options?: any) => any;\n\ninterface Renetworkable extends DefaultProviderFunc {\n renetwork: (network: Network) => DefaultProviderFunc;\n};\n\nfunction isRenetworkable(value: any): value is Renetworkable {\n return (value && typeof(value.renetwork) === \"function\");\n}\n\nfunction ethDefaultProvider(network: string | Network): Renetworkable {\n const func = function(providers: any, options?: any): any {\n if (options == null) { options = { }; }\n const providerList: Array<any> = [];\n\n if (providers.InfuraProvider && options.infura !== \"-\") {\n try {\n providerList.push(new providers.InfuraProvider(network, options.infura));\n } catch(error) { }\n }\n\n if (providers.EtherscanProvider && options.etherscan !== \"-\") {\n try {\n providerList.push(new providers.EtherscanProvider(network, options.etherscan));\n } catch(error) { }\n }\n\n if (providers.AlchemyProvider && options.alchemy !== \"-\") {\n try {\n providerList.push(new providers.AlchemyProvider(network, options.alchemy));\n } catch(error) { }\n }\n\n if (providers.PocketProvider && options.pocket !== \"-\") {\n // These networks are currently faulty on Pocket as their\n // network does not handle the Berlin hardfork, which is\n // live on these ones.\n // @TODO: This goes away once Pocket has upgraded their nodes\n const skip = [ \"goerli\", \"ropsten\", \"rinkeby\" ];\n try {\n const provider = new providers.PocketProvider(network, options.pocket);\n if (provider.network && skip.indexOf(provider.network.name) === -1) {\n providerList.push(provider);\n }\n } catch(error) { }\n }\n\n if (providers.CloudflareProvider && options.cloudflare !== \"-\") {\n try {\n providerList.push(new providers.CloudflareProvider(network));\n } catch(error) { }\n }\n\n if (providers.AnkrProvider && options.ankr !== \"-\") {\n try {\n providerList.push(new providers.AnkrProvider(network, options.ankr));\n } catch(error) { }\n }\n\n if (providerList.length === 0) { return null; }\n\n if (providers.FallbackProvider) {\n let quorum = 1;\n if (options.quorum != null) {\n quorum = options.quorum;\n } else if (network === \"homestead\") {\n quorum = 2;\n }\n return new providers.FallbackProvider(providerList, quorum);\n }\n\n return providerList[0];\n };\n\n func.renetwork = function(network: Network) {\n return ethDefaultProvider(network);\n };\n\n return func;\n}\n\nfunction etcDefaultProvider(url: string, network: string | Network): Renetworkable {\n const func = function(providers: any, options?: any): any {\n if (providers.JsonRpcProvider) {\n return new providers.JsonRpcProvider(url, network);\n }\n\n return null;\n };\n\n func.renetwork = function(network: Network) {\n return etcDefaultProvider(url, network);\n };\n\n return func;\n}\n\nconst homestead: Network = {\n chainId: 1,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"homestead\",\n _defaultProvider: ethDefaultProvider(\"homestead\")\n};\n\nconst ropsten: Network = {\n chainId: 3,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"ropsten\",\n _defaultProvider: ethDefaultProvider(\"ropsten\")\n};\n\nconst classicMordor: Network = {\n chainId: 63,\n name: \"classicMordor\",\n _defaultProvider: etcDefaultProvider(\"https://www.ethercluster.com/mordor\", \"classicMordor\")\n};\n\n// See: https://chainlist.org\nconst networks: { [name: string]: Network } = {\n unspecified: { chainId: 0, name: \"unspecified\" },\n\n homestead: homestead,\n mainnet: homestead,\n\n morden: { chainId: 2, name: \"morden\" },\n\n ropsten: ropsten,\n testnet: ropsten,\n\n rinkeby: {\n chainId: 4,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"rinkeby\",\n _defaultProvider: ethDefaultProvider(\"rinkeby\")\n },\n\n kovan: {\n chainId: 42,\n name: \"kovan\",\n _defaultProvider: ethDefaultProvider(\"kovan\")\n },\n\n goerli: {\n chainId: 5,\n ensAddress: \"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\n name: \"goerli\",\n _defaultProvider: ethDefaultProvider(\"goerli\")\n },\n\n kintsugi: { chainId: 1337702, name: \"kintsugi\" },\n\n\n // ETC (See: #351)\n classic: {\n chainId: 61,\n name: \"classic\",\n _defaultProvider: etcDefaultProvider(\"https:/\\/www.ethercluster.com/etc\", \"classic\")\n },\n\n classicMorden: { chainId: 62, name: \"classicMorden\" },\n\n classicMordor: classicMordor,\n classicTestnet: classicMordor,\n\n classicKotti: {\n chainId: 6,\n name: \"classicKotti\",\n _defaultProvider: etcDefaultProvider(\"https:/\\/www.ethercluster.com/kotti\", \"classicKotti\")\n },\n\n xdai: { chainId: 100, name: \"xdai\" },\n\n matic: { chainId: 137, name: \"matic\" },\n maticmum: { chainId: 80001, name: \"maticmum\" },\n\n optimism: { chainId: 10, name: \"optimism\" },\n \"optimism-kovan\": { chainId: 69, name: \"optimism-kovan\" },\n \"optimism-goerli\": { chainId: 420, name: \"optimism-goerli\" },\n\n arbitrum: { chainId: 42161, name: \"arbitrum\" },\n \"arbitrum-rinkeby\": { chainId: 421611, name: \"arbitrum-rinkeby\" },\n\n bnb: { chainId: 56, name: \"bnb\" },\n bnbt: { chainId: 97, name: \"bnbt\" },\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)\n if (network == null) { return null; }\n\n if (typeof(network) === \"number\") {\n for (const name in networks) {\n const standard = networks[name];\n if (standard.chainId === network) {\n return {\n name: standard.name,\n chainId: standard.chainId,\n ensAddress: (standard.ensAddress || null),\n _defaultProvider: (standard._defaultProvider || null)\n };\n }\n }\n\n return {\n chainId: network,\n name: \"unknown\"\n };\n }\n\n if (typeof(network) === \"string\") {\n const standard = networks[network];\n if (standard == null) { return null; }\n return {\n name: standard.name,\n chainId: standard.chainId,\n ensAddress: standard.ensAddress,\n _defaultProvider: (standard._defaultProvider || null)\n };\n }\n\n const standard = networks[network.name];\n\n // Not a standard network; check that it is a valid network in general\n if (!standard) {\n if (typeof(network.chainId) !== \"number\") {\n logger.throwArgumentError(\"invalid network chainId\", \"network\", 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 !== standard.chainId) {\n logger.throwArgumentError(\"network chainId mismatch\", \"network\", network);\n }\n\n // @TODO: In the next major version add an attach function to a defaultProvider\n // class and move the _defaultProvider internal to this file (extend Network)\n let defaultProvider: DefaultProviderFunc = network._defaultProvider || null;\n if (defaultProvider == null && standard._defaultProvider) {\n if (isRenetworkable(standard._defaultProvider)) {\n defaultProvider = standard._defaultProvider.renetwork(network);\n } else {\n defaultProvider = standard._defaultProvider;\n }\n }\n\n // Standard Network (allow overriding the ENS address)\n return {\n name: network.name,\n chainId: standard.chainId,\n ensAddress: (network.ensAddress || standard.ensAddress || null),\n _defaultProvider: defaultProvider\n };\n}\n","\"use strict\";\n\nimport { arrayify, BytesLike } from \"@ethersproject/bytes\";\n\nexport function decode(textData: string): Uint8Array {\n textData = atob(textData);\n const data = [];\n for (let i = 0; i < textData.length; i++) {\n data.push(textData.charCodeAt(i));\n }\n return arrayify(data);\n}\n\nexport function encode(data: BytesLike): string {\n data = arrayify(data);\n let textData = \"\";\n for (let i = 0; i < data.length; i++) {\n textData += String.fromCharCode(data[i]);\n }\n return btoa(textData);\n}\n\n\n","\"use strict\";\n\nexport { decode, encode } from \"./base64\";\n","export const version = \"web/5.6.0\";\n","\"use strict\";\n\nimport { arrayify } from \"@ethersproject/bytes\";\n\nimport type { GetUrlResponse, Options } from \"./types\";\n\nexport { GetUrlResponse, Options };\n\nexport async function getUrl(href: string, options?: Options): Promise<GetUrlResponse> {\n if (options == null) { options = { }; }\n\n const request: RequestInit = {\n method: (options.method || \"GET\"),\n headers: (options.headers || { }),\n body: (options.body || undefined),\n };\n\n if (options.skipFetchSetup !== true) {\n request.mode = <RequestMode>\"cors\"; // no-cors, cors, *same-origin\n request.cache = <RequestCache>\"no-cache\"; // *default, no-cache, reload, force-cache, only-if-cached\n request.credentials = <RequestCredentials>\"same-origin\"; // include, *same-origin, omit\n request.redirect = <RequestRedirect>\"follow\"; // manual, *follow, error\n request.referrer = \"client\"; // no-referrer, *client\n };\n\n const response = await fetch(href, request);\n const body = await response.arrayBuffer();\n\n const headers: { [ name: string ]: string } = { };\n if (response.headers.forEach) {\n response.headers.forEach((value, key) => {\n headers[key.toLowerCase()] = value;\n });\n } else {\n (<() => Array<string>>((<any>(response.headers)).keys))().forEach((key) => {\n headers[key.toLowerCase()] = response.headers.get(key);\n });\n }\n\n return {\n headers: headers,\n statusCode: response.status,\n statusMessage: response.statusText,\n body: arrayify(new Uint8Array(body)),\n }\n}\n","\"use strict\";\n\nimport { decode as base64Decode, encode as base64Encode } from \"@ethersproject/base64\";\nimport { hexlify, isBytesLike } from \"@ethersproject/bytes\";\nimport { shallowCopy } from \"@ethersproject/properties\";\nimport { toUtf8Bytes, toUtf8String } from \"@ethersproject/strings\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { getUrl, GetUrlResponse, Options } from \"./geturl\";\n\nfunction staller(duration: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\n\nfunction bodyify(value: any, type: string): string {\n if (value == null) { return null; }\n\n if (typeof(value) === \"string\") { return value; }\n\n if (isBytesLike(value)) {\n if (type && (type.split(\"/\")[0] === \"text\" || type.split(\";\")[0].trim() === \"application/json\")) {\n try {\n return toUtf8String(value);\n } catch (error) { };\n }\n return hexlify(value);\n }\n\n return value;\n}\n\n// Exported Types\nexport type ConnectionInfo = {\n url: string,\n headers?: { [key: string]: string | number }\n\n user?: string,\n password?: string,\n\n allowInsecureAuthentication?: boolean,\n allowGzip?: boolean,\n\n throttleLimit?: number,\n throttleSlotInterval?: number;\n throttleCallback?: (attempt: number, url: string) => Promise<boolean>,\n\n skipFetchSetup?: boolean;\n errorPassThrough?: boolean;\n\n timeout?: number,\n};\n\nexport interface OnceBlockable {\n once(eventName: \"block\", handler: () => void): void;\n}\n\nexport interface OncePollable {\n once(eventName: \"poll\", handler: () => void): void;\n}\n\nexport type PollOptions = {\n timeout?: number,\n floor?: number,\n ceiling?: number,\n interval?: number,\n retryLimit?: number,\n onceBlock?: OnceBlockable\n oncePoll?: OncePollable\n};\n\nexport type FetchJsonResponse = {\n statusCode: number;\n headers: { [ header: string ]: string };\n};\n\n\ntype Header = { key: string, value: string };\n\n// This API is still a work in progress; the future changes will likely be:\n// - ConnectionInfo => FetchDataRequest<T = any>\n// - FetchDataRequest.body? = string | Uint8Array | { contentType: string, data: string | Uint8Array }\n// - If string => text/plain, Uint8Array => application/octet-stream (if content-type unspecified)\n// - FetchDataRequest.processFunc = (body: Uint8Array, response: FetchDataResponse) => T\n// For this reason, it should be considered internal until the API is finalized\nexport function _fetchData<T = Uint8Array>(connection: string | ConnectionInfo, body?: Uint8Array, processFunc?: (value: Uint8Array, response: FetchJsonResponse) => T): Promise<T> {\n\n // How many times to retry in the event of a throttle\n const attemptLimit = (typeof(connection) === \"object\" && connection.throttleLimit != null) ? connection.throttleLimit: 12;\n logger.assertArgument((attemptLimit > 0 && (attemptLimit % 1) === 0),\n \"invalid connection throttle limit\", \"connection.throttleLimit\", attemptLimit);\n\n const throttleCallback = ((typeof(connection) === \"object\") ? connection.throttleCallback: null);\n const throttleSlotInterval = ((typeof(connection) === \"object\" && typeof(connection.throttleSlotInterval) === \"number\") ? connection.throttleSlotInterval: 100);\n logger.assertArgument((throttleSlotInterval > 0 && (throttleSlotInterval % 1) === 0),\n \"invalid connection throttle slot interval\", \"connection.throttleSlotInterval\", throttleSlotInterval);\n\n const errorPassThrough = ((typeof(connection) === \"object\") ? !!(connection.errorPassThrough): false);\n\n const headers: { [key: string]: Header } = { };\n\n let url: string = null;\n\n // @TODO: Allow ConnectionInfo to override some of these values\n const options: Options = {\n method: \"GET\",\n };\n\n let allow304 = false;\n\n let timeout = 2 * 60 * 1000;\n\n if (typeof(connection) === \"string\") {\n url = connection;\n\n } else if (typeof(connection) === \"object\") {\n if (connection == null || connection.url == null) {\n logger.throwArgumentError(\"missing URL\", \"connection.url\", connection);\n }\n\n url = connection.url;\n\n if (typeof(connection.timeout) === \"number\" && connection.timeout > 0) {\n timeout = connection.timeout;\n }\n\n if (connection.headers) {\n for (const key in connection.headers) {\n headers[key.toLowerCase()] = { key: key, value: String(connection.headers[key]) };\n if ([\"if-none-match\", \"if-modified-since\"].indexOf(key.toLowerCase()) >= 0) {\n allow304 = true;\n }\n }\n }\n\n options.allowGzip = !!connection.allowGzip;\n\n if (connection.user != null && connection.password != null) {\n if (url.substring(0, 6) !== \"https:\" && connection.allowInsecureAuthentication !== true) {\n logger.throwError(\n \"basic authentication requires a secure https url\",\n Logger.errors.INVALID_ARGUMENT,\n { argument: \"url\", url: url, user: connection.user, password: \"[REDACTED]\" }\n );\n }\n\n const authorization = connection.user + \":\" + connection.password;\n headers[\"authorization\"] = {\n key: \"Authorization\",\n value: \"Basic \" + base64Encode(toUtf8Bytes(authorization))\n };\n }\n\n if (connection.skipFetchSetup != null) {\n options.skipFetchSetup = !!connection.skipFetchSetup;\n }\n }\n const reData = new RegExp(\"^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$\", \"i\");\n const dataMatch = ((url) ? url.match(reData): null);\n if (dataMatch) {\n try {\n const response = {\n statusCode: 200,\n statusMessage: \"OK\",\n headers: { \"content-type\": dataMatch[1] },\n body: base64Decode(dataMatch[2])\n };\n\n let result: T = <T><unknown>response.body;\n if (processFunc) {\n result = processFunc(response.body, response);\n }\n return Promise.resolve(<T><unknown>result);\n\n } catch (error) {\n logger.throwError(\"processing response error\", Logger.errors.SERVER_ERROR, {\n body: bodyify(dataMatch[1], dataMatch[2]),\n error: error,\n requestBody: null,\n requestMethod: \"GET\",\n url: url\n });\n }\n }\n\n if (body) {\n options.method = \"POST\";\n options.body = body;\n if (headers[\"content-type\"] == null) {\n headers[\"content-type\"] = { key: \"Content-Type\", value: \"application/octet-stream\" };\n }\n if (headers[\"content-length\"] == null) {\n headers[\"content-length\"] = { key: \"Content-Length\", value: String(body.length) };\n }\n }\n\n const flatHeaders: { [ key: string ]: string } = { };\n Object.keys(headers).forEach((key) => {\n const header = headers[key];\n flatHeaders[header.key] = header.value;\n });\n options.headers = flatHeaders;\n\n const runningTimeout = (function() {\n let timer: NodeJS.Timer = null;\n const promise: Promise<never> = new Promise(function(resolve, reject) {\n if (timeout) {\n timer = setTimeout(() => {\n if (timer == null) { return; }\n timer = null;\n\n reject(logger.makeError(\"timeout\", Logger.errors.TIMEOUT, {\n requestBody: bodyify(options.body, flatHeaders[\"content-type\"]),\n requestMethod: options.method,\n timeout: timeout,\n url: url\n }));\n }, timeout);\n }\n });\n\n const cancel = function() {\n if (timer == null) { return; }\n clearTimeout(timer);\n timer = null;\n }\n\n return { promise, cancel };\n })();\n\n const runningFetch = (async function() {\n\n for (let attempt = 0; attempt < attemptLimit; attempt++) {\n let response: GetUrlResponse = null;\n\n try {\n response = await getUrl(url, options);\n\n if (attempt < attemptLimit) {\n if (response.statusCode === 301 || response.statusCode === 302) {\n // Redirection; for now we only support absolute locataions\n const location = response.headers.location || \"\";\n if (options.method === \"GET\" && location.match(/^https:/)) {\n url = response.headers.location;\n continue;\n }\n\n } else if (response.statusCode === 429) {\n // Exponential back-off throttling\n let tryAgain = true;\n if (throttleCallback) {\n tryAgain = await throttleCallback(attempt, url);\n }\n\n if (tryAgain) {\n let stall = 0;\n\n const retryAfter = response.headers[\"retry-after\"];\n if (typeof(retryAfter) === \"string\" && retryAfter.match(/^[1-9][0-9]*$/)) {\n stall = parseInt(retryAfter) * 1000;\n } else {\n stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));\n }\n\n //console.log(\"Stalling 429\");\n await staller(stall);\n continue;\n }\n }\n }\n\n } catch (error) {\n response = (<any>error).response;\n if (response == null) {\n runningTimeout.cancel();\n logger.throwError(\"missing response\", Logger.errors.SERVER_ERROR, {\n requestBody: bodyify(options.body, flatHeaders[\"content-type\"]),\n requestMethod: options.method,\n serverError: error,\n url: url\n });\n }\n }\n\n\n let body = response.body;\n\n if (allow304 && response.statusCode === 304) {\n body = null;\n } else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) {\n runningTimeout.cancel();\n logger.throwError(\"bad response\", Logger.errors.SERVER_ERROR, {\n status: response.statusCode,\n headers: response.headers,\n body: bodyify(body, ((response.headers) ? response.headers[\"content-type\"]: null)),\n requestBody: bodyify(options.body, flatHeaders[\"content-type\"]),\n requestMethod: options.method,\n url: url\n });\n }\n\n if (processFunc) {\n try {\n const result = await processFunc(body, response);\n runningTimeout.cancel();\n return result;\n\n } catch (error) {\n // Allow the processFunc to trigger a throttle\n if (error.throttleRetry && attempt < attemptLimit) {\n let tryAgain = true;\n if (throttleCallback) {\n tryAgain = await throttleCallback(attempt, url);\n }\n\n if (tryAgain) {\n const timeout = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));\n //console.log(\"Stalling callback\");\n await staller(timeout);\n continue;\n }\n }\n\n runningTimeout.cancel();\n logger.throwError(\"processing response error\", Logger.errors.SERVER_ERROR, {\n body: bodyify(body, ((response.headers) ? response.headers[\"content-type\"]: null)),\n error: error,\n requestBody: bodyify(options.body, flatHeaders[\"content-type\"]),\n requestMethod: options.method,\n url: url\n });\n }\n }\n\n runningTimeout.cancel();\n\n // If we had a processFunc, it either returned a T or threw above.\n // The \"body\" is now a Uint8Array.\n return <T>(<unknown>body);\n }\n\n return logger.throwError(\"failed response\", Logger.errors.SERVER_ERROR, {\n requestBody: bodyify(options.body, flatHeaders[\"content-type\"]),\n requestMethod: options.method,\n url: url\n });\n })();\n\n return Promise.race([ runningTimeout.promise, runningFetch ]);\n}\n\nexport function fetchJson(connection: string | ConnectionInfo, json?: string, processFunc?: (value: any, response: FetchJsonResponse) => any): Promise<any> {\n let processJsonFunc = (value: Uint8Array, response: FetchJsonResponse) => {\n let result: any = null;\n if (value != null) {\n try {\n result = JSON.parse(toUtf8String(value));\n } catch (error) {\n logger.throwError(\"invalid JSON\", Logger.errors.SERVER_ERROR, {\n body: value,\n error: error\n });\n }\n }\n\n if (processFunc) {\n result = processFunc(result, response);\n }\n\n return result;\n }\n\n // If we have json to send, we must\n // - add content-type of application/json (unless already overridden)\n // - convert the json to bytes\n let body: Uint8Array = null;\n if (json != null) {\n body = toUtf8Bytes(json);\n\n // Create a connection with the content-type set for JSON\n const updated: ConnectionInfo = (typeof(connection) === \"string\") ? ({ url: connection }): shallowCopy(connection);\n if (updated.headers) {\n const hasContentType = (Object.keys(updated.headers).filter((k) => (k.toLowerCase() === \"content-type\")).length) !== 0;\n if (!hasContentType) {\n updated.headers = shallowCopy(updated.headers);\n updated.headers[\"content-type\"] = \"application/json\";\n }\n } else {\n updated.headers = { \"content-type\": \"application/json\" };\n }\n connection = updated;\n }\n\n return _fetchData<any>(connection, body, processJsonFunc);\n}\n\nexport function poll<T>(func: () => Promise<T>, options?: PollOptions): Promise<T> {\n if (!options) { options = {}; }\n options = shallowCopy(options);\n if (options.floor == null) { options.floor = 0; }\n if (options.ceiling == null) { options.ceiling = 10000; }\n if (options.interval == null) { options.interval = 250; }\n\n return new Promise(function(resolve, reject) {\n\n let timer: NodeJS.Timer = null;\n let done: boolean = false;\n\n // Returns true if cancel was successful. Unsuccessful cancel means we're already done.\n const cancel = (): boolean => {\n if (done) { return false; }\n done = true;\n if (timer) { clearTimeout(timer); }\n return true;\n };\n\n if (options.timeout) {\n timer = setTimeout(() => {\n if (cancel()) { reject(new Error(\"timeout\")); }\n }, options.timeout)\n }\n\n const retryLimit = options.retryLimit;\n\n let attempt = 0;\n function check() {\n return func().then(function(result) {\n\n // If we have a result, or are allowed null then we're done\n if (result !== undefined) {\n if (cancel()) { resolve(result); }\n\n } else if (options.oncePoll) {\n options.oncePoll.once(\"poll\", check);\n\n } else if (options.onceBlock) {\n options.onceBlock.once(\"block\", check);\n\n // Otherwise, exponential back-off (up to 10s) our next request\n } else if (!done) {\n attempt++;\n if (attempt > retryLimit) {\n if (cancel()) { reject(new Error(\"retry limit reached\")); }\n return;\n }\n\n let timeout = options.interval * parseInt(String(Math.random() * Math.pow(2, attempt)));\n if (timeout < options.floor) { timeout = options.floor; }\n if (timeout > options.ceiling) { timeout = options.ceiling; }\n\n setTimeout(check, timeout);\n }\n\n return null;\n }, function(error) {\n if (cancel()) { reject(error); }\n });\n }\n check();\n });\n}\n\n","'use strict'\nvar ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'\n\n// pre-compute lookup table\nvar ALPHABET_MAP = {}\nfor (var z = 0; z < ALPHABET.length; z++) {\n var x = ALPHABET.charAt(z)\n\n if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous')\n ALPHABET_MAP[x] = z\n}\n\nfunction polymodStep (pre) {\n var b = pre >> 25\n return ((pre & 0x1FFFFFF) << 5) ^\n (-((b >> 0) & 1) & 0x3b6a57b2) ^\n (-((b >> 1) & 1) & 0x26508e6d) ^\n (-((b >> 2) & 1) & 0x1ea119fa) ^\n (-((b >> 3) & 1) & 0x3d4233dd) ^\n (-((b >> 4) & 1) & 0x2a1462b3)\n}\n\nfunction prefixChk (prefix) {\n var chk = 1\n for (var i = 0; i < prefix.length; ++i) {\n var c = prefix.charCodeAt(i)\n if (c < 33 || c > 126) return 'Invalid prefix (' + prefix + ')'\n\n chk = polymodStep(chk) ^ (c >> 5)\n }\n chk = polymodStep(chk)\n\n for (i = 0; i < prefix.length; ++i) {\n var v = prefix.charCodeAt(i)\n chk = polymodStep(chk) ^ (v & 0x1f)\n }\n return chk\n}\n\nfunction encode (prefix, words, LIMIT) {\n LIMIT = LIMIT || 90\n if ((prefix.length + 7 + words.length) > LIMIT) throw new TypeError('Exceeds length limit')\n\n prefix = prefix.toLowerCase()\n\n // determine chk mod\n var chk = prefixChk(prefix)\n if (typeof chk === 'string') throw new Error(chk)\n\n var result = prefix + '1'\n for (var i = 0; i < words.length; ++i) {\n var x = words[i]\n if ((x >> 5) !== 0) throw new Error('Non 5-bit word')\n\n chk = polymodStep(chk) ^ x\n result += ALPHABET.charAt(x)\n }\n\n for (i = 0; i < 6; ++i) {\n chk = polymodStep(chk)\n }\n chk ^= 1\n\n for (i = 0; i < 6; ++i) {\n var v = (chk >> ((5 - i) * 5)) & 0x1f\n result += ALPHABET.charAt(v)\n }\n\n return result\n}\n\nfunction __decode (str, LIMIT) {\n LIMIT = LIMIT || 90\n if (str.length < 8) return str + ' too short'\n if (str.length > LIMIT) return 'Exceeds length limit'\n\n // don't allow mixed case\n var lowered = str.toLowerCase()\n var uppered = str.toUpperCase()\n if (str !== lowered && str !== uppered) return 'Mixed-case string ' + str\n str = lowered\n\n var split = str.lastIndexOf('1')\n if (split === -1) return 'No separator character for ' + str\n if (split === 0) return 'Missing prefix for ' + str\n\n var prefix = str.slice(0, split)\n var wordChars = str.slice(split + 1)\n if (wordChars.length < 6) return 'Data too short'\n\n var chk = prefixChk(prefix)\n if (typeof chk === 'string') return chk\n\n var words = []\n for (var i = 0; i < wordChars.length; ++i) {\n var c = wordChars.charAt(i)\n var v = ALPHABET_MAP[c]\n if (v === undefined) return 'Unknown character ' + c\n chk = polymodStep(chk) ^ v\n\n // not in the checksum?\n if (i + 6 >= wordChars.length) continue\n words.push(v)\n }\n\n if (chk !== 1) return 'Invalid checksum for ' + str\n return { prefix: prefix, words: words }\n}\n\nfunction decodeUnsafe () {\n var res = __decode.apply(null, arguments)\n if (typeof res === 'object') return res\n}\n\nfunction decode (str) {\n var res = __decode.apply(null, arguments)\n if (typeof res === 'object') return res\n\n throw new Error(res)\n}\n\nfunction convert (data, inBits, outBits, pad) {\n var value = 0\n var bits = 0\n var maxV = (1 << outBits) - 1\n\n var result = []\n for (var i = 0; i < data.length; ++i) {\n value = (value << inBits) | data[i]\n bits += inBits\n\n while (bits >= outBits) {\n bits -= outBits\n result.push((value >> bits) & maxV)\n }\n }\n\n if (pad) {\n if (bits > 0) {\n result.push((value << (outBits - bits)) & maxV)\n }\n } else {\n if (bits >= inBits) return 'Excess padding'\n if ((value << (outBits - bits)) & maxV) return 'Non-zero padding'\n }\n\n return result\n}\n\nfunction toWordsUnsafe (bytes) {\n var res = convert(bytes, 8, 5, true)\n if (Array.isArray(res)) return res\n}\n\nfunction toWords (bytes) {\n var res = convert(bytes, 8, 5, true)\n if (Array.isArray(res)) return res\n\n throw new Error(res)\n}\n\nfunction fromWordsUnsafe (words) {\n var res = convert(words, 5, 8, false)\n if (Array.isArray(res)) return res\n}\n\nfunction fromWords (words) {\n var res = convert(words, 5, 8, false)\n if (Array.isArray(res)) return res\n\n throw new Error(res)\n}\n\nmodule.exports = {\n decodeUnsafe: decodeUnsafe,\n decode: decode,\n encode: encode,\n toWordsUnsafe: toWordsUnsafe,\n toWords: toWords,\n fromWordsUnsafe: fromWordsUnsafe,\n fromWords: fromWords\n}\n","export const version = \"providers/5.6.3\";\n","\"use strict\";\n\nimport { Block, TransactionReceipt, TransactionResponse } from \"@ethersproject/abstract-provider\";\nimport { getAddress, getContractAddress } from \"@ethersproject/address\";\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { hexDataLength, hexDataSlice, hexValue, hexZeroPad, isHexString } from \"@ethersproject/bytes\";\nimport { AddressZero } from \"@ethersproject/constants\";\nimport { shallowCopy } from \"@ethersproject/properties\";\nimport { AccessList, accessListify, parse as parseTransaction } from \"@ethersproject/transactions\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nexport type FormatFunc = (value: any) => any;\n\nexport type FormatFuncs = { [ key: string ]: FormatFunc };\n\nexport type Formats = {\n transaction: FormatFuncs,\n transactionRequest: FormatFuncs,\n receipt: FormatFuncs,\n receiptLog: FormatFuncs,\n block: FormatFuncs,\n blockWithTransactions: FormatFuncs,\n filter: FormatFuncs,\n filterLog: FormatFuncs,\n};\n\nexport class Formatter {\n readonly formats: Formats;\n\n constructor() {\n logger.checkNew(new.target, Formatter);\n this.formats = this.getDefaultFormats();\n }\n\n getDefaultFormats(): Formats {\n const formats: Formats = <Formats>({ });\n\n const address = this.address.bind(this);\n const bigNumber = this.bigNumber.bind(this);\n const blockTag = this.blockTag.bind(this);\n const data = this.data.bind(this);\n const hash = this.hash.bind(this);\n const hex = this.hex.bind(this);\n const number = this.number.bind(this);\n const type = this.type.bind(this);\n\n const strictData = (v: any) => { return this.data(v, true); };\n\n formats.transaction = {\n hash: hash,\n\n type: type,\n accessList: Formatter.allowNull(this.accessList.bind(this), null),\n\n blockHash: Formatter.allowNull(hash, null),\n blockNumber: Formatter.allowNull(number, null),\n transactionIndex: Formatter.allowNull(number, null),\n\n confirmations: Formatter.allowNull(number, null),\n\n from: address,\n\n // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas)\n // must be set\n gasPrice: Formatter.allowNull(bigNumber),\n maxPriorityFeePerGas: Formatter.allowNull(bigNumber),\n maxFeePerGas: Formatter.allowNull(bigNumber),\n\n gasLimit: bigNumber,\n to: Formatter.allowNull(address, null),\n value: bigNumber,\n nonce: number,\n data: data,\n\n r: Formatter.allowNull(this.uint256),\n s: Formatter.allowNull(this.uint256),\n v: Formatter.allowNull(number),\n\n creates: Formatter.allowNull(address, null),\n\n raw: Formatter.allowNull(data),\n };\n\n formats.transactionRequest = {\n from: Formatter.allowNull(address),\n nonce: Formatter.allowNull(number),\n gasLimit: Formatter.allowNull(bigNumber),\n gasPrice: Formatter.allowNull(bigNumber),\n maxPriorityFeePerGas: Formatter.allowNull(bigNumber),\n maxFeePerGas: Formatter.allowNull(bigNumber),\n to: Formatter.allowNull(address),\n value: Formatter.allowNull(bigNumber),\n data: Formatter.allowNull(strictData),\n type: Formatter.allowNull(number),\n accessList: Formatter.allowNull(this.accessList.bind(this), null),\n };\n\n formats.receiptLog = {\n transactionIndex: number,\n blockNumber: number,\n transactionHash: hash,\n address: address,\n topics: Formatter.arrayOf(hash),\n data: data,\n logIndex: number,\n blockHash: hash,\n };\n\n formats.receipt = {\n to: Formatter.allowNull(this.address, null),\n from: Formatter.allowNull(this.address, null),\n contractAddress: Formatter.allowNull(address, null),\n transactionIndex: number,\n // should be allowNull(hash), but broken-EIP-658 support is handled in receipt\n root: Formatter.allowNull(hex),\n gasUsed: bigNumber,\n logsBloom: Formatter.allowNull(data),// @TODO: should this be data?\n blockHash: hash,\n transactionHash: hash,\n logs: Formatter.arrayOf(this.receiptLog.bind(this)),\n blockNumber: number,\n confirmations: Formatter.allowNull(number, null),\n cumulativeGasUsed: bigNumber,\n effectiveGasPrice: Formatter.allowNull(bigNumber),\n status: Formatter.allowNull(number),\n type: type\n };\n\n formats.block = {\n hash: Formatter.allowNull(hash),\n parentHash: hash,\n number: number,\n\n timestamp: number,\n nonce: Formatter.allowNull(hex),\n difficulty: this.difficulty.bind(this),\n\n gasLimit: bigNumber,\n gasUsed: bigNumber,\n\n miner: Formatter.allowNull(address),\n extraData: data,\n\n transactions: Formatter.allowNull(Formatter.arrayOf(hash)),\n\n baseFeePerGas: Formatter.allowNull(bigNumber)\n };\n\n formats.blockWithTransactions = shallowCopy(formats.block);\n formats.blockWithTransactions.transactions = Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this)));\n\n formats.filter = {\n fromBlock: Formatter.allowNull(blockTag, undefined),\n toBlock: Formatter.allowNull(blockTag, undefined),\n blockHash: Formatter.allowNull(hash, undefined),\n address: Formatter.allowNull(address, undefined),\n topics: Formatter.allowNull(this.topics.bind(this), undefined),\n };\n\n formats.filterLog = {\n blockNumber: Formatter.allowNull(number),\n blockHash: Formatter.allowNull(hash),\n transactionIndex: number,\n\n removed: Formatter.allowNull(this.boolean.bind(this)),\n\n address: address,\n data: Formatter.allowFalsish(data, \"0x\"),\n\n topics: Formatter.arrayOf(hash),\n\n transactionHash: hash,\n logIndex: number,\n };\n\n return formats;\n }\n\n accessList(accessList: Array<any>): AccessList {\n return accessListify(accessList || []);\n }\n\n // Requires a BigNumberish that is within the IEEE754 safe integer range; returns a number\n // Strict! Used on input.\n number(number: any): number {\n if (number === \"0x\") { return 0; }\n return BigNumber.from(number).toNumber();\n }\n\n type(number: any): number {\n if (number === \"0x\" || number == null) { return 0; }\n return BigNumber.from(number).toNumber();\n }\n\n // Strict! Used on input.\n bigNumber(value: any): BigNumber {\n return BigNumber.from(value);\n }\n\n // Requires a boolean, \"true\" or \"false\"; returns a boolean\n boolean(value: any): boolean {\n if (typeof(value) === \"boolean\") { return value; }\n if (typeof(value) === \"string\") {\n value = value.toLowerCase();\n if (value === \"true\") { return true; }\n if (value === \"false\") { return false; }\n }\n throw new Error(\"invalid boolean - \" + value);\n }\n\n hex(value: any, strict?: boolean): string {\n if (typeof(value) === \"string\") {\n if (!strict && value.substring(0, 2) !== \"0x\") { value = \"0x\" + value; }\n if (isHexString(value)) {\n return value.toLowerCase();\n }\n }\n return logger.throwArgumentError(\"invalid hash\", \"value\", value);\n }\n\n data(value: any, strict?: boolean): string {\n const result = this.hex(value, strict);\n if ((result.length % 2) !== 0) {\n throw new Error(\"invalid data; odd-length - \" + value);\n }\n return result;\n }\n\n // Requires an address\n // Strict! Used on input.\n address(value: any): string {\n return getAddress(value);\n }\n\n callAddress(value: any): string {\n if (!isHexString(value, 32)) { return null; }\n const address = getAddress(hexDataSlice(value, 12));\n return (address === AddressZero) ? null: address;\n }\n\n contractAddress(value: any): string {\n return getContractAddress(value);\n }\n\n // Strict! Used on input.\n blockTag(blockTag: any): 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\" || isHexString(blockTag)) {\n return hexValue(<number | string>blockTag);\n }\n\n throw new Error(\"invalid blockTag\");\n }\n\n // Requires a hash, optionally requires 0x prefix; returns prefixed lowercase hash.\n hash(value: any, strict?: boolean): string {\n const result = this.hex(value, strict);\n if (hexDataLength(result) !== 32) {\n return logger.throwArgumentError(\"invalid hash\", \"value\", value);\n }\n return result;\n }\n\n // Returns the difficulty as a number, or if too large (i.e. PoA network) null\n difficulty(value: any): number {\n if (value == null) { return null; }\n\n const v = BigNumber.from(value);\n\n try {\n return v.toNumber();\n } catch (error) { }\n\n return null;\n }\n\n uint256(value: any): string {\n if (!isHexString(value)) {\n throw new Error(\"invalid uint256\");\n }\n return hexZeroPad(value, 32);\n }\n\n _block(value: any, format: any): Block {\n if (value.author != null && value.miner == null) {\n value.miner = value.author;\n }\n // The difficulty may need to come from _difficulty in recursed blocks\n const difficulty = (value._difficulty != null) ? value._difficulty: value.difficulty;\n const result = Formatter.check(format, value);\n result._difficulty = ((difficulty == null) ? null: BigNumber.from(difficulty));\n return result;\n }\n\n block(value: any): Block {\n return this._block(value, this.formats.block);\n }\n\n blockWithTransactions(value: any): Block {\n return this._block(value, this.formats.blockWithTransactions);\n }\n\n // Strict! Used on input.\n transactionRequest(value: any): any {\n return Formatter.check(this.formats.transactionRequest, value);\n }\n\n transactionResponse(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 && BigNumber.from(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 = this.contractAddress(transaction);\n }\n\n if ((transaction.type === 1 || transaction.type === 2)&& transaction.accessList == null) {\n transaction.accessList = [ ];\n }\n\n const result: TransactionResponse = Formatter.check(this.formats.transaction, transaction);\n\n if (transaction.chainId != null) {\n let chainId = transaction.chainId;\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n result.chainId = chainId;\n\n } else {\n let chainId = transaction.networkId;\n\n // geth-etc returns chainId\n if (chainId == null && result.v == null) {\n chainId = transaction.chainId;\n }\n\n if (isHexString(chainId)) {\n chainId = BigNumber.from(chainId).toNumber();\n }\n\n if (typeof(chainId) !== \"number\" && result.v != null) {\n chainId = (result.v - 35) / 2;\n if (chainId < 0) { chainId = 0; }\n chainId = parseInt(chainId);\n }\n\n if (typeof(chainId) !== \"number\") { chainId = 0; }\n\n result.chainId = chainId;\n }\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\n transaction(value: any): any {\n return parseTransaction(value);\n }\n\n receiptLog(value: any): any {\n return Formatter.check(this.formats.receiptLog, value);\n }\n\n receipt(value: any): TransactionReceipt {\n const result: TransactionReceipt = Formatter.check(this.formats.receipt, value);\n\n // RSK incorrectly implemented EIP-658, so we munge things a bit here for it\n if (result.root != null) {\n if (result.root.length <= 4) {\n // Could be 0x00, 0x0, 0x01 or 0x1\n const value = BigNumber.from(result.root).toNumber();\n if (value === 0 || value === 1) {\n // Make sure if both are specified, they match\n if (result.status != null && (result.status !== value)) {\n logger.throwArgumentError(\"alt-root-status/status mismatch\", \"value\", { root: result.root, status: result.status });\n }\n result.status = value;\n delete result.root;\n } else {\n logger.throwArgumentError(\"invalid alt-root-status\", \"value.root\", result.root);\n }\n } else if (result.root.length !== 66) {\n // Must be a valid bytes32\n logger.throwArgumentError(\"invalid root hash\", \"value.root\", result.root);\n }\n }\n\n if (result.status != null) {\n result.byzantium = true;\n }\n\n return result;\n }\n\n topics(value: any): any {\n if (Array.isArray(value)) {\n return value.map((v) => this.topics(v));\n\n } else if (value != null) {\n return this.hash(value, true);\n }\n\n return null;\n }\n\n filter(value: any): any {\n return Formatter.check(this.formats.filter, value);\n }\n\n filterLog(value: any): any {\n return Formatter.check(this.formats.filterLog, value);\n }\n\n static check(format: { [ name: string ]: FormatFunc }, object: any): any {\n const result: any = {};\n for (const key in format) {\n try {\n const 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\n // if value is null-ish, nullValue is returned\n static allowNull(format: FormatFunc, nullValue?: any): FormatFunc {\n return (function(value: any) {\n if (value == null) { return nullValue; }\n return format(value);\n });\n }\n\n // If value is false-ish, replaceValue is returned\n static allowFalsish(format: FormatFunc, replaceValue: any): FormatFunc {\n return (function(value: any) {\n if (!value) { return replaceValue; }\n return format(value);\n });\n }\n\n // Requires an Array satisfying check\n static arrayOf(format: FormatFunc): FormatFunc {\n return (function(array: any): Array<any> {\n if (!Array.isArray(array)) { throw new Error(\"not an array\"); }\n\n const result: any = [];\n\n array.forEach(function(value) {\n result.push(format(value));\n });\n\n return result;\n });\n }\n}\n\nexport interface CommunityResourcable {\n isCommunityResource(): boolean;\n}\n\nexport function isCommunityResourcable(value: any): value is CommunityResourcable {\n return (value && typeof(value.isCommunityResource) === \"function\");\n}\n\nexport function isCommunityResource(value: any): boolean {\n return (isCommunityResourcable(value) && value.isCommunityResource());\n}\n\n// Show the throttle message only once\nlet throttleMessage = false;\nexport function showThrottleMessage() {\n if (throttleMessage) { return; }\n throttleMessage = true;\n\n console.log(\"========= NOTICE =========\")\n console.log(\"Request-Rate Exceeded (this message will not be repeated)\");\n console.log(\"\");\n console.log(\"The default API keys for each service are provided as a highly-throttled,\");\n console.log(\"community resource for low-traffic projects and early prototyping.\");\n console.log(\"\");\n console.log(\"While your application will continue to function, we highly recommended\");\n console.log(\"signing up for your own API keys to improve performance, increase your\");\n console.log(\"request rate/limit and enable other perks, such as metrics and advanced APIs.\");\n console.log(\"\");\n console.log(\"For more details: https:/\\/docs.ethers.io/api-keys/\");\n console.log(\"==========================\");\n}\n\n","\"use strict\";\n\nimport {\n Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, ForkEvent,\n Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse\n} from \"@ethersproject/abstract-provider\";\nimport { Base58 } from \"@ethersproject/basex\";\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { arrayify, BytesLike, concat, hexConcat, hexDataLength, hexDataSlice, hexlify, hexValue, hexZeroPad, isHexString } from \"@ethersproject/bytes\";\nimport { HashZero } from \"@ethersproject/constants\";\nimport { dnsEncode, namehash } from \"@ethersproject/hash\";\nimport { getNetwork, Network, Networkish } from \"@ethersproject/networks\";\nimport { Deferrable, defineReadOnly, getStatic, resolveProperties } from \"@ethersproject/properties\";\nimport { Transaction } from \"@ethersproject/transactions\";\nimport { sha256 } from \"@ethersproject/sha2\";\nimport { toUtf8Bytes, toUtf8String } from \"@ethersproject/strings\";\nimport { fetchJson, poll } from \"@ethersproject/web\";\n\nimport bech32 from \"bech32\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { Formatter } from \"./formatter\";\n\nconst MAX_CCIP_REDIRECTS = 10;\n\n//////////////////////////////\n// Event Serializeing\n\nfunction checkTopic(topic: string): string {\n if (topic == null) { return \"null\"; }\n if (hexDataLength(topic) !== 32) {\n logger.throwArgumentError(\"invalid topic\", \"topic\", topic);\n }\n return topic.toLowerCase();\n}\n\nfunction serializeTopics(topics: Array<string | Array<string>>): string {\n // Remove trailing null AND-topics; they are redundant\n topics = topics.slice();\n while (topics.length > 0 && topics[topics.length - 1] == null) { topics.pop(); }\n\n return topics.map((topic) => {\n if (Array.isArray(topic)) {\n\n // Only track unique OR-topics\n const unique: { [ topic: string ]: boolean } = { }\n topic.forEach((topic) => {\n unique[checkTopic(topic)] = true;\n });\n\n // The order of OR-topics does not matter\n const sorted = Object.keys(unique);\n sorted.sort();\n\n return sorted.join(\"|\");\n\n } else {\n return checkTopic(topic);\n }\n }).join(\"&\");\n}\n\nfunction deserializeTopics(data: string): Array<string | Array<string>> {\n if (data === \"\") { return [ ]; }\n\n return data.split(/&/g).map((topic) => {\n if (topic === \"\") { return [ ]; }\n\n const comps = topic.split(\"|\").map((topic) => {\n return ((topic === \"null\") ? null: topic);\n });\n\n return ((comps.length === 1) ? comps[0]: comps);\n });\n}\n\nfunction getEventTag(eventName: EventType): string {\n if (typeof(eventName) === \"string\") {\n eventName = eventName.toLowerCase();\n\n if (hexDataLength(eventName) === 32) {\n return \"tx:\" + eventName;\n }\n\n if (eventName.indexOf(\":\") === -1) {\n return eventName;\n }\n\n } else if (Array.isArray(eventName)) {\n return \"filter:*:\" + serializeTopics(eventName);\n\n } else if (ForkEvent.isForkEvent(eventName)) {\n logger.warn(\"not implemented\");\n throw new Error(\"not implemented\");\n\n } else if (eventName && typeof(eventName) === \"object\") {\n return \"filter:\" + (eventName.address || \"*\") + \":\" + serializeTopics(eventName.topics || []);\n }\n\n throw new Error(\"invalid event - \" + eventName);\n}\n\n//////////////////////////////\n// Helper Object\n\nfunction getTime() {\n return (new Date()).getTime();\n}\n\nfunction stall(duration: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\n\n//////////////////////////////\n// Provider Object\n\n\n/**\n * EventType\n * - \"block\"\n * - \"poll\"\n * - \"didPoll\"\n * - \"pending\"\n * - \"error\"\n * - \"network\"\n * - filter\n * - topics array\n * - transaction hash\n */\n\nconst PollableEvents = [ \"block\", \"network\", \"pending\", \"poll\" ];\n\nexport class Event {\n readonly listener: Listener;\n readonly once: boolean;\n readonly tag: string;\n\n _lastBlockNumber: number\n _inflight: boolean;\n\n constructor(tag: string, listener: Listener, once: boolean) {\n defineReadOnly(this, \"tag\", tag);\n defineReadOnly(this, \"listener\", listener);\n defineReadOnly(this, \"once\", once);\n\n this._lastBlockNumber = -2;\n this._inflight = false;\n }\n\n get event(): EventType {\n switch (this.type) {\n case \"tx\":\n return this.hash;\n case \"filter\":\n return this.filter;\n }\n return this.tag;\n }\n\n get type(): string {\n return this.tag.split(\":\")[0]\n }\n\n get hash(): string {\n const comps = this.tag.split(\":\");\n if (comps[0] !== \"tx\") { return null; }\n return comps[1];\n }\n\n get filter(): Filter {\n const comps = this.tag.split(\":\");\n if (comps[0] !== \"filter\") { return null; }\n const address = comps[1];\n\n const topics = deserializeTopics(comps[2]);\n const filter: Filter = { };\n\n if (topics.length > 0) { filter.topics = topics; }\n if (address && address !== \"*\") { filter.address = address; }\n\n return filter;\n }\n\n pollable(): boolean {\n return (this.tag.indexOf(\":\") >= 0 || PollableEvents.indexOf(this.tag) >= 0);\n }\n}\n\nexport interface EnsResolver {\n\n // Name this Resolver is associated with\n readonly name: string;\n\n // The address of the resolver\n readonly address: string;\n\n // Multichain address resolution (also normal address resolution)\n // See: https://eips.ethereum.org/EIPS/eip-2304\n getAddress(coinType?: 60): Promise<null | string>\n\n // Contenthash field\n // See: https://eips.ethereum.org/EIPS/eip-1577\n getContentHash(): Promise<null | string>;\n\n // Storage of text records\n // See: https://eips.ethereum.org/EIPS/eip-634\n getText(key: string): Promise<null | string>;\n};\n\nexport interface EnsProvider {\n resolveName(name: string): Promise<null | string>;\n lookupAddress(address: string): Promise<null | string>;\n getResolver(name: string): Promise<null | EnsResolver>;\n}\n\ntype CoinInfo = {\n symbol: string,\n ilk?: string, // General family\n prefix?: string, // Bech32 prefix\n p2pkh?: number, // Pay-to-Public-Key-Hash Version\n p2sh?: number, // Pay-to-Script-Hash Version\n};\n\n// https://github.com/satoshilabs/slips/blob/master/slip-0044.md\nconst coinInfos: { [ coinType: string ]: CoinInfo } = {\n \"0\": { symbol: \"btc\", p2pkh: 0x00, p2sh: 0x05, prefix: \"bc\" },\n \"2\": { symbol: \"ltc\", p2pkh: 0x30, p2sh: 0x32, prefix: \"ltc\" },\n \"3\": { symbol: \"doge\", p2pkh: 0x1e, p2sh: 0x16 },\n \"60\": { symbol: \"eth\", ilk: \"eth\" },\n \"61\": { symbol: \"etc\", ilk: \"eth\" },\n \"700\": { symbol: \"xdai\", ilk: \"eth\" },\n};\n\nfunction bytes32ify(value: number): string {\n return hexZeroPad(BigNumber.from(value).toHexString(), 32);\n}\n\n// Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d)\nfunction base58Encode(data: Uint8Array): string {\n return Base58.encode(concat([ data, hexDataSlice(sha256(sha256(data)), 0, 4) ]));\n}\n\nexport interface Avatar {\n url: string;\n linkage: Array<{ type: string, content: string }>;\n}\n\nconst matcherIpfs = new RegExp(\"^(ipfs):/\\/(.*)$\", \"i\");\nconst matchers = [\n new RegExp(\"^(https):/\\/(.*)$\", \"i\"),\n new RegExp(\"^(data):(.*)$\", \"i\"),\n matcherIpfs,\n new RegExp(\"^eip155:[0-9]+/(erc[0-9]+):(.*)$\", \"i\"),\n];\n\nfunction _parseString(result: string, start: number): null | string {\n try {\n return toUtf8String(_parseBytes(result, start));\n } catch(error) { }\n return null;\n}\n\nfunction _parseBytes(result: string, start: number): null | string {\n if (result === \"0x\") { return null; }\n\n const offset = BigNumber.from(hexDataSlice(result, start, start + 32)).toNumber();\n const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber();\n\n return hexDataSlice(result, offset + 32, offset + 32 + length);\n}\n\n// Trim off the ipfs:// prefix and return the default gateway URL\nfunction getIpfsLink(link: string): string {\n if (link.match(/^ipfs:\\/\\/ipfs\\//i)) {\n link = link.substring(12);\n } else if (link.match(/^ipfs:\\/\\//i)) {\n link = link.substring(7);\n } else {\n logger.throwArgumentError(\"unsupported IPFS format\", \"link\", link);\n }\n\n return `https:/\\/gateway.ipfs.io/ipfs/${ link }`;\n}\n\nfunction numPad(value: number): Uint8Array {\n const result = arrayify(value);\n if (result.length > 32) { throw new Error(\"internal; should not happen\"); }\n\n const padded = new Uint8Array(32);\n padded.set(result, 32 - result.length);\n return padded;\n}\n\nfunction bytesPad(value: Uint8Array): Uint8Array {\n if ((value.length % 32) === 0) { return value; }\n\n const result = new Uint8Array(Math.ceil(value.length / 32) * 32);\n result.set(value);\n return result;\n}\n\n// ABI Encodes a series of (bytes, bytes, ...)\nfunction encodeBytes(datas: Array<BytesLike>) {\n const result: Array<Uint8Array> = [ ];\n\n let byteCount = 0;\n\n // Add place-holders for pointers as we add items\n for (let i = 0; i < datas.length; i++) {\n result.push(null);\n byteCount += 32;\n }\n\n for (let i = 0; i < datas.length; i++) {\n const data = arrayify(datas[i]);\n\n // Update the bytes offset\n result[i] = numPad(byteCount);\n\n // The length and padded value of data\n result.push(numPad(data.length));\n result.push(bytesPad(data));\n byteCount += 32 + Math.ceil(data.length / 32) * 32;\n }\n\n return hexConcat(result);\n}\n\nexport class Resolver implements EnsResolver {\n readonly provider: BaseProvider;\n\n readonly name: string;\n readonly address: string;\n\n readonly _resolvedAddress: null | string;\n\n // For EIP-2544 names, the ancestor that provided the resolver\n _supportsEip2544: null | Promise<boolean>;\n\n // The resolvedAddress is only for creating a ReverseLookup resolver\n constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string) {\n defineReadOnly(this, \"provider\", provider);\n defineReadOnly(this, \"name\", name);\n defineReadOnly(this, \"address\", provider.formatter.address(address));\n defineReadOnly(this, \"_resolvedAddress\", resolvedAddress);\n }\n\n supportsWildcard(): Promise<boolean> {\n if (!this._supportsEip2544) {\n // supportsInterface(bytes4 = selector(\"resolve(bytes,bytes)\"))\n this._supportsEip2544 = this.provider.call({\n to: this.address,\n data: \"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000\"\n }).then((result) => {\n return BigNumber.from(result).eq(1);\n }).catch((error) => {\n if (error.code === Logger.errors.CALL_EXCEPTION) { return false; }\n // Rethrow the error: link is down, etc. Let future attempts retry.\n this._supportsEip2544 = null;\n throw error;\n });\n }\n\n return this._supportsEip2544;\n }\n\n async _fetch(selector: string, parameters?: string): Promise<null | string> {\n\n // e.g. keccak256(\"addr(bytes32,uint256)\")\n const tx = {\n to: this.address,\n ccipReadEnabled: true,\n data: hexConcat([ selector, namehash(this.name), (parameters || \"0x\") ])\n };\n\n // Wildcard support; use EIP-2544 to resolve the request\n let parseBytes = false;\n if (await this.supportsWildcard()) {\n parseBytes = true;\n\n // selector(\"resolve(bytes,bytes)\")\n tx.data = hexConcat([ \"0x9061b923\", encodeBytes([ dnsEncode(this.name), tx.data ]) ]);\n }\n\n try {\n let result = await this.provider.call(tx);\n if ((arrayify(result).length % 32) === 4) {\n logger.throwError(\"resolver threw error\", Logger.errors.CALL_EXCEPTION, {\n transaction: tx, data: result\n });\n }\n if (parseBytes) { result = _parseBytes(result, 0); }\n return result;\n } catch (error) {\n if (error.code === Logger.errors.CALL_EXCEPTION) { return null; }\n throw error;\n }\n }\n\n async _fetchBytes(selector: string, parameters?: string): Promise<null | string> {\n const result = await this._fetch(selector, parameters);\n if (result != null) { return _parseBytes(result, 0); }\n return null;\n }\n\n _getAddress(coinType: number, hexBytes: string): string {\n const coinInfo = coinInfos[String(coinType)];\n\n if (coinInfo == null) {\n logger.throwError(`unsupported coin type: ${ coinType }`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: `getAddress(${ coinType })`\n });\n }\n\n if (coinInfo.ilk === \"eth\") {\n return this.provider.formatter.address(hexBytes);\n }\n\n const bytes = arrayify(hexBytes);\n\n // P2PKH: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG\n if (coinInfo.p2pkh != null) {\n const p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);\n if (p2pkh) {\n const length = parseInt(p2pkh[1], 16);\n if (p2pkh[2].length === length * 2 && length >= 1 && length <= 75) {\n return base58Encode(concat([ [ coinInfo.p2pkh ], (\"0x\" + p2pkh[2]) ]));\n }\n }\n }\n\n // P2SH: OP_HASH160 <scriptHash> OP_EQUAL\n if (coinInfo.p2sh != null) {\n const p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);\n if (p2sh) {\n const length = parseInt(p2sh[1], 16);\n if (p2sh[2].length === length * 2 && length >= 1 && length <= 75) {\n return base58Encode(concat([ [ coinInfo.p2sh ], (\"0x\" + p2sh[2]) ]));\n }\n }\n }\n\n // Bech32\n if (coinInfo.prefix != null) {\n const length = bytes[1];\n\n // https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program\n let version = bytes[0];\n if (version === 0x00) {\n if (length !== 20 && length !== 32) {\n version = -1;\n }\n } else {\n version = -1;\n }\n\n if (version >= 0 && bytes.length === 2 + length && length >= 1 && length <= 75) {\n const words = bech32.toWords(bytes.slice(2));\n words.unshift(version);\n return bech32.encode(coinInfo.prefix, words);\n }\n }\n\n return null;\n }\n\n\n async getAddress(coinType?: number): Promise<string> {\n if (coinType == null) { coinType = 60; }\n\n // If Ethereum, use the standard `addr(bytes32)`\n if (coinType === 60) {\n try {\n // keccak256(\"addr(bytes32)\")\n const result = await this._fetch(\"0x3b3b57de\");\n\n // No address\n if (result === \"0x\" || result === HashZero) { return null; }\n\n return this.provider.formatter.callAddress(result);\n } catch (error) {\n if (error.code === Logger.errors.CALL_EXCEPTION) { return null; }\n throw error;\n }\n }\n\n // keccak256(\"addr(bytes32,uint256\")\n const hexBytes = await this._fetchBytes(\"0xf1cb7e06\", bytes32ify(coinType));\n\n // No address\n if (hexBytes == null || hexBytes === \"0x\") { return null; }\n\n // Compute the address\n const address = this._getAddress(coinType, hexBytes);\n\n if (address == null) {\n logger.throwError(`invalid or unsupported coin data`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: `getAddress(${ coinType })`,\n coinType: coinType,\n data: hexBytes\n });\n }\n\n return address;\n }\n\n async getAvatar(): Promise<null | Avatar> {\n const linkage: Array<{ type: string, content: string }> = [ { type: \"name\", content: this.name } ];\n try {\n // test data for ricmoo.eth\n //const avatar = \"eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233\";\n const avatar = await this.getText(\"avatar\");\n if (avatar == null) { return null; }\n\n for (let i = 0; i < matchers.length; i++) {\n const match = avatar.match(matchers[i]);\n if (match == null) { continue; }\n\n const scheme = match[1].toLowerCase();\n\n switch (scheme) {\n case \"https\":\n linkage.push({ type: \"url\", content: avatar });\n return { linkage, url: avatar };\n\n case \"data\":\n linkage.push({ type: \"data\", content: avatar });\n return { linkage, url: avatar };\n\n case \"ipfs\":\n linkage.push({ type: \"ipfs\", content: avatar });\n return { linkage, url: getIpfsLink(avatar) };\n\n case \"erc721\":\n case \"erc1155\": {\n // Depending on the ERC type, use tokenURI(uint256) or url(uint256)\n const selector = (scheme === \"erc721\") ? \"0xc87b56dd\": \"0x0e89341c\";\n linkage.push({ type: scheme, content: avatar });\n\n // The owner of this name\n const owner = (this._resolvedAddress || await this.getAddress());\n\n const comps = (match[2] || \"\").split(\"/\");\n if (comps.length !== 2) { return null; }\n\n const addr = await this.provider.formatter.address(comps[0]);\n const tokenId = hexZeroPad(BigNumber.from(comps[1]).toHexString(), 32);\n\n // Check that this account owns the token\n if (scheme === \"erc721\") {\n // ownerOf(uint256 tokenId)\n const tokenOwner = this.provider.formatter.callAddress(await this.provider.call({\n to: addr, data: hexConcat([ \"0x6352211e\", tokenId ])\n }));\n if (owner !== tokenOwner) { return null; }\n linkage.push({ type: \"owner\", content: tokenOwner });\n\n } else if (scheme === \"erc1155\") {\n // balanceOf(address owner, uint256 tokenId)\n const balance = BigNumber.from(await this.provider.call({\n to: addr, data: hexConcat([ \"0x00fdd58e\", hexZeroPad(owner, 32), tokenId ])\n }));\n if (balance.isZero()) { return null; }\n linkage.push({ type: \"balance\", content: balance.toString() });\n }\n\n // Call the token contract for the metadata URL\n const tx = {\n to: this.provider.formatter.address(comps[0]),\n data: hexConcat([ selector, tokenId ])\n };\n\n let metadataUrl = _parseString(await this.provider.call(tx), 0);\n if (metadataUrl == null) { return null; }\n linkage.push({ type: \"metadata-url-base\", content: metadataUrl });\n\n // ERC-1155 allows a generic {id} in the URL\n if (scheme === \"erc1155\") {\n metadataUrl = metadataUrl.replace(\"{id}\", tokenId.substring(2));\n linkage.push({ type: \"metadata-url-expanded\", content: metadataUrl });\n }\n\n // Transform IPFS metadata links\n if (metadataUrl.match(/^ipfs:/i)) {\n metadataUrl = getIpfsLink(metadataUrl);\n }\n\n linkage.push({ type: \"metadata-url\", content: metadataUrl });\n\n // Get the token metadata\n const metadata = await fetchJson(metadataUrl);\n if (!metadata) { return null; }\n linkage.push({ type: \"metadata\", content: JSON.stringify(metadata) });\n\n // Pull the image URL out\n let imageUrl = metadata.image;\n if (typeof(imageUrl) !== \"string\") { return null; }\n\n if (imageUrl.match(/^(https:\\/\\/|data:)/i)) {\n // Allow\n } else {\n // Transform IPFS link to gateway\n const ipfs = imageUrl.match(matcherIpfs);\n if (ipfs == null) { return null; }\n\n linkage.push({ type: \"url-ipfs\", content: imageUrl });\n imageUrl = getIpfsLink(imageUrl);\n }\n\n linkage.push({ type: \"url\", content: imageUrl });\n\n return { linkage, url: imageUrl };\n }\n }\n }\n } catch (error) { }\n\n return null;\n }\n\n async getContentHash(): Promise<string> {\n\n // keccak256(\"contenthash()\")\n const hexBytes = await this._fetchBytes(\"0xbc1c58d1\");\n\n // No contenthash\n if (hexBytes == null || hexBytes === \"0x\") { return null; }\n\n // IPFS (CID: 1, Type: DAG-PB)\n const ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);\n if (ipfs) {\n const length = parseInt(ipfs[3], 16);\n if (ipfs[4].length === length * 2) {\n return \"ipfs:/\\/\" + Base58.encode(\"0x\" + ipfs[1]);\n }\n }\n\n // IPNS (CID: 1, Type: libp2p-key)\n const ipns = hexBytes.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);\n if (ipns) {\n const length = parseInt(ipns[3], 16);\n if (ipns[4].length === length * 2) {\n return \"ipns:/\\/\" + Base58.encode(\"0x\" + ipns[1]);\n }\n }\n\n // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)\n const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/)\n if (swarm) {\n if (swarm[1].length === (32 * 2)) {\n return \"bzz:/\\/\" + swarm[1]\n }\n }\n\n return logger.throwError(`invalid or unsupported content hash data`, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"getContentHash()\",\n data: hexBytes\n });\n }\n\n async getText(key: string): Promise<string> {\n\n // The key encoded as parameter to fetchBytes\n let keyBytes = toUtf8Bytes(key);\n\n // The nodehash consumes the first slot, so the string pointer targets\n // offset 64, with the length at offset 64 and data starting at offset 96\n keyBytes = concat([ bytes32ify(64), bytes32ify(keyBytes.length), keyBytes ]);\n\n // Pad to word-size (32 bytes)\n if ((keyBytes.length % 32) !== 0) {\n keyBytes = concat([ keyBytes, hexZeroPad(\"0x\", 32 - (key.length % 32)) ])\n }\n\n const hexBytes = await this._fetchBytes(\"0x59d1d43c\", hexlify(keyBytes));\n if (hexBytes == null || hexBytes === \"0x\") { return null; }\n\n return toUtf8String(hexBytes);\n }\n}\n\nlet defaultFormatter: Formatter = null;\n\nlet nextPollId = 1;\n\nexport class BaseProvider extends Provider implements EnsProvider {\n _networkPromise: Promise<Network>;\n _network: Network;\n\n _events: Array<Event>;\n\n formatter: Formatter;\n\n // To help mitigate the eventually consistent nature of the blockchain\n // we keep a mapping of events we emit. If we emit an event X, we expect\n // that a user should be able to query for that event in the callback,\n // if the node returns null, we stall the response until we get back a\n // meaningful value, since we may be hitting a re-org, or a node that\n // has not indexed the event yet.\n // Events:\n // - t:{hash} - Transaction hash\n // - b:{hash} - BlockHash\n // - block - The most recent emitted block\n _emitted: { [ eventName: string ]: number | \"pending\" };\n\n _pollingInterval: number;\n _poller: NodeJS.Timer;\n _bootstrapPoll: NodeJS.Timer;\n\n _lastBlockNumber: number;\n _maxFilterBlockRange: number;\n\n _fastBlockNumber: number;\n _fastBlockNumberPromise: Promise<number>;\n _fastQueryDate: number;\n\n _maxInternalBlockNumber: number;\n _internalBlockNumber: Promise<{ blockNumber: number, reqTime: number, respTime: number }>;\n\n readonly anyNetwork: boolean;\n\n disableCcipRead: boolean;\n\n\n /**\n * ready\n *\n * A Promise<Network> 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\n constructor(network: Networkish | Promise<Network>) {\n logger.checkNew(new.target, Provider);\n\n super();\n\n // Events being listened to\n this._events = [];\n\n this._emitted = { block: -2 };\n\n this.disableCcipRead = false;\n\n this.formatter = new.target.getFormatter();\n\n // If network is any, this Provider allows the underlying\n // network to change dynamically, and we auto-detect the\n // current network\n defineReadOnly(this, \"anyNetwork\", (network === \"any\"));\n if (this.anyNetwork) { network = this.detectNetwork(); }\n\n if (network instanceof Promise) {\n this._networkPromise = network;\n\n // Squash any \"unhandled promise\" errors; that do not need to be handled\n network.catch((error) => { });\n\n // Trigger initial network setting (async)\n this._ready().catch((error) => { });\n\n } else {\n const knownNetwork = getStatic<(network: Networkish) => Network>(new.target, \"getNetwork\")(network);\n if (knownNetwork) {\n defineReadOnly(this, \"_network\", knownNetwork);\n this.emit(\"network\", knownNetwork, null);\n\n } else {\n logger.throwArgumentError(\"invalid network\", \"network\", network);\n }\n }\n\n this._maxInternalBlockNumber = -1024;\n\n this._lastBlockNumber = -2;\n this._maxFilterBlockRange = 10;\n\n this._pollingInterval = 4000;\n\n this._fastQueryDate = 0;\n }\n\n async _ready(): Promise<Network> {\n if (this._network == null) {\n let network: Network = null;\n if (this._networkPromise) {\n try {\n network = await this._networkPromise;\n } catch (error) { }\n }\n\n // Try the Provider's network detection (this MUST throw if it cannot)\n if (network == null) {\n network = await this.detectNetwork();\n }\n\n // This should never happen; every Provider sub-class should have\n // suggested a network by here (or have thrown).\n if (!network) {\n logger.throwError(\"no network detected\", Logger.errors.UNKNOWN_ERROR, { });\n }\n\n // Possible this call stacked so do not call defineReadOnly again\n if (this._network == null) {\n if (this.anyNetwork) {\n this._network = network;\n } else {\n defineReadOnly(this, \"_network\", network);\n }\n this.emit(\"network\", network, null);\n }\n }\n\n return this._network;\n }\n\n // This will always return the most recently established network.\n // For \"any\", this can change (a \"network\" event is emitted before\n // any change is reflected); otherwise this cannot change\n get ready(): Promise<Network> {\n return poll(() => {\n return this._ready().then((network) => {\n return network;\n }, (error) => {\n // If the network isn't running yet, we will wait\n if (error.code === Logger.errors.NETWORK_ERROR && error.event === \"noNetwork\") {\n return undefined;\n }\n throw error;\n });\n });\n }\n\n // @TODO: Remove this and just create a singleton formatter\n static getFormatter(): Formatter {\n if (defaultFormatter == null) {\n defaultFormatter = new Formatter();\n }\n return defaultFormatter;\n }\n\n // @TODO: Remove this and just use getNetwork\n static getNetwork(network: Networkish): Network {\n return getNetwork((network == null) ? \"homestead\": network);\n }\n\n async ccipReadFetch(tx: Transaction, calldata: string, urls: Array<string>): Promise<null | string> {\n if (this.disableCcipRead || urls.length === 0) { return null; }\n\n const sender = tx.to.toLowerCase();\n const data = calldata.toLowerCase();\n\n const errorMessages: Array<string> = [ ];\n\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n\n // URL expansion\n const href = url.replace(\"{sender}\", sender).replace(\"{data}\", data);\n\n // If no {data} is present, use POST; otherwise GET\n const json: string | null = (url.indexOf(\"{data}\") >= 0) ? null: JSON.stringify({ data, sender });\n\n const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => {\n value.status = response.statusCode;\n return value;\n });\n\n if (result.data) { return result.data; }\n\n const errorMessage = (result.message || \"unknown error\");\n\n // 4xx indicates the result is not present; stop\n if (result.status >= 400 && result.status < 500) {\n return logger.throwError(`response not found during CCIP fetch: ${ errorMessage }`, Logger.errors.SERVER_ERROR, { url, errorMessage });\n }\n\n // 5xx indicates server issue; try the next url\n errorMessages.push(errorMessage);\n }\n\n return logger.throwError(`error encountered during CCIP fetch: ${ errorMessages.map((m) => JSON.stringify(m)).join(\", \") }`, Logger.errors.SERVER_ERROR, {\n urls, errorMessages\n });\n }\n\n // Fetches the blockNumber, but will reuse any result that is less\n // than maxAge old or has been requested since the last request\n async _getInternalBlockNumber(maxAge: number): Promise<number> {\n await this._ready();\n\n // Allowing stale data up to maxAge old\n if (maxAge > 0) {\n\n // While there are pending internal block requests...\n while (this._internalBlockNumber) {\n\n // ...\"remember\" which fetch we started with\n const internalBlockNumber = this._internalBlockNumber;\n\n try {\n // Check the result is not too stale\n const result = await internalBlockNumber;\n if ((getTime() - result.respTime) <= maxAge) {\n return result.blockNumber;\n }\n\n // Too old; fetch a new value\n break;\n\n } catch(error) {\n\n // The fetch rejected; if we are the first to get the\n // rejection, drop through so we replace it with a new\n // fetch; all others blocked will then get that fetch\n // which won't match the one they \"remembered\" and loop\n if (this._internalBlockNumber === internalBlockNumber) {\n break;\n }\n }\n }\n }\n\n const reqTime = getTime();\n\n const checkInternalBlockNumber = resolveProperties({\n blockNumber: this.perform(\"getBlockNumber\", { }),\n networkError: this.getNetwork().then((network) => (null), (error) => (error))\n }).then(({ blockNumber, networkError }) => {\n if (networkError) {\n // Unremember this bad internal block number\n if (this._internalBlockNumber === checkInternalBlockNumber) {\n this._internalBlockNumber = null;\n }\n throw networkError;\n }\n\n const respTime = getTime();\n\n blockNumber = BigNumber.from(blockNumber).toNumber();\n if (blockNumber < this._maxInternalBlockNumber) { blockNumber = this._maxInternalBlockNumber; }\n\n this._maxInternalBlockNumber = blockNumber;\n this._setFastBlockNumber(blockNumber); // @TODO: Still need this?\n return { blockNumber, reqTime, respTime };\n });\n\n this._internalBlockNumber = checkInternalBlockNumber;\n\n // Swallow unhandled exceptions; if needed they are handled else where\n checkInternalBlockNumber.catch((error) => {\n // Don't null the dead (rejected) fetch, if it has already been updated\n if (this._internalBlockNumber === checkInternalBlockNumber) {\n this._internalBlockNumber = null;\n }\n });\n\n return (await checkInternalBlockNumber).blockNumber;\n }\n\n async poll(): Promise<void> {\n const pollId = nextPollId++;\n\n // Track all running promises, so we can trigger a post-poll once they are complete\n const runners: Array<Promise<void>> = [];\n\n let blockNumber: number = null;\n try {\n blockNumber = await this._getInternalBlockNumber(100 + this.pollingInterval / 2);\n } catch (error) {\n this.emit(\"error\", error);\n return;\n }\n this._setFastBlockNumber(blockNumber);\n\n // Emit a poll event after we have the latest (fast) block number\n this.emit(\"poll\", pollId, blockNumber);\n\n // If the block has not changed, meh.\n if (blockNumber === this._lastBlockNumber) {\n this.emit(\"didPoll\", pollId);\n return;\n }\n\n // First polling cycle, trigger a \"block\" events\n if (this._emitted.block === -2) {\n this._emitted.block = blockNumber - 1;\n }\n\n if (Math.abs((<number>(this._emitted.block)) - blockNumber) > 1000) {\n logger.warn(`network block skew detected; skipping block events (emitted=${ this._emitted.block } blockNumber${ blockNumber })`);\n this.emit(\"error\", logger.makeError(\"network block skew detected\", Logger.errors.NETWORK_ERROR, {\n blockNumber: blockNumber,\n event: \"blockSkew\",\n previousBlockNumber: this._emitted.block\n }));\n this.emit(\"block\", blockNumber);\n\n } else {\n // Notify all listener for each block that has passed\n for (let i = (<number>this._emitted.block) + 1; i <= blockNumber; i++) {\n this.emit(\"block\", i);\n }\n }\n\n // The emitted block was updated, check for obsolete events\n if ((<number>this._emitted.block) !== blockNumber) {\n this._emitted.block = blockNumber;\n\n Object.keys(this._emitted).forEach((key) => {\n // The block event does not expire\n if (key === \"block\") { return; }\n\n // The block we were at when we emitted this event\n const eventBlockNumber = this._emitted[key];\n\n // We cannot garbage collect pending transactions or blocks here\n // They should be garbage collected by the Provider when setting\n // \"pending\" events\n if (eventBlockNumber === \"pending\") { return; }\n\n // Evict any transaction hashes or block hashes over 12 blocks\n // old, since they should not return null anyways\n if (blockNumber - eventBlockNumber > 12) {\n delete this._emitted[key];\n }\n });\n }\n\n // First polling cycle\n if (this._lastBlockNumber === -2) {\n this._lastBlockNumber = blockNumber - 1;\n }\n // Find all transaction hashes we are waiting on\n this._events.forEach((event) => {\n switch (event.type) {\n case \"tx\": {\n const hash = event.hash;\n let runner = this.getTransactionReceipt(hash).then((receipt) => {\n if (!receipt || receipt.blockNumber == null) { return null; }\n this._emitted[\"t:\" + hash] = receipt.blockNumber;\n this.emit(hash, receipt);\n return null;\n }).catch((error: Error) => { this.emit(\"error\", error); });\n\n runners.push(runner);\n\n break;\n }\n\n case \"filter\": {\n // We only allow a single getLogs to be in-flight at a time\n if (!event._inflight) {\n event._inflight = true;\n\n // Filter from the last known event; due to load-balancing\n // and some nodes returning updated block numbers before\n // indexing events, a logs result with 0 entries cannot be\n // trusted and we must retry a range which includes it again\n const filter = event.filter;\n filter.fromBlock = event._lastBlockNumber + 1;\n filter.toBlock = blockNumber;\n\n // Prevent fitler ranges from growing too wild\n if (filter.toBlock - this._maxFilterBlockRange > filter.fromBlock) {\n filter.fromBlock = filter.toBlock - this._maxFilterBlockRange;\n }\n\n const runner = this.getLogs(filter).then((logs) => {\n // Allow the next getLogs\n event._inflight = false;\n\n if (logs.length === 0) { return; }\n\n logs.forEach((log: Log) => {\n // Only when we get an event for a given block number\n // can we trust the events are indexed\n if (log.blockNumber > event._lastBlockNumber) {\n event._lastBlockNumber = log.blockNumber;\n }\n\n // Make sure we stall requests to fetch blocks and txs\n this._emitted[\"b:\" + log.blockHash] = log.blockNumber;\n this._emitted[\"t:\" + log.transactionHash] = log.blockNumber;\n\n this.emit(filter, log);\n });\n }).catch((error: Error) => {\n this.emit(\"error\", error);\n\n // Allow another getLogs (the range was not updated)\n event._inflight = false;\n });\n runners.push(runner);\n }\n\n break;\n }\n }\n });\n\n this._lastBlockNumber = blockNumber;\n\n // Once all events for this loop have been processed, emit \"didPoll\"\n Promise.all(runners).then(() => {\n this.emit(\"didPoll\", pollId);\n }).catch((error) => { this.emit(\"error\", error); });\n\n return;\n }\n\n // Deprecated; do not use this\n resetEventsBlock(blockNumber: number): void {\n this._lastBlockNumber = blockNumber - 1;\n if (this.polling) { this.poll(); }\n }\n\n get network(): Network {\n return this._network;\n }\n\n // This method should query the network if the underlying network\n // can change, such as when connected to a JSON-RPC backend\n async detectNetwork(): Promise<Network> {\n return logger.throwError(\"provider does not support network detection\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"provider.detectNetwork\"\n });\n }\n\n async getNetwork(): Promise<Network> {\n const network = await this._ready();\n\n // Make sure we are still connected to the same network; this is\n // only an external call for backends which can have the underlying\n // network change spontaneously\n const currentNetwork = await this.detectNetwork();\n if (network.chainId !== currentNetwork.chainId) {\n\n // We are allowing network changes, things can get complex fast;\n // make sure you know what you are doing if you use \"any\"\n if (this.anyNetwork) {\n this._network = currentNetwork;\n\n // Reset all internal block number guards and caches\n this._lastBlockNumber = -2;\n this._fastBlockNumber = null;\n this._fastBlockNumberPromise = null;\n this._fastQueryDate = 0;\n this._emitted.block = -2;\n this._maxInternalBlockNumber = -1024;\n this._internalBlockNumber = null;\n\n // The \"network\" event MUST happen before this method resolves\n // so any events have a chance to unregister, so we stall an\n // additional event loop before returning from /this/ call\n this.emit(\"network\", currentNetwork, network);\n await stall(0);\n\n return this._network;\n }\n\n const error = logger.makeError(\"underlying network changed\", Logger.errors.NETWORK_ERROR, {\n event: \"changed\",\n network: network,\n detectedNetwork: currentNetwork\n });\n\n this.emit(\"error\", error);\n throw error;\n }\n\n return network;\n }\n\n get blockNumber(): number {\n this._getInternalBlockNumber(100 + this.pollingInterval / 2).then((blockNumber) => {\n this._setFastBlockNumber(blockNumber);\n }, (error) => { });\n\n return (this._fastBlockNumber != null) ? this._fastBlockNumber: -1;\n }\n\n get polling(): boolean {\n return (this._poller != null);\n }\n\n set polling(value: boolean) {\n if (value && !this._poller) {\n this._poller = setInterval(() => { this.poll(); }, this.pollingInterval);\n\n if (!this._bootstrapPoll) {\n this._bootstrapPoll = setTimeout(() => {\n this.poll();\n\n // We block additional polls until the polling interval\n // is done, to prevent overwhelming the poll function\n this._bootstrapPoll = setTimeout(() => {\n // If polling was disabled, something may require a poke\n // since starting the bootstrap poll and it was disabled\n if (!this._poller) { this.poll(); }\n\n // Clear out the bootstrap so we can do another\n this._bootstrapPoll = null;\n }, this.pollingInterval);\n }, 0);\n }\n\n } else if (!value && this._poller) {\n clearInterval(this._poller);\n this._poller = null;\n }\n }\n\n get pollingInterval(): number {\n return this._pollingInterval;\n }\n\n set pollingInterval(value: number) {\n if (typeof(value) !== \"number\" || value <= 0 || parseInt(String(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.poll(); }, this._pollingInterval);\n }\n }\n\n _getFastBlockNumber(): Promise<number> {\n const now = getTime();\n\n // Stale block number, request a newer value\n if ((now - this._fastQueryDate) > 2 * this._pollingInterval) {\n this._fastQueryDate = now;\n this._fastBlockNumberPromise = this.getBlockNumber().then((blockNumber) => {\n if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) {\n this._fastBlockNumber = blockNumber;\n }\n return this._fastBlockNumber;\n });\n }\n\n return this._fastBlockNumberPromise;\n }\n\n _setFastBlockNumber(blockNumber: number): void {\n // Older block, maybe a stale request\n if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { return; }\n\n // Update the time we updated the blocknumber\n this._fastQueryDate = getTime();\n\n // Newer block number, use it\n if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) {\n this._fastBlockNumber = blockNumber;\n this._fastBlockNumberPromise = Promise.resolve(blockNumber);\n }\n }\n\n async waitForTransaction(transactionHash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt> {\n return this._waitForTransaction(transactionHash, (confirmations == null) ? 1: confirmations, timeout || 0, null);\n }\n\n async _waitForTransaction(transactionHash: string, confirmations: number, timeout: number, replaceable: { data: string, from: string, nonce: number, to: string, value: BigNumber, startBlock: number }): Promise<TransactionReceipt> {\n const receipt = await this.getTransactionReceipt(transactionHash);\n\n // Receipt is already good\n if ((receipt ? receipt.confirmations: 0) >= confirmations) { return receipt; }\n\n // Poll until the receipt is good...\n return new Promise((resolve, reject) => {\n const cancelFuncs: Array<() => void> = [];\n\n let done = false;\n const alreadyDone = function() {\n if (done) { return true; }\n done = true;\n cancelFuncs.forEach((func) => { func(); });\n return false;\n };\n\n const minedHandler = (receipt: TransactionReceipt) => {\n if (receipt.confirmations < confirmations) { return; }\n if (alreadyDone()) { return; }\n resolve(receipt);\n }\n this.on(transactionHash, minedHandler);\n cancelFuncs.push(() => { this.removeListener(transactionHash, minedHandler); });\n\n if (replaceable) {\n let lastBlockNumber = replaceable.startBlock;\n let scannedBlock: number = null;\n const replaceHandler = async (blockNumber: number) => {\n if (done) { return; }\n\n // Wait 1 second; this is only used in the case of a fault, so\n // we will trade off a little bit of latency for more consistent\n // results and fewer JSON-RPC calls\n await stall(1000);\n\n this.getTransactionCount(replaceable.from).then(async (nonce) => {\n if (done) { return; }\n\n if (nonce <= replaceable.nonce) {\n lastBlockNumber = blockNumber;\n\n } else {\n // First check if the transaction was mined\n {\n const mined = await this.getTransaction(transactionHash);\n if (mined && mined.blockNumber != null) { return; }\n }\n\n // First time scanning. We start a little earlier for some\n // wiggle room here to handle the eventually consistent nature\n // of blockchain (e.g. the getTransactionCount was for a\n // different block)\n if (scannedBlock == null) {\n scannedBlock = lastBlockNumber - 3;\n if (scannedBlock < replaceable.startBlock) {\n scannedBlock = replaceable.startBlock;\n }\n }\n\n while (scannedBlock <= blockNumber) {\n if (done) { return; }\n\n const block = await this.getBlockWithTransactions(scannedBlock);\n for (let ti = 0; ti < block.transactions.length; ti++) {\n const tx = block.transactions[ti];\n\n // Successfully mined!\n if (tx.hash === transactionHash) { return; }\n\n // Matches our transaction from and nonce; its a replacement\n if (tx.from === replaceable.from && tx.nonce === replaceable.nonce) {\n if (done) { return; }\n\n // Get the receipt of the replacement\n const receipt = await this.waitForTransaction(tx.hash, confirmations);\n\n // Already resolved or rejected (prolly a timeout)\n if (alreadyDone()) { return; }\n\n // The reason we were replaced\n let reason = \"replaced\";\n if (tx.data === replaceable.data && tx.to === replaceable.to && tx.value.eq(replaceable.value)) {\n reason = \"repriced\";\n } else if (tx.data === \"0x\" && tx.from === tx.to && tx.value.isZero()) {\n reason = \"cancelled\"\n }\n\n // Explain why we were replaced\n reject(logger.makeError(\"transaction was replaced\", Logger.errors.TRANSACTION_REPLACED, {\n cancelled: (reason === \"replaced\" || reason === \"cancelled\"),\n reason,\n replacement: this._wrapTransaction(tx),\n hash: transactionHash,\n receipt\n }));\n\n return;\n }\n }\n scannedBlock++;\n }\n }\n\n if (done) { return; }\n this.once(\"block\", replaceHandler);\n\n }, (error) => {\n if (done) { return; }\n this.once(\"block\", replaceHandler);\n });\n };\n\n if (done) { return; }\n this.once(\"block\", replaceHandler);\n\n cancelFuncs.push(() => {\n this.removeListener(\"block\", replaceHandler);\n });\n }\n\n if (typeof(timeout) === \"number\" && timeout > 0) {\n const timer = setTimeout(() => {\n if (alreadyDone()) { return; }\n reject(logger.makeError(\"timeout exceeded\", Logger.errors.TIMEOUT, { timeout: timeout }));\n }, timeout);\n if (timer.unref) { timer.unref(); }\n\n cancelFuncs.push(() => { clearTimeout(timer); });\n }\n });\n }\n\n async getBlockNumber(): Promise<number> {\n return this._getInternalBlockNumber(0);\n }\n\n async getGasPrice(): Promise<BigNumber> {\n await this.getNetwork();\n\n const result = await this.perform(\"getGasPrice\", { });\n try {\n return BigNumber.from(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getGasPrice\",\n result, error\n });\n }\n }\n\n async getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber> {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag)\n });\n\n const result = await this.perform(\"getBalance\", params);\n try {\n return BigNumber.from(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getBalance\",\n params, result, error\n });\n }\n }\n\n async getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number> {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag)\n });\n\n const result = await this.perform(\"getTransactionCount\", params);\n try {\n return BigNumber.from(result).toNumber();\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getTransactionCount\",\n params, result, error\n });\n }\n }\n\n async getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag)\n });\n\n const result = await this.perform(\"getCode\", params);\n try {\n return hexlify(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getCode\",\n params, result, error\n });\n }\n }\n\n async getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> {\n await this.getNetwork();\n const params = await resolveProperties({\n address: this._getAddress(addressOrName),\n blockTag: this._getBlockTag(blockTag),\n position: Promise.resolve(position).then((p) => hexValue(p))\n });\n const result = await this.perform(\"getStorageAt\", params);\n try {\n return hexlify(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"getStorageAt\",\n params, result, error\n });\n }\n }\n\n // This should be called by any subclass wrapping a TransactionResponse\n _wrapTransaction(tx: Transaction, hash?: string, startBlock?: number): TransactionResponse {\n if (hash != null && hexDataLength(hash) !== 32) { throw new Error(\"invalid response - sendTransaction\"); }\n\n const result = <TransactionResponse>tx;\n\n // Check the hash we expect is the same as the hash the server reported\n if (hash != null && tx.hash !== hash) {\n logger.throwError(\"Transaction hash mismatch from Provider.sendTransaction.\", Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });\n }\n\n result.wait = async (confirms?: number, timeout?: number) => {\n if (confirms == null) { confirms = 1; }\n if (timeout == null) { timeout = 0; }\n\n // Get the details to detect replacement\n let replacement = undefined;\n if (confirms !== 0 && startBlock != null) {\n replacement = {\n data: tx.data,\n from: tx.from,\n nonce: tx.nonce,\n to: tx.to,\n value: tx.value,\n startBlock\n };\n }\n\n const receipt = await this._waitForTransaction(tx.hash, confirms, timeout, replacement);\n if (receipt == null && confirms === 0) { return null; }\n\n // No longer pending, allow the polling loop to garbage collect this\n this._emitted[\"t:\" + tx.hash] = receipt.blockNumber;\n\n if (receipt.status === 0) {\n logger.throwError(\"transaction failed\", Logger.errors.CALL_EXCEPTION, {\n transactionHash: tx.hash,\n transaction: tx,\n receipt: receipt\n });\n }\n return receipt;\n };\n\n return result;\n }\n\n async sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse> {\n await this.getNetwork();\n const hexTx = await Promise.resolve(signedTransaction).then(t => hexlify(t));\n const tx = this.formatter.transaction(signedTransaction);\n if (tx.confirmations == null) { tx.confirmations = 0; }\n const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n try {\n const hash = await this.perform(\"sendTransaction\", { signedTransaction: hexTx });\n return this._wrapTransaction(tx, hash, blockNumber);\n } catch (error) {\n (<any>error).transaction = tx;\n (<any>error).transactionHash = tx.hash;\n throw error;\n }\n }\n\n async _getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction> {\n const values: any = await transaction;\n\n const tx: any = { };\n\n [\"from\", \"to\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => (v ? this._getAddress(v): null))\n });\n\n [\"gasLimit\", \"gasPrice\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"value\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => (v ? BigNumber.from(v): null));\n });\n\n [\"type\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => ((v != null) ? v: null));\n });\n\n if (values.accessList) {\n tx.accessList = this.formatter.accessList(values.accessList);\n }\n\n [\"data\"].forEach((key) => {\n if (values[key] == null) { return; }\n tx[key] = Promise.resolve(values[key]).then((v) => (v ? hexlify(v): null));\n });\n\n return this.formatter.transactionRequest(await resolveProperties(tx));\n }\n\n async _getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash> {\n filter = await filter;\n\n const result: any = { };\n\n if (filter.address != null) {\n result.address = this._getAddress(filter.address);\n }\n\n [\"blockHash\", \"topics\"].forEach((key) => {\n if ((<any>filter)[key] == null) { return; }\n result[key] = (<any>filter)[key];\n });\n\n [\"fromBlock\", \"toBlock\"].forEach((key) => {\n if ((<any>filter)[key] == null) { return; }\n result[key] = this._getBlockTag((<any>filter)[key]);\n });\n\n return this.formatter.filter(await resolveProperties(result));\n }\n\n async _call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise<string> {\n if (attempt >= MAX_CCIP_REDIRECTS) {\n logger.throwError(\"CCIP read exceeded maximum redirections\", Logger.errors.SERVER_ERROR, {\n redirects: attempt, transaction\n });\n }\n\n const txSender = transaction.to;\n\n const result = await this.perform(\"call\", { transaction, blockTag });\n\n // CCIP Read request via OffchainLookup(address,string[],bytes,bytes4,bytes)\n if (attempt >= 0 && blockTag === \"latest\" && txSender != null && result.substring(0, 10) === \"0x556f1830\" && (hexDataLength(result) % 32 === 4)) {\n try {\n const data = hexDataSlice(result, 4);\n\n // Check the sender of the OffchainLookup matches the transaction\n const sender = hexDataSlice(data, 0, 32);\n if (!BigNumber.from(sender).eq(txSender)) {\n logger.throwError(\"CCIP Read sender did not match\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n\n // Read the URLs from the response\n const urls: Array<string> = [];\n const urlsOffset = BigNumber.from(hexDataSlice(data, 32, 64)).toNumber();\n const urlsLength = BigNumber.from(hexDataSlice(data, urlsOffset, urlsOffset + 32)).toNumber();\n const urlsData = hexDataSlice(data, urlsOffset + 32);\n for (let u = 0; u < urlsLength; u++) {\n const url = _parseString(urlsData, u * 32);\n if (url == null) {\n logger.throwError(\"CCIP Read contained corrupt URL string\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n urls.push(url);\n }\n\n // Get the CCIP calldata to forward\n const calldata = _parseBytes(data, 64);\n\n // Get the callbackSelector (bytes4)\n if (!BigNumber.from(hexDataSlice(data, 100, 128)).isZero()) {\n logger.throwError(\"CCIP Read callback selector included junk\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n const callbackSelector = hexDataSlice(data, 96, 100);\n\n // Get the extra data to send back to the contract as context\n const extraData = _parseBytes(data, 128);\n\n const ccipResult = await this.ccipReadFetch(<Transaction>transaction, calldata, urls);\n if (ccipResult == null) {\n logger.throwError(\"CCIP Read disabled or provided no URLs\", Logger.errors.CALL_EXCEPTION, {\n name: \"OffchainLookup\",\n signature: \"OffchainLookup(address,string[],bytes,bytes4,bytes)\",\n transaction, data: result\n });\n }\n\n const tx = {\n to: txSender,\n data: hexConcat([ callbackSelector, encodeBytes([ ccipResult, extraData ]) ])\n };\n\n return this._call(tx, blockTag, attempt + 1);\n\n } catch (error) {\n if (error.code === Logger.errors.SERVER_ERROR) { throw error; }\n }\n }\n\n try {\n return hexlify(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"call\",\n params: { transaction, blockTag }, result, error\n });\n }\n\n }\n\n async call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> {\n await this.getNetwork();\n const resolved = await resolveProperties({\n transaction: this._getTransactionRequest(transaction),\n blockTag: this._getBlockTag(blockTag),\n ccipReadEnabled: Promise.resolve(transaction.ccipReadEnabled)\n });\n return this._call(resolved.transaction, resolved.blockTag, resolved.ccipReadEnabled ? 0: -1);\n }\n\n async estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber> {\n await this.getNetwork();\n const params = await resolveProperties({\n transaction: this._getTransactionRequest(transaction)\n });\n\n const result = await this.perform(\"estimateGas\", params);\n try {\n return BigNumber.from(result);\n } catch (error) {\n return logger.throwError(\"bad result from backend\", Logger.errors.SERVER_ERROR, {\n method: \"estimateGas\",\n params, result, error\n });\n }\n }\n\n async _getAddress(addressOrName: string | Promise<string>): Promise<string> {\n addressOrName = await addressOrName;\n if (typeof(addressOrName) !== \"string\") {\n logger.throwArgumentError(\"invalid address or ENS name\", \"name\", addressOrName);\n }\n\n const address = await this.resolveName(addressOrName);\n if (address == null) {\n logger.throwError(\"ENS name not configured\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: `resolveName(${ JSON.stringify(addressOrName) })`\n });\n }\n return address;\n }\n\n async _getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions> {\n await this.getNetwork();\n\n blockHashOrBlockTag = await blockHashOrBlockTag;\n\n // If blockTag is a number (not \"latest\", etc), this is the block number\n let blockNumber = -128;\n\n const params: { [key: string]: any } = {\n includeTransactions: !!includeTransactions\n };\n\n if (isHexString(blockHashOrBlockTag, 32)) {\n params.blockHash = blockHashOrBlockTag;\n } else {\n try {\n params.blockTag = await this._getBlockTag(blockHashOrBlockTag);\n if (isHexString(params.blockTag)) {\n blockNumber = parseInt(params.blockTag.substring(2), 16);\n }\n } catch (error) {\n logger.throwArgumentError(\"invalid block hash or block tag\", \"blockHashOrBlockTag\", blockHashOrBlockTag);\n }\n }\n\n return poll(async () => {\n const block = await this.perform(\"getBlock\", params);\n\n // Block was not found\n if (block == null) {\n\n // For blockhashes, if we didn't say it existed, that blockhash may\n // not exist. If we did see it though, perhaps from a log, we know\n // it exists, and this node is just not caught up yet.\n if (params.blockHash != null) {\n if (this._emitted[\"b:\" + params.blockHash] == null) { return null; }\n }\n\n // For block tags, if we are asking for a future block, we return null\n if (params.blockTag != null) {\n if (blockNumber > this._emitted.block) { return null; }\n }\n\n // Retry on the next block\n return undefined;\n }\n\n // Add transactions\n if (includeTransactions) {\n let blockNumber: number = null;\n for (let i = 0; i < block.transactions.length; i++) {\n const tx = block.transactions[i];\n if (tx.blockNumber == null) {\n tx.confirmations = 0;\n\n } else if (tx.confirmations == null) {\n if (blockNumber == null) {\n blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n }\n\n // Add the confirmations using the fast block number (pessimistic)\n let confirmations = (blockNumber - tx.blockNumber) + 1;\n if (confirmations <= 0) { confirmations = 1; }\n tx.confirmations = confirmations;\n }\n }\n\n const blockWithTxs: any = this.formatter.blockWithTransactions(block);\n blockWithTxs.transactions = blockWithTxs.transactions.map((tx: TransactionResponse) => this._wrapTransaction(tx));\n return blockWithTxs;\n }\n\n return this.formatter.block(block);\n\n }, { oncePoll: this });\n }\n\n getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block> {\n return <Promise<Block>>(this._getBlock(blockHashOrBlockTag, false));\n }\n\n getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions> {\n return <Promise<BlockWithTransactions>>(this._getBlock(blockHashOrBlockTag, true));\n }\n\n async getTransaction(transactionHash: string | Promise<string>): Promise<TransactionResponse> {\n await this.getNetwork();\n transactionHash = await transactionHash;\n\n const params = { transactionHash: this.formatter.hash(transactionHash, true) };\n\n return poll(async () => {\n const result = await this.perform(\"getTransaction\", params);\n\n if (result == null) {\n if (this._emitted[\"t:\" + transactionHash] == null) {\n return null;\n }\n return undefined;\n }\n\n const tx = this.formatter.transactionResponse(result);\n\n if (tx.blockNumber == null) {\n tx.confirmations = 0;\n\n } else if (tx.confirmations == null) {\n const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n\n // Add the confirmations using the fast block number (pessimistic)\n let confirmations = (blockNumber - tx.blockNumber) + 1;\n if (confirmations <= 0) { confirmations = 1; }\n tx.confirmations = confirmations;\n }\n\n return this._wrapTransaction(tx);\n }, { oncePoll: this });\n }\n\n async getTransactionReceipt(transactionHash: string | Promise<string>): Promise<TransactionReceipt> {\n await this.getNetwork();\n\n transactionHash = await transactionHash;\n\n const params = { transactionHash: this.formatter.hash(transactionHash, true) };\n\n return poll(async () => {\n const result = await this.perform(\"getTransactionReceipt\", params);\n\n if (result == null) {\n if (this._emitted[\"t:\" + transactionHash] == null) {\n return null;\n }\n return undefined;\n }\n\n // \"geth-etc\" returns receipts before they are ready\n if (result.blockHash == null) { return undefined; }\n\n const receipt = this.formatter.receipt(result);\n\n if (receipt.blockNumber == null) {\n receipt.confirmations = 0;\n\n } else if (receipt.confirmations == null) {\n const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n\n // Add the confirmations using the fast block number (pessimistic)\n let confirmations = (blockNumber - receipt.blockNumber) + 1;\n if (confirmations <= 0) { confirmations = 1; }\n receipt.confirmations = confirmations;\n }\n\n return receipt;\n }, { oncePoll: this });\n }\n\n async getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Array<Log>> {\n await this.getNetwork();\n const params = await resolveProperties({ filter: this._getFilter(filter) });\n const logs: Array<Log> = await this.perform(\"getLogs\", params);\n logs.forEach((log) => {\n if (log.removed == null) { log.removed = false; }\n });\n return Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs);\n }\n\n async getEtherPrice(): Promise<number> {\n await this.getNetwork();\n return this.perform(\"getEtherPrice\", { });\n }\n\n async _getBlockTag(blockTag: BlockTag | Promise<BlockTag>): Promise<BlockTag> {\n blockTag = await blockTag;\n\n if (typeof(blockTag) === \"number\" && blockTag < 0) {\n if (blockTag % 1) {\n logger.throwArgumentError(\"invalid BlockTag\", \"blockTag\", blockTag);\n }\n\n let blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval);\n blockNumber += blockTag;\n if (blockNumber < 0) { blockNumber = 0; }\n return this.formatter.blockTag(blockNumber)\n }\n\n return this.formatter.blockTag(blockTag);\n }\n\n\n async getResolver(name: string): Promise<null | Resolver> {\n let currentName = name;\n while (true) {\n if (currentName === \"\" || currentName === \".\") { return null; }\n\n // Optimization since the eth node cannot change and does\n // not have a wildcar resolver\n if (name !== \"eth\" && currentName === \"eth\") { return null; }\n\n // Check the current node for a resolver\n const addr = await this._getResolver(currentName, \"getResolver\");\n\n // Found a resolver!\n if (addr != null) {\n const resolver = new Resolver(this, addr, name);\n\n // Legacy resolver found, using EIP-2544 so it isn't safe to use\n if (currentName !== name && !(await resolver.supportsWildcard())) { return null; }\n\n return resolver;\n }\n\n // Get the parent node\n currentName = currentName.split(\".\").slice(1).join(\".\");\n }\n\n }\n\n async _getResolver(name: string, operation?: string): Promise<string> {\n if (operation == null) { operation = \"ENS\"; }\n\n const network = await this.getNetwork();\n\n // No ENS...\n if (!network.ensAddress) {\n logger.throwError(\n \"network does not support ENS\",\n Logger.errors.UNSUPPORTED_OPERATION,\n { operation, network: network.name }\n );\n }\n\n try {\n // keccak256(\"resolver(bytes32)\")\n const addrData = await this.call({\n to: network.ensAddress,\n data: (\"0x0178b8bf\" + namehash(name).substring(2))\n });\n return this.formatter.callAddress(addrData);\n } catch (error) {\n // ENS registry cannot throw errors on resolver(bytes32)\n }\n\n return null;\n }\n\n async resolveName(name: string | Promise<string>): Promise<null | string> {\n name = await name;\n\n // If it is already an address, nothing to resolve\n try {\n return Promise.resolve(this.formatter.address(name));\n } catch (error) {\n // If is is a hexstring, the address is bad (See #694)\n if (isHexString(name)) { throw error; }\n }\n\n if (typeof(name) !== \"string\") {\n logger.throwArgumentError(\"invalid ENS name\", \"name\", name);\n }\n\n // Get the addr from the resovler\n const resolver = await this.getResolver(name);\n if (!resolver) { return null; }\n\n return await resolver.getAddress();\n }\n\n async lookupAddress(address: string | Promise<string>): Promise<null | string> {\n address = await address;\n address = this.formatter.address(address);\n\n const node = address.substring(2).toLowerCase() + \".addr.reverse\";\n\n const resolverAddr = await this._getResolver(node, \"lookupAddress\");\n if (resolverAddr == null) { return null; }\n\n // keccak(\"name(bytes32)\")\n const name = _parseString(await this.call({\n to: resolverAddr,\n data: (\"0x691f3431\" + namehash(node).substring(2))\n }), 0);\n\n const addr = await this.resolveName(name);\n if (addr != address) { return null; }\n\n return name;\n }\n\n async getAvatar(nameOrAddress: string): Promise<null | string> {\n let resolver: Resolver = null;\n if (isHexString(nameOrAddress)) {\n // Address; reverse lookup\n const address = this.formatter.address(nameOrAddress);\n\n const node = address.substring(2).toLowerCase() + \".addr.reverse\";\n\n const resolverAddress = await this._getResolver(node, \"getAvatar\");\n if (!resolverAddress) { return null; }\n\n // Try resolving the avatar against the addr.reverse resolver\n resolver = new Resolver(this, resolverAddress, node);\n try {\n const avatar = await resolver.getAvatar();\n if (avatar) { return avatar.url; }\n } catch (error) {\n if (error.code !== Logger.errors.CALL_EXCEPTION) { throw error; }\n }\n\n // Try getting the name and performing forward lookup; allowing wildcards\n try {\n // keccak(\"name(bytes32)\")\n const name = _parseString(await this.call({\n to: resolverAddress,\n data: (\"0x691f3431\" + namehash(node).substring(2))\n }), 0);\n resolver = await this.getResolver(name);\n } catch (error) {\n if (error.code !== Logger.errors.CALL_EXCEPTION) { throw error; }\n return null;\n }\n\n } else {\n // ENS name; forward lookup with wildcard\n resolver = await this.getResolver(nameOrAddress);\n if (!resolver) { return null; }\n }\n\n const avatar = await resolver.getAvatar();\n if (avatar == null) { return null; }\n\n return avatar.url;\n }\n\n perform(method: string, params: any): Promise<any> {\n return logger.throwError(method + \" not implemented\", Logger.errors.NOT_IMPLEMENTED, { operation: method });\n }\n\n _startEvent(event: Event): void {\n this.polling = (this._events.filter((e) => e.pollable()).length > 0);\n }\n\n _stopEvent(event: Event): void {\n this.polling = (this._events.filter((e) => e.pollable()).length > 0);\n }\n\n _addEventListener(eventName: EventType, listener: Listener, once: boolean): this {\n const event = new Event(getEventTag(eventName), listener, once)\n this._events.push(event);\n this._startEvent(event);\n\n return this;\n }\n\n on(eventName: EventType, listener: Listener): this {\n return this._addEventListener(eventName, listener, false);\n }\n\n once(eventName: EventType, listener: Listener): this {\n return this._addEventListener(eventName, listener, true);\n }\n\n\n emit(eventName: EventType, ...args: Array<any>): boolean {\n let result = false;\n\n let stopped: Array<Event> = [ ];\n\n let eventTag = getEventTag(eventName);\n this._events = this._events.filter((event) => {\n if (event.tag !== eventTag) { return true; }\n\n setTimeout(() => {\n event.listener.apply(this, args);\n }, 0);\n\n result = true;\n\n if (event.once) {\n stopped.push(event);\n return false;\n }\n\n return true;\n });\n\n stopped.forEach((event) => { this._stopEvent(event); });\n\n return result;\n }\n\n listenerCount(eventName?: EventType): number {\n if (!eventName) { return this._events.length; }\n\n let eventTag = getEventTag(eventName);\n return this._events.filter((event) => {\n return (event.tag === eventTag);\n }).length;\n }\n\n listeners(eventName?: EventType): Array<Listener> {\n if (eventName == null) {\n return this._events.map((event) => event.listener);\n }\n\n let eventTag = getEventTag(eventName);\n return this._events\n .filter((event) => (event.tag === eventTag))\n .map((event) => event.listener);\n }\n\n off(eventName: EventType, listener?: Listener): this {\n if (listener == null) {\n return this.removeAllListeners(eventName);\n }\n\n const stopped: Array<Event> = [ ];\n\n let found = false;\n\n let eventTag = getEventTag(eventName);\n this._events = this._events.filter((event) => {\n if (event.tag !== eventTag || event.listener != listener) { return true; }\n if (found) { return true; }\n found = true;\n stopped.push(event);\n return false;\n });\n\n stopped.forEach((event) => { this._stopEvent(event); });\n\n return this;\n }\n\n removeAllListeners(eventName?: EventType): this {\n let stopped: Array<Event> = [ ];\n if (eventName == null) {\n stopped = this._events;\n\n this._events = [ ];\n } else {\n const eventTag = getEventTag(eventName);\n this._events = this._events.filter((event) => {\n if (event.tag !== eventTag) { return true; }\n stopped.push(event);\n return false;\n });\n }\n\n stopped.forEach((event) => { this._stopEvent(event); });\n\n return this;\n }\n}\n","\"use strict\";\n\n// See: https://github.com/ethereum/wiki/wiki/JSON-RPC\n\nimport { Provider, TransactionRequest, TransactionResponse } from \"@ethersproject/abstract-provider\";\nimport { Signer, TypedDataDomain, TypedDataField, TypedDataSigner } from \"@ethersproject/abstract-signer\";\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { Bytes, hexlify, hexValue, isHexString } from \"@ethersproject/bytes\";\nimport { _TypedDataEncoder } from \"@ethersproject/hash\";\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { checkProperties, deepCopy, Deferrable, defineReadOnly, getStatic, resolveProperties, shallowCopy } from \"@ethersproject/properties\";\nimport { toUtf8Bytes } from \"@ethersproject/strings\";\nimport { AccessList, accessListify } from \"@ethersproject/transactions\";\nimport { ConnectionInfo, fetchJson, poll } from \"@ethersproject/web\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { BaseProvider, Event } from \"./base-provider\";\n\n\nconst errorGas = [ \"call\", \"estimateGas\" ];\n\nfunction spelunk(value: any): null | { message: string, data: string } {\n if (value == null) { return null; }\n\n // These *are* the droids we're looking for.\n if (typeof(value.message) === \"string\" && value.message.match(\"reverted\") && isHexString(value.data)) {\n return { message: value.message, data: value.data };\n }\n\n // Spelunk further...\n if (typeof(value) === \"object\") {\n for (const key in value) {\n const result = spelunk(value[key]);\n if (result) { return result; }\n }\n return null;\n }\n\n // Might be a JSON string we can further descend...\n if (typeof(value) === \"string\") {\n try {\n return spelunk(JSON.parse(value));\n } catch (error) { }\n }\n\n return null;\n}\n\nfunction checkError(method: string, error: any, params: any): any {\n\n // Undo the \"convenience\" some nodes are attempting to prevent backwards\n // incompatibility; maybe for v6 consider forwarding reverts as errors\n if (method === \"call\") {\n const result = spelunk(error);\n if (result) { return result.data; }\n\n logger.throwError(\"missing revert data in call exception; Transaction reverted without a reason string\", Logger.errors.CALL_EXCEPTION, {\n error, data: \"0x\"\n });\n }\n\n // @TODO: Should we spelunk for message too?\n\n let message = error.message;\n if (error.code === Logger.errors.SERVER_ERROR && error.error && typeof(error.error.message) === \"string\") {\n message = error.error.message;\n } else if (typeof(error.body) === \"string\") {\n message = error.body;\n } else if (typeof(error.responseText) === \"string\") {\n message = error.responseText;\n }\n message = (message || \"\").toLowerCase();\n\n const transaction = params.transaction || params.signedTransaction;\n\n // \"insufficient funds for gas * price + value + cost(data)\"\n if (message.match(/insufficient funds|base fee exceeds gas limit/)) {\n logger.throwError(\"insufficient funds for intrinsic transaction cost\", Logger.errors.INSUFFICIENT_FUNDS, {\n error, method, transaction\n });\n }\n\n // \"nonce too low\"\n if (message.match(/nonce too low/)) {\n logger.throwError(\"nonce has already been used\", Logger.errors.NONCE_EXPIRED, {\n error, method, transaction\n });\n }\n\n // \"replacement transaction underpriced\"\n if (message.match(/replacement transaction underpriced/)) {\n logger.throwError(\"replacement fee too low\", Logger.errors.REPLACEMENT_UNDERPRICED, {\n error, method, transaction\n });\n }\n\n // \"replacement transaction underpriced\"\n if (message.match(/only replay-protected/)) {\n logger.throwError(\"legacy pre-eip-155 transactions not supported\", Logger.errors.UNSUPPORTED_OPERATION, {\n error, method, transaction\n });\n }\n\n if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted/)) {\n logger.throwError(\"cannot estimate gas; transaction may fail or may require manual gas limit\", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {\n error, method, transaction\n });\n }\n\n throw error;\n}\n\nfunction timer(timeout: number): Promise<any> {\n return new Promise(function(resolve) {\n setTimeout(resolve, timeout);\n });\n}\n\nfunction getResult(payload: { error?: { code?: number, data?: any, message?: string }, result?: any }): any {\n if (payload.error) {\n // @TODO: not any\n const 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\nfunction getLowerCase(value: string): string {\n if (value) { return value.toLowerCase(); }\n return value;\n}\n\nconst _constructorGuard = {};\n\nexport class JsonRpcSigner extends Signer implements TypedDataSigner {\n readonly provider: JsonRpcProvider;\n _index: number;\n _address: string;\n\n constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number) {\n logger.checkNew(new.target, JsonRpcSigner);\n\n super();\n\n if (constructorGuard !== _constructorGuard) {\n throw new Error(\"do not call the JsonRpcSigner constructor directly; use provider.getSigner\");\n }\n\n defineReadOnly(this, \"provider\", provider);\n\n if (addressOrIndex == null) { addressOrIndex = 0; }\n\n if (typeof(addressOrIndex) === \"string\") {\n defineReadOnly(this, \"_address\", this.provider.formatter.address(addressOrIndex));\n defineReadOnly(this, \"_index\", null);\n\n } else if (typeof(addressOrIndex) === \"number\") {\n defineReadOnly(this, \"_index\", addressOrIndex);\n defineReadOnly(this, \"_address\", null);\n\n } else {\n logger.throwArgumentError(\"invalid address or index\", \"addressOrIndex\", addressOrIndex);\n }\n }\n\n connect(provider: Provider): JsonRpcSigner {\n return logger.throwError(\"cannot alter JSON-RPC Signer connection\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"connect\"\n });\n }\n\n connectUnchecked(): JsonRpcSigner {\n return new UncheckedJsonRpcSigner(_constructorGuard, this.provider, this._address || this._index);\n }\n\n getAddress(): Promise<string> {\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 <= this._index) {\n logger.throwError(\"unknown account #\" + this._index, Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"getAddress\"\n });\n }\n return this.provider.formatter.address(accounts[this._index])\n });\n }\n\n sendUncheckedTransaction(transaction: Deferrable<TransactionRequest>): Promise<string> {\n transaction = shallowCopy(transaction);\n\n const fromAddress = this.getAddress().then((address) => {\n if (address) { address = address.toLowerCase(); }\n return address;\n });\n\n // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user\n // wishes to use this, it is easy to specify explicitly, otherwise\n // we look it up for them.\n if (transaction.gasLimit == null) {\n const estimate = shallowCopy(transaction);\n estimate.from = fromAddress;\n transaction.gasLimit = this.provider.estimateGas(estimate);\n }\n\n if (transaction.to != null) {\n transaction.to = Promise.resolve(transaction.to).then(async (to) => {\n if (to == null) { return null; }\n const address = await this.provider.resolveName(to);\n if (address == null) {\n logger.throwArgumentError(\"provided ENS name resolves to null\", \"tx.to\", to);\n }\n return address;\n });\n }\n\n return resolveProperties({\n tx: resolveProperties(transaction),\n sender: fromAddress\n }).then(({ tx, sender }) => {\n\n if (tx.from != null) {\n if (tx.from.toLowerCase() !== sender) {\n logger.throwArgumentError(\"from address mismatch\", \"transaction\", transaction);\n }\n } else {\n tx.from = sender;\n }\n\n const hexTx = (<any>this.provider.constructor).hexlifyTransaction(tx, { from: true });\n\n return this.provider.send(\"eth_sendTransaction\", [ hexTx ]).then((hash) => {\n return hash;\n }, (error) => {\n return checkError(\"sendTransaction\", error, hexTx);\n });\n });\n }\n\n signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string> {\n return logger.throwError(\"signing transactions is unsupported\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"signTransaction\"\n });\n }\n\n async sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> {\n // This cannot be mined any earlier than any recent block\n const blockNumber = await this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval);\n\n // Send the transaction\n const hash = await this.sendUncheckedTransaction(transaction);\n\n try {\n // Unfortunately, JSON-RPC only provides and opaque transaction hash\n // for a response, and we need the actual transaction, so we poll\n // for it; it should show up very quickly\n return await poll(async () => {\n const tx = await this.provider.getTransaction(hash);\n if (tx === null) { return undefined; }\n return this.provider._wrapTransaction(tx, hash, blockNumber);\n }, { oncePoll: this.provider });\n } catch (error) {\n (<any>error).transactionHash = hash;\n throw error;\n }\n }\n\n async signMessage(message: Bytes | string): Promise<string> {\n const data = ((typeof(message) === \"string\") ? toUtf8Bytes(message): message);\n const address = await this.getAddress();\n\n return await this.provider.send(\"personal_sign\", [ hexlify(data), address.toLowerCase() ]);\n }\n\n async _legacySignMessage(message: Bytes | string): Promise<string> {\n const data = ((typeof(message) === \"string\") ? toUtf8Bytes(message): message);\n const address = await this.getAddress();\n\n // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign\n return await this.provider.send(\"eth_sign\", [ address.toLowerCase(), hexlify(data) ]);\n }\n\n async _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string> {\n // Populate any ENS names (in-place)\n const populated = await _TypedDataEncoder.resolveNames(domain, types, value, (name: string) => {\n return this.provider.resolveName(name);\n });\n\n const address = await this.getAddress();\n\n return await this.provider.send(\"eth_signTypedData_v4\", [\n address.toLowerCase(),\n JSON.stringify(_TypedDataEncoder.getPayload(populated.domain, types, populated.value))\n ]);\n }\n\n async unlock(password: string): Promise<boolean> {\n const provider = this.provider;\n\n const address = await this.getAddress();\n\n return provider.send(\"personal_unlockAccount\", [ address.toLowerCase(), password, null ]);\n }\n}\n\nclass UncheckedJsonRpcSigner extends JsonRpcSigner {\n sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> {\n return this.sendUncheckedTransaction(transaction).then((hash) => {\n return <TransactionResponse>{\n hash: hash,\n nonce: null,\n gasLimit: null,\n gasPrice: null,\n data: null,\n value: null,\n chainId: null,\n confirmations: 0,\n from: null,\n wait: (confirmations?: number) => { return this.provider.waitForTransaction(hash, confirmations); }\n };\n });\n }\n}\n\nconst allowedTransactionKeys: { [ key: string ]: boolean } = {\n chainId: true, data: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true,\n type: true, accessList: true,\n maxFeePerGas: true, maxPriorityFeePerGas: true\n}\n\nexport class JsonRpcProvider extends BaseProvider {\n readonly connection: ConnectionInfo;\n\n _pendingFilter: Promise<number>;\n _nextId: number;\n\n // During any given event loop, the results for a given call will\n // all be the same, so we can dedup the calls to save requests and\n // bandwidth. @TODO: Try out generalizing this against send?\n _eventLoopCache: Record<string, Promise<any>>;\n get _cache(): Record<string, Promise<any>> {\n if (this._eventLoopCache == null) {\n this._eventLoopCache = { };\n }\n return this._eventLoopCache;\n }\n\n constructor(url?: ConnectionInfo | string, network?: Networkish) {\n logger.checkNew(new.target, JsonRpcProvider);\n\n let networkOrReady: Networkish | Promise<Network> = network;\n\n // The network is unknown, query the JSON-RPC for it\n if (networkOrReady == null) {\n networkOrReady = new Promise((resolve, reject) => {\n setTimeout(() => {\n this.detectNetwork().then((network) => {\n resolve(network);\n }, (error) => {\n reject(error);\n });\n }, 0);\n });\n }\n\n super(networkOrReady);\n\n // Default URL\n if (!url) { url = getStatic<() => string>(this.constructor, \"defaultUrl\")(); }\n\n if (typeof(url) === \"string\") {\n defineReadOnly(this, \"connection\",Object.freeze({\n url: url\n }));\n } else {\n defineReadOnly(this, \"connection\", Object.freeze(shallowCopy(url)));\n }\n\n this._nextId = 42;\n }\n\n static defaultUrl(): string {\n return \"http:/\\/localhost:8545\";\n }\n\n detectNetwork(): Promise<Network> {\n if (!this._cache[\"detectNetwork\"]) {\n this._cache[\"detectNetwork\"] = this._uncachedDetectNetwork();\n\n // Clear this cache at the beginning of the next event loop\n setTimeout(() => {\n this._cache[\"detectNetwork\"] = null;\n }, 0);\n }\n return this._cache[\"detectNetwork\"];\n }\n\n async _uncachedDetectNetwork(): Promise<Network> {\n await timer(0);\n\n let chainId = null;\n try {\n chainId = await this.send(\"eth_chainId\", [ ]);\n } catch (error) {\n try {\n chainId = await this.send(\"net_version\", [ ]);\n } catch (error) { }\n }\n\n if (chainId != null) {\n const getNetwork = getStatic<(network: Networkish) => Network>(this.constructor, \"getNetwork\");\n try {\n return getNetwork(BigNumber.from(chainId).toNumber());\n } catch (error) {\n return logger.throwError(\"could not detect network\", Logger.errors.NETWORK_ERROR, {\n chainId: chainId,\n event: \"invalidNetwork\",\n serverError: error\n });\n }\n }\n\n return logger.throwError(\"could not detect network\", Logger.errors.NETWORK_ERROR, {\n event: \"noNetwork\"\n });\n }\n\n getSigner(addressOrIndex?: string | number): JsonRpcSigner {\n return new JsonRpcSigner(_constructorGuard, this, addressOrIndex);\n }\n\n getUncheckedSigner(addressOrIndex?: string | number): UncheckedJsonRpcSigner {\n return this.getSigner(addressOrIndex).connectUnchecked();\n }\n\n listAccounts(): Promise<Array<string>> {\n return this.send(\"eth_accounts\", []).then((accounts: Array<string>) => {\n return accounts.map((a) => this.formatter.address(a));\n });\n }\n\n send(method: string, params: Array<any>): Promise<any> {\n const request = {\n method: method,\n params: params,\n id: (this._nextId++),\n jsonrpc: \"2.0\"\n };\n\n this.emit(\"debug\", {\n action: \"request\",\n request: deepCopy(request),\n provider: this\n });\n\n // We can expand this in the future to any call, but for now these\n // are the biggest wins and do not require any serializing parameters.\n const cache = ([ \"eth_chainId\", \"eth_blockNumber\" ].indexOf(method) >= 0);\n if (cache && this._cache[method]) {\n return this._cache[method];\n }\n\n const result = fetchJson(this.connection, JSON.stringify(request), getResult).then((result) => {\n this.emit(\"debug\", {\n action: \"response\",\n request: request,\n response: result,\n provider: this\n });\n\n return result;\n\n }, (error) => {\n this.emit(\"debug\", {\n action: \"response\",\n error: error,\n request: request,\n provider: this\n });\n\n throw error;\n });\n\n // Cache the fetch, but clear it on the next event loop\n if (cache) {\n this._cache[method] = result;\n setTimeout(() => {\n this._cache[method] = null;\n }, 0);\n }\n\n return result;\n }\n\n prepareRequest(method: string, params: any): [ string, Array<any> ] {\n switch (method) {\n case \"getBlockNumber\":\n return [ \"eth_blockNumber\", [] ];\n\n case \"getGasPrice\":\n return [ \"eth_gasPrice\", [] ];\n\n case \"getBalance\":\n return [ \"eth_getBalance\", [ getLowerCase(params.address), params.blockTag ] ];\n\n case \"getTransactionCount\":\n return [ \"eth_getTransactionCount\", [ getLowerCase(params.address), params.blockTag ] ];\n\n case \"getCode\":\n return [ \"eth_getCode\", [ getLowerCase(params.address), params.blockTag ] ];\n\n case \"getStorageAt\":\n return [ \"eth_getStorageAt\", [ getLowerCase(params.address), params.position, params.blockTag ] ];\n\n case \"sendTransaction\":\n return [ \"eth_sendRawTransaction\", [ params.signedTransaction ] ]\n\n case \"getBlock\":\n if (params.blockTag) {\n return [ \"eth_getBlockByNumber\", [ params.blockTag, !!params.includeTransactions ] ];\n } else if (params.blockHash) {\n return [ \"eth_getBlockByHash\", [ params.blockHash, !!params.includeTransactions ] ];\n }\n return null;\n\n case \"getTransaction\":\n return [ \"eth_getTransactionByHash\", [ params.transactionHash ] ];\n\n case \"getTransactionReceipt\":\n return [ \"eth_getTransactionReceipt\", [ params.transactionHash ] ];\n\n case \"call\": {\n const hexlifyTransaction = getStatic<(t: TransactionRequest, a?: { [key: string]: boolean }) => { [key: string]: string }>(this.constructor, \"hexlifyTransaction\");\n return [ \"eth_call\", [ hexlifyTransaction(params.transaction, { from: true }), params.blockTag ] ];\n }\n\n case \"estimateGas\": {\n const hexlifyTransaction = getStatic<(t: TransactionRequest, a?: { [key: string]: boolean }) => { [key: string]: string }>(this.constructor, \"hexlifyTransaction\");\n return [ \"eth_estimateGas\", [ hexlifyTransaction(params.transaction, { from: true }) ] ];\n }\n\n case \"getLogs\":\n if (params.filter && params.filter.address != null) {\n params.filter.address = getLowerCase(params.filter.address);\n }\n return [ \"eth_getLogs\", [ params.filter ] ];\n\n default:\n break;\n }\n\n return null;\n }\n\n async perform(method: string, params: any): Promise<any> {\n // Legacy networks do not like the type field being passed along (which\n // is fair), so we delete type if it is 0 and a non-EIP-1559 network\n if (method === \"call\" || method === \"estimateGas\") {\n const tx = params.transaction;\n if (tx && tx.type != null && BigNumber.from(tx.type).isZero()) {\n // If there are no EIP-1559 properties, it might be non-EIP-a559\n if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) {\n const feeData = await this.getFeeData();\n if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) {\n // Network doesn't know about EIP-1559 (and hence type)\n params = shallowCopy(params);\n params.transaction = shallowCopy(tx);\n delete params.transaction.type;\n }\n }\n }\n }\n\n const args = this.prepareRequest(method, params);\n\n if (args == null) {\n logger.throwError(method + \" not implemented\", Logger.errors.NOT_IMPLEMENTED, { operation: method });\n }\n try {\n return await this.send(args[0], args[1])\n } catch (error) {\n return checkError(method, error, params);\n }\n }\n\n _startEvent(event: Event): void {\n if (event.tag === \"pending\") { this._startPending(); }\n super._startEvent(event);\n }\n\n _startPending(): void {\n if (this._pendingFilter != null) { return; }\n const self = this;\n\n const pendingFilter: Promise<number> = 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: Array<string>) {\n if (self._pendingFilter != pendingFilter) { return null; }\n\n let seq = Promise.resolve();\n hashes.forEach(function(hash) {\n // @TODO: This should be garbage collected at some point... How? When?\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 return null;\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 return null;\n }).catch((error: Error) => { });\n }\n poll();\n\n return filterId;\n }).catch((error: Error) => { });\n }\n\n _stopEvent(event: Event): void {\n if (event.tag === \"pending\" && this.listenerCount(\"pending\") === 0) {\n this._pendingFilter = null;\n }\n super._stopEvent(event);\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\n // - All addresses are lowercased\n // NOTE: This allows a TransactionRequest, but all values should be resolved\n // before this is called\n // @TODO: This will likely be removed in future versions and prepareRequest\n // will be the preferred method for this.\n static hexlifyTransaction(transaction: TransactionRequest, allowExtra?: { [key: string]: boolean }): { [key: string]: string | AccessList } {\n // Check only allowed properties are given\n const allowed = shallowCopy(allowedTransactionKeys);\n if (allowExtra) {\n for (const key in allowExtra) {\n if (allowExtra[key]) { allowed[key] = true; }\n }\n }\n\n checkProperties(transaction, allowed);\n\n const result: { [key: string]: string | AccessList } = {};\n\n // JSON-RPC now requires numeric values to be \"quantity\" values\n [\"chainId\", \"gasLimit\", \"gasPrice\", \"type\", \"maxFeePerGas\", \"maxPriorityFeePerGas\", \"nonce\", \"value\"].forEach(function(key) {\n if ((<any>transaction)[key] == null) { return; }\n const value = hexValue((<any>transaction)[key]);\n if (key === \"gasLimit\") { key = \"gas\"; }\n result[key] = value;\n });\n\n [\"from\", \"to\", \"data\"].forEach(function(key) {\n if ((<any>transaction)[key] == null) { return; }\n result[key] = hexlify((<any>transaction)[key]);\n });\n\n if ((<any>transaction).accessList) {\n result[\"accessList\"] = accessListify((<any>transaction).accessList);\n }\n\n return result;\n }\n}\n","\"use strict\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\n\nlet WS: any = null;\n\ntry {\n WS = (WebSocket as any);\n if (WS == null) { throw new Error(\"inject please\"); }\n} catch (error) {\n const logger = new Logger(version);\n WS = function() {\n logger.throwError(\"WebSockets not supported in this environment\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"new WebSocket()\"\n });\n }\n}\n//export default WS;\n//module.exports = WS;\nexport { WS as WebSocket };\n","\"use strict\";\n\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Event } from \"./base-provider\";\nimport { JsonRpcProvider } from \"./json-rpc-provider\";\nimport { WebSocket } from \"./ws\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n/**\n * Notes:\n *\n * This provider differs a bit from the polling providers. One main\n * difference is how it handles consistency. The polling providers\n * will stall responses to ensure a consistent state, while this\n * WebSocket provider assumes the connected backend will manage this.\n *\n * For example, if a polling provider emits an event which indicates\n * the event occurred in blockhash XXX, a call to fetch that block by\n * its hash XXX, if not present will retry until it is present. This\n * can occur when querying a pool of nodes that are mildly out of sync\n * with each other.\n */\n\nlet NextId = 1;\n\nexport type InflightRequest = {\n callback: (error: Error, result: any) => void;\n payload: string;\n};\n\nexport type Subscription = {\n tag: string;\n processFunc: (payload: any) => void;\n};\n\nexport interface WebSocketLike {\n onopen: (...args: Array<any>) => any;\n onmessage: (...args: Array<any>) => any;\n onerror: (...args: Array<any>) => any;\n\n readyState: number;\n\n send(payload: any): void;\n close(code?: number, reason?: string): void;\n}\n\n// For more info about the Real-time Event API see:\n// https://geth.ethereum.org/docs/rpc/pubsub\n\nexport class WebSocketProvider extends JsonRpcProvider {\n readonly _websocket: any;\n readonly _requests: { [ name: string ]: InflightRequest };\n readonly _detectNetwork: Promise<Network>;\n\n // Maps event tag to subscription ID (we dedupe identical events)\n readonly _subIds: { [ tag: string ]: Promise<string> };\n\n // Maps Subscription ID to Subscription\n readonly _subs: { [ name: string ]: Subscription };\n\n _wsReady: boolean;\n\n constructor(url: string | WebSocketLike, network?: Networkish) {\n\n // This will be added in the future; please open an issue to expedite\n if (network === \"any\") {\n logger.throwError(\"WebSocketProvider does not support 'any' network yet\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"network:any\"\n });\n }\n\n if (typeof(url) === \"string\") {\n super(url, network);\n } else {\n super(\"_websocket\", network);\n }\n\n this._pollingInterval = -1;\n\n this._wsReady = false;\n\n if (typeof(url) === \"string\") {\n defineReadOnly(this, \"_websocket\", new WebSocket(this.connection.url));\n } else {\n defineReadOnly(this, \"_websocket\", url);\n }\n\n defineReadOnly(this, \"_requests\", { });\n defineReadOnly(this, \"_subs\", { });\n defineReadOnly(this, \"_subIds\", { });\n defineReadOnly(this, \"_detectNetwork\", super.detectNetwork());\n\n // Stall sending requests until the socket is open...\n this.websocket.onopen = () => {\n this._wsReady = true;\n Object.keys(this._requests).forEach((id) => {\n this.websocket.send(this._requests[id].payload);\n });\n };\n\n this.websocket.onmessage = (messageEvent: { data: string }) => {\n const data = messageEvent.data;\n const result = JSON.parse(data);\n if (result.id != null) {\n const id = String(result.id);\n const request = this._requests[id];\n delete this._requests[id];\n\n if (result.result !== undefined) {\n request.callback(null, result.result);\n\n this.emit(\"debug\", {\n action: \"response\",\n request: JSON.parse(request.payload),\n response: result.result,\n provider: this\n });\n\n } else {\n let error: Error = null;\n if (result.error) {\n error = new Error(result.error.message || \"unknown error\");\n defineReadOnly(<any>error, \"code\", result.error.code || null);\n defineReadOnly(<any>error, \"response\", data);\n } else {\n error = new Error(\"unknown error\");\n }\n\n request.callback(error, undefined);\n\n this.emit(\"debug\", {\n action: \"response\",\n error: error,\n request: JSON.parse(request.payload),\n provider: this\n });\n\n }\n\n } else if (result.method === \"eth_subscription\") {\n // Subscription...\n const sub = this._subs[result.params.subscription];\n if (sub) {\n //this.emit.apply(this, );\n sub.processFunc(result.params.result)\n }\n\n } else {\n console.warn(\"this should not happen\");\n }\n };\n\n // This Provider does not actually poll, but we want to trigger\n // poll events for things that depend on them (like stalling for\n // block and transaction lookups)\n const fauxPoll = setInterval(() => {\n this.emit(\"poll\");\n }, 1000);\n if (fauxPoll.unref) { fauxPoll.unref(); }\n }\n\n // Cannot narrow the type of _websocket, as that is not backwards compatible\n // so we add a getter and let the WebSocket be a public API.\n get websocket(): WebSocketLike { return this._websocket; }\n\n detectNetwork(): Promise<Network> {\n return this._detectNetwork;\n }\n\n get pollingInterval(): number {\n return 0;\n }\n\n resetEventsBlock(blockNumber: number): void {\n logger.throwError(\"cannot reset events block on WebSocketProvider\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"resetEventBlock\"\n });\n }\n\n set pollingInterval(value: number) {\n logger.throwError(\"cannot set polling interval on WebSocketProvider\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setPollingInterval\"\n });\n }\n\n async poll(): Promise<void> {\n return null;\n }\n\n set polling(value: boolean) {\n if (!value) { return; }\n\n logger.throwError(\"cannot set polling on WebSocketProvider\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"setPolling\"\n });\n }\n\n send(method: string, params?: Array<any>): Promise<any> {\n const rid = NextId++;\n\n return new Promise((resolve, reject) => {\n function callback(error: Error, result: any) {\n if (error) { return reject(error); }\n return resolve(result);\n }\n\n const payload = JSON.stringify({\n method: method,\n params: params,\n id: rid,\n jsonrpc: \"2.0\"\n });\n\n this.emit(\"debug\", {\n action: \"request\",\n request: JSON.parse(payload),\n provider: this\n });\n\n this._requests[String(rid)] = { callback, payload };\n\n if (this._wsReady) { this.websocket.send(payload); }\n });\n }\n\n static defaultUrl(): string {\n return \"ws:/\\/localhost:8546\";\n }\n\n async _subscribe(tag: string, param: Array<any>, processFunc: (result: any) => void): Promise<void> {\n let subIdPromise = this._subIds[tag];\n if (subIdPromise == null) {\n subIdPromise = Promise.all(param).then((param) => {\n return this.send(\"eth_subscribe\", param);\n });\n this._subIds[tag] = subIdPromise;\n }\n const subId = await subIdPromise;\n this._subs[subId] = { tag, processFunc };\n }\n\n _startEvent(event: Event): void {\n switch (event.type) {\n case \"block\":\n this._subscribe(\"block\", [ \"newHeads\" ], (result: any) => {\n const blockNumber = BigNumber.from(result.number).toNumber();\n this._emitted.block = blockNumber;\n this.emit(\"block\", blockNumber);\n });\n break;\n\n case \"pending\":\n this._subscribe(\"pending\", [ \"newPendingTransactions\" ], (result: any) => {\n this.emit(\"pending\", result);\n });\n break;\n\n case \"filter\":\n this._subscribe(event.tag, [ \"logs\", this._getFilter(event.filter) ], (result: any) => {\n if (result.removed == null) { result.removed = false; }\n this.emit(event.filter, this.formatter.filterLog(result));\n });\n break;\n\n case \"tx\": {\n const emitReceipt = (event: Event) => {\n const hash = event.hash;\n this.getTransactionReceipt(hash).then((receipt) => {\n if (!receipt) { return; }\n this.emit(hash, receipt);\n });\n };\n\n // In case it is already mined\n emitReceipt(event);\n\n // To keep things simple, we start up a single newHeads subscription\n // to keep an eye out for transactions we are watching for.\n // Starting a subscription for an event (i.e. \"tx\") that is already\n // running is (basically) a nop.\n this._subscribe(\"tx\", [ \"newHeads\" ], (result: any) => {\n this._events.filter((e) => (e.type === \"tx\")).forEach(emitReceipt);\n });\n break;\n }\n\n // Nothing is needed\n case \"debug\":\n case \"poll\":\n case \"willPoll\":\n case \"didPoll\":\n case \"error\":\n break;\n\n default:\n console.log(\"unhandled:\", event);\n break;\n }\n }\n\n _stopEvent(event: Event): void {\n let tag = event.tag;\n\n if (event.type === \"tx\") {\n // There are remaining transaction event listeners\n if (this._events.filter((e) => (e.type === \"tx\")).length) {\n return;\n }\n tag = \"tx\";\n } else if (this.listenerCount(event.event)) {\n // There are remaining event listeners\n return;\n }\n\n const subId = this._subIds[tag];\n if (!subId) { return; }\n\n delete this._subIds[tag];\n subId.then((subId) => {\n if (!this._subs[subId]) { return; }\n delete this._subs[subId];\n this.send(\"eth_unsubscribe\", [ subId ]);\n });\n }\n\n async destroy(): Promise<void> {\n // Wait until we have connected before trying to disconnect\n if (this.websocket.readyState === WebSocket.CONNECTING) {\n await (new Promise((resolve) => {\n this.websocket.onopen = function() {\n resolve(true);\n };\n\n this.websocket.onerror = function() {\n resolve(false);\n };\n }));\n }\n\n // Hangup\n // See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes\n this.websocket.close(1000);\n }\n}\n","\n\"use strict\";\n\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { defineReadOnly, getStatic } from \"@ethersproject/properties\";\nimport { ConnectionInfo } from \"@ethersproject/web\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { CommunityResourcable } from \"./formatter\";\nimport { JsonRpcProvider, JsonRpcSigner } from \"./json-rpc-provider\";\n\ntype getUrlFunc = (network: Network, apiKey: string) => string | ConnectionInfo;\n\n// A StaticJsonRpcProvider is useful when you *know* for certain that\n// the backend will never change, as it never calls eth_chainId to\n// verify its backend. However, if the backend does change, the effects\n// are undefined and may include:\n// - inconsistent results\n// - locking up the UI\n// - block skew warnings\n// - wrong results\n// If the network is not explicit (i.e. auto-detection is expected), the\n// node MUST be running and available to respond to requests BEFORE this\n// is instantiated.\nexport class StaticJsonRpcProvider extends JsonRpcProvider {\n async detectNetwork(): Promise<Network> {\n let network = this.network;\n if (network == null) {\n network = await super.detectNetwork();\n\n if (!network) {\n logger.throwError(\"no network detected\", Logger.errors.UNKNOWN_ERROR, { });\n }\n\n // If still not set, set it\n if (this._network == null) {\n // A static network does not support \"any\"\n defineReadOnly(this, \"_network\", network);\n\n this.emit(\"network\", network, null);\n }\n }\n return network;\n }\n}\n\nexport abstract class UrlJsonRpcProvider extends StaticJsonRpcProvider implements CommunityResourcable {\n readonly apiKey: any;\n\n constructor(network?: Networkish, apiKey?: any) {\n logger.checkAbstract(new.target, UrlJsonRpcProvider);\n\n // Normalize the Network and API Key\n network = getStatic<(network: Networkish) => Network>(new.target, \"getNetwork\")(network);\n apiKey = getStatic<(apiKey: string) => string>(new.target, \"getApiKey\")(apiKey);\n\n const connection = getStatic<getUrlFunc>(new.target, \"getUrl\")(network, apiKey);\n\n super(connection, network);\n\n if (typeof(apiKey) === \"string\") {\n defineReadOnly(this, \"apiKey\", apiKey);\n } else if (apiKey != null) {\n Object.keys(apiKey).forEach((key) => {\n defineReadOnly<any, any>(this, key, apiKey[key]);\n });\n }\n }\n\n _startPending(): void {\n logger.warn(\"WARNING: API provider does not support pending filters\");\n }\n\n isCommunityResource(): boolean {\n return false;\n }\n\n getSigner(address?: string): JsonRpcSigner {\n return logger.throwError(\n \"API provider does not support signing\",\n Logger.errors.UNSUPPORTED_OPERATION,\n { operation: \"getSigner\" }\n );\n }\n\n listAccounts(): Promise<Array<string>> {\n return Promise.resolve([]);\n }\n\n // Return a defaultApiKey if null, otherwise validate the API key\n static getApiKey(apiKey: any): any {\n return apiKey;\n }\n\n // Returns the url or connection for the given network and API key. The\n // API key will have been sanitized by the getApiKey first, so any validation\n // or transformations can be done there.\n static getUrl(network: Network, apiKey: any): string | ConnectionInfo {\n return logger.throwError(\"not implemented; sub-classes must override getUrl\", Logger.errors.NOT_IMPLEMENTED, {\n operation: \"getUrl\"\n });\n }\n}\n","\"use strict\";\n\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\nimport { ConnectionInfo } from \"@ethersproject/web\";\n\nimport { CommunityResourcable, showThrottleMessage } from \"./formatter\";\nimport { WebSocketProvider } from \"./websocket-provider\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { UrlJsonRpcProvider } from \"./url-json-rpc-provider\";\n\n// This key was provided to ethers.js by Alchemy to be used by the\n// default provider, but it is recommended that for your own\n// production environments, that you acquire your own API key at:\n// https://dashboard.alchemyapi.io\n\nconst defaultApiKey = \"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC\"\n\nexport class AlchemyWebSocketProvider extends WebSocketProvider implements CommunityResourcable {\n readonly apiKey: string;\n\n constructor(network?: Networkish, apiKey?: any) {\n const provider = new AlchemyProvider(network, apiKey);\n\n const url = provider.connection.url.replace(/^http/i, \"ws\")\n .replace(\".alchemyapi.\", \".ws.alchemyapi.\");\n\n super(url, provider.network);\n defineReadOnly(this, \"apiKey\", provider.apiKey);\n }\n\n isCommunityResource(): boolean {\n return (this.apiKey === defaultApiKey);\n }\n}\n\nexport class AlchemyProvider extends UrlJsonRpcProvider {\n\n static getWebSocketProvider(network?: Networkish, apiKey?: any): AlchemyWebSocketProvider {\n return new AlchemyWebSocketProvider(network, apiKey);\n }\n\n static getApiKey(apiKey: any): any {\n if (apiKey == null) { return defaultApiKey; }\n if (apiKey && typeof(apiKey) !== \"string\") {\n logger.throwArgumentError(\"invalid apiKey\", \"apiKey\", apiKey);\n }\n return apiKey;\n }\n\n static getUrl(network: Network, apiKey: string): ConnectionInfo {\n let host = null;\n switch (network.name) {\n case \"homestead\":\n host = \"eth-mainnet.alchemyapi.io/v2/\";\n break;\n case \"ropsten\":\n host = \"eth-ropsten.alchemyapi.io/v2/\";\n break;\n case \"rinkeby\":\n host = \"eth-rinkeby.alchemyapi.io/v2/\";\n break;\n case \"goerli\":\n host = \"eth-goerli.alchemyapi.io/v2/\";\n break;\n case \"kovan\":\n host = \"eth-kovan.alchemyapi.io/v2/\";\n break;\n case \"matic\":\n host = \"polygon-mainnet.g.alchemy.com/v2/\";\n break;\n case \"maticmum\":\n host = \"polygon-mumbai.g.alchemy.com/v2/\";\n break;\n case \"arbitrum\":\n host = \"arb-mainnet.g.alchemy.com/v2/\";\n break;\n case \"arbitrum-rinkeby\":\n host = \"arb-rinkeby.g.alchemy.com/v2/\";\n break;\n case \"optimism\":\n host = \"opt-mainnet.g.alchemy.com/v2/\";\n break;\n case \"optimism-kovan\":\n host = \"opt-kovan.g.alchemy.com/v2/\";\n break;\n default:\n logger.throwArgumentError(\"unsupported network\", \"network\", arguments[0]);\n }\n\n return {\n allowGzip: true,\n url: (\"https:/\" + \"/\" + host + apiKey),\n throttleCallback: (attempt: number, url: string) => {\n if (apiKey === defaultApiKey) {\n showThrottleMessage();\n }\n return Promise.resolve(true);\n }\n };\n }\n\n isCommunityResource(): boolean {\n return (this.apiKey === defaultApiKey);\n }\n}\n","\nimport { Network } from \"@ethersproject/networks\";\n\nimport { showThrottleMessage } from \"./formatter\";\nimport { UrlJsonRpcProvider } from \"./url-json-rpc-provider\";\n\nimport type { ConnectionInfo } from \"@ethersproject/web\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n\nconst defaultApiKey = \"9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972\";\n\nfunction getHost(name: string): string {\n switch (name) {\n case \"homestead\":\n return \"rpc.ankr.com/eth/\";\n case \"matic\":\n return \"rpc.ankr.com/polygon/\";\n case \"arbitrum\":\n return \"rpc.ankr.com/arbitrum/\";\n }\n return logger.throwArgumentError(\"unsupported network\", \"name\", name);\n}\n\nexport class AnkrProvider extends UrlJsonRpcProvider {\n readonly apiKey: string;\n\n isCommunityResource(): boolean {\n return (this.apiKey === defaultApiKey);\n }\n\n static getApiKey(apiKey: any): any {\n if (apiKey == null) { return defaultApiKey; }\n return apiKey;\n }\n\n static getUrl(network: Network, apiKey: any): ConnectionInfo {\n if (apiKey == null) { apiKey = defaultApiKey; }\n const connection: ConnectionInfo = {\n allowGzip: true,\n url: (\"https:/\\/\" + getHost(network.name) + apiKey),\n throttleCallback: (attempt: number, url: string) => {\n if (apiKey.apiKey === defaultApiKey) {\n showThrottleMessage();\n }\n return Promise.resolve(true);\n }\n };\n\n if (apiKey.projectSecret != null) {\n connection.user = \"\";\n connection.password = apiKey.projectSecret\n }\n\n return connection;\n }\n}\n","\"use strict\";\n\nimport { Network } from \"@ethersproject/networks\";\nimport { UrlJsonRpcProvider } from \"./url-json-rpc-provider\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nexport class CloudflareProvider extends UrlJsonRpcProvider {\n\n static getApiKey(apiKey: any): any {\n if (apiKey != null) {\n logger.throwArgumentError(\"apiKey not supported for cloudflare\", \"apiKey\", apiKey);\n }\n return null;\n }\n\n static getUrl(network: Network, apiKey?: any): string {\n let host = null;\n switch (network.name) {\n case \"homestead\":\n host = \"https://cloudflare-eth.com/\";\n break;\n default:\n logger.throwArgumentError(\"unsupported network\", \"network\", arguments[0]);\n }\n\n return host;\n }\n\n async perform(method: string, params: any): Promise<any> {\n // The Cloudflare provider does not support eth_blockNumber,\n // so we get the latest block and pull it from that\n if (method === \"getBlockNumber\") {\n const block = await super.perform(\"getBlock\", { blockTag: \"latest\" });\n return block.number;\n }\n\n return super.perform(method, params);\n }\n}\n","\"use strict\";\n\nimport { BlockTag, TransactionRequest, TransactionResponse } from \"@ethersproject/abstract-provider\";\nimport { hexlify, hexValue, isHexString } from \"@ethersproject/bytes\";\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { deepCopy, defineReadOnly } from \"@ethersproject/properties\";\nimport { accessListify } from \"@ethersproject/transactions\";\nimport { ConnectionInfo, fetchJson } from \"@ethersproject/web\";\n\nimport { showThrottleMessage } from \"./formatter\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { BaseProvider } from \"./base-provider\";\n\n\n// The transaction has already been sanitized by the calls in Provider\nfunction getTransactionPostData(transaction: TransactionRequest): Record<string, string> {\n const result: Record<string, string> = { };\n for (let key in transaction) {\n if ((<any>transaction)[key] == null) { continue; }\n let value = (<any>transaction)[key];\n if (key === \"type\" && value === 0) { continue; }\n\n // Quantity-types require no leading zero, unless 0\n if ((<any>{ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true })[key]) {\n value = hexValue(hexlify(value));\n } else if (key === \"accessList\") {\n value = \"[\" + accessListify(value).map((set) => {\n return `{address:\"${ set.address }\",storageKeys:[\"${ set.storageKeys.join('\",\"') }\"]}`;\n }).join(\",\") + \"]\";\n } else {\n value = hexlify(value);\n }\n result[key] = value;\n }\n return result;\n}\n\nfunction getResult(result: { status?: number, message?: string, result?: any }): any {\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 const error: any = new Error(\"invalid response\");\n error.result = JSON.stringify(result);\n if ((result.result || \"\").toLowerCase().indexOf(\"rate limit\") >= 0) {\n error.throttleRetry = true;\n }\n throw error;\n }\n\n return result.result;\n}\n\nfunction getJsonResult(result: { jsonrpc: string, result?: any, error?: { code?: number, data?: any, message?: string} } ): any {\n // This response indicates we are being throttled\n if (result && (<any>result).status == 0 && (<any>result).message == \"NOTOK\" && (result.result || \"\").toLowerCase().indexOf(\"rate limit\") >= 0) {\n const error: any = new Error(\"throttled response\");\n error.result = JSON.stringify(result);\n error.throttleRetry = true;\n throw error;\n }\n\n if (result.jsonrpc != \"2.0\") {\n // @TODO: not any\n const 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 const 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\nconst defaultApiKey = \"9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB\";\n\nfunction checkError(method: string, error: any, transaction: any): any {\n // Undo the \"convenience\" some nodes are attempting to prevent backwards\n // incompatibility; maybe for v6 consider forwarding reverts as errors\n if (method === \"call\" && error.code === Logger.errors.SERVER_ERROR) {\n const e = error.error;\n\n // Etherscan keeps changing their string\n if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) {\n // Etherscan prefixes the data like \"Reverted 0x1234\"\n let data = e.data;\n if (data) { data = \"0x\" + data.replace(/^.*0x/i, \"\"); }\n\n if (isHexString(data)) { return data; }\n\n logger.throwError(\"missing revert data in call exception\", Logger.errors.CALL_EXCEPTION, {\n error, data: \"0x\"\n });\n }\n }\n\n // Get the message from any nested error structure\n let message = error.message;\n if (error.code === Logger.errors.SERVER_ERROR) {\n if (error.error && typeof(error.error.message) === \"string\") {\n message = error.error.message;\n } else if (typeof(error.body) === \"string\") {\n message = error.body;\n } else if (typeof(error.responseText) === \"string\") {\n message = error.responseText;\n }\n }\n message = (message || \"\").toLowerCase();\n\n // \"Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 21464000000000 and got: 0\"\n if (message.match(/insufficient funds/)) {\n logger.throwError(\"insufficient funds for intrinsic transaction cost\", Logger.errors.INSUFFICIENT_FUNDS, {\n error, method, transaction\n });\n }\n\n // \"Transaction with the same hash was already imported.\"\n if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {\n logger.throwError(\"nonce has already been used\", Logger.errors.NONCE_EXPIRED, {\n error, method, transaction\n });\n }\n\n // \"Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce.\"\n if (message.match(/another transaction with same nonce/)) {\n logger.throwError(\"replacement fee too low\", Logger.errors.REPLACEMENT_UNDERPRICED, {\n error, method, transaction\n });\n }\n\n if (message.match(/execution failed due to an exception|execution reverted/)) {\n logger.throwError(\"cannot estimate gas; transaction may fail or may require manual gas limit\", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {\n error, method, transaction\n });\n }\n\n throw error;\n}\n\nexport class EtherscanProvider extends BaseProvider{\n readonly baseUrl: string;\n readonly apiKey: string;\n\n constructor(network?: Networkish, apiKey?: string) {\n logger.checkNew(new.target, EtherscanProvider);\n\n super(network);\n\n defineReadOnly(this, \"baseUrl\", this.getBaseUrl());\n defineReadOnly(this, \"apiKey\", apiKey || defaultApiKey);\n }\n\n getBaseUrl(): string {\n switch(this.network ? this.network.name: \"invalid\") {\n case \"homestead\":\n return \"https:/\\/api.etherscan.io\";\n case \"ropsten\":\n return \"https:/\\/api-ropsten.etherscan.io\";\n case \"rinkeby\":\n return \"https:/\\/api-rinkeby.etherscan.io\";\n case \"kovan\":\n return \"https:/\\/api-kovan.etherscan.io\";\n case \"goerli\":\n return \"https:/\\/api-goerli.etherscan.io\";\n default:\n }\n\n return logger.throwArgumentError(\"unsupported network\", \"network\", name);\n }\n\n getUrl(module: string, params: Record<string, string>): string {\n const query = Object.keys(params).reduce((accum, key) => {\n const value = params[key];\n if (value != null) {\n accum += `&${ key }=${ value }`\n }\n return accum\n }, \"\");\n const apiKey = ((this.apiKey) ? `&apikey=${ this.apiKey }`: \"\");\n return `${ this.baseUrl }/api?module=${ module }${ query }${ apiKey }`;\n }\n\n getPostUrl(): string {\n return `${ this.baseUrl }/api`;\n }\n\n getPostData(module: string, params: Record<string, any>): Record<string, any> {\n params.module = module;\n params.apikey = this.apiKey;\n return params;\n }\n\n async fetch(module: string, params: Record<string, any>, post?: boolean): Promise<any> {\n const url = (post ? this.getPostUrl(): this.getUrl(module, params));\n const payload = (post ? this.getPostData(module, params): null);\n const procFunc = (module === \"proxy\") ? getJsonResult: getResult;\n\n this.emit(\"debug\", {\n action: \"request\",\n request: url,\n provider: this\n });\n\n const connection: ConnectionInfo = {\n url: url,\n throttleSlotInterval: 1000,\n throttleCallback: (attempt: number, url: string) => {\n if (this.isCommunityResource()) {\n showThrottleMessage();\n }\n return Promise.resolve(true);\n }\n };\n\n let payloadStr: string = null;\n if (payload) {\n connection.headers = { \"content-type\": \"application/x-www-form-urlencoded; charset=UTF-8\" };\n payloadStr = Object.keys(payload).map((key) => {\n return `${ key }=${ payload[key] }`\n }).join(\"&\");\n }\n\n const result = await fetchJson(connection, payloadStr, procFunc || getJsonResult);\n\n this.emit(\"debug\", {\n action: \"response\",\n request: url,\n response: deepCopy(result),\n provider: this\n });\n\n return result;\n }\n\n async detectNetwork(): Promise<Network> {\n return this.network;\n }\n\n async perform(method: string, params: any): Promise<any> {\n\n switch (method) {\n case \"getBlockNumber\":\n return this.fetch(\"proxy\", { action: \"eth_blockNumber\" });\n\n case \"getGasPrice\":\n return this.fetch(\"proxy\", { action: \"eth_gasPrice\" });\n\n case \"getBalance\":\n // Returns base-10 result\n return this.fetch(\"account\", {\n action: \"balance\",\n address: params.address,\n tag: params.blockTag\n });\n\n case \"getTransactionCount\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionCount\",\n address: params.address,\n tag: params.blockTag\n });\n\n case \"getCode\":\n return this.fetch(\"proxy\", {\n action: \"eth_getCode\",\n address: params.address,\n tag: params.blockTag\n });\n\n case \"getStorageAt\":\n return this.fetch(\"proxy\", {\n action: \"eth_getStorageAt\",\n address: params.address,\n position: params.position,\n tag: params.blockTag\n });\n\n case \"sendTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_sendRawTransaction\",\n hex: params.signedTransaction\n }, true).catch((error) => {\n return checkError(\"sendTransaction\", error, params.signedTransaction);\n });\n\n case \"getBlock\":\n if (params.blockTag) {\n return this.fetch(\"proxy\", {\n action: \"eth_getBlockByNumber\",\n tag: params.blockTag,\n boolean: (params.includeTransactions ? \"true\": \"false\")\n });\n }\n throw new Error(\"getBlock by blockHash not implemented\");\n\n case \"getTransaction\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionByHash\",\n txhash: params.transactionHash\n });\n\n case \"getTransactionReceipt\":\n return this.fetch(\"proxy\", {\n action: \"eth_getTransactionReceipt\",\n txhash: params.transactionHash\n });\n\n case \"call\": {\n if (params.blockTag !== \"latest\") {\n throw new Error(\"EtherscanProvider does not support blockTag for call\");\n }\n\n const postData = getTransactionPostData(params.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_call\";\n\n try {\n return await this.fetch(\"proxy\", postData, true);\n } catch (error) {\n return checkError(\"call\", error, params.transaction);\n }\n }\n\n case \"estimateGas\": {\n const postData = getTransactionPostData(params.transaction);\n postData.module = \"proxy\";\n postData.action = \"eth_estimateGas\";\n\n try {\n return await this.fetch(\"proxy\", postData, true);\n } catch (error) {\n return checkError(\"estimateGas\", error, params.transaction);\n }\n }\n\n case \"getLogs\": {\n const args: Record<string, any> = { action: \"getLogs\" }\n\n if (params.filter.fromBlock) {\n args.fromBlock = checkLogTag(params.filter.fromBlock);\n }\n\n if (params.filter.toBlock) {\n args.toBlock = checkLogTag(params.filter.toBlock);\n }\n\n if (params.filter.address) {\n args.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 logger.throwError(\"unsupported topic count\", Logger.errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });\n }\n\n if (params.filter.topics.length === 1) {\n const topic0 = params.filter.topics[0];\n if (typeof(topic0) !== \"string\" || topic0.length !== 66) {\n logger.throwError(\"unsupported topic format\", Logger.errors.UNSUPPORTED_OPERATION, { topic0: topic0 });\n }\n args.topic0 = topic0;\n }\n }\n\n const logs: Array<any> = await this.fetch(\"logs\", args);\n\n // Cache txHash => blockHash\n let blocks: { [tag: string]: string } = {};\n\n // Add any missing blockHash to the logs\n for (let i = 0; i < logs.length; i++) {\n const log = logs[i];\n if (log.blockHash != null) { continue; }\n if (blocks[log.blockNumber] == null) {\n const block = await this.getBlock(log.blockNumber);\n if (block) {\n blocks[log.blockNumber] = block.hash;\n }\n }\n log.blockHash = blocks[log.blockNumber];\n }\n\n return logs;\n }\n\n case \"getEtherPrice\":\n if (this.network.name !== \"homestead\") { return 0.0; }\n return parseFloat((await this.fetch(\"stats\", { action: \"ethprice\" })).ethusd);\n\n default:\n break;\n }\n\n return super.perform(method, params);\n }\n\n // Note: The `page` page parameter only allows pagination within the\n // 10,000 window available without a page and offset parameter\n // Error: Result window is too large, PageNo x Offset size must\n // be less than or equal to 10000\n async getHistory(addressOrName: string | Promise<string>, startBlock?: BlockTag, endBlock?: BlockTag): Promise<Array<TransactionResponse>> {\n const params = {\n action: \"txlist\",\n address: (await this.resolveName(addressOrName)),\n startblock: ((startBlock == null) ? 0: startBlock),\n endblock: ((endBlock == null) ? 99999999: endBlock),\n sort: \"asc\"\n };\n\n const result = await this.fetch(\"account\", params);\n\n return result.map((tx: any) => {\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 const item = this.formatter.transactionResponse(tx);\n if (tx.timeStamp) { item.timestamp = parseInt(tx.timeStamp); }\n return item;\n });\n }\n\n isCommunityResource(): boolean {\n return (this.apiKey === defaultApiKey);\n }\n}\n","\"use strict\";\n\nimport { Block, BlockWithTransactions, Provider } from \"@ethersproject/abstract-provider\";\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { isHexString } from \"@ethersproject/bytes\";\nimport { Network } from \"@ethersproject/networks\";\nimport { deepCopy, defineReadOnly, shallowCopy } from \"@ethersproject/properties\";\nimport { shuffled } from \"@ethersproject/random\";\nimport { poll } from \"@ethersproject/web\";\n\nimport { BaseProvider } from \"./base-provider\";\nimport { isCommunityResource } from \"./formatter\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nfunction now() { return (new Date()).getTime(); }\n\n// Returns to network as long as all agree, or null if any is null.\n// Throws an error if any two networks do not match.\nfunction checkNetworks(networks: Array<Network>): Network {\n let result = null;\n\n for (let i = 0; i < networks.length; i++) {\n const network = networks[i];\n\n // Null! We do not know our network; bail.\n if (network == null) { return null; }\n\n if (result) {\n // Make sure the network matches the previous networks\n if (!(result.name === network.name && result.chainId === network.chainId &&\n ((result.ensAddress === network.ensAddress) || (result.ensAddress == null && network.ensAddress == null)))) {\n\n logger.throwArgumentError(\"provider mismatch\", \"networks\", networks);\n }\n } else {\n result = network;\n }\n }\n\n return result;\n}\n\nfunction median(values: Array<number>, maxDelta?: number): number {\n values = values.slice().sort();\n const middle = Math.floor(values.length / 2);\n\n // Odd length; take the middle\n if (values.length % 2) {\n return values[middle];\n }\n\n // Even length; take the average of the two middle\n const a = values[middle - 1], b = values[middle];\n\n if (maxDelta != null && Math.abs(a - b) > maxDelta) {\n return null;\n }\n\n return (a + b) / 2;\n}\n\nfunction serialize(value: any): string {\n if (value === null) {\n return \"null\";\n } else if (typeof(value) === \"number\" || typeof(value) === \"boolean\") {\n return JSON.stringify(value);\n } else if (typeof(value) === \"string\") {\n return value;\n } else if (BigNumber.isBigNumber(value)) {\n return value.toString();\n } else if (Array.isArray(value)) {\n return JSON.stringify(value.map((i) => serialize(i)));\n } else if (typeof(value) === \"object\") {\n const keys = Object.keys(value);\n keys.sort();\n return \"{\" + keys.map((key) => {\n let v = value[key];\n if (typeof(v) === \"function\") {\n v = \"[function]\";\n } else {\n v = serialize(v);\n }\n return JSON.stringify(key) + \":\" + v;\n }).join(\",\") + \"}\";\n }\n\n throw new Error(\"unknown value type: \" + typeof(value));\n}\n\n// Next request ID to use for emitting debug info\nlet nextRid = 1;\n\n\nexport interface FallbackProviderConfig {\n // The Provider\n provider: Provider;\n\n // The priority to favour this Provider; lower values are used first (higher priority)\n priority?: number;\n\n // Timeout before also triggering the next provider; this does not stop\n // this provider and if its result comes back before a quorum is reached\n // it will be incorporated into the vote\n // - lower values will cause more network traffic but may result in a\n // faster result.\n stallTimeout?: number;\n\n // How much this provider contributes to the quorum; sometimes a specific\n // provider may be more reliable or trustworthy than others, but usually\n // this should be left as the default\n weight?: number;\n};\n\n// A Staller is used to provide a delay to give a Provider a chance to response\n// before asking the next Provider to try.\ntype Staller = {\n wait: (func: () => void) => Promise<void>\n getPromise: () => Promise<void>,\n cancel: () => void\n};\n\nfunction stall(duration: number): Staller {\n let cancel: () => void = null;\n\n let timer: NodeJS.Timer = null;\n let promise = <Promise<void>>(new Promise((resolve) => {\n cancel = function() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n resolve();\n }\n timer = setTimeout(cancel, duration);\n }));\n\n const wait = (func: () => void) => {\n promise = promise.then(func);\n return promise;\n }\n\n function getPromise(): Promise<void> {\n return promise;\n }\n\n return { cancel, getPromise, wait };\n}\n\nconst ForwardErrors = [\n Logger.errors.CALL_EXCEPTION,\n Logger.errors.INSUFFICIENT_FUNDS,\n Logger.errors.NONCE_EXPIRED,\n Logger.errors.REPLACEMENT_UNDERPRICED,\n Logger.errors.UNPREDICTABLE_GAS_LIMIT\n];\n\nconst ForwardProperties = [\n \"address\",\n \"args\",\n \"errorArgs\",\n \"errorSignature\",\n \"method\",\n \"transaction\",\n];\n\n\n// @TODO: Make this an object with staller and cancel built-in\ninterface RunningConfig extends FallbackProviderConfig {\n start?: number;\n done?: boolean;\n cancelled?: boolean;\n runner?: Promise<any>;\n staller?: Staller;\n result?: any;\n error?: Error;\n};\n\nfunction exposeDebugConfig(config: RunningConfig, now?: number): any {\n const result: any = {\n weight: config.weight\n };\n Object.defineProperty(result, \"provider\", { get: () => config.provider });\n if (config.start) { result.start = config.start; }\n if (now) { result.duration = (now - config.start); }\n if (config.done) {\n if (config.error) {\n result.error = config.error;\n } else {\n result.result = config.result || null;\n }\n }\n return result;\n}\n\nfunction normalizedTally(normalize: (value: any) => string, quorum: number): (configs: Array<RunningConfig>) => any {\n return function(configs: Array<RunningConfig>): any {\n\n // Count the votes for each result\n const tally: { [ key: string]: { count: number, result: any } } = { };\n configs.forEach((c) => {\n const value = normalize(c.result);\n if (!tally[value]) { tally[value] = { count: 0, result: c.result }; }\n tally[value].count++;\n });\n\n // Check for a quorum on any given result\n const keys = Object.keys(tally);\n for (let i = 0; i < keys.length; i++) {\n const check = tally[keys[i]];\n if (check.count >= quorum) {\n return check.result;\n }\n }\n\n // No quroum\n return undefined;\n }\n}\nfunction getProcessFunc(provider: FallbackProvider, method: string, params: { [ key: string ]: any }): (configs: Array<RunningConfig>) => any {\n\n let normalize = serialize;\n\n switch (method) {\n case \"getBlockNumber\":\n // Return the median value, unless there is (median + 1) is also\n // present, in which case that is probably true and the median\n // is going to be stale soon. In the event of a malicious node,\n // the lie will be true soon enough.\n return function(configs: Array<RunningConfig>): number {\n const values = configs.map((c) => c.result);\n\n // Get the median block number\n let blockNumber = median(configs.map((c) => c.result), 2);\n if (blockNumber == null) { return undefined; }\n\n blockNumber = Math.ceil(blockNumber);\n\n // If the next block height is present, its prolly safe to use\n if (values.indexOf(blockNumber + 1) >= 0) { blockNumber++; }\n\n // Don't ever roll back the blockNumber\n if (blockNumber >= provider._highestBlockNumber) {\n provider._highestBlockNumber = blockNumber;\n }\n\n return provider._highestBlockNumber;\n };\n\n case \"getGasPrice\":\n // Return the middle (round index up) value, similar to median\n // but do not average even entries and choose the higher.\n // Malicious actors must compromise 50% of the nodes to lie.\n return function(configs: Array<RunningConfig>): BigNumber {\n const values = configs.map((c) => c.result);\n values.sort();\n return values[Math.floor(values.length / 2)];\n }\n\n case \"getEtherPrice\":\n // Returns the median price. Malicious actors must compromise at\n // least 50% of the nodes to lie (in a meaningful way).\n return function(configs: Array<RunningConfig>): number {\n return median(configs.map((c) => c.result));\n }\n\n // No additional normalizing required; serialize is enough\n case \"getBalance\":\n case \"getTransactionCount\":\n case \"getCode\":\n case \"getStorageAt\":\n case \"call\":\n case \"estimateGas\":\n case \"getLogs\":\n break;\n\n // We drop the confirmations from transactions as it is approximate\n case \"getTransaction\":\n case \"getTransactionReceipt\":\n normalize = function(tx: any): string {\n if (tx == null) { return null; }\n\n tx = shallowCopy(tx);\n tx.confirmations = -1;\n return serialize(tx);\n }\n break;\n\n // We drop the confirmations from transactions as it is approximate\n case \"getBlock\":\n // We drop the confirmations from transactions as it is approximate\n if (params.includeTransactions) {\n normalize = function(block: BlockWithTransactions): string {\n if (block == null) { return null; }\n\n block = shallowCopy(block);\n block.transactions = block.transactions.map((tx) => {\n tx = shallowCopy(tx);\n tx.confirmations = -1;\n return tx;\n });\n return serialize(block);\n };\n } else {\n normalize = function(block: Block): string {\n if (block == null) { return null; }\n return serialize(block);\n }\n }\n break;\n\n default:\n throw new Error(\"unknown method: \" + method);\n }\n\n // Return the result if and only if the expected quorum is\n // satisfied and agreed upon for the final result.\n return normalizedTally(normalize, provider.quorum);\n\n}\n\n// If we are doing a blockTag query, we need to make sure the backend is\n// caught up to the FallbackProvider, before sending a request to it.\nasync function waitForSync(config: RunningConfig, blockNumber: number): Promise<BaseProvider> {\n const provider = <BaseProvider>(config.provider);\n\n if ((provider.blockNumber != null && provider.blockNumber >= blockNumber) || blockNumber === -1) {\n return provider;\n }\n\n return poll(() => {\n return new Promise((resolve, reject) => {\n setTimeout(function() {\n\n // We are synced\n if (provider.blockNumber >= blockNumber) { return resolve(provider); }\n\n // We're done; just quit\n if (config.cancelled) { return resolve(null); }\n\n // Try again, next block\n return resolve(undefined);\n }, 0);\n });\n }, { oncePoll: provider });\n}\n\nasync function getRunner(config: RunningConfig, currentBlockNumber: number, method: string, params: { [ key: string]: any }): Promise<any> {\n let provider = config.provider;\n\n switch (method) {\n case \"getBlockNumber\":\n case \"getGasPrice\":\n return provider[method]();\n case \"getEtherPrice\":\n if ((<any>provider).getEtherPrice) {\n return (<any>provider).getEtherPrice();\n }\n break;\n case \"getBalance\":\n case \"getTransactionCount\":\n case \"getCode\":\n if (params.blockTag && isHexString(params.blockTag)) {\n provider = await waitForSync(config, currentBlockNumber)\n }\n return provider[method](params.address, params.blockTag || \"latest\");\n case \"getStorageAt\":\n if (params.blockTag && isHexString(params.blockTag)) {\n provider = await waitForSync(config, currentBlockNumber)\n }\n return provider.getStorageAt(params.address, params.position, params.blockTag || \"latest\");\n case \"getBlock\":\n if (params.blockTag && isHexString(params.blockTag)) {\n provider = await waitForSync(config, currentBlockNumber)\n }\n return provider[(params.includeTransactions ? \"getBlockWithTransactions\": \"getBlock\")](params.blockTag || params.blockHash);\n case \"call\":\n case \"estimateGas\":\n if (params.blockTag && isHexString(params.blockTag)) {\n provider = await waitForSync(config, currentBlockNumber)\n }\n return provider[method](params.transaction);\n case \"getTransaction\":\n case \"getTransactionReceipt\":\n return provider[method](params.transactionHash);\n case \"getLogs\": {\n let filter = params.filter;\n if ((filter.fromBlock && isHexString(filter.fromBlock)) || (filter.toBlock && isHexString(filter.toBlock))) {\n provider = await waitForSync(config, currentBlockNumber)\n }\n return provider.getLogs(filter);\n }\n }\n\n return logger.throwError(\"unknown method error\", Logger.errors.UNKNOWN_ERROR, {\n method: method,\n params: params\n });\n}\n\nexport class FallbackProvider extends BaseProvider {\n readonly providerConfigs: ReadonlyArray<FallbackProviderConfig>;\n readonly quorum: number;\n\n // Due to the highly asyncronous nature of the blockchain, we need\n // to make sure we never unroll the blockNumber due to our random\n // sample of backends\n _highestBlockNumber: number;\n\n constructor(providers: Array<Provider | FallbackProviderConfig>, quorum?: number) {\n logger.checkNew(new.target, FallbackProvider);\n\n if (providers.length === 0) {\n logger.throwArgumentError(\"missing providers\", \"providers\", providers);\n }\n\n const providerConfigs: Array<FallbackProviderConfig> = providers.map((configOrProvider, index) => {\n if (Provider.isProvider(configOrProvider)) {\n const stallTimeout = isCommunityResource(configOrProvider) ? 2000: 750;\n const priority = 1;\n return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority });\n }\n\n const config: FallbackProviderConfig = shallowCopy(configOrProvider);\n\n if (config.priority == null) { config.priority = 1; }\n if (config.stallTimeout == null) {\n config.stallTimeout = isCommunityResource(configOrProvider) ? 2000: 750;\n }\n if (config.weight == null) { config.weight = 1; }\n\n const weight = config.weight;\n if (weight % 1 || weight > 512 || weight < 1) {\n logger.throwArgumentError(\"invalid weight; must be integer in [1, 512]\", `providers[${ index }].weight`, weight);\n }\n\n return Object.freeze(config);\n });\n\n const total = providerConfigs.reduce((accum, c) => (accum + c.weight), 0);\n\n if (quorum == null) {\n quorum = total / 2;\n } else if (quorum > total) {\n logger.throwArgumentError(\"quorum will always fail; larger than total weight\", \"quorum\", quorum);\n }\n\n // Are all providers' networks are known\n let networkOrReady: Network | Promise<Network> = checkNetworks(providerConfigs.map((c) => (<any>(c.provider)).network));\n\n // Not all networks are known; we must stall\n if (networkOrReady == null) {\n networkOrReady = new Promise((resolve, reject) => {\n setTimeout(() => {\n this.detectNetwork().then(resolve, reject);\n }, 0);\n });\n }\n\n super(networkOrReady);\n\n // Preserve a copy, so we do not get mutated\n defineReadOnly(this, \"providerConfigs\", Object.freeze(providerConfigs));\n defineReadOnly(this, \"quorum\", quorum);\n\n this._highestBlockNumber = -1;\n }\n\n async detectNetwork(): Promise<Network> {\n const networks = await Promise.all(this.providerConfigs.map((c) => c.provider.getNetwork()));\n return checkNetworks(networks);\n }\n\n async perform(method: string, params: { [name: string]: any }): Promise<any> {\n // Sending transactions is special; always broadcast it to all backends\n if (method === \"sendTransaction\") {\n const results: Array<string | Error> = await Promise.all(this.providerConfigs.map((c) => {\n return c.provider.sendTransaction(params.signedTransaction).then((result) => {\n return result.hash;\n }, (error) => {\n return error;\n });\n }));\n\n // Any success is good enough (other errors are likely \"already seen\" errors\n for (let i = 0; i < results.length; i++) {\n const result = results[i];\n if (typeof(result) === \"string\") { return result; }\n }\n\n // They were all an error; pick the first error\n throw results[0];\n }\n\n // We need to make sure we are in sync with our backends, so we need\n // to know this before we can make a lot of calls\n if (this._highestBlockNumber === -1 && method !== \"getBlockNumber\") {\n await this.getBlockNumber();\n }\n\n const processFunc = getProcessFunc(this, method, params);\n\n // Shuffle the providers and then sort them by their priority; we\n // shallowCopy them since we will store the result in them too\n const configs: Array<RunningConfig> = shuffled(this.providerConfigs.map(shallowCopy));\n configs.sort((a, b) => (a.priority - b.priority));\n\n const currentBlockNumber = this._highestBlockNumber;\n\n let i = 0;\n let first = true;\n while (true) {\n const t0 = now();\n\n // Compute the inflight weight (exclude anything past)\n let inflightWeight = configs.filter((c) => (c.runner && ((t0 - c.start) < c.stallTimeout)))\n .reduce((accum, c) => (accum + c.weight), 0);\n\n // Start running enough to meet quorum\n while (inflightWeight < this.quorum && i < configs.length) {\n const config = configs[i++];\n\n const rid = nextRid++;\n\n config.start = now();\n config.staller = stall(config.stallTimeout);\n config.staller.wait(() => { config.staller = null; });\n\n config.runner = getRunner(config, currentBlockNumber, method, params).then((result) => {\n config.done = true;\n config.result = result;\n\n if (this.listenerCount(\"debug\")) {\n this.emit(\"debug\", {\n action: \"request\",\n rid: rid,\n backend: exposeDebugConfig(config, now()),\n request: { method: method, params: deepCopy(params) },\n provider: this\n });\n }\n\n }, (error) => {\n config.done = true;\n config.error = error;\n\n if (this.listenerCount(\"debug\")) {\n this.emit(\"debug\", {\n action: \"request\",\n rid: rid,\n backend: exposeDebugConfig(config, now()),\n request: { method: method, params: deepCopy(params) },\n provider: this\n });\n }\n });\n\n if (this.listenerCount(\"debug\")) {\n this.emit(\"debug\", {\n action: \"request\",\n rid: rid,\n backend: exposeDebugConfig(config, null),\n request: { method: method, params: deepCopy(params) },\n provider: this\n });\n }\n\n inflightWeight += config.weight;\n }\n\n // Wait for anything meaningful to finish or stall out\n const waiting: Array<Promise<any>> = [ ];\n configs.forEach((c) => {\n if (c.done || !c.runner) { return; }\n waiting.push(c.runner);\n if (c.staller) { waiting.push(c.staller.getPromise()); }\n });\n\n if (waiting.length) { await Promise.race(waiting); }\n\n // Check the quorum and process the results; the process function\n // may additionally decide the quorum is not met\n const results = configs.filter((c) => (c.done && c.error == null));\n if (results.length >= this.quorum) {\n const result = processFunc(results);\n if (result !== undefined) {\n // Shut down any stallers\n configs.forEach(c => {\n if (c.staller) { c.staller.cancel(); }\n c.cancelled = true;\n });\n return result;\n }\n if (!first) { await stall(100).getPromise(); }\n first = false;\n }\n\n // No result, check for errors that should be forwarded\n const errors = configs.reduce((accum, c) => {\n if (!c.done || c.error == null) { return accum; }\n\n const code = (<any>(c.error)).code;\n if (ForwardErrors.indexOf(code) >= 0) {\n if (!accum[code]) { accum[code] = { error: c.error, weight: 0 }; }\n accum[code].weight += c.weight;\n }\n\n return accum;\n }, <{ [ code: string ]: { error: Error, weight: number } }>({ }));\n\n Object.keys(errors).forEach((errorCode: string) => {\n const tally = errors[errorCode];\n if (tally.weight < this.quorum) { return; }\n\n // Shut down any stallers\n configs.forEach(c => {\n if (c.staller) { c.staller.cancel(); }\n c.cancelled = true;\n });\n\n const e = <any>(tally.error);\n\n const props: { [ name: string ]: any } = { };\n ForwardProperties.forEach((name) => {\n if (e[name] == null) { return; }\n props[name] = e[name];\n });\n\n logger.throwError(e.reason || e.message, <any>errorCode, props);\n });\n\n // All configs have run to completion; we will never get more data\n if (configs.filter((c) => !c.done).length === 0) { break; }\n }\n\n // Shut down any stallers; shouldn't be any\n configs.forEach(c => {\n if (c.staller) { c.staller.cancel(); }\n c.cancelled = true;\n });\n\n return logger.throwError(\"failed to meet quorum\", Logger.errors.SERVER_ERROR, {\n method: method,\n params: params,\n //results: configs.map((c) => c.result),\n //errors: configs.map((c) => c.error),\n results: configs.map((c) => exposeDebugConfig(c)),\n provider: this\n });\n }\n}\n","\"use strict\";\n\nconst IpcProvider: any = null;\n\nexport {\n IpcProvider\n};\n","\"use strict\";\n\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { defineReadOnly } from \"@ethersproject/properties\";\nimport { ConnectionInfo } from \"@ethersproject/web\";\n\nimport { WebSocketProvider } from \"./websocket-provider\";\nimport { CommunityResourcable, showThrottleMessage } from \"./formatter\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { UrlJsonRpcProvider } from \"./url-json-rpc-provider\";\n\n\nconst defaultProjectId = \"84842078b09946638c03157f83405213\"\n\nexport class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable {\n readonly apiKey: string;\n readonly projectId: string;\n readonly projectSecret: string;\n\n constructor(network?: Networkish, apiKey?: any) {\n const provider = new InfuraProvider(network, apiKey);\n const connection = provider.connection;\n if (connection.password) {\n logger.throwError(\"INFURA WebSocket project secrets unsupported\", Logger.errors.UNSUPPORTED_OPERATION, {\n operation: \"InfuraProvider.getWebSocketProvider()\"\n });\n }\n\n const url = connection.url.replace(/^http/i, \"ws\").replace(\"/v3/\", \"/ws/v3/\");\n super(url, network);\n\n defineReadOnly(this, \"apiKey\", provider.projectId);\n defineReadOnly(this, \"projectId\", provider.projectId);\n defineReadOnly(this, \"projectSecret\", provider.projectSecret);\n }\n\n isCommunityResource(): boolean {\n return (this.projectId === defaultProjectId);\n }\n}\n\nexport class InfuraProvider extends UrlJsonRpcProvider {\n readonly projectId: string;\n readonly projectSecret: string;\n\n static getWebSocketProvider(network?: Networkish, apiKey?: any): InfuraWebSocketProvider {\n return new InfuraWebSocketProvider(network, apiKey);\n }\n\n static getApiKey(apiKey: any): any {\n const apiKeyObj: { apiKey: string, projectId: string, projectSecret: string } = {\n apiKey: defaultProjectId,\n projectId: defaultProjectId,\n projectSecret: null\n };\n\n if (apiKey == null) { return apiKeyObj; }\n\n if (typeof(apiKey) === \"string\") {\n apiKeyObj.projectId = apiKey;\n\n } else if (apiKey.projectSecret != null) {\n logger.assertArgument((typeof(apiKey.projectId) === \"string\"),\n \"projectSecret requires a projectId\", \"projectId\", apiKey.projectId);\n logger.assertArgument((typeof(apiKey.projectSecret) === \"string\"),\n \"invalid projectSecret\", \"projectSecret\", \"[REDACTED]\");\n\n apiKeyObj.projectId = apiKey.projectId;\n apiKeyObj.projectSecret = apiKey.projectSecret;\n\n } else if (apiKey.projectId) {\n apiKeyObj.projectId = apiKey.projectId;\n }\n\n apiKeyObj.apiKey = apiKeyObj.projectId;\n\n return apiKeyObj;\n }\n\n static getUrl(network: Network, apiKey: any): ConnectionInfo {\n let host: string = null;\n switch(network ? network.name: \"unknown\") {\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 case \"goerli\":\n host = \"goerli.infura.io\";\n break;\n case \"matic\":\n host = \"polygon-mainnet.infura.io\";\n break;\n case \"maticmum\":\n host = \"polygon-mumbai.infura.io\";\n break;\n case \"optimism\":\n host = \"optimism-mainnet.infura.io\";\n break;\n case \"optimism-kovan\":\n host = \"optimism-kovan.infura.io\";\n break;\n case \"arbitrum\":\n host = \"arbitrum-mainnet.infura.io\";\n break;\n case \"arbitrum-rinkeby\":\n host = \"arbitrum-rinkeby.infura.io\";\n break;\n default:\n logger.throwError(\"unsupported network\", Logger.errors.INVALID_ARGUMENT, {\n argument: \"network\",\n value: network\n });\n }\n\n const connection: ConnectionInfo = {\n allowGzip: true,\n url: (\"https:/\" + \"/\" + host + \"/v3/\" + apiKey.projectId),\n throttleCallback: (attempt: number, url: string) => {\n if (apiKey.projectId === defaultProjectId) {\n showThrottleMessage();\n }\n return Promise.resolve(true);\n }\n };\n\n if (apiKey.projectSecret != null) {\n connection.user = \"\";\n connection.password = apiKey.projectSecret\n }\n\n return connection;\n }\n\n isCommunityResource(): boolean {\n return (this.projectId === defaultProjectId);\n }\n}\n","\nimport { deepCopy } from \"@ethersproject/properties\";\nimport { fetchJson } from \"@ethersproject/web\";\n\nimport { JsonRpcProvider } from \"./json-rpc-provider\";\n\n// Experimental\n\nexport class JsonRpcBatchProvider extends JsonRpcProvider {\n _pendingBatchAggregator: NodeJS.Timer;\n _pendingBatch: Array<{\n request: { method: string, params: Array<any>, id: number, jsonrpc: \"2.0\" },\n resolve: (result: any) => void,\n reject: (error: Error) => void\n }>;\n\n send(method: string, params: Array<any>): Promise<any> {\n const request = {\n method: method,\n params: params,\n id: (this._nextId++),\n jsonrpc: \"2.0\"\n };\n\n if (this._pendingBatch == null) {\n this._pendingBatch = [ ];\n }\n\n const inflightRequest: any = { request, resolve: null, reject: null };\n\n const promise = new Promise((resolve, reject) => {\n inflightRequest.resolve = resolve;\n inflightRequest.reject = reject;\n });\n\n this._pendingBatch.push(inflightRequest);\n\n if (!this._pendingBatchAggregator) {\n // Schedule batch for next event loop + short duration\n this._pendingBatchAggregator = setTimeout(() => {\n\n // Get teh current batch and clear it, so new requests\n // go into the next batch\n const batch = this._pendingBatch;\n this._pendingBatch = null;\n this._pendingBatchAggregator = null;\n\n // Get the request as an array of requests\n const request = batch.map((inflight) => inflight.request);\n\n this.emit(\"debug\", {\n action: \"requestBatch\",\n request: deepCopy(request),\n provider: this\n });\n\n return fetchJson(this.connection, JSON.stringify(request)).then((result) => {\n this.emit(\"debug\", {\n action: \"response\",\n request: request,\n response: result,\n provider: this\n });\n\n // For each result, feed it to the correct Promise, depending\n // on whether it was a success or error\n batch.forEach((inflightRequest, index) => {\n const payload = result[index];\n if (payload.error) {\n const error = new Error(payload.error.message);\n (<any>error).code = payload.error.code;\n (<any>error).data = payload.error.data;\n inflightRequest.reject(error);\n } else {\n inflightRequest.resolve(payload.result);\n }\n });\n\n }, (error) => {\n this.emit(\"debug\", {\n action: \"response\",\n error: error,\n request: request,\n provider: this\n });\n\n batch.forEach((inflightRequest) => {\n inflightRequest.reject(error);\n });\n });\n\n }, 10);\n }\n\n return promise;\n }\n}\n","/* istanbul ignore file */\n\n\"use strict\";\n\nimport { Network } from \"@ethersproject/networks\";\nimport { UrlJsonRpcProvider } from \"./url-json-rpc-provider\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n// Special API key provided by Nodesmith for ethers.js\nconst defaultApiKey = \"ETHERS_JS_SHARED\";\n\nexport class NodesmithProvider extends UrlJsonRpcProvider {\n\n static getApiKey(apiKey: any): any {\n if (apiKey && typeof(apiKey) !== \"string\") {\n logger.throwArgumentError(\"invalid apiKey\", \"apiKey\", apiKey);\n }\n return apiKey || defaultApiKey;\n }\n\n static getUrl(network: Network, apiKey?: any): string {\n logger.warn(\"NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.\");\n\n let host = null;\n switch (network.name) {\n case \"homestead\":\n host = \"https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc\";\n break;\n case \"ropsten\":\n host = \"https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc\";\n break;\n case \"rinkeby\":\n host = \"https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc\";\n break;\n case \"goerli\":\n host = \"https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc\";\n break;\n case \"kovan\":\n host = \"https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc\";\n break;\n default:\n logger.throwArgumentError(\"unsupported network\", \"network\", arguments[0]);\n }\n\n return (host + \"?apiKey=\" + apiKey);\n }\n}\n","\"use strict\";\n\nimport { Network, Networkish } from \"@ethersproject/networks\";\nimport { getStatic } from \"@ethersproject/properties\";\nimport { ConnectionInfo } from \"@ethersproject/web\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { UrlJsonRpcProvider } from \"./url-json-rpc-provider\";\n\n// These are load-balancer-based application IDs\nconst defaultApplicationIds: Record<string, string> = {\n homestead: \"6004bcd10040261633ade990\",\n ropsten: \"6004bd4d0040261633ade991\",\n rinkeby: \"6004bda20040261633ade994\",\n goerli: \"6004bd860040261633ade992\",\n};\n\nexport class PocketProvider extends UrlJsonRpcProvider {\n readonly applicationId: string;\n readonly applicationSecretKey: string;\n readonly loadBalancer: boolean;\n\n constructor(network?: Networkish, apiKey?: any) {\n // We need a bit of creativity in the constructor because\n // Pocket uses different default API keys based on the network\n\n if (apiKey == null) {\n const n = getStatic<(network: Networkish) => Network>(new.target, \"getNetwork\")(network);\n if (n) {\n const applicationId = defaultApplicationIds[n.name];\n if (applicationId) {\n apiKey = {\n applicationId: applicationId,\n loadBalancer: true\n };\n }\n }\n\n // If there was any issue above, we don't know this network\n if (apiKey == null) {\n logger.throwError(\"unsupported network\", Logger.errors.INVALID_ARGUMENT, {\n argument: \"network\",\n value: network\n });\n }\n\n }\n\n super(network, apiKey);\n }\n\n static getApiKey(apiKey: any): any {\n // Most API Providers allow null to get the default configuration, but\n // Pocket requires the network to decide the default provider, so we\n // rely on hijacking the constructor to add a sensible default for us\n\n if (apiKey == null) {\n logger.throwArgumentError(\"PocketProvider.getApiKey does not support null apiKey\", \"apiKey\", apiKey);\n }\n\n const apiKeyObj: { applicationId: string, applicationSecretKey: string, loadBalancer: boolean } = {\n applicationId: null,\n loadBalancer: false,\n applicationSecretKey: null\n };\n\n // Parse applicationId and applicationSecretKey\n if (typeof (apiKey) === \"string\") {\n apiKeyObj.applicationId = apiKey;\n\n } else if (apiKey.applicationSecretKey != null) {\n logger.assertArgument((typeof (apiKey.applicationId) === \"string\"),\n \"applicationSecretKey requires an applicationId\", \"applicationId\", apiKey.applicationId);\n logger.assertArgument((typeof (apiKey.applicationSecretKey) === \"string\"),\n \"invalid applicationSecretKey\", \"applicationSecretKey\", \"[REDACTED]\");\n\n apiKeyObj.applicationId = apiKey.applicationId;\n apiKeyObj.applicationSecretKey = apiKey.applicationSecretKey;\n apiKeyObj.loadBalancer = !!apiKey.loadBalancer;\n\n } else if (apiKey.applicationId) {\n logger.assertArgument((typeof (apiKey.applicationId) === \"string\"),\n \"apiKey.applicationId must be a string\", \"apiKey.applicationId\", apiKey.applicationId);\n\n apiKeyObj.applicationId = apiKey.applicationId;\n apiKeyObj.loadBalancer = !!apiKey.loadBalancer;\n\n } else {\n logger.throwArgumentError(\"unsupported PocketProvider apiKey\", \"apiKey\", apiKey);\n }\n\n return apiKeyObj;\n }\n\n static getUrl(network: Network, apiKey: any): ConnectionInfo {\n let host: string = null;\n switch (network ? network.name : \"unknown\") {\n case \"homestead\":\n host = \"eth-mainnet.gateway.pokt.network\";\n break;\n case \"ropsten\":\n host = \"eth-ropsten.gateway.pokt.network\";\n break;\n case \"rinkeby\":\n host = \"eth-rinkeby.gateway.pokt.network\";\n break;\n case \"goerli\":\n host = \"eth-goerli.gateway.pokt.network\";\n break;\n default:\n logger.throwError(\"unsupported network\", Logger.errors.INVALID_ARGUMENT, {\n argument: \"network\",\n value: network\n });\n }\n\n let url = null;\n if (apiKey.loadBalancer) {\n url = `https:/\\/${ host }/v1/lb/${ apiKey.applicationId }`\n } else {\n url = `https:/\\/${ host }/v1/${ apiKey.applicationId }`\n }\n\n const connection: ConnectionInfo = { url };\n\n // Initialize empty headers\n connection.headers = {}\n\n // Apply application secret key\n if (apiKey.applicationSecretKey != null) {\n connection.user = \"\";\n connection.password = apiKey.applicationSecretKey\n }\n\n return connection;\n }\n\n isCommunityResource(): boolean {\n return (this.applicationId === defaultApplicationIds[this.network.name]);\n }\n}\n","\"use strict\";\n\nimport { Networkish } from \"@ethersproject/networks\";\nimport { deepCopy, defineReadOnly } from \"@ethersproject/properties\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nimport { JsonRpcProvider } from \"./json-rpc-provider\";\n\n// Exported Types\nexport type ExternalProvider = {\n isMetaMask?: boolean;\n isStatus?: boolean;\n host?: string;\n path?: string;\n sendAsync?: (request: { method: string, params?: Array<any> }, callback: (error: any, response: any) => void) => void\n send?: (request: { method: string, params?: Array<any> }, callback: (error: any, response: any) => void) => void\n request?: (request: { method: string, params?: Array<any> }) => Promise<any>\n}\n\nlet _nextId = 1;\n\nexport type JsonRpcFetchFunc = (method: string, params?: Array<any>) => Promise<any>;\n\ntype Web3LegacySend = (request: any, callback: (error: Error, response: any) => void) => void;\n\nfunction buildWeb3LegacyFetcher(provider: ExternalProvider, sendFunc: Web3LegacySend) : JsonRpcFetchFunc {\n const fetcher = \"Web3LegacyFetcher\";\n\n return function(method: string, params: Array<any>): Promise<any> {\n const request = {\n method: method,\n params: params,\n id: (_nextId++),\n jsonrpc: \"2.0\"\n };\n\n return new Promise((resolve, reject) => {\n this.emit(\"debug\", {\n action: \"request\",\n fetcher,\n request: deepCopy(request),\n provider: this\n });\n\n sendFunc(request, (error, response) => {\n\n if (error) {\n this.emit(\"debug\", {\n action: \"response\",\n fetcher,\n error,\n request,\n provider: this\n });\n\n return reject(error);\n }\n\n this.emit(\"debug\", {\n action: \"response\",\n fetcher,\n request,\n response,\n provider: this\n });\n\n if (response.error) {\n const error = new Error(response.error.message);\n (<any>error).code = response.error.code;\n (<any>error).data = response.error.data;\n return reject(error);\n }\n\n resolve(response.result);\n });\n });\n }\n}\n\nfunction buildEip1193Fetcher(provider: ExternalProvider): JsonRpcFetchFunc {\n return function(method: string, params: Array<any>): Promise<any> {\n if (params == null) { params = [ ]; }\n\n const request = { method, params };\n\n this.emit(\"debug\", {\n action: \"request\",\n fetcher: \"Eip1193Fetcher\",\n request: deepCopy(request),\n provider: this\n });\n\n return provider.request(request).then((response) => {\n this.emit(\"debug\", {\n action: \"response\",\n fetcher: \"Eip1193Fetcher\",\n request,\n response,\n provider: this\n });\n\n return response;\n\n }, (error) => {\n this.emit(\"debug\", {\n action: \"response\",\n fetcher: \"Eip1193Fetcher\",\n request,\n error,\n provider: this\n });\n\n throw error;\n });\n }\n}\n\nexport class Web3Provider extends JsonRpcProvider {\n readonly provider: ExternalProvider;\n readonly jsonRpcFetchFunc: JsonRpcFetchFunc;\n\n constructor(provider: ExternalProvider | JsonRpcFetchFunc, network?: Networkish) {\n logger.checkNew(new.target, Web3Provider);\n\n if (provider == null) {\n logger.throwArgumentError(\"missing provider\", \"provider\", provider);\n }\n\n let path: string = null;\n let jsonRpcFetchFunc: JsonRpcFetchFunc = null;\n let subprovider: ExternalProvider = null;\n\n if (typeof(provider) === \"function\") {\n path = \"unknown:\";\n jsonRpcFetchFunc = provider;\n\n } else {\n path = provider.host || provider.path || \"\";\n if (!path && provider.isMetaMask) {\n path = \"metamask\";\n }\n\n subprovider = provider;\n\n if (provider.request) {\n if (path === \"\") { path = \"eip-1193:\"; }\n jsonRpcFetchFunc = buildEip1193Fetcher(provider);\n } else if (provider.sendAsync) {\n jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.sendAsync.bind(provider));\n } else if (provider.send) {\n jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.send.bind(provider));\n } else {\n logger.throwArgumentError(\"unsupported provider\", \"provider\", provider);\n }\n\n if (!path) { path = \"unknown:\"; }\n }\n\n super(path, network);\n\n defineReadOnly(this, \"jsonRpcFetchFunc\", jsonRpcFetchFunc);\n defineReadOnly(this, \"provider\", subprovider);\n }\n\n send(method: string, params: Array<any>): Promise<any> {\n return this.jsonRpcFetchFunc(method, params);\n }\n}\n","\"use strict\";\n\nimport {\n Block,\n BlockTag,\n EventType,\n FeeData,\n Filter,\n Log,\n Listener,\n Provider,\n TransactionReceipt,\n TransactionRequest,\n TransactionResponse\n} from \"@ethersproject/abstract-provider\";\n\nimport { getNetwork } from \"@ethersproject/networks\";\nimport { Network, Networkish } from \"@ethersproject/networks\";\n\nimport { BaseProvider, EnsProvider, EnsResolver, Resolver } from \"./base-provider\";\n\nimport { AlchemyProvider, AlchemyWebSocketProvider } from \"./alchemy-provider\";\nimport { AnkrProvider } from \"./ankr-provider\";\nimport { CloudflareProvider } from \"./cloudflare-provider\";\nimport { EtherscanProvider } from \"./etherscan-provider\";\nimport { FallbackProvider, FallbackProviderConfig } from \"./fallback-provider\";\nimport { IpcProvider } from \"./ipc-provider\";\nimport { InfuraProvider, InfuraWebSocketProvider } from \"./infura-provider\";\nimport { JsonRpcProvider, JsonRpcSigner } from \"./json-rpc-provider\";\nimport { JsonRpcBatchProvider } from \"./json-rpc-batch-provider\";\nimport { NodesmithProvider } from \"./nodesmith-provider\";\nimport { PocketProvider } from \"./pocket-provider\";\nimport { StaticJsonRpcProvider, UrlJsonRpcProvider } from \"./url-json-rpc-provider\";\nimport { Web3Provider } from \"./web3-provider\";\nimport { WebSocketProvider } from \"./websocket-provider\";\nimport { ExternalProvider, JsonRpcFetchFunc } from \"./web3-provider\";\n\nimport { CommunityResourcable, Formatter, isCommunityResourcable, isCommunityResource, showThrottleMessage } from \"./formatter\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n////////////////////////\n// Helper Functions\n\nfunction getDefaultProvider(network?: Networkish, options?: any): BaseProvider {\n if (network == null) { network = \"homestead\"; }\n\n // If passed a URL, figure out the right type of provider based on the scheme\n if (typeof(network) === \"string\") {\n // @TODO: Add support for IpcProvider; maybe if it ends in \".ipc\"?\n\n // Handle http and ws (and their secure variants)\n const match = network.match(/^(ws|http)s?:/i);\n if (match) {\n switch (match[1]) {\n case \"http\":\n return new JsonRpcProvider(network);\n case \"ws\":\n return new WebSocketProvider(network);\n default:\n logger.throwArgumentError(\"unsupported URL scheme\", \"network\", network);\n }\n }\n }\n\n const n = getNetwork(network);\n if (!n || !n._defaultProvider) {\n logger.throwError(\"unsupported getDefaultProvider network\", Logger.errors.NETWORK_ERROR, {\n operation: \"getDefaultProvider\",\n network: network\n });\n }\n\n return n._defaultProvider({\n FallbackProvider,\n\n AlchemyProvider,\n AnkrProvider,\n CloudflareProvider,\n EtherscanProvider,\n InfuraProvider,\n JsonRpcProvider,\n NodesmithProvider,\n PocketProvider,\n Web3Provider,\n\n IpcProvider,\n }, options);\n}\n\n////////////////////////\n// Exports\n\nexport {\n\n // Abstract Providers (or Abstract-ish)\n Provider,\n BaseProvider,\n\n Resolver,\n\n UrlJsonRpcProvider,\n\n ///////////////////////\n // Concrete Providers\n\n FallbackProvider,\n\n AlchemyProvider,\n AlchemyWebSocketProvider,\n AnkrProvider,\n CloudflareProvider,\n EtherscanProvider,\n InfuraProvider,\n InfuraWebSocketProvider,\n JsonRpcProvider,\n JsonRpcBatchProvider,\n NodesmithProvider,\n PocketProvider,\n StaticJsonRpcProvider,\n Web3Provider,\n WebSocketProvider,\n\n IpcProvider,\n\n\n ///////////////////////\n // Signer\n\n JsonRpcSigner,\n\n\n ///////////////////////\n // Functions\n\n getDefaultProvider,\n getNetwork,\n isCommunityResource,\n isCommunityResourcable,\n showThrottleMessage,\n\n\n ///////////////////////\n // Objects\n\n Formatter,\n\n\n ///////////////////////\n // Types\n\n Block,\n BlockTag,\n EventType,\n FeeData,\n Filter,\n Log,\n Listener,\n TransactionReceipt,\n TransactionRequest,\n TransactionResponse,\n\n ExternalProvider,\n JsonRpcFetchFunc,\n\n FallbackProviderConfig,\n\n Network,\n Networkish,\n\n EnsProvider,\n EnsResolver,\n\n CommunityResourcable\n};\n\n","export const version = \"solidity/5.6.0\";\n","\"use strict\";\n\nimport { BigNumber } from \"@ethersproject/bignumber\";\nimport { arrayify, concat, hexlify, zeroPad } from \"@ethersproject/bytes\";\nimport { keccak256 as hashKeccak256 } from \"@ethersproject/keccak256\";\nimport { sha256 as hashSha256 } from \"@ethersproject/sha2\";\nimport { toUtf8Bytes } from \"@ethersproject/strings\";\n\nconst regexBytes = new RegExp(\"^bytes([0-9]+)$\");\nconst regexNumber = new RegExp(\"^(u?int)([0-9]*)$\");\nconst regexArray = new RegExp(\"^(.*)\\\\[([0-9]*)\\\\]$\");\n\nconst Zeros = \"0000000000000000000000000000000000000000000000000000000000000000\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\n\nfunction _pack(type: string, value: any, isArray?: boolean): Uint8Array {\n switch(type) {\n case \"address\":\n if (isArray) { return zeroPad(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 zeroPad(value, 32); }\n return arrayify(value);\n }\n\n let match = type.match(regexNumber);\n if (match) {\n //let signed = (match[1] === \"int\")\n let size = parseInt(match[2] || \"256\")\n\n if ((match[2] && String(size) !== match[2]) || (size % 8 !== 0) || size === 0 || size > 256) {\n logger.throwArgumentError(\"invalid number type\", \"type\", type)\n }\n\n if (isArray) { size = 256; }\n\n value = BigNumber.from(value).toTwos(size);\n\n return zeroPad(value, size / 8);\n }\n\n match = type.match(regexBytes);\n if (match) {\n const size = parseInt(match[1]);\n\n if (String(size) !== match[1] || size === 0 || size > 32) {\n logger.throwArgumentError(\"invalid bytes type\", \"type\", type)\n }\n if (arrayify(value).byteLength !== size) {\n logger.throwArgumentError(`invalid value for ${ type }`, \"value\", value)\n }\n if (isArray) { return arrayify((value + Zeros).substring(0, 66)); }\n return value;\n }\n\n match = type.match(regexArray);\n if (match && Array.isArray(value)) {\n const baseType = match[1];\n const count = parseInt(match[2] || String(value.length));\n if (count != value.length) {\n logger.throwArgumentError(`invalid array length for ${ type }`, \"value\", value)\n }\n const result: Array<Uint8Array> = [];\n value.forEach(function(value) {\n result.push(_pack(baseType, value, true));\n });\n return concat(result);\n }\n\n return logger.throwArgumentError(\"invalid type\", \"type\", type)\n}\n\n// @TODO: Array Enum\n\nexport function pack(types: ReadonlyArray<string>, values: ReadonlyArray<any>) {\n if (types.length != values.length) {\n logger.throwArgumentError(\"wrong number of values; expected ${ types.length }\", \"values\", values)\n }\n const tight: Array<Uint8Array> = [];\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: ReadonlyArray<string>, values: ReadonlyArray<any>) {\n return hashKeccak256(pack(types, values));\n}\n\nexport function sha256(types: ReadonlyArray<string>, values: ReadonlyArray<any>) {\n return hashSha256(pack(types, values));\n}\n","export const version = \"units/5.6.0\";\n","\"use strict\";\n\nimport { BigNumber, BigNumberish } from \"@ethersproject/bignumber\";\nimport { formatFixed, parseFixed } from \"@ethersproject/bignumber\";\n\nimport { Logger } from \"@ethersproject/logger\";\nimport { version } from \"./_version\";\nconst logger = new Logger(version);\n\nconst names = [\n \"wei\",\n \"kwei\",\n \"mwei\",\n \"gwei\",\n \"szabo\",\n \"finney\",\n \"ether\",\n];\n\n\n// Some environments have issues with RegEx that contain back-tracking, so we cannot\n// use them.\nexport function commify(value: string | number): string {\n const comps = String(value).split(\".\");\n\n if (comps.length > 2 || !comps[0].match(/^-?[0-9]*$/) || (comps[1] && !comps[1].match(/^[0-9]*$/)) || value === \".\" || value === \"-.\") {\n logger.throwArgumentError(\"invalid value\", \"value\", value);\n }\n\n // Make sure we have at least one whole digit (0 if none)\n let whole = comps[0];\n\n let negative = \"\";\n if (whole.substring(0, 1) === \"-\") {\n negative = \"-\";\n whole = whole.substring(1);\n }\n\n // Make sure we have at least 1 whole digit with no leading zeros\n while (whole.substring(0, 1) === \"0\") { whole = whole.substring(1); }\n if (whole === \"\") { whole = \"0\"; }\n\n let suffix = \"\";\n if (comps.length === 2) { suffix = \".\" + (comps[1] || \"0\"); }\n while (suffix.length > 2 && suffix[suffix.length - 1] === \"0\") {\n suffix = suffix.substring(0, suffix.length - 1);\n }\n\n const formatted = [];\n while (whole.length) {\n if (whole.length <= 3) {\n formatted.unshift(whole);\n break;\n } else {\n const index = whole.length - 3;\n formatted.unshift(whole.substring(index));\n whole = whole.substring(0, index);\n }\n }\n\n return negative + formatted.join(\",\") + suffix;\n}\n\nexport function formatUnits(value: BigNumberish, unitName?: string | BigNumberish): string {\n if (typeof(unitName) === \"string\") {\n const index = names.indexOf(unitName);\n if (index !== -1) { unitName = 3 * index; }\n }\n return formatFixed(value, (unitName != null) ? unitName: 18);\n}\n\nexport function parseUnits(value: string, unitName?: BigNumberish): BigNumber {\n if (typeof(value) !== \"string\") {\n logger.throwArgumentError(\"value must be a string\", \"value\", value);\n }\n if (typeof(unitName) === \"string\") {\n const index = names.indexOf(unitName);\n if (index !== -1) { unitName = 3 * index; }\n }\n return parseFixed(value, (unitName != null) ? unitName: 18);\n}\n\nexport function formatEther(wei: BigNumberish): string {\n return formatUnits(wei, 18);\n}\n\nexport function parseEther(ether: string): BigNumber {\n return parseUnits(ether, 18);\n}\n\n","\"use strict\";\n\nimport { AbiCoder, checkResultErrors, ConstructorFragment, defaultAbiCoder, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, LogDescription, ParamType, Result, TransactionDescription }from \"@ethersproject/abi\";\nimport { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from \"@ethersproject/address\";\nimport * as base64 from \"@ethersproject/base64\";\nimport { Base58 as base58 } from \"@ethersproject/basex\";\nimport { arrayify, concat, hexConcat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from \"@ethersproject/bytes\";\nimport { _TypedDataEncoder, dnsEncode, hashMessage, id, isValidName, namehash } from \"@ethersproject/hash\";\nimport { defaultPath, entropyToMnemonic, getAccountPath, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from \"@ethersproject/hdnode\";\nimport { getJsonWalletAddress } from \"@ethersproject/json-wallets\";\nimport { keccak256 } from \"@ethersproject/keccak256\";\nimport { Logger } from \"@ethersproject/logger\";\nimport { computeHmac, ripemd160, sha256, sha512 } from \"@ethersproject/sha2\";\nimport { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from \"@ethersproject/solidity\";\nimport { randomBytes, shuffled } from \"@ethersproject/random\";\nimport { checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy } from \"@ethersproject/properties\";\nimport * as RLP from \"@ethersproject/rlp\";\nimport { computePublicKey, recoverPublicKey, SigningKey } from \"@ethersproject/signing-key\";\nimport { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs } from \"@ethersproject/strings\";\nimport { accessListify, computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction, TransactionTypes } from \"@ethersproject/transactions\";\nimport { commify, formatEther, parseEther, formatUnits, parseUnits } from \"@ethersproject/units\";\nimport { verifyMessage, verifyTypedData } from \"@ethersproject/wallet\";\nimport { _fetchData, fetchJson, poll } from \"@ethersproject/web\";\n\n////////////////////////\n// Enums\n\nimport { SupportedAlgorithm } from \"@ethersproject/sha2\";\nimport { UnicodeNormalizationForm, Utf8ErrorReason } from \"@ethersproject/strings\";\nimport { UnsignedTransaction } from \"@ethersproject/transactions\";\n\n////////////////////////\n// Types and Interfaces\n\nimport { CoerceFunc } from \"@ethersproject/abi\";\nimport { Bytes, BytesLike, Hexable } from \"@ethersproject/bytes\"\nimport { Mnemonic } from \"@ethersproject/hdnode\";\nimport { EncryptOptions, ProgressCallback } from \"@ethersproject/json-wallets\";\nimport { Deferrable } from \"@ethersproject/properties\";\nimport { Utf8ErrorFunc } from \"@ethersproject/strings\";\nimport { AccessList, AccessListish } from \"@ethersproject/transactions\";\nimport { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from \"@ethersproject/web\";\n\n////////////////////////\n// Exports\n\nexport {\n AbiCoder,\n defaultAbiCoder,\n\n Fragment,\n ConstructorFragment,\n ErrorFragment,\n EventFragment,\n FunctionFragment,\n ParamType,\n FormatTypes,\n\n checkResultErrors,\n Result,\n\n Logger,\n\n RLP,\n\n _fetchData,\n fetchJson,\n poll,\n\n checkProperties,\n deepCopy,\n defineReadOnly,\n getStatic,\n resolveProperties,\n shallowCopy,\n\n arrayify,\n\n concat,\n stripZeros,\n zeroPad,\n\n isBytes,\n isBytesLike,\n\n defaultPath,\n HDNode,\n SigningKey,\n\n Interface,\n\n LogDescription,\n TransactionDescription,\n\n base58,\n base64,\n\n hexlify,\n isHexString,\n hexConcat,\n hexStripZeros,\n hexValue,\n hexZeroPad,\n hexDataLength,\n hexDataSlice,\n\n nameprep,\n _toEscapedUtf8String,\n toUtf8Bytes,\n toUtf8CodePoints,\n toUtf8String,\n Utf8ErrorFuncs,\n\n formatBytes32String,\n parseBytes32String,\n\n dnsEncode,\n hashMessage,\n namehash,\n isValidName,\n id,\n\n _TypedDataEncoder,\n\n getAddress,\n getIcapAddress,\n getContractAddress,\n getCreate2Address,\n isAddress,\n\n formatEther,\n parseEther,\n\n formatUnits,\n parseUnits,\n\n commify,\n\n computeHmac,\n keccak256,\n ripemd160,\n sha256,\n sha512,\n\n randomBytes,\n shuffled,\n\n solidityPack,\n solidityKeccak256,\n soliditySha256,\n\n splitSignature,\n joinSignature,\n\n accessListify,\n parseTransaction,\n serializeTransaction,\n TransactionTypes,\n\n getJsonWalletAddress,\n\n computeAddress,\n recoverAddress,\n\n computePublicKey,\n recoverPublicKey,\n\n verifyMessage,\n verifyTypedData,\n\n getAccountPath,\n mnemonicToEntropy,\n entropyToMnemonic,\n isValidMnemonic,\n mnemonicToSeed,\n\n\n ////////////////////////\n // Enums\n\n SupportedAlgorithm,\n\n UnicodeNormalizationForm,\n Utf8ErrorReason,\n\n ////////////////////////\n // Types\n\n Bytes,\n BytesLike,\n Hexable,\n\n AccessList,\n AccessListish,\n UnsignedTransaction,\n\n CoerceFunc,\n\n Indexed,\n\n Mnemonic,\n\n Deferrable,\n\n Utf8ErrorFunc,\n\n ConnectionInfo,\n OnceBlockable,\n OncePollable,\n PollOptions,\n FetchJsonResponse,\n\n EncryptOptions,\n ProgressCallback\n}\n\n","export const version = \"ethers/5.6.3\";\n","\"use strict\";\n\nimport { BaseContract, Contract, ContractFactory } from \"@ethersproject/contracts\";\n\nimport { BigNumber, FixedNumber } from \"@ethersproject/bignumber\";\n\nimport { Signer, VoidSigner } from \"@ethersproject/abstract-signer\";\nimport { Wallet } from \"@ethersproject/wallet\";\n\nimport * as constants from \"@ethersproject/constants\";\n\nimport * as providers from \"@ethersproject/providers\";\nimport { getDefaultProvider } from \"@ethersproject/providers\";\n\nimport { Wordlist, wordlists} from \"@ethersproject/wordlists\";\n\nimport * as utils from \"./utils\";\n\nimport { ErrorCode as errors, Logger } from \"@ethersproject/logger\";\n\n////////////////////////\n// Types\n\nimport { BigNumberish } from \"@ethersproject/bignumber\";\nimport { Bytes, BytesLike, Signature } from \"@ethersproject/bytes\";\nimport { Transaction, UnsignedTransaction } from \"@ethersproject/transactions\";\n\n\n////////////////////////\n// Compile-Time Constants\n\n// This is generated by \"npm run dist\"\nimport { version } from \"./_version\";\n\nconst logger = new Logger(version);\n\n////////////////////////\n// Types\n\nimport {\n ContractFunction,\n ContractReceipt,\n ContractTransaction,\n\n Event,\n EventFilter,\n\n Overrides,\n PayableOverrides,\n CallOverrides,\n\n PopulatedTransaction,\n\n ContractInterface\n} from \"@ethersproject/contracts\";\n\n\n////////////////////////\n// Exports\n\nexport {\n Signer,\n\n Wallet,\n VoidSigner,\n\n getDefaultProvider,\n providers,\n\n BaseContract,\n Contract,\n ContractFactory,\n\n BigNumber,\n FixedNumber,\n\n constants,\n errors,\n\n logger,\n\n utils,\n\n wordlists,\n\n\n ////////////////////////\n // Compile-Time Constants\n\n version,\n\n\n ////////////////////////\n // Types\n\n ContractFunction,\n ContractReceipt,\n ContractTransaction,\n Event,\n EventFilter,\n\n Overrides,\n PayableOverrides,\n CallOverrides,\n\n PopulatedTransaction,\n\n ContractInterface,\n\n BigNumberish,\n\n Bytes,\n BytesLike,\n\n Signature,\n\n Transaction,\n UnsignedTransaction,\n\n Wordlist\n};\n\n","\"use strict\";\n\n// To modify this file, you must update ./misc/admin/lib/cmds/update-exports.js\n\nimport * as ethers from \"./ethers\";\n\ntry {\n const anyGlobal = (window as any);\n\n if (anyGlobal._ethers == null) {\n anyGlobal._ethers = ethers;\n }\n} catch (error) { }\n\nexport { ethers };\n\nexport {\n Signer,\n\n Wallet,\n VoidSigner,\n\n getDefaultProvider,\n providers,\n\n BaseContract,\n Contract,\n ContractFactory,\n\n BigNumber,\n FixedNumber,\n\n constants,\n errors,\n\n logger,\n\n utils,\n\n wordlists,\n\n\n ////////////////////////\n // Compile-Time Constants\n\n version,\n\n\n ////////////////////////\n // Types\n\n ContractFunction,\n ContractReceipt,\n ContractTransaction,\n Event,\n EventFilter,\n\n Overrides,\n PayableOverrides,\n CallOverrides,\n\n PopulatedTransaction,\n\n ContractInterface,\n\n BigNumberish,\n\n Bytes,\n BytesLike,\n\n Signature,\n\n Transaction,\n UnsignedTransaction,\n\n Wordlist\n} from \"./ethers\";\n"]}