UNPKG

@metamask/account-watcher

Version:

Keep an eye on Ethereum accounts right in MetaMask

1 lines 457 kB
(()=>{var t={9034:(t,e,r)=>{var n;!function(){"use strict";var i="input is invalid type",o="object"==typeof window,s=o?window:{};s.JS_SHA3_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!s.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?s=r.g:a&&(s=self);var u=!s.JS_SHA3_NO_COMMON_JS&&t.exports,c=r.amdO,h=!s.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[4,1024,262144,67108864],d=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],m=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!s.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!h||!s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var w=function(t,e,r){return function(n){return new P(t,e,t).update(n)[r]()}},b=function(t,e,r){return function(n,i){return new P(t,e,i).update(n)[r]()}},A=function(t,e,r){return function(e,n,i,o){return _["cshake"+t].update(e,n,i,o)[r]()}},E=function(t,e,r){return function(e,n,i,o){return _["kmac"+t].update(e,n,i,o)[r]()}},S=function(t,e,r,n){for(var i=0;i<y.length;++i){var o=y[i];t[o]=e(r,n,o)}return t},I=function(t,e){var r=w(t,e,"hex");return r.create=function(){return new P(t,e,t)},r.update=function(t){return r.create().update(t)},S(r,w,t,e)},R=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:I},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:I},{name:"shake",padding:[31,7936,2031616,520093696],bits:m,createMethod:function(t,e){var r=b(t,e,"hex");return r.create=function(r){return new P(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},S(r,b,t,e)}},{name:"cshake",padding:l,bits:m,createMethod:function(t,e){var r=v[t],n=A(t,0,"hex");return n.create=function(n,i,o){return i||o?new P(t,e,n).bytepad([i,o],r):_["shake"+t].create(n)},n.update=function(t,e,r,i){return n.create(e,r,i).update(t)},S(n,A,t,e)}},{name:"kmac",padding:l,bits:m,createMethod:function(t,e){var r=v[t],n=E(t,0,"hex");return n.create=function(n,i,o){return new T(t,e,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(t,e,r,i){return n.create(t,r,i).update(e)},S(n,E,t,e)}}],_={},x=[],M=0;M<R.length;++M)for(var N=R[M],k=N.bits,C=0;C<k.length;++C){var O=N.name+"_"+k[C];if(x.push(O),_[O]=N.createMethod(k[C],N.padding),"sha3"!==N.name){var B=N.name+k[C];x.push(B),_[B]=_[O]}}function P(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function T(t,e,r){P.call(this,t,e,r)}P.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(i);if(null===t)throw new Error(i);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(i);e=!0}for(var n,o,s=this.blocks,a=this.byteCount,u=t.length,c=this.blockCount,f=0,l=this.s;f<u;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<c+1;++n)s[n]=0;if(e)for(n=this.start;f<u&&n<a;++f)s[n>>2]|=t[f]<<d[3&n++];else for(n=this.start;f<u&&n<a;++f)(o=t.charCodeAt(f))<128?s[n>>2]|=o<<d[3&n++]:o<2048?(s[n>>2]|=(192|o>>6)<<d[3&n++],s[n>>2]|=(128|63&o)<<d[3&n++]):o<55296||o>=57344?(s[n>>2]|=(224|o>>12)<<d[3&n++],s[n>>2]|=(128|o>>6&63)<<d[3&n++],s[n>>2]|=(128|63&o)<<d[3&n++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++f)),s[n>>2]|=(240|o>>18)<<d[3&n++],s[n>>2]|=(128|o>>12&63)<<d[3&n++],s[n>>2]|=(128|o>>6&63)<<d[3&n++],s[n>>2]|=(128|63&o)<<d[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=s[c],n=0;n<c;++n)l[n]^=s[n];L(l),this.reset=!0}else this.start=n}return this},P.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},P.prototype.encodeString=function(t){var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(i);if(null===t)throw new Error(i);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(i);e=!0}var n=0,o=t.length;if(e)n=o;else for(var s=0;s<t.length;++s){var a=t.charCodeAt(s);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(t),n},P.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=e-r%e,o=[];return o.length=i,this.update(o),this},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];L(n)}},P.prototype.toString=P.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<e&&s<n;++o,++s)t=r[o],a+=f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15];s%e==0&&(L(r),o=0)}return i&&(t=r[o],a+=f[t>>4&15]+f[15&t],i>1&&(a+=f[t>>12&15]+f[t>>8&15]),i>2&&(a+=f[t>>20&15]+f[t>>16&15])),a},P.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(t);s<n;){for(o=0;o<e&&s<n;++o,++s)u[s]=r[o];s%e==0&&L(r)}return i&&(u[o]=r[o],t=t.slice(0,a)),t},P.prototype.buffer=P.prototype.arrayBuffer,P.prototype.digest=P.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)t=a<<2,e=n[s],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;a%r==0&&L(n)}return o&&(t=a<<2,e=n[s],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},T.prototype=new P,T.prototype.finalize=function(){return this.encode(this.outputBits,!0),P.prototype.finalize.call(this)};var L=function(t){var e,r,n,i,o,s,a,u,c,h,f,l,d,g,m,y,v,w,b,A,E,S,I,R,_,x,M,N,k,C,O,B,P,T,L,U,j,F,D,q,$,G,H,z,K,J,V,X,W,Q,Y,Z,tt,et,rt,nt,it,ot,st,at,ut,ct,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],f=t[7]^t[17]^t[27]^t[37]^t[47],e=(l=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),r=(d=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(h<<1|f>>>31),r=a^(f<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(l<<1|d>>>31),r=c^(d<<1|l>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|o>>>31),r=f^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,g=t[0],m=t[1],J=t[11]<<4|t[10]>>>28,V=t[10]<<4|t[11]>>>28,N=t[20]<<3|t[21]>>>29,k=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,G=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,T=t[2]<<1|t[3]>>>31,L=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,X=t[22]<<10|t[23]>>>22,W=t[23]<<10|t[22]>>>22,C=t[33]<<13|t[32]>>>19,O=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,U=t[14]<<6|t[15]>>>26,j=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,Q=t[34]<<15|t[35]>>>17,Y=t[35]<<15|t[34]>>>17,B=t[45]<<29|t[44]>>>3,P=t[44]<<29|t[45]>>>3,R=t[6]<<28|t[7]>>>4,_=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,F=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,A=t[36]<<21|t[37]>>>11,E=t[37]<<21|t[36]>>>11,Z=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,z=t[8]<<27|t[9]>>>5,K=t[9]<<27|t[8]>>>5,x=t[18]<<20|t[19]>>>12,M=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,q=t[38]<<8|t[39]>>>24,$=t[39]<<8|t[38]>>>24,S=t[48]<<14|t[49]>>>18,I=t[49]<<14|t[48]>>>18,t[0]=g^~y&w,t[1]=m^~v&b,t[10]=R^~x&N,t[11]=_^~M&k,t[20]=T^~U&F,t[21]=L^~j&D,t[30]=z^~J&X,t[31]=K^~V&W,t[40]=et^~nt&ot,t[41]=rt^~it&st,t[2]=y^~w&A,t[3]=v^~b&E,t[12]=x^~N&C,t[13]=M^~k&O,t[22]=U^~F&q,t[23]=j^~D&$,t[32]=J^~X&Q,t[33]=V^~W&Y,t[42]=nt^~ot&at,t[43]=it^~st&ut,t[4]=w^~A&S,t[5]=b^~E&I,t[14]=N^~C&B,t[15]=k^~O&P,t[24]=F^~q&G,t[25]=D^~$&H,t[34]=X^~Q&Z,t[35]=W^~Y&tt,t[44]=ot^~at&ct,t[45]=st^~ut&ht,t[6]=A^~S&g,t[7]=E^~I&m,t[16]=C^~B&R,t[17]=O^~P&_,t[26]=q^~G&T,t[27]=$^~H&L,t[36]=Q^~Z&z,t[37]=Y^~tt&K,t[46]=at^~ct&et,t[47]=ut^~ht&rt,t[8]=S^~g&y,t[9]=I^~m&v,t[18]=B^~R&x,t[19]=P^~_&M,t[28]=G^~T&U,t[29]=H^~L&j,t[38]=Z^~z&J,t[39]=tt^~K&V,t[48]=ct^~et&nt,t[49]=ht^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(u)t.exports=_;else{for(M=0;M<x.length;++M)s[x[M]]=_[x[M]];c&&(void 0===(n=function(){return _}.call(e,r,e,t))||(t.exports=n))}}()},5978:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JsonRpcRequestStruct=void 0;const n=r(5620),i=r(953),o=r(4520);e.JsonRpcRequestStruct=(0,o.object)({jsonrpc:(0,n.literal)("2.0"),id:(0,n.union)([(0,n.string)(),(0,n.number)(),(0,n.literal)(null)]),method:(0,n.string)(),params:(0,o.exactOptional)((0,n.union)([(0,n.array)(i.JsonStruct),(0,n.record)((0,n.string)(),i.JsonStruct)]))})},1236:function(t,e,r){"use strict";var n,i,o,s=this&&this.__classPrivateFieldSet||function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},a=this&&this.__classPrivateFieldGet||function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};Object.defineProperty(e,"__esModule",{value:!0}),e.KeyringClient=void 0;const u=r(5620),c=r(2831),h=r(2582),f=r(1925),l=r(4520);e.KeyringClient=class{constructor(t){n.add(this),i.set(this,void 0),s(this,i,t,"f")}async listAccounts(){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.ListAccounts}),h.ListAccountsResponseStruct)}async getAccount(t){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.GetAccount,params:{id:t}}),h.GetAccountResponseStruct)}async getAccountBalances(t,e){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.GetAccountBalances,params:{id:t,assets:e}}),h.GetAccountBalancesResponseStruct)}async createAccount(t={}){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.CreateAccount,params:{options:t}}),h.CreateAccountResponseStruct)}async filterAccountChains(t,e){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.FilterAccountChains,params:{id:t,chains:e}}),h.FilterAccountChainsResponseStruct)}async updateAccount(t){(0,u.assert)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.UpdateAccount,params:{account:t}}),h.UpdateAccountResponseStruct)}async deleteAccount(t){(0,u.assert)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.DeleteAccount,params:{id:t}}),h.DeleteAccountResponseStruct)}async exportAccount(t){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.ExportAccount,params:{id:t}}),h.ExportAccountResponseStruct)}async listRequests(){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.ListRequests}),h.ListRequestsResponseStruct)}async getRequest(t){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.GetRequest,params:{id:t}}),h.GetRequestResponseStruct)}async submitRequest(t){return(0,l.strictMask)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.SubmitRequest,params:t}),h.SubmitRequestResponseStruct)}async approveRequest(t,e={}){(0,u.assert)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.ApproveRequest,params:{id:t,data:e}}),h.ApproveRequestResponseStruct)}async rejectRequest(t){(0,u.assert)(await a(this,n,"m",o).call(this,{method:f.KeyringRpcMethod.RejectRequest,params:{id:t}}),h.RejectRequestResponseStruct)}},i=new WeakMap,n=new WeakSet,o=async function(t){return a(this,i,"f").send({jsonrpc:"2.0",id:(0,c.v4)(),...t})}},4071:function(t,e,r){"use strict";var n,i,o=this&&this.__classPrivateFieldSet||function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},s=this&&this.__classPrivateFieldGet||function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};Object.defineProperty(e,"__esModule",{value:!0}),e.KeyringSnapRpcClient=e.SnapRpcSender=void 0;const a=r(1236);class u{constructor(t,e){n.set(this,void 0),i.set(this,void 0),o(this,n,t,"f"),o(this,i,e,"f")}async send(t){return s(this,i,"f").request({method:"wallet_invokeKeyring",params:{snapId:s(this,n,"f"),request:t}})}}e.SnapRpcSender=u,n=new WeakMap,i=new WeakMap;class c extends a.KeyringClient{constructor(t,e){super(new u(t,e))}}e.KeyringSnapRpcClient=c},1950:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyringAccountStruct=e.BtcAccountType=e.EthAccountType=void 0;const n=r(5620),i=r(953),o=r(4520),s=r(4199);var a,u;!function(t){t.Eoa="eip155:eoa",t.Erc4337="eip155:erc4337"}(a=e.EthAccountType||(e.EthAccountType={})),function(t){t.P2wpkh="bip122:p2wpkh"}(u=e.BtcAccountType||(e.BtcAccountType={})),e.KeyringAccountStruct=(0,o.object)({id:s.UuidStruct,type:(0,n.enums)([`${a.Eoa}`,`${a.Erc4337}`,`${u.P2wpkh}`]),address:(0,n.string)(),options:(0,n.record)((0,n.string)(),i.JsonStruct),methods:(0,n.array)((0,n.string)())})},3433:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BalanceStruct=void 0;const n=r(5620),i=r(4520),o=r(4199);e.BalanceStruct=(0,i.object)({amount:o.StringNumberStruct,unit:(0,n.string)()})},8588:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isCaipAssetId=e.isCaipAssetType=e.CaipAssetIdStruct=e.CaipAssetTypeStruct=void 0;const n=r(5620),i=r(4520);e.CaipAssetTypeStruct=(0,i.definePattern)("CaipAssetType",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u),e.CaipAssetIdStruct=(0,i.definePattern)("CaipAssetId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u),e.isCaipAssetType=function(t){return(0,n.is)(t,e.CaipAssetTypeStruct)},e.isCaipAssetId=function(t){return(0,n.is)(t,e.CaipAssetIdStruct)}},4015:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyringAccountDataStruct=void 0;const n=r(5620),i=r(953);e.KeyringAccountDataStruct=(0,n.record)((0,n.string)(),i.JsonStruct)},5417:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(1950),e),i(r(3433),e),i(r(8588),e),i(r(4015),e),i(r(5444),e),i(r(7884),e),i(r(6142),e)},5444:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},7884:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyringRequestStruct=void 0;const n=r(5620),i=r(953),o=r(4520),s=r(4199);e.KeyringRequestStruct=(0,o.object)({id:s.UuidStruct,scope:(0,n.string)(),account:s.UuidStruct,request:(0,o.object)({method:(0,n.string)(),params:(0,o.exactOptional)((0,n.union)([(0,n.array)(i.JsonStruct),(0,n.record)((0,n.string)(),i.JsonStruct)]))})})},6142:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyringResponseStruct=void 0;const n=r(5620),i=r(953),o=r(4520);e.KeyringResponseStruct=(0,n.union)([(0,o.object)({pending:(0,n.literal)(!0),redirect:(0,o.exactOptional)((0,o.object)({message:(0,o.exactOptional)((0,n.string)()),url:(0,o.exactOptional)((0,n.string)())}))}),(0,o.object)({pending:(0,n.literal)(!1),result:i.JsonStruct})])},5238:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(5787),e)},5787:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BtcP2wpkhAccountStruct=e.BtcMethod=e.BtcP2wpkhAddressStruct=void 0;const n=r(5620),i=r(115),o=r(5417),s=r(4520);var a;e.BtcP2wpkhAddressStruct=(0,n.refine)((0,n.string)(),"BtcP2wpkhAddressStruct",(t=>{try{i.bech32.decode(t)}catch(t){return new Error(`Could not decode P2WPKH address: ${t.message}`)}return!0})),function(t){t.SendMany="btc_sendmany"}(a=e.BtcMethod||(e.BtcMethod={})),e.BtcP2wpkhAccountStruct=(0,s.object)({...o.KeyringAccountStruct.schema,address:e.BtcP2wpkhAddressStruct,type:(0,n.literal)(`${o.BtcAccountType.P2wpkh}`),methods:(0,n.array)((0,n.enums)([`${a.SendMany}`]))})},1360:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},322:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(4943),e)},4943:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EthUserOperationPatchStruct=e.EthBaseUserOperationStruct=e.EthBaseTransactionStruct=e.EthUserOperationStruct=void 0;const n=r(4520),i=r(4199),o=r(6879);e.EthUserOperationStruct=(0,n.object)({sender:o.EthAddressStruct,nonce:o.EthUint256Struct,initCode:o.EthBytesStruct,callData:o.EthBytesStruct,callGasLimit:o.EthUint256Struct,verificationGasLimit:o.EthUint256Struct,preVerificationGas:o.EthUint256Struct,maxFeePerGas:o.EthUint256Struct,maxPriorityFeePerGas:o.EthUint256Struct,paymasterAndData:o.EthBytesStruct,signature:o.EthBytesStruct}),e.EthBaseTransactionStruct=(0,n.object)({to:o.EthAddressStruct,value:o.EthUint256Struct,data:o.EthBytesStruct}),e.EthBaseUserOperationStruct=(0,n.object)({nonce:o.EthUint256Struct,initCode:o.EthBytesStruct,callData:o.EthBytesStruct,gasLimits:(0,n.exactOptional)((0,n.object)({callGasLimit:o.EthUint256Struct,verificationGasLimit:o.EthUint256Struct,preVerificationGas:o.EthUint256Struct})),dummyPaymasterAndData:o.EthBytesStruct,dummySignature:o.EthBytesStruct,bundlerUrl:i.UrlStruct}),e.EthUserOperationPatchStruct=(0,n.object)({paymasterAndData:o.EthBytesStruct,callGasLimit:(0,n.exactOptional)(o.EthUint256Struct),verificationGasLimit:(0,n.exactOptional)(o.EthUint256Struct),preVerificationGas:(0,n.exactOptional)(o.EthUint256Struct)})},6034:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(322),e),i(r(6879),e),i(r(1267),e)},6879:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EthErc4337AccountStruct=e.EthEoaAccountStruct=e.EthMethod=e.EthUint256Struct=e.EthAddressStruct=e.EthBytesStruct=void 0;const n=r(5620),i=r(5417),o=r(4520);var s;e.EthBytesStruct=(0,o.definePattern)("EthBytes",/^0x[0-9a-f]*$/iu),e.EthAddressStruct=(0,o.definePattern)("EthAddress",/^0x[0-9a-f]{40}$/iu),e.EthUint256Struct=(0,o.definePattern)("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/iu),function(t){t.PersonalSign="personal_sign",t.Sign="eth_sign",t.SignTransaction="eth_signTransaction",t.SignTypedDataV1="eth_signTypedData_v1",t.SignTypedDataV3="eth_signTypedData_v3",t.SignTypedDataV4="eth_signTypedData_v4",t.PrepareUserOperation="eth_prepareUserOperation",t.PatchUserOperation="eth_patchUserOperation",t.SignUserOperation="eth_signUserOperation"}(s=e.EthMethod||(e.EthMethod={})),e.EthEoaAccountStruct=(0,o.object)({...i.KeyringAccountStruct.schema,address:e.EthAddressStruct,type:(0,n.literal)(`${i.EthAccountType.Eoa}`),methods:(0,n.array)((0,n.enums)([`${s.PersonalSign}`,`${s.Sign}`,`${s.SignTransaction}`,`${s.SignTypedDataV1}`,`${s.SignTypedDataV3}`,`${s.SignTypedDataV4}`]))}),e.EthErc4337AccountStruct=(0,o.object)({...i.KeyringAccountStruct.schema,address:e.EthAddressStruct,type:(0,n.literal)(`${i.EthAccountType.Erc4337}`),methods:(0,n.array)((0,n.enums)([`${s.PersonalSign}`,`${s.Sign}`,`${s.SignTypedDataV1}`,`${s.SignTypedDataV3}`,`${s.SignTypedDataV4}`,`${s.PrepareUserOperation}`,`${s.PatchUserOperation}`,`${s.SignUserOperation}`]))})},1267:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isEvmAccountType=void 0;const n=r(5417);e.isEvmAccountType=function(t){return t===n.EthAccountType.Eoa||t===n.EthAccountType.Erc4337}},4433:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KeyringEvent=void 0,function(t){t.AccountCreated="notify:accountCreated",t.AccountUpdated="notify:accountUpdated",t.AccountDeleted="notify:accountDeleted",t.RequestApproved="notify:requestApproved",t.RequestRejected="notify:requestRejected"}(e.KeyringEvent||(e.KeyringEvent={}))},7962:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(5417),e),i(r(5238),e),i(r(1360),e),i(r(6034),e),i(r(4433),e),i(r(7470),e),i(r(1236),e),i(r(4071),e),i(r(3060),e),i(r(5524),e),i(r(4520),e)},2582:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RejectRequestResponseStruct=e.RejectRequestRequestStruct=e.ApproveRequestResponseStruct=e.ApproveRequestRequestStruct=e.SubmitRequestResponseStruct=e.SubmitRequestRequestStruct=e.GetRequestResponseStruct=e.GetRequestRequestStruct=e.ListRequestsResponseStruct=e.ListRequestsRequestStruct=e.ExportAccountResponseStruct=e.ExportAccountRequestStruct=e.DeleteAccountResponseStruct=e.DeleteAccountRequestStruct=e.UpdateAccountResponseStruct=e.UpdateAccountRequestStruct=e.FilterAccountChainsResponseStruct=e.FilterAccountChainsStruct=e.GetAccountBalancesResponseStruct=e.GetAccountBalancesRequestStruct=e.CreateAccountResponseStruct=e.CreateAccountRequestStruct=e.GetAccountResponseStruct=e.GetAccountRequestStruct=e.ListAccountsResponseStruct=e.ListAccountsRequestStruct=void 0;const n=r(5620),i=r(953),o=r(5417),s=r(4520),a=r(4199),u=r(1925),c={jsonrpc:(0,n.literal)("2.0"),id:(0,n.union)([(0,n.string)(),(0,n.number)(),(0,n.literal)(null)])};e.ListAccountsRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_listAccounts")}),e.ListAccountsResponseStruct=(0,n.array)(o.KeyringAccountStruct),e.GetAccountRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_getAccount"),params:(0,s.object)({id:a.UuidStruct})}),e.GetAccountResponseStruct=o.KeyringAccountStruct,e.CreateAccountRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_createAccount"),params:(0,s.object)({options:(0,n.record)((0,n.string)(),i.JsonStruct)})}),e.CreateAccountResponseStruct=o.KeyringAccountStruct,e.GetAccountBalancesRequestStruct=(0,s.object)({...c,method:(0,n.literal)(`${u.KeyringRpcMethod.GetAccountBalances}`),params:(0,s.object)({id:a.UuidStruct,assets:(0,n.array)(o.CaipAssetTypeStruct)})}),e.GetAccountBalancesResponseStruct=(0,n.record)(o.CaipAssetTypeStruct,o.BalanceStruct),e.FilterAccountChainsStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_filterAccountChains"),params:(0,s.object)({id:a.UuidStruct,chains:(0,n.array)((0,n.string)())})}),e.FilterAccountChainsResponseStruct=(0,n.array)((0,n.string)()),e.UpdateAccountRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_updateAccount"),params:(0,s.object)({account:o.KeyringAccountStruct})}),e.UpdateAccountResponseStruct=(0,n.literal)(null),e.DeleteAccountRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_deleteAccount"),params:(0,s.object)({id:a.UuidStruct})}),e.DeleteAccountResponseStruct=(0,n.literal)(null),e.ExportAccountRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_exportAccount"),params:(0,s.object)({id:a.UuidStruct})}),e.ExportAccountResponseStruct=o.KeyringAccountDataStruct,e.ListRequestsRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_listRequests")}),e.ListRequestsResponseStruct=(0,n.array)(o.KeyringRequestStruct),e.GetRequestRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_getRequest"),params:(0,s.object)({id:a.UuidStruct})}),e.GetRequestResponseStruct=o.KeyringRequestStruct,e.SubmitRequestRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_submitRequest"),params:o.KeyringRequestStruct}),e.SubmitRequestResponseStruct=o.KeyringResponseStruct,e.ApproveRequestRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_approveRequest"),params:(0,s.object)({id:a.UuidStruct,data:(0,n.record)((0,n.string)(),i.JsonStruct)})}),e.ApproveRequestResponseStruct=(0,n.literal)(null),e.RejectRequestRequestStruct=(0,s.object)({...c,method:(0,n.literal)("keyring_rejectRequest"),params:(0,s.object)({id:a.UuidStruct})}),e.RejectRequestResponseStruct=(0,n.literal)(null)},6796:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},222:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(6796),e)},3005:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RequestRejectedEventStruct=e.RequestApprovedEventStruct=e.AccountDeletedEventStruct=e.AccountUpdatedEventStruct=e.AccountCreatedEventStruct=void 0;const n=r(5620),i=r(953),o=r(5417),s=r(4433),a=r(4520),u=r(4199);e.AccountCreatedEventStruct=(0,a.object)({method:(0,n.literal)(`${s.KeyringEvent.AccountCreated}`),params:(0,a.object)({account:o.KeyringAccountStruct,accountNameSuggestion:(0,a.exactOptional)((0,n.string)()),displayConfirmation:(0,a.exactOptional)((0,n.boolean)())})}),e.AccountUpdatedEventStruct=(0,a.object)({method:(0,n.literal)(`${s.KeyringEvent.AccountUpdated}`),params:(0,a.object)({account:o.KeyringAccountStruct})}),e.AccountDeletedEventStruct=(0,a.object)({method:(0,n.literal)(`${s.KeyringEvent.AccountDeleted}`),params:(0,a.object)({id:u.UuidStruct})}),e.RequestApprovedEventStruct=(0,a.object)({method:(0,n.literal)(`${s.KeyringEvent.RequestApproved}`),params:(0,a.object)({id:u.UuidStruct,result:i.JsonStruct})}),e.RequestRejectedEventStruct=(0,a.object)({method:(0,n.literal)(`${s.KeyringEvent.RequestRejected}`),params:(0,a.object)({id:u.UuidStruct})})},7470:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(2582),e),i(r(222),e),i(r(3005),e),i(r(1925),e),i(r(3699),e)},1925:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.isKeyringRpcMethod=e.KeyringRpcMethod=void 0,function(t){t.ListAccounts="keyring_listAccounts",t.GetAccount="keyring_getAccount",t.CreateAccount="keyring_createAccount",t.GetAccountBalances="keyring_getAccountBalances",t.FilterAccountChains="keyring_filterAccountChains",t.UpdateAccount="keyring_updateAccount",t.DeleteAccount="keyring_deleteAccount",t.ExportAccount="keyring_exportAccount",t.ListRequests="keyring_listRequests",t.GetRequest="keyring_getRequest",t.SubmitRequest="keyring_submitRequest",t.ApproveRequest="keyring_approveRequest",t.RejectRequest="keyring_rejectRequest"}(r=e.KeyringRpcMethod||(e.KeyringRpcMethod={})),e.isKeyringRpcMethod=function(t){return Object.values(r).includes(t)}},3699:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InternalAccountStruct=e.InternalAccountStructs=e.InternalBtcP2wpkhAccountStruct=e.InternalEthErc4337AccountStruct=e.InternalEthEoaAccountStruct=e.InternalAccountMetadataStruct=void 0;const n=r(5620),i=r(5417),o=r(5787),s=r(6879),a=r(4520);function u(t){return(0,a.object)({...t.schema,...e.InternalAccountMetadataStruct.schema})}e.InternalAccountMetadataStruct=(0,a.object)({metadata:(0,a.object)({name:(0,n.string)(),nameLastUpdatedAt:(0,a.exactOptional)((0,n.number)()),snap:(0,a.exactOptional)((0,a.object)({id:(0,n.string)(),enabled:(0,n.boolean)(),name:(0,n.string)()})),lastSelected:(0,a.exactOptional)((0,n.number)()),importTime:(0,n.number)(),keyring:(0,a.object)({type:(0,n.string)()})})}),e.InternalEthEoaAccountStruct=u(s.EthEoaAccountStruct),e.InternalEthErc4337AccountStruct=u(s.EthErc4337AccountStruct),e.InternalBtcP2wpkhAccountStruct=u(o.BtcP2wpkhAccountStruct),e.InternalAccountStructs={[`${i.EthAccountType.Eoa}`]:e.InternalEthEoaAccountStruct,[`${i.EthAccountType.Erc4337}`]:e.InternalEthErc4337AccountStruct,[`${i.BtcAccountType.P2wpkh}`]:e.InternalBtcP2wpkhAccountStruct},e.InternalAccountStruct=(0,a.object)({...i.KeyringAccountStruct.schema,...e.InternalAccountMetadataStruct.schema})},3060:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.handleKeyringRequest=e.MethodNotSupportedError=void 0;const n=r(5620),i=r(2582),o=r(1925),s=r(5978);class a extends Error{constructor(t){super(`Method not supported: ${t}`)}}e.MethodNotSupportedError=a,e.handleKeyringRequest=async function(t,e){try{return await async function(t,e){switch((0,n.assert)(e,s.JsonRpcRequestStruct),e.method){case o.KeyringRpcMethod.ListAccounts:return(0,n.assert)(e,i.ListAccountsRequestStruct),t.listAccounts();case o.KeyringRpcMethod.GetAccount:return(0,n.assert)(e,i.GetAccountRequestStruct),t.getAccount(e.params.id);case o.KeyringRpcMethod.CreateAccount:return(0,n.assert)(e,i.CreateAccountRequestStruct),t.createAccount(e.params.options);case o.KeyringRpcMethod.GetAccountBalances:if(void 0===t.getAccountBalances)throw new a(e.method);return(0,n.assert)(e,i.GetAccountBalancesRequestStruct),t.getAccountBalances(e.params.id,e.params.assets);case o.KeyringRpcMethod.FilterAccountChains:return(0,n.assert)(e,i.FilterAccountChainsStruct),t.filterAccountChains(e.params.id,e.params.chains);case o.KeyringRpcMethod.UpdateAccount:return(0,n.assert)(e,i.UpdateAccountRequestStruct),t.updateAccount(e.params.account);case o.KeyringRpcMethod.DeleteAccount:return(0,n.assert)(e,i.DeleteAccountRequestStruct),t.deleteAccount(e.params.id);case o.KeyringRpcMethod.ExportAccount:if(void 0===t.exportAccount)throw new a(e.method);return(0,n.assert)(e,i.ExportAccountRequestStruct),t.exportAccount(e.params.id);case o.KeyringRpcMethod.ListRequests:if(void 0===t.listRequests)throw new a(e.method);return(0,n.assert)(e,i.ListRequestsRequestStruct),t.listRequests();case o.KeyringRpcMethod.GetRequest:if(void 0===t.getRequest)throw new a(e.method);return(0,n.assert)(e,i.GetRequestRequestStruct),t.getRequest(e.params.id);case o.KeyringRpcMethod.SubmitRequest:return(0,n.assert)(e,i.SubmitRequestRequestStruct),t.submitRequest(e.params);case o.KeyringRpcMethod.ApproveRequest:if(void 0===t.approveRequest)throw new a(e.method);return(0,n.assert)(e,i.ApproveRequestRequestStruct),t.approveRequest(e.params.id,e.params.data);case o.KeyringRpcMethod.RejectRequest:if(void 0===t.rejectRequest)throw new a(e.method);return(0,n.assert)(e,i.RejectRequestRequestStruct),t.rejectRequest(e.params.id);default:throw new a(e.method)}}(t,e)}catch(t){const e=t instanceof Error&&"string"==typeof t.message?t.message:"An unknown error occurred while handling the keyring request";throw new Error(e)}}},5524:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.emitSnapKeyringEvent=void 0,e.emitSnapKeyringEvent=async function(t,e,r){await t.request({method:"snap_manageAccounts",params:{method:e,params:{...r}}})}},4520:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.strictMask=e.definePattern=e.exactOptional=e.object=void 0;const n=r(5620);function i(t){return t.path[t.path.length-1]in t.branch[t.branch.length-2]}e.object=function(t){return(0,n.object)(t)},e.exactOptional=function(t){return new n.Struct({...t,validator:(e,r)=>!i(r)||t.validator(e,r),refiner:(e,r)=>!i(r)||t.refiner(e,r)})},e.definePattern=function(t,e){return(0,n.define)(t,(t=>"string"==typeof t&&e.test(t)))},e.strictMask=function(t,e,r){return(0,n.assert)(t,e,r),t}},4199:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(8401),e),i(r(7765),e)},8401:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StringNumberStruct=e.UrlStruct=e.UuidStruct=void 0;const n=r(5620),i=r(4520);e.UuidStruct=(0,i.definePattern)("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),e.UrlStruct=(0,n.define)("Url",(t=>{try{const e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch(t){return!1}})),e.StringNumberStruct=(0,i.definePattern)("StringNumber",/^\d+(\.\d+)?$/u)},7765:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.expectTrue=void 0,e.expectTrue=function(){}},115:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bech32m=e.bech32=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<32;t++){const e=r.charAt(t);n[e]=t}function i(t){const e=t>>25;return(33554431&t)<<5^996825010&-(1&e)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function o(t){let e=1;for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);e=i(e)^31&n}return e}function s(t,e,r,n){let i=0,o=0;const s=(1<<r)-1,a=[];for(let n=0;n<t.length;++n)for(i=i<<e|t[n],o+=e;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=e)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}function a(t){return s(t,8,5,!0)}function u(t){const e=s(t,5,8,!1);if(Array.isArray(e))return e}function c(t){const e=s(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function h(t){let e;function s(t,r){if(r=r||90,t.length<8)return t+" too short";if(t.length>r)return"Exceeds length limit";const s=t.toLowerCase(),a=t.toUpperCase();if(t!==s&&t!==a)return"Mixed-case string "+t;const u=(t=s).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const c=t.slice(0,u),h=t.slice(u+1);if(h.length<6)return"Data too short";let f=o(c);if("string"==typeof f)return f;const l=[];for(let t=0;t<h.length;++t){const e=h.charAt(t),r=n[e];if(void 0===r)return"Unknown character "+e;f=i(f)^r,t+6>=h.length||l.push(r)}return f!==e?"Invalid checksum for "+t:{prefix:c,words:l}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const r=s(t,e);if("object"==typeof r)return r},decode:function(t,e){const r=s(t,e);if("object"==typeof r)return r;throw new Error(r)},encode:function(t,n,s){if(s=s||90,t.length+7+n.length>s)throw new TypeError("Exceeds length limit");let a=o(t=t.toLowerCase());if("string"==typeof a)throw new Error(a);let u=t+"1";for(let t=0;t<n.length;++t){const e=n[t];if(e>>5)throw new Error("Non 5-bit word");a=i(a)^e,u+=r.charAt(e)}for(let t=0;t<6;++t)a=i(a);a^=e;for(let t=0;t<6;++t){u+=r.charAt(a>>5*(5-t)&31)}return u},toWords:a,fromWordsUnsafe:u,fromWords:c}}e.bech32=h("bech32"),e.bech32m=h("bech32m")},7557:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function n(t,...e){if(!((r=t)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}Object.defineProperty(e,"__esModule",{value:!0}),e.anumber=r,e.abytes=n,e.ahash=function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)},e.aexists=function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},e.aoutput=function(t,e){n(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}},2318:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.add5L=e.add5H=e.add4H=e.add4L=e.add3H=e.add3L=e.rotlBL=e.rotlBH=e.rotlSL=e.rotlSH=e.rotr32L=e.rotr32H=e.rotrBL=e.rotrBH=e.rotrSL=e.rotrSH=e.shrSL=e.shrSH=e.toBig=void 0,e.fromBig=i,e.split=o,e.add=w;const r=BigInt(2**32-1),n=BigInt(32);function i(t,e=!1){return e?{h:Number(t&r),l:Number(t>>n&r)}:{h:0|Number(t>>n&r),l:0|Number(t&r)}}function o(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:s,l:a}=i(t[o],e);[r[o],n[o]]=[s,a]}return[r,n]}const s=(t,e)=>BigInt(t>>>0)<<n|BigInt(e>>>0);e.toBig=s;const a=(t,e,r)=>t>>>r;e.shrSH=a;const u=(t,e,r)=>t<<32-r|e>>>r;e.shrSL=u;const c=(t,e,r)=>t>>>r|e<<32-r;e.rotrSH=c;const h=(t,e,r)=>t<<32-r|e>>>r;e.rotrSL=h;const f=(t,e,r)=>t<<64-r|e>>>r-32;e.rotrBH=f;const l=(t,e,r)=>t>>>r-32|e<<64-r;e.rotrBL=l;const d=(t,e)=>e;e.rotr32H=d;const p=(t,e)=>t;e.rotr32L=p;const g=(t,e,r)=>t<<r|e>>>32-r;e.rotlSH=g;const m=(t,e,r)=>e<<r|t>>>32-r;e.rotlSL=m;const y=(t,e,r)=>e<<r-32|t>>>64-r;e.rotlBH=y;const v=(t,e,r)=>t<<r-32|e>>>64-r;function w(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:0|i}}e.rotlBL=v;const b=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0);e.add3L=b;const A=(t,e,r,n)=>e+r+n+(t/2**32|0)|0;e.add3H=A;const E=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0);e.add4L=E;const S=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0;e.add4H=S;const I=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0);e.add5L=I;const R=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;e.add5H=R;const _={fromBig:i,split:o,toBig:s,shrSH:a,shrSL:u,rotrSH:c,rotrSL:h,rotrBH:f,rotrBL:l,rotr32H:d,rotr32L:p,rotlSH:g,rotlSL:m,rotlBH:y,rotlBL:v,add:w,add3L:b,add3H:A,add4L:E,add4H:S,add5H:R,add5L:I};e.default=_},5145:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},2955:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.shake256=e.shake128=e.keccak_512=e.keccak_384=e.keccak_256=e.keccak_224=e.sha3_512=e.sha3_384=e.sha3_256=e.sha3_224=e.Keccak=void 0,e.keccakP=w;const n=r(7557),i=r(2318),o=r(9175),s=[],a=[],u=[],c=BigInt(0),h=BigInt(1),f=BigInt(2),l=BigInt(7),d=BigInt(256),p=BigInt(113);for(let t=0,e=h,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],s.push(2*(5*n+r)),a.push((t+1)*(t+2)/2%64);let i=c;for(let t=0;t<7;t++)e=(e<<h^(e>>l)*p)%d,e&f&&(i^=h<<(h<<BigInt(t))-h);u.push(i)}const[g,m]=(0,i.split)(u,!0),y=(t,e,r)=>r>32?(0,i.rotlBH)(t,e,r):(0,i.rotlSH)(t,e,r),v=(t,e,r)=>r>32?(0,i.rotlBL)(t,e,r):(0,i.rotlSL)(t,e,r);function w(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let e=0;e<10;e++)r[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const n=(e+8)%10,i=(e+2)%10,o=r[i],s=r[i+1],a=y(o,s,1)^r[n],u=v(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)t[e+r]^=a,t[e+r+1]^=u}let e=t[2],i=t[3];for(let r=0;r<24;r++){const n=a[r],o=y(e,i,n),u=v(e,i,n),c=s[r];e=t[c],i=t[c+1],t[c]=o,t[c+1]=u}for(let e=0;e<50;e+=10){for(let n=0;n<10;n++)r[n]=t[e+n];for(let n=0;n<10;n++)t[e+n]^=~r[(n+2)%10]&r[(n+4)%10]}t[0]^=g[n],t[1]^=m[n]}r.fill(0)}class b extends o.Hash{constructor(t,e,r,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,n.anumber)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,o.u32)(this.state)}keccak(){o.isLE||(0,o.byteSwap32)(this.state32),w(this.state32,this.rounds),o.isLE||(0,o.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,n.aexists)(this);const{blockLen:e,state:r}=this,i=(t=(0,o.toBytes)(t)).length;for(let n=0;n<i;){const o=Math.min(e-this.pos,i-n);for(let e=0;e<o;e++)r[this.pos++]^=t[n++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:n}=this;t[r]^=e,128&e&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){(0,n.aexists)(this,!1),(0,n.abytes)(t),this.finish();const e=this.state,{blockLen:r}=this;for(let n=0,i=t.length;n<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,n.anumber)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,n.aoutput)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return t||(t=new b(e,r,n,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}}e.Keccak=b;const A=(t,e,r)=>(0,o.wrapConstructor)((()=>new b(e,t,r)));e.sha3_224=A(6,144,28),e.sha3_256=A(6,136,32),e.sha3_384=A(6,104,48),e.sha3_512=A(6,72,64),e.keccak_224=A(1,144,28),e.keccak_256=A(1,136,32),e.keccak_384=A(1,104,48),e.keccak_512=A(1,72,64);const E=(t,e,r)=>(0,o.wrapXOFConstructorWithOpts)(((n={})=>new b(e,t,void 0===n.dkLen?r:n.dkLen,!0)));e.shake128=E(31,168,16),e.shake256=E(31,136,32)},9175:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.isLE=void 0,e.isBytes=function(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name},e.u8=function(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)},e.u32=function(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))},e.createView=function(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)},e.rotr=function(t,e){return t<<32-e|t>>>e},e.rotl=function(t,e){return t<<e|t>>>32-e>>>0},e.byteSwap=o,e.byteSwap32=function(t){for(let e=0;e<t.length;e++)t[e]=o(t[e])},e.bytesToHex=function(t){(0,i.abytes)(t);let e="";for(let r=0;r<t.length;r++)e+=s[t[r]];return e},e.hexToBytes=function(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,i=0;e<r;e++,i+=2){const r=u(t.charCodeAt(i)),o=u(t.charCodeAt(i+1));if(void 0===r||void 0===o){const e=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+i)}n[e]=16*r+o}return n},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o<t;o++){n(o);const t=Date.now()-i;t>=0&&t<r||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=c,e.toBytes=h,e.concatBytes=function(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];(0,i.abytes)(n),e+=n.length}const r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r},e.checkOpts=function(t,e){if(void 0!==e&&"[object Object]"!=={}.toString.call(e))throw new Error("Options should be object or undefined");return Object.assign(t,e)},e.wrapConstructor=function(t){const e=e=>t().update(h(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.wrapXOFConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.randomBytes=function(t=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(t));if(n.crypto&&"function"==typeof n.crypto.randomBytes)return n.crypto.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")};const n=r(5145),i=r(7557);function o(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.byteSwapIfBE=e.isLE?t=>t:t=>o(t);const s=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));const a={_0:48,_9:57,A:65,F:70,a:97,f:102};function u(t){return t>=a._0&&t<=a._9?t-a._0:t>=a.A&&t<=a.F?t-(a.A-10):t>=a.a&&t<=a.f?t-(a.a-10):void 0}function c(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function h(t){return"string"==typeof t&&(t=c(t)),(0,i.abytes)(t),t}e.nextTick=async()=>{};e.Hash=class{clone(){return this._cloneInto()}}},3203:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function n(t){return t instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name}function i(...t){const e=t=>t,r=(t,e)=>r=>t(e(r));return{encode:t.map((t=>t.encode)).reduceRight(r,e),decode:t.map((t=>t.decode)).reduce(r,e)}}function o(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("alphabet.encode input should be an array of numbers");return e.map((e=>{if(r(e),e<0||e>=t.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${t.length})`);return t[e]}))},decode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("alphabet.decode input should be array of strings");return e.map((e=>{if("string"!=typeof e)throw new Error(`alphabet.decode: not string element=${e}`);const r=t.indexOf(e);if(-1===r)throw new Error(`Unknown letter: "${e}". Allowed: ${t}`);return r}))}}}function s(t=""){if("string"!=typeof t)throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&"string"!=typeof e[0])throw new Error("join.encode input should be array of strings");for(let t of e)if("string"!=typeof t)throw new Error(`join.encod