1!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="5467c7d8-a5cc-4b7e-89e7-aaf4cd72d876",t._sentryDebugIdIdentifier="sentry-dbid-5467c7d8-a5cc-4b7e-89e7-aaf4cd72d876")}catch(t){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[14718],{14718:function(t,e,s){"use strict";s.d(e,{EthereumProvider:function(){return tF},OPTIONAL_EVENTS:function(){return tq},OPTIONAL_METHODS:function(){return t_}});var i=s(51200),r=s.n(i),n=s(87883),a=s(29525),o=s(25436),h=s(91065),c=s(81953),p=s.n(c),l=s(71858),d=s(44975),u=Object.defineProperty,m=Object.defineProperties,f=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,y=(t,e,s)=>e in t?u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,w=(t,e)=>{for(var s in e||(e={}))g.call(e,s)&&y(t,s,e[s]);if(v)for(var s of v(e))P.call(e,s)&&y(t,s,e[s]);return t},b=(t,e)=>m(t,f(e));let C={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class I{constructor(t,e=!1){if(this.url=t,this.disableProviderPing=e,this.events=new i.EventEmitter,this.isAvailable=!1,this.registering=!1,!(0,d.isHttpUrl)(t))throw Error(`Provided URL is not compatible with HTTP connection: ${t}`);this.url=t,this.disableProviderPing=e}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw Error("Connection already closed");this.onClose()}async send(t){this.isAvailable||await this.register();try{let e=(0,l.u)(t),s=await (await p()(this.url,b(w({},C),{body:e}))).json();this.onPayload({data:s})}catch(e){this.onError(t.id,e)}}async register(t=this.url){if(!(0,d.isHttpUrl)(t))throw Error(`Provided URL is not compatible with HTTP connection: ${t}`);if(this.registering){let t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((t,e)=>{this.events.once("register_error",t=>{this.resetMaxListeners(),e(t)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return e(Error("HTTP connection is missing or invalid"));t()})})}this.url=t,this.registering=!0;try{if(!this.disableProviderPing){let e=(0,l.u)({id:1,jsonrpc:"2.0",method:"test",params:[]});await p()(t,b(w({},C),{body:e}))}this.onOpen()}catch(e){let t=this.parseError(e);throw this.events.emit("register_error",t),this.onClose(),t}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(typeof t.data>"u")return;let e="string"==typeof t.data?(0,l.D)(t.data):t.data;this.events.emit("payload",e)}onError(t,e){let s=this.parseError(e),i=s.message||s.toString(),r=(0,d.formatJsonRpcError)(t,i);this.events.emit("payload",r)}parseError(t,e=this.url){return(0,d.parseConnectionError)(t,e,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}var E=s(85672);let O="error",A="wc@2:universal_provider:",$="https://rpc.walletconnect.org/v1/",_="generic",H=`${$}bundler`,q="default_chain_changed";var S=Object.defineProperty,j=Object.defineProperties,D=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,T=(t,e,s)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,x=(t,e)=>{for(var s in e||(e={}))R.call(e,s)&&T(t,s,e[s]);if(N)for(var s of N(e))M.call(e,s)&&T(t,s,e[s]);return t},U=(t,e)=>j(t,D(e));function k(t,e,s){var i;let r=(0,n.DQe)(t);return(null==(i=e.rpcMap)?void 0:i[r.reference])||`${$}?chainId=${r.namespace}:${r.reference}&projectId=${s}`}function B(t){return t.includes(":")?t.split(":")[1]:t}function L(t){return t.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function F(t={},e={}){let s=z(t),i=z(e);return(0,h.merge)(s,i)}function z(t){var e,s,i,r;let a={};if(!(0,n.L5o)(t))return a;for(let[o,h]of Object.entries(t)){let t=(0,n.gpE)(o)?[o]:h.chains,c=h.methods||[],p=h.events||[],l=h.rpcMap||{},d=(0,n.Maj)(o);a[d]=U(x(x({},a[d]),h),{chains:(0,n.eGA)(t,null==(e=a[d])?void 0:e.chains),methods:(0,n.eGA)(c,null==(s=a[d])?void 0:s.methods),events:(0,n.eGA)(p,null==(i=a[d])?void 0:i.events),rpcMap:x(x({},l),null==(r=a[d])?void 0:r.rpcMap)})}return a}function J(t){return t.includes(":")?t.split(":")[2]:t}function G(t){let e={};for(let[s,i]of Object.entries(t)){let t=i.methods||[],r=i.events||[],a=i.accounts||[],o=(0,n.gpE)(s)?[s]:i.chains?i.chains:L(i.accounts);e[s]={chains:o,methods:t,events:r,accounts:a}}return e}function Q(t){return"number"==typeof t?t:t.includes("0x")?parseInt(t,16):isNaN(Number(t=t.includes(":")?t.split(":")[1]:t))?t:Number(t)}let W={},K=t=>W[t],V=(t,e)=>{W[t]=e};class Y{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(q,`${this.name}:${t}`)}getAccounts(){let t=this.namespace.accounts;return t&&t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]}createHttpProviders(){let t={};
1return this.namespace.chains.forEach(e=>{var s;let i=B(e);t[i]=this.createHttpProvider(i,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}}var X=Object.defineProperty,Z=Object.defineProperties,tt=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,ts=Object.prototype.hasOwnProperty,ti=Object.prototype.propertyIsEnumerable,tr=(t,e,s)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,tn=(t,e)=>{for(var s in e||(e={}))ts.call(e,s)&&tr(t,s,e[s]);if(te)for(var s of te(e))ti.call(e,s)&&tr(t,s,e[s]);return t},ta=(t,e)=>Z(t,tt(e));class to{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(q,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){let s=e||k(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){let t={};return this.namespace.chains.forEach(e=>{var s;let i=parseInt(B(e));t[i]=this.createHttpProvider(i,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){let t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,s;let i=t.request.params?null==(e=t.request.params[0])?void 0:e.chainId:"0x0",r=parseInt(i=i.startsWith("0x")?i:`0x${i}`,16);if(this.isChainApproved(r))this.setDefaultChain(`${r}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:i}]},chainId:null==(s=this.namespace.chains)?void 0:s[0]}),this.setDefaultChain(`${r}`);else throw Error(`Failed to switch to chain 'eip155:${r}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,i;let r=null==(s=null==(e=t.request)?void 0:e.params)?void 0:s[0];if(!r)throw Error("Missing address parameter in `wallet_getCapabilities` request");let n=this.client.session.get(t.topic),a=(null==(i=n?.sessionProperties)?void 0:i.capabilities)||{};if(null!=a&&a[r])return a?.[r];let o=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:ta(tn({},n.sessionProperties||{}),{capabilities:ta(tn({},a||{}),{[r]:o})})})}catch(t){console.warn("Failed to update session with capabilities",t)}return o}async getCallStatus(t){var e,s;let i=this.client.session.get(t.topic),r=null==(e=i.sessionProperties)?void 0:e.bundler_name;if(r){let e=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(e,t)}catch(t){console.warn("Failed to fetch call status from bundler",t,e)}}let n=null==(s=i.sessionProperties)?void 0:s.bundler_url;if(n)try{return await this.getUserOperationReceipt(n,t)}catch(t){console.warn("Failed to fetch call status from custom bundler",t,n
1)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var s;let i=new URL(t),r=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,d.formatJsonRpcRequest)("eth_getUserOperationReceipt",[null==(s=e.request.params)?void 0:s[0]]))});if(!r.ok)throw Error(`Failed to fetch user operation receipt - ${r.status}`);return await r.json()}getBundlerUrl(t,e){return`${H}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}}class th{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(q,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){let t={};return this.namespace.chains.forEach(e=>{var s;let i=B(e);t[i]=this.createHttpProvider(i,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}}class tc{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(q,`${this.name}:${this.chainId}`)}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){let t={};return this.namespace.chains.forEach(e=>{var s;let i=B(e);t[i]=this.createHttpProvider(i,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}}class tp{constructor(t){this.name="algorand",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){let s=e||k(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(q,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){let t={};
1return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new E.r(new I(s,K("disableProviderPing")))}}class tl{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(q,`${this.name}:${this.chainId}`)}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){let t={};return this.namespace.chains.forEach(e=>{let s=this.getCardanoRPCUrl(e),i=B(e);t[i]=this.createHttpProvider(i,s)}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){let e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||this.getCardanoRPCUrl(t);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}}class td{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(q,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){let t={};return this.namespace.chains.forEach(e=>{var s;let i=B(e);t[i]=this.createHttpProvider(i,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}}class tu{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(q,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){let t={};
1return this.namespace.chains.forEach(e=>{var s;let i=B(e);t[i]=this.createHttpProvider(i,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}}class tm{constructor(t){this.name="near",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){let s=e||k(`${this.name}:${t}`,this.namespace);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(q,`${this.name}:${this.chainId}`)}getAccounts(){let t=this.namespace.accounts;return t&&t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]}createHttpProviders(){let t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,null==(s=this.namespace.rpcMap)?void 0:s[e])}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace);return typeof s>"u"?void 0:new E.r(new I(s,K("disableProviderPing")))}}class tf{constructor(t){this.name="tezos",this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){let s=e||k(`${this.name}:${t}`,this.namespace);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(q,`${this.name}:${this.chainId}`)}getAccounts(){let t=this.namespace.accounts;return t&&t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]}createHttpProviders(){let t={};return this.namespace.chains.forEach(e=>{t[e]=this.createHttpProvider(e)}),t}getHttpProvider(){let t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace);return typeof s>"u"?void 0:new E.r(new I(s))}}class tv{constructor(t){this.name=_,this.namespace=t.namespace,this.events=K("events"),this.client=K("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(q,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let t=this.namespace.chains[0];if(!t)throw Error("ChainId not found");return t.split(":")[1]}getAccounts(){let t=this.namespace.accounts;return t?[...new Set(t.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var t,e;let s={};return null==(e=null==(t=this.namespace)?void 0:t.accounts)||e.forEach(t=>{let e=(0,n.DQe)(t);s[`${e.namespace}:${e.reference}`]=this.createHttpProvider(t)}),s}getHttpProvider(t){let e=this.httpProviders[t];if(typeof e>"u")throw Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){let s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){let s=e||k(t,this.namespace,this.client.core.projectId);if(!s)throw Error(`No RPC url provided for chainId: ${t}`);return new E.r(new I(s,K("disableProviderPing")))}}var tg=Object.defineProperty,tP=Object.defineProperties,ty=Object.getOwnPropertyDescriptors,tw=Object.getOwnPropertySymbols,tb=Object.prototype.hasOwnProperty,tC=Object.prototype.propertyIsEnumerable,tI=(t,e,s)=>e in t?tg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,tE=(t,e)=>{for(var s in e||(e={}))tb.call(e,s)&&tI(t,s,e[s]);if(tw)for(var s of tw(e))tC.call(e,s)&&tI(t,s,e[s]);return t},tO=(t,e)=>tP(t,ty(e));class tA{constructor(t){this.events=new(r()),this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger="u">typeof t?.logger&&"string"!=typeof t?.logger?t.logger:(0,o.gw)((0,o.jI)({level:t?.logger||O})),this.disableProviderPing=t?.disableProviderPing||!1}static async init(t){let e=new tA(t);return await e.initialize(),e}async request(t,e,s){let[i,r]=this.validateChain(e);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(i).request({request:tE({},t),chainId:`${i}:${r}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,i){let r=new Date().getTime();this.request(t,s,i).then(t=>e(null,(0,d.formatJsonRpcResult)(r,t))).catch(t=>e(t,void 0))}async enable(){if(!this.client)throw Error("Sign Client not initialized");
1return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(t=this.session)?void 0:t.topic,reason:(0,n.D6H)("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();let{uri:s,response:i}=await this.client.authenticate(t,e);s&&(this.uri=s,this.events.emit("display_uri",s));let r=await i();if(this.session=r.session,this.session){let t=G(this.session.namespaces);this.namespaces=F(this.namespaces,t),this.persist("namespaces",this.namespaces),this.onConnect()}return r}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw Error("Max auto pairing attempts reached");let{uri:s,approval:i}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await i().then(t=>{this.session=t;let e=G(t.namespaces);this.namespaces=F(this.namespaces,e),this.persist("namespaces",this.namespaces)}).catch(t=>{if(t.message!==a.lO)throw t;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;let[s,i]=this.validateChain(t),r=this.getProvider(s);r.name===_?r.setDefaultChain(`${s}:${i}`,e):r.setDefaultChain(i,e)}catch(t){if(!/Please call connect/.test(t.message))throw t}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");let e=this.client.pairing.getAll();if((0,n.qt8)(e)){for(let s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){let t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await a.ZP.init({core:this.providerOpts.core,logger:this.providerOpts.logger||O,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw Error("Sign Client not initialized");if(!this.session)throw Error("Session not initialized. Please call connect() before enable()");let t=[...new Set(Object.keys(this.session.namespaces).map(t=>(0,n.Maj)(t)))];V("client",this.client),V("events",this.events),V("disableProviderPing",this.disableProviderPing),t.forEach(t=>{if(!this.session)return;let e=function(t,e){let s=Object.keys(e.namespaces).filter(e=>e.includes(t));if(!s.length)return[];let i=[];return s.forEach(t=>{let s=e.namespaces[t].accounts;i.push(...s)}),i}(t,this.session),s=L(e),i=tO(tE({},F(this.namespaces,this.optionalNamespaces)[t]),{accounts:e,chains:s});switch(t){case"eip155":this.rpcProviders[t]=new to({namespace:i});break;case"algorand":this.rpcProviders[t]=new tp({namespace:i});break;case"solana":this.rpcProviders[t]=new th({namespace:i});break;case"cosmos":this.rpcProviders[t]=new tc({namespace:i});break;case"polkadot":this.rpcProviders[t]=new Y({namespace:i});break;
1case"cip34":this.rpcProviders[t]=new tl({namespace:i});break;case"elrond":this.rpcProviders[t]=new td({namespace:i});break;case"multiversx":this.rpcProviders[t]=new tu({namespace:i});break;case"near":this.rpcProviders[t]=new tm({namespace:i});break;case"tezos":this.rpcProviders[t]=new tf({namespace:i});break;default:this.rpcProviders[_]?this.rpcProviders[_].updateNamespace(i):this.rpcProviders[_]=new tv({namespace:i})}})}registerEventListeners(){if(typeof this.client>"u")throw Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{let{params:e}=t,{event:s}=e;if("accountsChanged"===s.name){let t=s.data;t&&(0,n.qt8)(t)&&this.events.emit("accountsChanged",t.map(J))}else if("chainChanged"===s.name){let t=e.chainId,s=e.event.data,i=(0,n.Maj)(t),r=Q(t)!==Q(s)?`${i}:${Q(s)}`:t;this.onChainChanged(r)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s;let{namespaces:i}=e,r=null==(s=this.client)?void 0:s.session.get(t);this.session=tO(tE({},r),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",tO(tE({},(0,n.D6H)("USER_DISCONNECTED")),{data:t.topic}))}),this.on(q,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[_]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace(null==(e=this.session)?void 0:e.namespaces[t])})}setNamespaces(t){let{namespaces:e,optionalNamespaces:s,sessionProperties:i}=t;e&&Object.keys(e).length&&(this.namespaces=e),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=i,this.persist("namespaces",e),this.persist("optionalNamespaces",s)}validateChain(t){let[e,s]=t?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(t=>(0,n.Maj)(t)).includes(e))throw Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];
1let i=(0,n.Maj)(Object.keys(this.namespaces)[0]),r=this.rpcProviders[i].getDefaultChain();return[i,r]}async requestAccounts(){let[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;let[s,i]=this.validateChain(t);i&&(e||this.getProvider(s).setDefaultChain(i),this.namespaces[s]?this.namespaces[s].defaultChain=i:this.namespaces[`${s}:${i}`]?this.namespaces[`${s}:${i}`].defaultChain=i:this.namespaces[`${s}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,e){this.client.core.storage.setItem(`${A}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${A}/${t}`)}}let t$=["eth_sendTransaction","personal_sign"],t_=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],tH=["chainChanged","accountsChanged"],tq=["chainChanged","accountsChanged","message","disconnect","connect"];var tS=Object.defineProperty,tj=Object.defineProperties,tD=Object.getOwnPropertyDescriptors,tN=Object.getOwnPropertySymbols,tR=Object.prototype.hasOwnProperty,tM=Object.prototype.propertyIsEnumerable,tT=(t,e,s)=>e in t?tS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,tx=(t,e)=>{for(var s in e||(e={}))tR.call(e,s)&&tT(t,s,e[s]);if(tN)for(var s of tN(e))tM.call(e,s)&&tT(t,s,e[s]);return t},tU=(t,e)=>tj(t,tD(e));function tk(t){return Number(t[0].split(":")[1])}function tB(t){return`0x${t.toString(16)}`}class tL{constructor(){this.events=new i.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){let e=new tL;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,s){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),s)}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);let{required:e,optional:s}=function(t){let{chains:e,optionalChains:s,methods:i,optionalMethods:r,events:a,optionalEvents:o,rpcMap:h}=t;if(!(0,n.qt8)(e))throw Error("Invalid chains");let c={chains:e,methods:i||t$,events:a||tH,rpcMap:tx({},e.length?{[tk(e)]:h[tk(e)]}:{})},p=a?.filter(t=>!tH.includes(t)),l=i?.filter(t=>!t$.includes(t));if(!s&&!o&&!r&&!(null!=p&&p.length)&&!(null!=l&&l.length))return{required:e.length?c:void 0};let d={chains:[...new Set(p?.length&&l?.length||!s?c.chains.concat(s||[]):s)],methods:[...new Set(c.methods.concat(null!=r&&r.length?r:t_))],events:[...new Set(c.events.concat(null!=o&&o.length?o:tq))],rpcMap:h};return{required:e.length?c:void 0,optional:s.length?d:void 0}}(this.rpc);try{let i=await new Promise(async(i,r)=>{var n;this.rpc.showQrModal&&(null==(n=this.modal)||n.subscribeModal(t=>{t.open||this.signer.session||(this.signer.abortPairingAttempt(),r(Error("Connection request reset. Please try again.")))})),await this.signer.connect(tU(tx({namespaces:tx({},e&&{[this.namespace]:e})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t?.pairingTopic})).then(t=>{i(t)}
1).catch(t=>{r(Error(t.message))})});if(!i)return;let r=(0,n.guN)(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:r),this.setAccounts(r),this.events.emit("connect",{chainId:tB(this.chainId)})}catch(t){throw this.signer.logger.error(t),t}finally{this.modal&&this.modal.closeModal()}}async authenticate(t,e){if(!this.signer.client)throw Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t?.chains});try{let s=await new Promise(async(s,i)=>{var r;this.rpc.showQrModal&&(null==(r=this.modal)||r.subscribeModal(t=>{t.open||this.signer.session||(this.signer.abortPairingAttempt(),i(Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(tU(tx({},t),{chains:this.rpc.chains}),e).then(t=>{s(t)}).catch(t=>{i(Error(t.message))})}),i=s.session;if(i){let t=(0,n.guN)(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:t),this.setAccounts(t),this.events.emit("connect",{chainId:tB(this.chainId)})}return s}catch(t){throw this.signer.logger.error(t),t}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{let{params:e}=t,{event:s}=e;"accountsChanged"===s.name?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===s.name?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{let e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",tB(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",tU(tx({},(0,n.D6H)("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,s;this.rpc.showQrModal&&(null==(e=this.modal)||e.closeModal(),null==(s=this.modal)||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return"string"==typeof t&&t.startsWith(`${this.namespace}:`)}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){let e=t.filter(t=>this.isCompatibleChainId(t)).map(t=>this.parseChainId(t));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",tB(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){let e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){let[e,s,i]=t.split(":");return{chainId:`${e}:${s}`,address:i}}setAccounts(t){this.accounts=t.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,s;let i=null!=(e=t?.chains)?e:[],r=null!=(s=t?.optionalChains)?s:[],n=i.concat(r);if(!n.length)throw Error("No chains specified in either `chains` or `optionalChains`");let a=i.length?t?.methods||t$:[],o=i.length?t?.events||tH:[],h=t?.optionalMethods||[],c=t?.optionalEvents||[],p=t?.rpcMap||this.buildRpcMap(n,t.projectId),l=t?.qrModalOptions||void 0;return{chains:i?.map(t=>this.formatChainId(t)),optionalChains:r.map(t=>this.formatChainId(t)),methods:a,events:o,optionalMethods:h,optionalEvents:c,rpcMap:p,showQrModal:!!(null!=t&&t.showQrModal),qrModalOptions:l,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){let s={};return t.forEach(t=>{s[t]=this.getRpcUrl(t,e)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?tk(this.rpc.chains):tk(this.rpc.optionalChains),this.signer=await tA.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions,customStoragePrefix:t.customStoragePrefix,telemetryEnabled:t.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;
1try{let{WalletConnectModal:e}=await s.e(54452).then(s.bind(s,54452));t=e}catch{throw Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(tx({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(t){throw this.signer.logger.error(t),Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;let{chains:e,optionalChains:s,rpcMap:i}=t;e&&(0,n.qt8)(e)&&(this.rpc.chains=e.map(t=>this.formatChainId(t)),e.forEach(t=>{this.rpc.rpcMap[t]=i?.[t]||this.getRpcUrl(t)})),s&&(0,n.qt8)(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s?.map(t=>this.formatChainId(t)),s.forEach(t=>{this.rpc.rpcMap[t]=i?.[t]||this.getRpcUrl(t)}))}getRpcUrl(t,e){var s;return(null==(s=this.rpc.rpcMap)?void 0:s[t])||`https://rpc.walletconnect.org/v1/?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{let t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e?.accounts),this.setAccounts(e?.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return"string"==typeof t||t instanceof String?[this.parseAccount(t)]:t.map(t=>this.parseAccount(t))}}let tF=tL},81953:function(t,e){var s="undefined"!=typeof self?self:this,i=function(){function t(){this.fetch=!1,this.DOMException=s.DOMException}return t.prototype=s,new t}();(function(t){var e={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};if(e.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function o(t){var s={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(s[Symbol.iterator]=function(){return s}),s}function h(t){this.map={},t instanceof h?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(t){if(t.bodyUsed)return Promise.reject(TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise(function(e,s){t.onload=function(){e(t.result)},t.onerror=function(){s(t.error)}})}function l(t){var e=new FileReader,s=p(e);return e.readAsArrayBuffer(t),s}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function u(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t){if("string"==typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else{var s;e.arrayBuffer&&e.blob&&(s=t)&&DataView.prototype.isPrototypeOf(s)?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t)}}else this._bodyText="";!this.headers.get("content-type")&&("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,e,s,i=c(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,s=p(e=new FileReader),e.readAsText(t),s;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),s=Array(e.length),i=0;i<e.length;i++)s[i]=String.fromCharCode(e[i]);return s.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},e.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,e){t=n(t),e=a(e);var s=this.map[t];this.map[t]=s?s+", "+e:e},h.prototype.delete=function(t){delete this.map[n(t)]},h.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},h.prototype.set=function(t,e){this.map[n(t)]=a(e)},h.prototype.forEach=function(t,e){for(var s in this.map)this.map.hasOwnProperty(s)&&t.call(e,this.map[s],s,this)},h.prototype.keys=function(){var t=[];return this.forEach(function(e,s){t.push(s)}),o(t)},h.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),o(t)},h.prototype.entries=function(){var t=[];return this.forEach(function(e,s){t.push([s,e])}),o(t)},e.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(t,e){var s,i,r=(e=e||{}).body;if(t instanceof f){if(t.bodyUsed)throw TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new h(e.headers)),this.method=(i=(s=e.method||this.method||"GET").toUpperCase(),m.indexOf(i)>-1?i:s),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function v(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var s=t.split("="),i=s.shift().replace(/\+/g," "),r=s.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}}),e}function g(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},u.call(f.prototype),u.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var P=[301,302,303,307,308];g.redirect=function(t,e){if(-1===P.indexOf(e))throw RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.DOMException=i.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(t,e){this.message=t,this.name=e;var s=Error(t);this.stack=s.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function y(s,i){return new Promise(function(r,n){var a=new f(s,i);if(a.signal&&a.signal.aborted)return n(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function c(){o.abort()}o.onload=function(){var t,e,s={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEac
1h(function(t){var s=t.split(":"),i=s.shift().trim();if(i){var r=s.join(":").trim();e.append(i,r)}}),e)};s.url="responseURL"in o?o.responseURL:s.headers.get("X-Request-URL"),r(new g("response"in o?o.response:o.responseText,s))},o.onerror=function(){n(TypeError("Network request failed"))},o.ontimeout=function(){n(TypeError("Network request failed"))},o.onabort=function(){n(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&e.blob&&(o.responseType="blob"),a.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),a.signal&&(a.signal.addEventListener("abort",c),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",c)}),o.send(void 0===a._bodyInit?null:a._bodyInit)})}y.polyfill=!0,i.fetch||(i.fetch=y,i.Headers=h,i.Request=f,i.Response=g),t.Headers=h,t.Request=f,t.Response=g,t.fetch=y,Object.defineProperty(t,"__esModule",{value:!0})})({}),i.fetch.ponyfill=!0,delete i.fetch.polyfill,(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.