-
Notifications
You must be signed in to change notification settings - Fork 31
/
28980.a8eb4e50.iframe.bundle.js
1 lines (1 loc) · 8.13 KB
/
28980.a8eb4e50.iframe.bundle.js
1
"use strict";(globalThis.webpackChunkmetamask_crx=globalThis.webpackChunkmetamask_crx||[]).push([[28980],{"./node_modules/@metamask/accounts-controller/dist/utils.mjs":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{o7:()=>keyringTypeToName}),__webpack_require__("./ui/__mocks__/ethereumjs-util.js");var KeyringController=__webpack_require__("./node_modules/@metamask/keyring-controller/dist/KeyringController.mjs"),_assert=__webpack_require__("./node_modules/ethereum-cryptography/node_modules/@noble/hashes/esm/_assert.js");let createView=arr=>new DataView(arr.buffer,arr.byteOffset,arr.byteLength),rotr=(word,shift)=>word<<32-shift|word>>>shift;new Uint8Array(new Uint32Array([287454020]).buffer)[0],(_,i)=>i.toString(16).padStart(2,"0");function utf8ToBytes(str){if("string"!=typeof str)throw Error(`utf8ToBytes expected string, got ${typeof str}`);return new Uint8Array(new TextEncoder().encode(str))}function toBytes(data){return"string"==typeof data&&(data=utf8ToBytes(data)),(0,_assert.ee)(data),data}class Hash{clone(){return this._cloneInto()}}function utils_wrapConstructor(hashCons){let hashC=msg=>hashCons().update(toBytes(msg)).digest(),tmp=hashCons();return hashC.outputLen=tmp.outputLen,hashC.blockLen=tmp.blockLen,hashC.create=()=>hashCons(),hashC}function setBigUint64(view,byteOffset,value,isLE){if("function"==typeof view.setBigUint64)return view.setBigUint64(byteOffset,value,isLE);let _32n=BigInt(32),_u32_max=BigInt(4294967295),wh=Number(value>>_32n&_u32_max),wl=Number(value&_u32_max),h=isLE?4:0,l=isLE?0:4;view.setUint32(byteOffset+h,wh,isLE),view.setUint32(byteOffset+l,wl,isLE)}let Chi=(a,b,c)=>a&b^~a&c,Maj=(a,b,c)=>a&b^a&c^b&c;class HashMD extends Hash{constructor(blockLen,outputLen,padOffset,isLE){super(),this.blockLen=blockLen,this.outputLen=outputLen,this.padOffset=padOffset,this.isLE=isLE,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(blockLen),this.view=createView(this.buffer)}update(data){(0,_assert.t2)(this);let{view,buffer,blockLen}=this,len=(data=toBytes(data)).length;for(let pos=0;pos<len;){let take=Math.min(blockLen-this.pos,len-pos);if(take===blockLen){let dataView=createView(data);for(;blockLen<=len-pos;pos+=blockLen)this.process(dataView,pos);continue}buffer.set(data.subarray(pos,pos+take),this.pos),this.pos+=take,pos+=take,this.pos===blockLen&&(this.process(view,0),this.pos=0)}return this.length+=data.length,this.roundClean(),this}digestInto(out){(0,_assert.t2)(this),(0,_assert.CG)(out,this),this.finished=!0;let{buffer,view,blockLen,isLE}=this,{pos}=this;buffer[pos++]=128,this.buffer.subarray(pos).fill(0),this.padOffset>blockLen-pos&&(this.process(view,0),pos=0);for(let i=pos;i<blockLen;i++)buffer[i]=0;setBigUint64(view,blockLen-8,BigInt(8*this.length),isLE),this.process(view,0);let oview=createView(out),len=this.outputLen;if(len%4)throw Error("_sha2: outputLen should be aligned to 32bit");let outLen=len/4,state=this.get();if(outLen>state.length)throw Error("_sha2: outputLen bigger than state");for(let i=0;i<outLen;i++)oview.setUint32(4*i,state[i],isLE)}digest(){let{buffer,outputLen}=this;this.digestInto(buffer);let res=buffer.slice(0,outputLen);return this.destroy(),res}_cloneInto(to){to||(to=new this.constructor),to.set(...this.get());let{blockLen,buffer,length,finished,destroyed,pos}=this;return to.length=length,to.pos=pos,to.finished=finished,to.destroyed=destroyed,length%blockLen&&to.buffer.set(buffer),to}}let SHA256_K=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W=new Uint32Array(64);class SHA256 extends HashMD{constructor(){super(64,32,8,!1),this.A=0|SHA256_IV[0],this.B=0|SHA256_IV[1],this.C=0|SHA256_IV[2],this.D=0|SHA256_IV[3],this.E=0|SHA256_IV[4],this.F=0|SHA256_IV[5],this.G=0|SHA256_IV[6],this.H=0|SHA256_IV[7]}get(){let{A,B,C,D,E,F,G,H}=this;return[A,B,C,D,E,F,G,H]}set(A,B,C,D,E,F,G,H){this.A=0|A,this.B=0|B,this.C=0|C,this.D=0|D,this.E=0|E,this.F=0|F,this.G=0|G,this.H=0|H}process(view,offset){for(let i=0;i<16;i++,offset+=4)SHA256_W[i]=view.getUint32(offset,!1);for(let i=16;i<64;i++){let W15=SHA256_W[i-15],W2=SHA256_W[i-2],s0=rotr(W15,7)^rotr(W15,18)^W15>>>3,s1=rotr(W2,17)^rotr(W2,19)^W2>>>10;SHA256_W[i]=s1+SHA256_W[i-7]+s0+SHA256_W[i-16]|0}let{A,B,C,D,E,F,G,H}=this;for(let i=0;i<64;i++){let T1=H+(rotr(E,6)^rotr(E,11)^rotr(E,25))+Chi(E,F,G)+SHA256_K[i]+SHA256_W[i]|0,T2=(rotr(A,2)^rotr(A,13)^rotr(A,22))+Maj(A,B,C)|0;H=G,G=F,F=E,E=D+T1|0,D=C,C=B,B=A,A=T1+T2|0}A=A+this.A|0,B=B+this.B|0,C=C+this.C|0,D=D+this.D|0,E=E+this.E|0,F=F+this.F|0,G=G+this.G|0,H=H+this.H|0,this.set(A,B,C,D,E,F,G,H)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let sha256_sha256=utils_wrapConstructor(()=>new SHA256);function keyringTypeToName(keyringType){if((0,KeyringController.R0)(keyringType))return"Custody";switch(keyringType){case KeyringController.rI.simple:case KeyringController.rI.hd:return"Account";case KeyringController.rI.trezor:return"Trezor";case KeyringController.rI.ledger:return"Ledger";case KeyringController.rI.lattice:return"Lattice";case KeyringController.rI.qr:return"QR";case KeyringController.rI.snap:return"Snap Account";default:throw Error(`Unknown keyring ${keyringType}`)}}(0,__webpack_require__("./node_modules/ethereum-cryptography/esm/utils.js").RS)(sha256_sha256)},"./node_modules/ethereum-cryptography/esm/utils.js":(module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{RS:()=>wrapHash});var _noble_hashes_assert__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/ethereum-cryptography/node_modules/@noble/hashes/esm/_assert.js");function wrapHash(hash){return msg=>(_noble_hashes_assert__WEBPACK_IMPORTED_MODULE_0__.Ay.bytes(msg),hash(msg))}module=__webpack_require__.hmd(module),_noble_hashes_assert__WEBPACK_IMPORTED_MODULE_0__.Ay.bool,_noble_hashes_assert__WEBPACK_IMPORTED_MODULE_0__.Ay.bytes,(()=>{let webCrypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,nodeRequire="function"==typeof module.require&&module.require.bind(module);return nodeRequire&&!webCrypto?nodeRequire("crypto"):void 0})()},"./node_modules/ethereum-cryptography/node_modules/@noble/hashes/esm/_assert.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function number(n){if(!Number.isSafeInteger(n)||n<0)throw Error(`positive integer expected, not ${n}`)}function bool(b){if("boolean"!=typeof b)throw Error(`boolean expected, not ${b}`)}function isBytes(a){return a instanceof Uint8Array||null!=a&&"object"==typeof a&&"Uint8Array"===a.constructor.name}function bytes(b,...lengths){if(!isBytes(b))throw Error("Uint8Array expected");if(lengths.length>0&&!lengths.includes(b.length))throw Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`)}function hash(h){if("function"!=typeof h||"function"!=typeof h.create)throw Error("Hash should be wrapped by utils.wrapConstructor");number(h.outputLen),number(h.blockLen)}function exists(instance,checkFinished=!0){if(instance.destroyed)throw Error("Hash instance has been destroyed");if(checkFinished&&instance.finished)throw Error("Hash#digest() has already been called")}function output(out,instance){bytes(out);let min=instance.outputLen;if(out.length<min)throw Error(`digestInto() expects output buffer of length at least ${min}`)}__webpack_require__.d(__webpack_exports__,{Ay:()=>__WEBPACK_DEFAULT_EXPORT__,CG:()=>output,ee:()=>bytes,t2:()=>exists});let __WEBPACK_DEFAULT_EXPORT__={number,bool,bytes,hash,exists,output}}}]);