@wormhole-foundation/wormhole-connect 0.3.13-beta.0-development → 0.3.14-beta.0-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/assets/{ccip-OOFnKthE.js → ccip-CiwWapsw.js} +1 -1
- package/dist/assets/{evm-DItqF4y9.js → evm-SQX7GUy3.js} +4 -4
- package/dist/assets/{index-DhiBnkGj.js → index-BIQdJ2Hq.js} +2 -2
- package/dist/assets/{index-DPMNShK9.js → index-DcVWUluz.js} +1 -1
- package/dist/assets/{index.es-C_PUYdAu.js → index.es-DtZOeBDR.js} +2 -2
- package/dist/main.js +6 -6
- package/dist/src/config/mainnet/chains.d.ts.map +1 -1
- package/dist/src/config/mainnet/gasEstimates.d.ts.map +1 -1
- package/dist/src/config/mainnet/rpcs.d.ts.map +1 -1
- package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/src/config/testnet/chains.d.ts.map +1 -1
- package/dist/src/config/testnet/gasEstimates.d.ts.map +1 -1
- package/dist/src/config/testnet/rpcs.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +2 -1
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/icons/TokenIcons.d.ts.map +1 -1
- package/lib/{algorand-Bg8JSyZc.mjs → algorand-Bd_uk5ty.mjs} +4 -4
- package/lib/{algorand-Bl2bjZ-6.js → algorand-SmbH_jTV.js} +1 -1
- package/lib/{aptos-DJ84G9fi.js → aptos-BKfgdGvV.js} +2 -2
- package/lib/{aptos-CR2gkPFr.js → aptos-BQYmbkvI.js} +1 -1
- package/lib/{aptos-C7Wu-1h4.mjs → aptos-Cuq-Ov9W.mjs} +1 -1
- package/lib/{aptos-CMMGNgpi.mjs → aptos-DPHWvHlk.mjs} +4 -4
- package/lib/{browser-CkDunXxD.js → browser-CQB2lMdG.js} +1 -1
- package/lib/{browser-ZXnp4FKs.mjs → browser-XQd2ks95.mjs} +2 -2
- package/lib/{ccip-DhCmkuPu.mjs → ccip-BBjt3olQ.mjs} +1 -1
- package/lib/{ccip-D-Pj74dK.js → ccip-Bs1f_-UL.js} +1 -1
- package/lib/{chain-CVIItqOT.mjs → chain-BiWuKs6u.mjs} +1 -1
- package/lib/{chain-Bwy1h3yo.js → chain-Do8Ik6-A.js} +1 -1
- package/lib/{cosmos-CmK1H6Y0.mjs → cosmos-CnHfTE6o.mjs} +3 -3
- package/lib/{cosmos-6GOVGAZN.js → cosmos-Xf_i-x40.js} +1 -1
- package/lib/{cosmwasm-Con1USCX.js → cosmwasm-3p_o8-Nq.js} +2 -2
- package/lib/{cosmwasm-MvfQhXNe.mjs → cosmwasm-DDvkgx7X.mjs} +6 -6
- package/lib/{create-BRdq6ZSm.mjs → create-C3UEfztz.mjs} +1 -1
- package/lib/{create-CDRecM8t.js → create-rbF6rEI3.js} +1 -1
- package/lib/{ens-validation.es6-CPiX5dlm.js → ens-validation.es6-CrIX-E9e.js} +1 -1
- package/lib/{ens-validation.es6-DApujkCb.mjs → ens-validation.es6-DprozbFd.mjs} +2 -2
- package/lib/{evm-UD1FtfQa.mjs → evm-ButCLf61.mjs} +6 -6
- package/lib/{evm-DS32wBN9.mjs → evm-C5UdXBpx.mjs} +6 -6
- package/lib/{evm-Cc4KRKsc.js → evm-DIgvtYGP.js} +2 -2
- package/lib/{evm-BJ032m_M.js → evm-DzNw1zeN.js} +4 -4
- package/lib/{index-DtwoCm8e.mjs → index-2aGXQlUx.mjs} +4 -4
- package/lib/{index-1n9fqp9v.mjs → index-4lijpjeY.mjs} +1 -1
- package/lib/{index-CqaNSRi8.mjs → index-84P2mXxJ.mjs} +152 -33
- package/lib/{index-mWfCnAaQ.js → index-B27q1OfP.js} +1 -1
- package/lib/{index-B-YY9GIv.mjs → index-B3JCQv-y.mjs} +4 -4
- package/lib/{index-eqTjyg7U.js → index-B3nGKc8Q.js} +1 -1
- package/lib/{index-BFGs_cKt.js → index-B3waKmRP.js} +1 -1
- package/lib/{index-mYo3ol_k.js → index-B4aaHrsy.js} +1 -1
- package/lib/{index-Z109VDLJ.js → index-B9-nO28U.js} +6 -6
- package/lib/{index-D70PNWdi.js → index-BAWLzdAh.js} +1 -1
- package/lib/{index-DRq96-rz.js → index-BCDo_6yU.js} +1 -1
- package/lib/{index-7j3-yEnt.mjs → index-BUrSQTmL.mjs} +1 -1
- package/lib/{index-DqQ___9y.js → index-BcncuB3T.js} +1 -1
- package/lib/{index-C8A6Lqgw.mjs → index-BvASMnC6.mjs} +3 -3
- package/lib/{index-CyiGY2nE.js → index-By-SK4U6.js} +1 -1
- package/lib/{index-IqeoAbGU.js → index-Bz_plxBJ.js} +1 -1
- package/lib/{index-DjCQ8uLP.js → index-C0Gpa7Do.js} +1 -1
- package/lib/{index-j4_UFrLd.js → index-C3YCI2l5.js} +1 -1
- package/lib/{index-DPR5REBL.mjs → index-C4cQZfxC.mjs} +3 -3
- package/lib/{index-CHQq3YQO.mjs → index-CLenatGt.mjs} +2 -2
- package/lib/{index-DL8RgEWe.js → index-CQjJ0e_k.js} +1 -1
- package/lib/{index-uGiYgmNv.mjs → index-CVKTjnHy.mjs} +4 -4
- package/lib/{index-CQ1ulNVi.js → index-CVz-6Ym8.js} +1 -1
- package/lib/{index-BwIRT-Wk.mjs → index-CaXF3dZX.mjs} +4 -4
- package/lib/{index-D2sZc5xv.mjs → index-CjW28YEL.mjs} +3 -3
- package/lib/{index-DZyYJrWL.mjs → index-CuVBsGuM.mjs} +4 -4
- package/lib/{index-BFG5RlAl.mjs → index-CwgM9BIO.mjs} +5 -5
- package/lib/{index-CRYmVHnM.js → index-CzLQutNJ.js} +1 -1
- package/lib/{index-DXyqUYq2.mjs → index-D43BwGxC.mjs} +4 -4
- package/lib/{index-CJmh4QE2.js → index-D71PT1GD.js} +1 -1
- package/lib/{index-BuDqNPcO.js → index-DAqI-Ew_.js} +1 -1
- package/lib/{index-DHJyF-pO.mjs → index-DIcxzZhK.mjs} +5 -5
- package/lib/{index-B24bqgIz.mjs → index-DW1ftkbL.mjs} +4 -4
- package/lib/{index-D4DDOeoI.js → index-DpJvOqHb.js} +1 -1
- package/lib/{index-hl4dntDw.js → index-Ds9QUCq_.js} +1 -1
- package/lib/{index-COFhlc-l.mjs → index-DtkVSV5H.mjs} +4 -4
- package/lib/{index-BJQon5qX.mjs → index-EEir2XIu.mjs} +4 -4
- package/lib/{index-D1b3883O.mjs → index-HU_7Ur7N.mjs} +4 -4
- package/lib/{index-DTS_3d8l.js → index-IiRMqP2i.js} +1 -1
- package/lib/{index-Di3sMEo7.js → index-IznDlDxH.js} +1 -1
- package/lib/{index-CvqS6-7r.mjs → index-Vi7u7-iV.mjs} +2 -2
- package/lib/{index-COvdHjEw.js → index-XI46bffs.js} +1 -1
- package/lib/{index-Yv4XR6FC.mjs → index-mcBHbGuw.mjs} +5 -5
- package/lib/{index-lbAFXIJn.js → index-oMBh8Dne.js} +1 -1
- package/lib/{index-BBqQFfdG.mjs → index-oTLnfDzP.mjs} +6 -6
- package/lib/{index-BCBG0qdU.mjs → index-oUiZ4VeZ.mjs} +2 -2
- package/lib/{index.es-CAK--miD.js → index.es-BeEuj9b9.js} +2 -2
- package/lib/{index.es-BjHm3oKE.mjs → index.es-DTJZ9tuK.mjs} +4 -4
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-kbvVfw30.js → libsodium-wrappers-CMuAe95D.js} +1 -1
- package/lib/{libsodium-wrappers-BeOpJRQU.mjs → libsodium-wrappers-D1hSOCcz.mjs} +1 -1
- package/lib/{sei-CAQxpS0Z.mjs → sei-B7TjWxIw.mjs} +2 -2
- package/lib/{sei-BW-0gNsO.js → sei-SziAtn8k.js} +1 -1
- package/lib/{solana-C6-Nhw0r.js → solana-BP8qy_US.js} +1 -1
- package/lib/{solana-C935JrJy.js → solana-CMkgvEDT.js} +2 -2
- package/lib/{solana-BAw4p_wG.mjs → solana-Cb_oiWS0.mjs} +3 -3
- package/lib/{solana-BmZEcITF.mjs → solana-ClDkinjy.mjs} +6 -6
- package/lib/{solanaEmbed.esm-P8gWbyY6.js → solanaEmbed.esm-DTAJz_N9.js} +1 -1
- package/lib/{solanaEmbed.esm-ChgWwUf5.mjs → solanaEmbed.esm-Sgq-h9YE.mjs} +2 -2
- package/lib/src/config/mainnet/chains.d.ts.map +1 -1
- package/lib/src/config/mainnet/gasEstimates.d.ts.map +1 -1
- package/lib/src/config/mainnet/rpcs.d.ts.map +1 -1
- package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
- package/lib/src/config/testnet/chains.d.ts.map +1 -1
- package/lib/src/config/testnet/gasEstimates.d.ts.map +1 -1
- package/lib/src/config/testnet/rpcs.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/config/types.d.ts +2 -1
- package/lib/src/config/types.d.ts.map +1 -1
- package/lib/src/icons/TokenIcons.d.ts.map +1 -1
- package/lib/{sui-B6rErTwb.mjs → sui-Da9wJTn3.mjs} +1 -1
- package/lib/{sui-LOtTZxFG.js → sui-L1XeF4pM.js} +2 -2
- package/lib/{sui-MwjLxOll.mjs → sui-MZyCHxqc.mjs} +4 -4
- package/lib/{sui-CaR22DH7.js → sui-XfnVse7Y.js} +1 -1
- package/lib/{unsignedTransaction-CybCHnDx.mjs → unsignedTransaction-DKcxxF0x.mjs} +2 -2
- package/lib/{unsignedTransaction-B5T303Id.js → unsignedTransaction-DWavCFla.js} +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__fileDeps=["assets/index-
|
|
2
|
-
import{_ as fe}from"../main.js";const me=Symbol(),ee=Object.getPrototypeOf,G=new WeakMap,ge=e=>e&&(G.has(e)?G.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),he=e=>ge(e)&&e[me]||null,te=(e,t=!0)=>{G.set(e,t)};var z={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1,REACT_APP_CONNECT_VERSION:"0.3.13-beta.0-development"};const q=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,h)=>new Proxy(n,h),s=n=>q(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,h,I=r)=>{const y=l.get(n);if((y==null?void 0:y[0])===h)return y[1];const v=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return te(v,!0),l.set(n,[h,v]),Reflect.ownKeys(n).forEach(D=>{if(Object.getOwnPropertyDescriptor(v,D))return;const L=Reflect.get(n,D),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))te(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,H]=A.get(L);M.value=c(b,H(),I)}Object.defineProperty(v,D,M)}),Object.preventExtensions(v)},m=new WeakMap,f=[1,1],W=n=>{if(!q(n))throw new Error("object required");const h=m.get(n);if(h)return h;let I=f[0];const y=new Set,v=(i,a=++f[0])=>{I!==a&&(I=a,y.forEach(o=>o(i,a)))};let D=f[1];const L=(i=++f[1])=>(D!==i&&!y.size&&(D=i,b.forEach(([a])=>{const o=a[1](i);o>I&&(I=o)})),I),M=i=>(a,o)=>{const g=[...a];g[1]=[i,...g[1]],v(g,o)},b=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&b.has(i))throw new Error("prop listener already exists");if(y.size){const o=a[3](M(i));b.set(i,[a,o])}else b.set(i,[a])},Z=i=>{var a;const o=b.get(i);o&&(b.delete(i),(a=o[1])==null||a.call(o))},ue=i=>(y.add(i),y.size===1&&b.forEach(([o,g],_)=>{if((z?"production":void 0)!=="production"&&g)throw new Error("remove already exists");const R=o[3](M(_));b.set(_,[o,R])}),()=>{y.delete(i),y.size===0&&b.forEach(([o,g],_)=>{g&&(g(),b.set(_,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(i,a){const o=Reflect.get(i,a);Z(a);const g=Reflect.deleteProperty(i,a);return g&&v(["delete",[a],o]),g},set(i,a,o,g){const _=Reflect.has(i,a),R=Reflect.get(i,a,g);if(_&&(e(R,o)||m.has(o)&&e(R,m.get(o))))return!0;Z(a),q(o)&&(o=he(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,v(["resolve",[a],C])}).catch(C=>{o.status="rejected",o.reason=C,v(["reject",[a],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&H(a,C)}return Reflect.set(i,a,V,g),v(["set",[a],o,R]),!0}});m.set(n,$);const pe=[J,L,c,ue];return A.set($,pe),Reflect.ownKeys(n).forEach(i=>{const a=Object.getOwnPropertyDescriptor(n,i);"value"in a&&($[i]=n[i],delete a.value,delete a.writable),Object.defineProperty(J,i,a)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function S(e,t,s){const r=A.get(e);(z?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(h=>{c.push(h),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:d,subscribe(e){return S(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:u,subscribe(e){return S(u.events,()=>e(ve(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:E,subscribe(e){return S(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),N={state:B,subscribe(e){return S(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(B,e)}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Le.call(t,s)&&ne(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=We({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",N.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const U={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${N.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${N.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Ae.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))je.call(t,s)&&re(e,s,t[s]);return e};const ae=p.isMobile(),O=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Te={state:O,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=N.state;if(e==="NONE"||t==="ALL"&&!e)return O.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await U.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),O.recomendedWallets=l}else{const{chains:s,isAuth:r}=w.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await U.getMobileListings(m):await U.getDesktopListings(m);O.recomendedWallets=Object.values(f)}return O.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=N.state,{recomendedWallets:l}=O;if(r==="ALL")return O.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=ae?await U.getMobileListings(t):await U.getDesktopListings(t),n=Object.values(f),h=m?"search":"wallets";return O[h]={listings:[...O[h].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return U.getWalletImageUrl(e)},getAssetImageUrl(e){return U.getAssetImageUrl(e)},resetSearch(){O.search={listings:[],total:0,page:1}}},k=j({open:!1}),F={state:k,subscribe(e){return S(k,()=>e(k))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=w.state;if(p.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&r)k.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),k.open=!0,t())},200)}})},close(){k.open=!1}};var Ue=Object.defineProperty,ie=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))Se.call(t,s)&&le(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const T=j({themeMode:_e()?"dark":"light"}),ce={state:T,subscribe(e){return S(T,()=>e(T))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=De({},s))}},P=j({open:!1,message:"",variant:"success"}),$e={state:P,subscribe(e){return S(P,()=>e(P))},openToast(e,t){P.open=!0,P.message=e,P.variant=t},closeToast(){P.open=!1}};class ke{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),N.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await fe(()=>import("./index-DPMNShK9.js"),__vite__mapDeps([0,1,2,3]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:ke},Symbol.toStringTag,{value:"Module"}));export{Ie as R,de as T,p as a,Ve as i,ce as n,$e as o,w as p,F as s,Te as t,N as y};
|
|
1
|
+
const __vite__fileDeps=["assets/index-DcVWUluz.js","assets/dijkstra-D_NXgYpA.js","main.js","main.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
|
|
2
|
+
import{_ as fe}from"../main.js";const me=Symbol(),ee=Object.getPrototypeOf,G=new WeakMap,ge=e=>e&&(G.has(e)?G.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),he=e=>ge(e)&&e[me]||null,te=(e,t=!0)=>{G.set(e,t)};var z={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1,REACT_APP_CONNECT_VERSION:"0.3.14-beta.0-development"};const q=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,h)=>new Proxy(n,h),s=n=>q(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,h,I=r)=>{const y=l.get(n);if((y==null?void 0:y[0])===h)return y[1];const v=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return te(v,!0),l.set(n,[h,v]),Reflect.ownKeys(n).forEach(D=>{if(Object.getOwnPropertyDescriptor(v,D))return;const L=Reflect.get(n,D),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))te(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,H]=A.get(L);M.value=c(b,H(),I)}Object.defineProperty(v,D,M)}),Object.preventExtensions(v)},m=new WeakMap,f=[1,1],W=n=>{if(!q(n))throw new Error("object required");const h=m.get(n);if(h)return h;let I=f[0];const y=new Set,v=(i,a=++f[0])=>{I!==a&&(I=a,y.forEach(o=>o(i,a)))};let D=f[1];const L=(i=++f[1])=>(D!==i&&!y.size&&(D=i,b.forEach(([a])=>{const o=a[1](i);o>I&&(I=o)})),I),M=i=>(a,o)=>{const g=[...a];g[1]=[i,...g[1]],v(g,o)},b=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&b.has(i))throw new Error("prop listener already exists");if(y.size){const o=a[3](M(i));b.set(i,[a,o])}else b.set(i,[a])},Z=i=>{var a;const o=b.get(i);o&&(b.delete(i),(a=o[1])==null||a.call(o))},ue=i=>(y.add(i),y.size===1&&b.forEach(([o,g],_)=>{if((z?"production":void 0)!=="production"&&g)throw new Error("remove already exists");const R=o[3](M(_));b.set(_,[o,R])}),()=>{y.delete(i),y.size===0&&b.forEach(([o,g],_)=>{g&&(g(),b.set(_,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(i,a){const o=Reflect.get(i,a);Z(a);const g=Reflect.deleteProperty(i,a);return g&&v(["delete",[a],o]),g},set(i,a,o,g){const _=Reflect.has(i,a),R=Reflect.get(i,a,g);if(_&&(e(R,o)||m.has(o)&&e(R,m.get(o))))return!0;Z(a),q(o)&&(o=he(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,v(["resolve",[a],C])}).catch(C=>{o.status="rejected",o.reason=C,v(["reject",[a],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&H(a,C)}return Reflect.set(i,a,V,g),v(["set",[a],o,R]),!0}});m.set(n,$);const pe=[J,L,c,ue];return A.set($,pe),Reflect.ownKeys(n).forEach(i=>{const a=Object.getOwnPropertyDescriptor(n,i);"value"in a&&($[i]=n[i],delete a.value,delete a.writable),Object.defineProperty(J,i,a)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function S(e,t,s){const r=A.get(e);(z?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(h=>{c.push(h),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:d,subscribe(e){return S(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:u,subscribe(e){return S(u.events,()=>e(ve(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:E,subscribe(e){return S(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),N={state:B,subscribe(e){return S(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(B,e)}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Le.call(t,s)&&ne(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=We({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",N.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const U={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${N.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${N.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Ae.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))je.call(t,s)&&re(e,s,t[s]);return e};const ae=p.isMobile(),O=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Te={state:O,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=N.state;if(e==="NONE"||t==="ALL"&&!e)return O.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await U.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),O.recomendedWallets=l}else{const{chains:s,isAuth:r}=w.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await U.getMobileListings(m):await U.getDesktopListings(m);O.recomendedWallets=Object.values(f)}return O.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=N.state,{recomendedWallets:l}=O;if(r==="ALL")return O.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=ae?await U.getMobileListings(t):await U.getDesktopListings(t),n=Object.values(f),h=m?"search":"wallets";return O[h]={listings:[...O[h].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return U.getWalletImageUrl(e)},getAssetImageUrl(e){return U.getAssetImageUrl(e)},resetSearch(){O.search={listings:[],total:0,page:1}}},k=j({open:!1}),F={state:k,subscribe(e){return S(k,()=>e(k))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=w.state;if(p.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&r)k.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),k.open=!0,t())},200)}})},close(){k.open=!1}};var Ue=Object.defineProperty,ie=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))Se.call(t,s)&&le(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const T=j({themeMode:_e()?"dark":"light"}),ce={state:T,subscribe(e){return S(T,()=>e(T))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=De({},s))}},P=j({open:!1,message:"",variant:"success"}),$e={state:P,subscribe(e){return S(P,()=>e(P))},openToast(e,t){P.open=!0,P.message=e,P.variant=t},closeToast(){P.open=!1}};class ke{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),N.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await fe(()=>import("./index-DcVWUluz.js"),__vite__mapDeps([0,1,2,3]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:ke},Symbol.toStringTag,{value:"Module"}));export{Ie as R,de as T,p as a,Ve as i,ce as n,$e as o,w as p,F as s,Te as t,N as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as _t,s as ce,T as N,t as H,a as C,o as ot,R as Do,p as K,y as gt}from"./index-
|
|
1
|
+
import{n as _t,s as ce,T as N,t as H,a as C,o as ot,R as Do,p as K,y as gt}from"./index-BIQdJ2Hq.js";import{d as Uo}from"./dijkstra-D_NXgYpA.js";import"../main.js";var Wo=function(t){for(var r=[],n=t.length,o=0;o<n;o++){var i=t.charCodeAt(o);if(i>=55296&&i<=56319&&n>o+1){var a=t.charCodeAt(o+1);a>=56320&&a<=57343&&(i=(i-55296)*1024+a-56320+65536,o+=1)}if(i<128){r.push(i);continue}if(i<2048){r.push(i>>6|192),r.push(i&63|128);continue}if(i<55296||i>=57344&&i<65536){r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128);continue}if(i>=65536&&i<=1114111){r.push(i>>18|240),r.push(i>>12&63|128),r.push(i>>6&63|128),r.push(i&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__fileDeps=["assets/index-
|
|
1
|
+
const __vite__fileDeps=["assets/index-BIQdJ2Hq.js","main.js","main.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
|
|
2
2
|
import{d as re,ad as el,y as It,bR as Bo,o as Tw,g as $w,_ as Aw}from"../main.js";import{c as M,s as Ko,x as tl,r as rl,H as Cw,a as il,q as xs}from"./index-Dr0mLvmO.js";import{c as xw,a as Dw,g as zu,s as qw,d as jw,k as Uw,b as Mw,I as mr,f as Et,t as dt,e as Hu,C as Lw,r as kw,h as kr,i as sl,j as Tt,l as Us,G as zw,E as Ge,y as rt,o as Ms,m as Ls,n as Vu,p as Hw,q as Vw,u as Bw,v as Fo,w as ks,x as Wo,z as er,Y as Kw,A as Fw,B as Bu,D as Ww}from"./browser-ClU5eOFb.js";var he={};Object.defineProperty(he,"__esModule",{value:!0});he.getLocalStorage=he.getLocalStorageOrThrow=he.getCrypto=he.getCryptoOrThrow=he.getLocation=he.getLocationOrThrow=he.getNavigator=he.getNavigatorOrThrow=he.getDocument=he.getDocumentOrThrow=he.getFromWindowOrThrow=he.getFromWindow=void 0;function vr(o){let t;return typeof window<"u"&&typeof window[o]<"u"&&(t=window[o]),t}he.getFromWindow=vr;function Vr(o){const t=vr(o);if(!t)throw new Error(`${o} is not defined in Window`);return t}he.getFromWindowOrThrow=Vr;function Gw(){return Vr("document")}he.getDocumentOrThrow=Gw;function Qw(){return vr("document")}he.getDocument=Qw;function Jw(){return Vr("navigator")}he.getNavigatorOrThrow=Jw;function Yw(){return vr("navigator")}he.getNavigator=Yw;function Zw(){return Vr("location")}he.getLocationOrThrow=Zw;function Xw(){return vr("location")}he.getLocation=Xw;function e0(){return Vr("crypto")}he.getCryptoOrThrow=e0;function t0(){return vr("crypto")}he.getCrypto=t0;function r0(){return Vr("localStorage")}he.getLocalStorageOrThrow=r0;function i0(){return vr("localStorage")}he.getLocalStorage=i0;var Go={};Object.defineProperty(Go,"__esModule",{value:!0});Go.getWindowMetadata=void 0;const Ku=he;function s0(){let o,t;try{o=Ku.getDocumentOrThrow(),t=Ku.getLocationOrThrow()}catch{return null}function r(){const O=o.getElementsByTagName("link"),N=[];for(let U=0;U<O.length;U++){const $=O[U],V=$.getAttribute("rel");if(V&&V.toLowerCase().indexOf("icon")>-1){const q=$.getAttribute("href");if(q)if(q.toLowerCase().indexOf("https:")===-1&&q.toLowerCase().indexOf("http:")===-1&&q.indexOf("//")!==0){let Q=t.protocol+"//"+t.host;if(q.indexOf("/")===0)Q+=q;else{const ye=t.pathname.split("/");ye.pop();const X=ye.join("/");Q+=X+"/"+q}N.push(Q)}else if(q.indexOf("//")===0){const Q=t.protocol+q;N.push(Q)}else N.push(q)}}return N}function s(...O){const N=o.getElementsByTagName("meta");for(let U=0;U<N.length;U++){const $=N[U],V=["itemprop","property","name"].map(q=>$.getAttribute(q)).filter(q=>q?O.includes(q):!1);if(V.length&&V){const q=$.getAttribute("content");if(q)return q}}return""}function a(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=o.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=a(),f=u(),w=t.origin,_=r();return{description:f,url:w,icons:_,name:l}}Go.getWindowMetadata=s0;function n0(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}const o0={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function a0(o,t){const{message:r,code:s}=o0[o];return{message:r,code:s}}function To(o,t){return!!Array.isArray(o)}const c0=o=>JSON.stringify(o,(t,r)=>typeof r=="bigint"?r.toString()+"n":r),u0=o=>{const t=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=o.replace(t,'$1"$2n"$3');return JSON.parse(r,(s,a)=>typeof a=="string"&&a.match(/^\d+n$/)?BigInt(a.substring(0,a.length-1)):a)};function Qo(o){if(typeof o!="string")throw new Error(`Cannot safe json parse value of type ${typeof o}`);try{return u0(o)}catch{return o}}function Jo(o){return typeof o=="string"?o:c0(o)||""}const h0="idb-keyval";var l0=(o={})=>{const t=o.base&&o.base.length>0?`${o.base}:`:"",r=a=>t+a;let s;return o.dbName&&o.storeName&&(s=Dw(o.dbName,o.storeName)),{name:h0,options:o,async hasItem(a){return!(typeof await zu(r(a),s)>"u")},async getItem(a){return await zu(r(a),s)??null},setItem(a,u){return qw(r(a),u,s)},removeItem(a){return jw(r(a),s)},getKeys(){return Uw(s)},clear(){return Mw(s)}}};const p0="WALLET_CONNECT_V2_INDEXED_DB",d0="keyvaluestorage";let f0=class{constructor(){this.indexedDb=xw({driver:l0({dbName:p0,storeName:d0})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const r=await this.indexedDb.getItem(t);if(r!==null)return r}async setItem(t,r){await this.indexedDb.setItem(t,Jo(r))}async removeItem(t){await this.indexedDb.removeItem(t)}};var go=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof re.global<"u"?re.global:typeof self<"u"?self:{},$s={exports:{}};(function(){let o;function t(){}o=t,o.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},o.prototype.setItem=function(r,s){this[r]=String(s)},o.prototype.removeItem=function(r){delete this[r]},o.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(s){r[s]=void 0,delete r[s]})},o.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof go<"u"&&go.localStorage?$s.exports=go.localStorage:typeof window<"u"&&window.localStorage?$s.exports=window.localStorage:$s.exports=new t})();function g0(o){var t;return[o[0],Qo((t=o[1])!=null?t:"")]}let y0=class{constructor(){this.localStorage=$s.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(g0)}async getItem(t){const r=this.localStorage.getItem(t);if(r!==null)return Qo(r)}async setItem(t,r){this.localStorage.setItem(t,Jo(r))}async removeItem(t){this.localStorage.removeItem(t)}};const m0="wc_storage_version",Fu=1,v0=async(o,t,r)=>{const s=m0,a=await t.getItem(s);if(a&&a>=Fu){r(t);return}const u=await o.getKeys();if(!u.length){r(t);return}const l=[];for(;u.length;){const f=u.shift();if(!f)continue;const w=f.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const _=await o.getItem(f);await t.setItem(f,_),l.push(f)}}await t.setItem(s,Fu),r(t),w0(o,l)},w0=async(o,t)=>{t.length&&t.forEach(async r=>{await o.removeItem(r)})};let b0=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const t=new y0;this.storage=t;try{const r=new f0;v0(t,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,r){return await this.initialize(),this.storage.setItem(t,r)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),t())},20)})}};var Br={};/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -44,4 +44,4 @@ __p += '`),Z&&(R+=`' +
|
|
|
44
44
|
function print() { __p += __j.call(arguments, '') }
|
|
45
45
|
`:`;
|
|
46
46
|
`)+R+`return __p
|
|
47
|
-
}`;var W=Mu(function(){return te(d,j+"return "+R).apply(r,g)});if(W.source=R,io(W))throw W;return W}function jv(e){return ie(e).toLowerCase()}function Uv(e){return ie(e).toUpperCase()}function Mv(e,i,n){if(e=ie(e),e&&(n||i===r))return Wa(e);if(!e||!(i=Ye(i)))return e;var c=yt(e),h=yt(i),d=Ga(c,h),g=Qa(c,h)+1;return Zt(c,d,g).join("")}function Lv(e,i,n){if(e=ie(e),e&&(n||i===r))return e.slice(0,Ya(e)+1);if(!e||!(i=Ye(i)))return e;var c=yt(e),h=Qa(c,yt(i))+1;return Zt(c,0,h).join("")}function kv(e,i,n){if(e=ie(e),e&&(n||i===r))return e.replace(rn,"");if(!e||!(i=Ye(i)))return e;var c=yt(e),h=Ga(c,yt(i));return Zt(c,h).join("")}function zv(e,i){var n=Bs,c=it;if(we(i)){var h="separator"in i?i.separator:h;n="length"in i?K(i.length):n,c="omission"in i?Ye(i.omission):c}e=ie(e);var d=e.length;if(Or(e)){var g=yt(e);d=g.length}if(n>=d)return e;var y=n-Rr(c);if(y<1)return c;var v=g?Zt(g,0,y).join(""):e.slice(0,y);if(h===r)return v+c;if(g&&(y+=v.length-y),so(h)){if(e.slice(y).search(h)){var P,S=v;for(h.global||(h=bn(h.source,ie(ga.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;v=v.slice(0,R===r?y:R)}}else if(e.indexOf(Ye(h),y)!=y){var x=v.lastIndexOf(h);x>-1&&(v=v.slice(0,x))}return v+c}function Hv(e){return e=ie(e),e&&Zl.test(e)?e.replace(pa,yd):e}var Vv=Dr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),ao=Lc("toUpperCase");function Uu(e,i,n){return e=ie(e),i=n?r:i,i===r?ld(e)?wd(e):rd(e):e.match(i)||[]}var Mu=G(function(e,i){try{return Qe(e,r,i)}catch(n){return io(n)?n:new H(n)}}),Bv=jt(function(e,i){return nt(i,function(n){n=Rt(n),Dt(e,n,to(e[n],e))}),e});function Kv(e){var i=e==null?0:e.length,n=L();return e=i?fe(e,function(c){if(typeof c[1]!="function")throw new ot(l);return[n(c[0]),c[1]]}):[],G(function(c){for(var h=-1;++h<i;){var d=e[h];if(Qe(d[0],this,c))return Qe(d[1],this,c)}})}function Fv(e){return mf(ct(e,O))}function co(e){return function(){return e}}function Wv(e,i){return e==null||e!==e?i:e}var Gv=zc(),Qv=zc(!0);function Be(e){return e}function uo(e){return mc(typeof e=="function"?e:ct(e,O))}function Jv(e){return wc(ct(e,O))}function Yv(e,i){return bc(e,ct(i,O))}var Zv=G(function(e,i){return function(n){return pi(n,e,i)}}),Xv=G(function(e,i){return function(n){return pi(e,n,i)}});function ho(e,i,n){var c=Re(i),h=os(i,c);n==null&&!(we(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=os(i,Re(i)));var d=!(we(n)&&"chain"in n)||!!n.chain,g=Mt(e);return nt(h,function(y){var v=i[y];e[y]=v,g&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=ze(this.__actions__);return R.push({func:v,args:arguments,thisArg:e}),S.__chain__=P,S}return v.apply(e,Ft([this.value()],arguments))})}),e}function ew(){return $e._===this&&($e._=Sd),this}function lo(){}function tw(e){return e=K(e),G(function(i){return _c(i,e)})}var rw=Hn(fe),iw=Hn(Ha),sw=Hn(dn);function Lu(e){return Qn(e)?fn(Rt(e)):Df(e)}function nw(e){return function(i){return e==null?r:hr(e,i)}}var ow=Vc(),aw=Vc(!0);function po(){return[]}function fo(){return!1}function cw(){return{}}function uw(){return""}function hw(){return!0}function lw(e,i){if(e=K(e),e<1||e>ce)return[];var n=xe,c=De(e,xe);i=L(i),e-=xe;for(var h=mn(c,i);++n<e;)i(n);return h}function pw(e){return B(e)?fe(e,Rt):Ze(e)?[e]:ze(nu(ie(e)))}function dw(e){var i=++Id;return ie(e)+i}var fw=ps(function(e,i){return e+i},0),gw=Vn("ceil"),yw=ps(function(e,i){return e/i},1),mw=Vn("floor");function vw(e){return e&&e.length?ns(e,Be,Nn):r}function ww(e,i){return e&&e.length?ns(e,L(i,2),Nn):r}function bw(e){return Ka(e,Be)}function _w(e,i){return Ka(e,L(i,2))}function Ew(e){return e&&e.length?ns(e,Be,Cn):r}function Iw(e,i){return e&&e.length?ns(e,L(i,2),Cn):r}var Pw=ps(function(e,i){return e*i},1),Sw=Vn("round"),Ow=ps(function(e,i){return e-i},0);function Rw(e){return e&&e.length?yn(e,Be):0}function Nw(e,i){return e&&e.length?yn(e,L(i,2)):0}return p.after=Jy,p.ary=yu,p.assign=Um,p.assignIn=$u,p.assignInWith=Ss,p.assignWith=Mm,p.at=Lm,p.before=mu,p.bind=to,p.bindAll=Bv,p.bindKey=vu,p.castArray=cm,p.chain=du,p.chunk=mg,p.compact=vg,p.concat=wg,p.cond=Kv,p.conforms=Fv,p.constant=co,p.countBy=Ry,p.create=km,p.curry=wu,p.curryRight=bu,p.debounce=_u,p.defaults=zm,p.defaultsDeep=Hm,p.defer=Yy,p.delay=Zy,p.difference=bg,p.differenceBy=_g,p.differenceWith=Eg,p.drop=Ig,p.dropRight=Pg,p.dropRightWhile=Sg,p.dropWhile=Og,p.fill=Rg,p.filter=Ty,p.flatMap=Cy,p.flatMapDeep=xy,p.flatMapDepth=Dy,p.flatten=uu,p.flattenDeep=Ng,p.flattenDepth=Tg,p.flip=Xy,p.flow=Gv,p.flowRight=Qv,p.fromPairs=$g,p.functions=Qm,p.functionsIn=Jm,p.groupBy=qy,p.initial=Cg,p.intersection=xg,p.intersectionBy=Dg,p.intersectionWith=qg,p.invert=Zm,p.invertBy=Xm,p.invokeMap=Uy,p.iteratee=uo,p.keyBy=My,p.keys=Re,p.keysIn=Ve,p.map=ws,p.mapKeys=tv,p.mapValues=rv,p.matches=Jv,p.matchesProperty=Yv,p.memoize=_s,p.merge=iv,p.mergeWith=Au,p.method=Zv,p.methodOf=Xv,p.mixin=ho,p.negate=Es,p.nthArg=tw,p.omit=sv,p.omitBy=nv,p.once=em,p.orderBy=Ly,p.over=rw,p.overArgs=tm,p.overEvery=iw,p.overSome=sw,p.partial=ro,p.partialRight=Eu,p.partition=ky,p.pick=ov,p.pickBy=Cu,p.property=Lu,p.propertyOf=nw,p.pull=Lg,p.pullAll=lu,p.pullAllBy=kg,p.pullAllWith=zg,p.pullAt=Hg,p.range=ow,p.rangeRight=aw,p.rearg=rm,p.reject=Vy,p.remove=Vg,p.rest=im,p.reverse=Xn,p.sampleSize=Ky,p.set=cv,p.setWith=uv,p.shuffle=Fy,p.slice=Bg,p.sortBy=Qy,p.sortedUniq=Yg,p.sortedUniqBy=Zg,p.split=Cv,p.spread=sm,p.tail=Xg,p.take=ey,p.takeRight=ty,p.takeRightWhile=ry,p.takeWhile=iy,p.tap=vy,p.throttle=nm,p.thru=vs,p.toArray=Ru,p.toPairs=xu,p.toPairsIn=Du,p.toPath=pw,p.toPlainObject=Tu,p.transform=hv,p.unary=om,p.union=sy,p.unionBy=ny,p.unionWith=oy,p.uniq=ay,p.uniqBy=cy,p.uniqWith=uy,p.unset=lv,p.unzip=eo,p.unzipWith=pu,p.update=pv,p.updateWith=dv,p.values=Ur,p.valuesIn=fv,p.without=hy,p.words=Uu,p.wrap=am,p.xor=ly,p.xorBy=py,p.xorWith=dy,p.zip=fy,p.zipObject=gy,p.zipObjectDeep=yy,p.zipWith=my,p.entries=xu,p.entriesIn=Du,p.extend=$u,p.extendWith=Ss,ho(p,p),p.add=fw,p.attempt=Mu,p.camelCase=vv,p.capitalize=qu,p.ceil=gw,p.clamp=gv,p.clone=um,p.cloneDeep=lm,p.cloneDeepWith=pm,p.cloneWith=hm,p.conformsTo=dm,p.deburr=ju,p.defaultTo=Wv,p.divide=yw,p.endsWith=wv,p.eq=vt,p.escape=bv,p.escapeRegExp=_v,p.every=Ny,p.find=$y,p.findIndex=au,p.findKey=Vm,p.findLast=Ay,p.findLastIndex=cu,p.findLastKey=Bm,p.floor=mw,p.forEach=fu,p.forEachRight=gu,p.forIn=Km,p.forInRight=Fm,p.forOwn=Wm,p.forOwnRight=Gm,p.get=no,p.gt=fm,p.gte=gm,p.has=Ym,p.hasIn=oo,p.head=hu,p.identity=Be,p.includes=jy,p.indexOf=Ag,p.inRange=yv,p.invoke=ev,p.isArguments=dr,p.isArray=B,p.isArrayBuffer=ym,p.isArrayLike=He,p.isArrayLikeObject=_e,p.isBoolean=mm,p.isBuffer=Xt,p.isDate=vm,p.isElement=wm,p.isEmpty=bm,p.isEqual=_m,p.isEqualWith=Em,p.isError=io,p.isFinite=Im,p.isFunction=Mt,p.isInteger=Iu,p.isLength=Is,p.isMap=Pu,p.isMatch=Pm,p.isMatchWith=Sm,p.isNaN=Om,p.isNative=Rm,p.isNil=Tm,p.isNull=Nm,p.isNumber=Su,p.isObject=we,p.isObjectLike=be,p.isPlainObject=vi,p.isRegExp=so,p.isSafeInteger=$m,p.isSet=Ou,p.isString=Ps,p.isSymbol=Ze,p.isTypedArray=jr,p.isUndefined=Am,p.isWeakMap=Cm,p.isWeakSet=xm,p.join=jg,p.kebabCase=Ev,p.last=ht,p.lastIndexOf=Ug,p.lowerCase=Iv,p.lowerFirst=Pv,p.lt=Dm,p.lte=qm,p.max=vw,p.maxBy=ww,p.mean=bw,p.meanBy=_w,p.min=Ew,p.minBy=Iw,p.stubArray=po,p.stubFalse=fo,p.stubObject=cw,p.stubString=uw,p.stubTrue=hw,p.multiply=Pw,p.nth=Mg,p.noConflict=ew,p.noop=lo,p.now=bs,p.pad=Sv,p.padEnd=Ov,p.padStart=Rv,p.parseInt=Nv,p.random=mv,p.reduce=zy,p.reduceRight=Hy,p.repeat=Tv,p.replace=$v,p.result=av,p.round=Sw,p.runInContext=m,p.sample=By,p.size=Wy,p.snakeCase=Av,p.some=Gy,p.sortedIndex=Kg,p.sortedIndexBy=Fg,p.sortedIndexOf=Wg,p.sortedLastIndex=Gg,p.sortedLastIndexBy=Qg,p.sortedLastIndexOf=Jg,p.startCase=xv,p.startsWith=Dv,p.subtract=Ow,p.sum=Rw,p.sumBy=Nw,p.template=qv,p.times=lw,p.toFinite=Lt,p.toInteger=K,p.toLength=Nu,p.toLower=jv,p.toNumber=lt,p.toSafeInteger=jm,p.toString=ie,p.toUpper=Uv,p.trim=Mv,p.trimEnd=Lv,p.trimStart=kv,p.truncate=zv,p.unescape=Hv,p.uniqueId=dw,p.upperCase=Vv,p.upperFirst=ao,p.each=fu,p.eachRight=gu,p.first=hu,ho(p,function(){var e={};return St(p,function(i,n){ne.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),nt(["drop","take"],function(e,i){Y.prototype[e]=function(n){n=n===r?1:Oe(K(n),0);var c=this.__filtered__&&!i?new Y(this):this.clone();return c.__filtered__?c.__takeCount__=De(n,c.__takeCount__):c.__views__.push({size:De(n,xe),type:e+(c.__dir__<0?"Right":"")}),c},Y.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),nt(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==E||n==F;Y.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:L(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),nt(["head","last"],function(e,i){var n="take"+(i?"Right":"");Y.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Y.prototype[e]=function(){return this.__filtered__?new Y(this):this[n](1)}}),Y.prototype.compact=function(){return this.filter(Be)},Y.prototype.find=function(e){return this.filter(e).head()},Y.prototype.findLast=function(e){return this.reverse().find(e)},Y.prototype.invokeMap=G(function(e,i){return typeof e=="function"?new Y(this):this.map(function(n){return pi(n,e,i)})}),Y.prototype.reject=function(e){return this.filter(Es(L(e)))},Y.prototype.slice=function(e,i){e=K(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Y(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=K(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Y.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Y.prototype.toArray=function(){return this.take(xe)},St(Y.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,v=g instanceof Y,P=y[0],S=v||B(g),R=function(J){var Z=h.apply(p,Ft([J],y));return c&&x?Z[0]:Z};S&&n&&typeof P=="function"&&P.length!=1&&(v=S=!1);var x=this.__chain__,j=!!this.__actions__.length,k=d&&!x,W=v&&!j;if(!d&&S){g=W?g:new Y(this);var z=e.apply(g,y);return z.__actions__.push({func:vs,args:[R],thisArg:r}),new at(z,x)}return k&&W?e.apply(this,y):(z=this.thru(R),k?c?z.value()[0]:z.value():z)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var i=Bi[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(B(d)?d:[],h)}return this[n](function(g){return i.apply(B(g)?g:[],h)})}}),St(Y.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";ne.call(Ar,c)||(Ar[c]=[]),Ar[c].push({name:i,func:n})}}),Ar[ls(r,Q).name]=[{name:"wrapper",func:r}],Y.prototype.clone=zd,Y.prototype.reverse=Hd,Y.prototype.value=Vd,p.prototype.at=wy,p.prototype.chain=by,p.prototype.commit=_y,p.prototype.next=Ey,p.prototype.plant=Py,p.prototype.reverse=Sy,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Oy,p.prototype.first=p.prototype.head,ni&&(p.prototype[ni]=Iy),p},Nr=bd();nr?((nr.exports=Nr)._=Nr,un._=Nr):$e._=Nr}).call(Si)})(zo,zo.exports);var ZI=Object.defineProperty,XI=Object.defineProperties,eP=Object.getOwnPropertyDescriptors,Fh=Object.getOwnPropertySymbols,tP=Object.prototype.hasOwnProperty,rP=Object.prototype.propertyIsEnumerable,Wh=(o,t,r)=>t in o?ZI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,Ns=(o,t)=>{for(var r in t||(t={}))tP.call(t,r)&&Wh(o,r,t[r]);if(Fh)for(var r of Fh(t))rP.call(t,r)&&Wh(o,r,t[r]);return o},iP=(o,t)=>XI(o,eP(t));function ir(o,t,r){var s;const a=$b(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${YI}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function _r(o){return o.includes(":")?o.split(":")[1]:o}function Ll(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function sP(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function nP(o={},t={}){const r=Gh(o),s=Gh(t);return zo.exports.merge(r,s)}function Gh(o){var t,r,s,a;const u={};if(!Hr(o))return u;for(const[l,f]of Object.entries(o)){const w=ia(l)?[l]:f.chains,_=f.methods||[],T=f.events||[],O=f.rpcMap||{},N=Oi(l);u[N]=iP(Ns(Ns({},u[N]),f),{chains:vo(w,(t=u[N])==null?void 0:t.chains),methods:vo(_,(r=u[N])==null?void 0:r.methods),events:vo(T,(s=u[N])==null?void 0:s.events),rpcMap:Ns(Ns({},O),(a=u[N])==null?void 0:a.rpcMap)})}return u}function oP(o){return o.includes(":")?o.split(":")[2]:o}function aP(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],f=ia(r)?[r]:s.chains?s.chains:Ll(s.accounts);t[r]={chains:f,methods:a,events:u,accounts:l}}return t}function So(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const kl={},ge=o=>kl[o],Oo=(o,t)=>{kl[o]=t};class cP{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class uP{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}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,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||ir(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(_r(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. 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}`)}}class hP{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class lP{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class pP{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=_r(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class dP{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class fP{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class gP{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||ir(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace);return typeof s>"u"?void 0:new Vt(new sr(s,ge("disableProviderPing")))}}var yP=Object.defineProperty,mP=Object.defineProperties,vP=Object.getOwnPropertyDescriptors,Qh=Object.getOwnPropertySymbols,wP=Object.prototype.hasOwnProperty,bP=Object.prototype.propertyIsEnumerable,Jh=(o,t,r)=>t in o?yP(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,Ts=(o,t)=>{for(var r in t||(t={}))wP.call(t,r)&&Jh(o,r,t[r]);if(Qh)for(var r of Qh(t))bP.call(t,r)&&Jh(o,r,t[r]);return o},Ro=(o,t)=>mP(o,vP(t));class ca{constructor(t){this.events=new Bo,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Ms(Ls({level:(t==null?void 0:t.logger)||Bh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new ca(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Ts({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,ks(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return 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 new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Ie("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=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 a().then(u=>{this.session=u,this.namespaces||(this.namespaces=aP(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Ul)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(yr(r)){for(const s of r)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: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const 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 jI.init({logger:this.providerOpts.logger||Bh,relayUrl:this.providerOpts.relayUrl||GI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>Oi(r)))];Oo("client",this.client),Oo("events",this.events),Oo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=sP(r,this.session),a=Ll(s),u=nP(this.namespaces,this.optionalNamespaces),l=Ro(Ts({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new uP({namespace:l});break;case"solana":this.rpcProviders[r]=new hP({namespace:l});break;case"cosmos":this.rpcProviders[r]=new lP({namespace:l});break;case"polkadot":this.rpcProviders[r]=new cP({namespace:l});break;case"cip34":this.rpcProviders[r]=new pP({namespace:l});break;case"elrond":this.rpcProviders[r]=new dP({namespace:l});break;case"multiversx":this.rpcProviders[r]=new fP({namespace:l});break;case"near":this.rpcProviders[r]=new gP({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&yr(a)&&this.events.emit("accountsChanged",a.map(oP))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=Oi(a),f=So(a)!==So(u)?`${l}:${So(u)}`:a;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=Ro(Ts({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",Ro(Ts({},Ie("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Bt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>Oi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=Oi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}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,r){this.client.core.storage.setItem(`${Kh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Kh}/${t}`)}}const _P=ca,EP="wc",IP="ethereum_provider",PP=`${EP}@2:${IP}:`,SP="https://rpc.walletconnect.com/v1/",Ho=["eth_sendTransaction","personal_sign"],OP=["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"],Vo=["chainChanged","accountsChanged"],RP=["chainChanged","accountsChanged","message","disconnect","connect"];var NP=Object.defineProperty,TP=Object.defineProperties,$P=Object.getOwnPropertyDescriptors,Yh=Object.getOwnPropertySymbols,AP=Object.prototype.hasOwnProperty,CP=Object.prototype.propertyIsEnumerable,Zh=(o,t,r)=>t in o?NP(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,Ni=(o,t)=>{for(var r in t||(t={}))AP.call(t,r)&&Zh(o,r,t[r]);if(Yh)for(var r of Yh(t))CP.call(t,r)&&Zh(o,r,t[r]);return o},Xh=(o,t)=>TP(o,$P(t));function js(o){return Number(o[0].split(":")[1])}function No(o){return`0x${o.toString(16)}`}function xP(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:f}=o;if(!To(t))throw new Error("Invalid chains");const w={chains:t,methods:s||Ho,events:u||Vo,rpcMap:Ni({},t.length?{[js(t)]:f[js(t)]}:{})},_=u==null?void 0:u.filter(U=>!Vo.includes(U)),T=s==null?void 0:s.filter(U=>!Ho.includes(U));if(!r&&!l&&!a&&!(_!=null&&_.length)&&!(T!=null&&T.length))return{required:t.length?w:void 0};const O=(_==null?void 0:_.length)&&(T==null?void 0:T.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:OP))],events:[...new Set(w.events.concat(l!=null&&l.length?l:RP))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class ua{constructor(){this.events=new It.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=PP,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new ua;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=xP(this.rpc);try{const a=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(_=>{!_.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Xh(Ni({namespaces:Ni({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(_=>{l(_)}).catch(_=>{f(new Error(_.message))})});if(!a)return;const u=n0(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:No(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}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=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",No(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",Xh(Ni({},a0("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||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 typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",No(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=a.length?(t==null?void 0:t.methods)||Ho:[],w=a.length?(t==null?void 0:t.events)||Vo:[],_=(t==null?void 0:t.optionalMethods)||[],T=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(U=>this.formatChainId(U)),optionalChains:u.map(U=>this.formatChainId(U)),methods:f,events:w,optionalMethods:_,optionalEvents:T,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?js(this.rpc.chains):js(this.rpc.optionalChains),this.signer=await _P.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Aw(()=>import("./index-DhiBnkGj.js").then(a=>a.i),__vite__mapDeps([0,1,2]));r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Ni({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&To(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&To(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${SP}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const ZP=ua;export{ZP as EthereumProvider,RP as OPTIONAL_EVENTS,OP as OPTIONAL_METHODS,Vo as REQUIRED_EVENTS,Ho as REQUIRED_METHODS,ua as default};
|
|
47
|
+
}`;var W=Mu(function(){return te(d,j+"return "+R).apply(r,g)});if(W.source=R,io(W))throw W;return W}function jv(e){return ie(e).toLowerCase()}function Uv(e){return ie(e).toUpperCase()}function Mv(e,i,n){if(e=ie(e),e&&(n||i===r))return Wa(e);if(!e||!(i=Ye(i)))return e;var c=yt(e),h=yt(i),d=Ga(c,h),g=Qa(c,h)+1;return Zt(c,d,g).join("")}function Lv(e,i,n){if(e=ie(e),e&&(n||i===r))return e.slice(0,Ya(e)+1);if(!e||!(i=Ye(i)))return e;var c=yt(e),h=Qa(c,yt(i))+1;return Zt(c,0,h).join("")}function kv(e,i,n){if(e=ie(e),e&&(n||i===r))return e.replace(rn,"");if(!e||!(i=Ye(i)))return e;var c=yt(e),h=Ga(c,yt(i));return Zt(c,h).join("")}function zv(e,i){var n=Bs,c=it;if(we(i)){var h="separator"in i?i.separator:h;n="length"in i?K(i.length):n,c="omission"in i?Ye(i.omission):c}e=ie(e);var d=e.length;if(Or(e)){var g=yt(e);d=g.length}if(n>=d)return e;var y=n-Rr(c);if(y<1)return c;var v=g?Zt(g,0,y).join(""):e.slice(0,y);if(h===r)return v+c;if(g&&(y+=v.length-y),so(h)){if(e.slice(y).search(h)){var P,S=v;for(h.global||(h=bn(h.source,ie(ga.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;v=v.slice(0,R===r?y:R)}}else if(e.indexOf(Ye(h),y)!=y){var x=v.lastIndexOf(h);x>-1&&(v=v.slice(0,x))}return v+c}function Hv(e){return e=ie(e),e&&Zl.test(e)?e.replace(pa,yd):e}var Vv=Dr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),ao=Lc("toUpperCase");function Uu(e,i,n){return e=ie(e),i=n?r:i,i===r?ld(e)?wd(e):rd(e):e.match(i)||[]}var Mu=G(function(e,i){try{return Qe(e,r,i)}catch(n){return io(n)?n:new H(n)}}),Bv=jt(function(e,i){return nt(i,function(n){n=Rt(n),Dt(e,n,to(e[n],e))}),e});function Kv(e){var i=e==null?0:e.length,n=L();return e=i?fe(e,function(c){if(typeof c[1]!="function")throw new ot(l);return[n(c[0]),c[1]]}):[],G(function(c){for(var h=-1;++h<i;){var d=e[h];if(Qe(d[0],this,c))return Qe(d[1],this,c)}})}function Fv(e){return mf(ct(e,O))}function co(e){return function(){return e}}function Wv(e,i){return e==null||e!==e?i:e}var Gv=zc(),Qv=zc(!0);function Be(e){return e}function uo(e){return mc(typeof e=="function"?e:ct(e,O))}function Jv(e){return wc(ct(e,O))}function Yv(e,i){return bc(e,ct(i,O))}var Zv=G(function(e,i){return function(n){return pi(n,e,i)}}),Xv=G(function(e,i){return function(n){return pi(e,n,i)}});function ho(e,i,n){var c=Re(i),h=os(i,c);n==null&&!(we(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=os(i,Re(i)));var d=!(we(n)&&"chain"in n)||!!n.chain,g=Mt(e);return nt(h,function(y){var v=i[y];e[y]=v,g&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=ze(this.__actions__);return R.push({func:v,args:arguments,thisArg:e}),S.__chain__=P,S}return v.apply(e,Ft([this.value()],arguments))})}),e}function ew(){return $e._===this&&($e._=Sd),this}function lo(){}function tw(e){return e=K(e),G(function(i){return _c(i,e)})}var rw=Hn(fe),iw=Hn(Ha),sw=Hn(dn);function Lu(e){return Qn(e)?fn(Rt(e)):Df(e)}function nw(e){return function(i){return e==null?r:hr(e,i)}}var ow=Vc(),aw=Vc(!0);function po(){return[]}function fo(){return!1}function cw(){return{}}function uw(){return""}function hw(){return!0}function lw(e,i){if(e=K(e),e<1||e>ce)return[];var n=xe,c=De(e,xe);i=L(i),e-=xe;for(var h=mn(c,i);++n<e;)i(n);return h}function pw(e){return B(e)?fe(e,Rt):Ze(e)?[e]:ze(nu(ie(e)))}function dw(e){var i=++Id;return ie(e)+i}var fw=ps(function(e,i){return e+i},0),gw=Vn("ceil"),yw=ps(function(e,i){return e/i},1),mw=Vn("floor");function vw(e){return e&&e.length?ns(e,Be,Nn):r}function ww(e,i){return e&&e.length?ns(e,L(i,2),Nn):r}function bw(e){return Ka(e,Be)}function _w(e,i){return Ka(e,L(i,2))}function Ew(e){return e&&e.length?ns(e,Be,Cn):r}function Iw(e,i){return e&&e.length?ns(e,L(i,2),Cn):r}var Pw=ps(function(e,i){return e*i},1),Sw=Vn("round"),Ow=ps(function(e,i){return e-i},0);function Rw(e){return e&&e.length?yn(e,Be):0}function Nw(e,i){return e&&e.length?yn(e,L(i,2)):0}return p.after=Jy,p.ary=yu,p.assign=Um,p.assignIn=$u,p.assignInWith=Ss,p.assignWith=Mm,p.at=Lm,p.before=mu,p.bind=to,p.bindAll=Bv,p.bindKey=vu,p.castArray=cm,p.chain=du,p.chunk=mg,p.compact=vg,p.concat=wg,p.cond=Kv,p.conforms=Fv,p.constant=co,p.countBy=Ry,p.create=km,p.curry=wu,p.curryRight=bu,p.debounce=_u,p.defaults=zm,p.defaultsDeep=Hm,p.defer=Yy,p.delay=Zy,p.difference=bg,p.differenceBy=_g,p.differenceWith=Eg,p.drop=Ig,p.dropRight=Pg,p.dropRightWhile=Sg,p.dropWhile=Og,p.fill=Rg,p.filter=Ty,p.flatMap=Cy,p.flatMapDeep=xy,p.flatMapDepth=Dy,p.flatten=uu,p.flattenDeep=Ng,p.flattenDepth=Tg,p.flip=Xy,p.flow=Gv,p.flowRight=Qv,p.fromPairs=$g,p.functions=Qm,p.functionsIn=Jm,p.groupBy=qy,p.initial=Cg,p.intersection=xg,p.intersectionBy=Dg,p.intersectionWith=qg,p.invert=Zm,p.invertBy=Xm,p.invokeMap=Uy,p.iteratee=uo,p.keyBy=My,p.keys=Re,p.keysIn=Ve,p.map=ws,p.mapKeys=tv,p.mapValues=rv,p.matches=Jv,p.matchesProperty=Yv,p.memoize=_s,p.merge=iv,p.mergeWith=Au,p.method=Zv,p.methodOf=Xv,p.mixin=ho,p.negate=Es,p.nthArg=tw,p.omit=sv,p.omitBy=nv,p.once=em,p.orderBy=Ly,p.over=rw,p.overArgs=tm,p.overEvery=iw,p.overSome=sw,p.partial=ro,p.partialRight=Eu,p.partition=ky,p.pick=ov,p.pickBy=Cu,p.property=Lu,p.propertyOf=nw,p.pull=Lg,p.pullAll=lu,p.pullAllBy=kg,p.pullAllWith=zg,p.pullAt=Hg,p.range=ow,p.rangeRight=aw,p.rearg=rm,p.reject=Vy,p.remove=Vg,p.rest=im,p.reverse=Xn,p.sampleSize=Ky,p.set=cv,p.setWith=uv,p.shuffle=Fy,p.slice=Bg,p.sortBy=Qy,p.sortedUniq=Yg,p.sortedUniqBy=Zg,p.split=Cv,p.spread=sm,p.tail=Xg,p.take=ey,p.takeRight=ty,p.takeRightWhile=ry,p.takeWhile=iy,p.tap=vy,p.throttle=nm,p.thru=vs,p.toArray=Ru,p.toPairs=xu,p.toPairsIn=Du,p.toPath=pw,p.toPlainObject=Tu,p.transform=hv,p.unary=om,p.union=sy,p.unionBy=ny,p.unionWith=oy,p.uniq=ay,p.uniqBy=cy,p.uniqWith=uy,p.unset=lv,p.unzip=eo,p.unzipWith=pu,p.update=pv,p.updateWith=dv,p.values=Ur,p.valuesIn=fv,p.without=hy,p.words=Uu,p.wrap=am,p.xor=ly,p.xorBy=py,p.xorWith=dy,p.zip=fy,p.zipObject=gy,p.zipObjectDeep=yy,p.zipWith=my,p.entries=xu,p.entriesIn=Du,p.extend=$u,p.extendWith=Ss,ho(p,p),p.add=fw,p.attempt=Mu,p.camelCase=vv,p.capitalize=qu,p.ceil=gw,p.clamp=gv,p.clone=um,p.cloneDeep=lm,p.cloneDeepWith=pm,p.cloneWith=hm,p.conformsTo=dm,p.deburr=ju,p.defaultTo=Wv,p.divide=yw,p.endsWith=wv,p.eq=vt,p.escape=bv,p.escapeRegExp=_v,p.every=Ny,p.find=$y,p.findIndex=au,p.findKey=Vm,p.findLast=Ay,p.findLastIndex=cu,p.findLastKey=Bm,p.floor=mw,p.forEach=fu,p.forEachRight=gu,p.forIn=Km,p.forInRight=Fm,p.forOwn=Wm,p.forOwnRight=Gm,p.get=no,p.gt=fm,p.gte=gm,p.has=Ym,p.hasIn=oo,p.head=hu,p.identity=Be,p.includes=jy,p.indexOf=Ag,p.inRange=yv,p.invoke=ev,p.isArguments=dr,p.isArray=B,p.isArrayBuffer=ym,p.isArrayLike=He,p.isArrayLikeObject=_e,p.isBoolean=mm,p.isBuffer=Xt,p.isDate=vm,p.isElement=wm,p.isEmpty=bm,p.isEqual=_m,p.isEqualWith=Em,p.isError=io,p.isFinite=Im,p.isFunction=Mt,p.isInteger=Iu,p.isLength=Is,p.isMap=Pu,p.isMatch=Pm,p.isMatchWith=Sm,p.isNaN=Om,p.isNative=Rm,p.isNil=Tm,p.isNull=Nm,p.isNumber=Su,p.isObject=we,p.isObjectLike=be,p.isPlainObject=vi,p.isRegExp=so,p.isSafeInteger=$m,p.isSet=Ou,p.isString=Ps,p.isSymbol=Ze,p.isTypedArray=jr,p.isUndefined=Am,p.isWeakMap=Cm,p.isWeakSet=xm,p.join=jg,p.kebabCase=Ev,p.last=ht,p.lastIndexOf=Ug,p.lowerCase=Iv,p.lowerFirst=Pv,p.lt=Dm,p.lte=qm,p.max=vw,p.maxBy=ww,p.mean=bw,p.meanBy=_w,p.min=Ew,p.minBy=Iw,p.stubArray=po,p.stubFalse=fo,p.stubObject=cw,p.stubString=uw,p.stubTrue=hw,p.multiply=Pw,p.nth=Mg,p.noConflict=ew,p.noop=lo,p.now=bs,p.pad=Sv,p.padEnd=Ov,p.padStart=Rv,p.parseInt=Nv,p.random=mv,p.reduce=zy,p.reduceRight=Hy,p.repeat=Tv,p.replace=$v,p.result=av,p.round=Sw,p.runInContext=m,p.sample=By,p.size=Wy,p.snakeCase=Av,p.some=Gy,p.sortedIndex=Kg,p.sortedIndexBy=Fg,p.sortedIndexOf=Wg,p.sortedLastIndex=Gg,p.sortedLastIndexBy=Qg,p.sortedLastIndexOf=Jg,p.startCase=xv,p.startsWith=Dv,p.subtract=Ow,p.sum=Rw,p.sumBy=Nw,p.template=qv,p.times=lw,p.toFinite=Lt,p.toInteger=K,p.toLength=Nu,p.toLower=jv,p.toNumber=lt,p.toSafeInteger=jm,p.toString=ie,p.toUpper=Uv,p.trim=Mv,p.trimEnd=Lv,p.trimStart=kv,p.truncate=zv,p.unescape=Hv,p.uniqueId=dw,p.upperCase=Vv,p.upperFirst=ao,p.each=fu,p.eachRight=gu,p.first=hu,ho(p,function(){var e={};return St(p,function(i,n){ne.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),nt(["drop","take"],function(e,i){Y.prototype[e]=function(n){n=n===r?1:Oe(K(n),0);var c=this.__filtered__&&!i?new Y(this):this.clone();return c.__filtered__?c.__takeCount__=De(n,c.__takeCount__):c.__views__.push({size:De(n,xe),type:e+(c.__dir__<0?"Right":"")}),c},Y.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),nt(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==E||n==F;Y.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:L(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),nt(["head","last"],function(e,i){var n="take"+(i?"Right":"");Y.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Y.prototype[e]=function(){return this.__filtered__?new Y(this):this[n](1)}}),Y.prototype.compact=function(){return this.filter(Be)},Y.prototype.find=function(e){return this.filter(e).head()},Y.prototype.findLast=function(e){return this.reverse().find(e)},Y.prototype.invokeMap=G(function(e,i){return typeof e=="function"?new Y(this):this.map(function(n){return pi(n,e,i)})}),Y.prototype.reject=function(e){return this.filter(Es(L(e)))},Y.prototype.slice=function(e,i){e=K(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Y(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=K(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Y.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Y.prototype.toArray=function(){return this.take(xe)},St(Y.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,v=g instanceof Y,P=y[0],S=v||B(g),R=function(J){var Z=h.apply(p,Ft([J],y));return c&&x?Z[0]:Z};S&&n&&typeof P=="function"&&P.length!=1&&(v=S=!1);var x=this.__chain__,j=!!this.__actions__.length,k=d&&!x,W=v&&!j;if(!d&&S){g=W?g:new Y(this);var z=e.apply(g,y);return z.__actions__.push({func:vs,args:[R],thisArg:r}),new at(z,x)}return k&&W?e.apply(this,y):(z=this.thru(R),k?c?z.value()[0]:z.value():z)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var i=Bi[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(B(d)?d:[],h)}return this[n](function(g){return i.apply(B(g)?g:[],h)})}}),St(Y.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";ne.call(Ar,c)||(Ar[c]=[]),Ar[c].push({name:i,func:n})}}),Ar[ls(r,Q).name]=[{name:"wrapper",func:r}],Y.prototype.clone=zd,Y.prototype.reverse=Hd,Y.prototype.value=Vd,p.prototype.at=wy,p.prototype.chain=by,p.prototype.commit=_y,p.prototype.next=Ey,p.prototype.plant=Py,p.prototype.reverse=Sy,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Oy,p.prototype.first=p.prototype.head,ni&&(p.prototype[ni]=Iy),p},Nr=bd();nr?((nr.exports=Nr)._=Nr,un._=Nr):$e._=Nr}).call(Si)})(zo,zo.exports);var ZI=Object.defineProperty,XI=Object.defineProperties,eP=Object.getOwnPropertyDescriptors,Fh=Object.getOwnPropertySymbols,tP=Object.prototype.hasOwnProperty,rP=Object.prototype.propertyIsEnumerable,Wh=(o,t,r)=>t in o?ZI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,Ns=(o,t)=>{for(var r in t||(t={}))tP.call(t,r)&&Wh(o,r,t[r]);if(Fh)for(var r of Fh(t))rP.call(t,r)&&Wh(o,r,t[r]);return o},iP=(o,t)=>XI(o,eP(t));function ir(o,t,r){var s;const a=$b(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${YI}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function _r(o){return o.includes(":")?o.split(":")[1]:o}function Ll(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function sP(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function nP(o={},t={}){const r=Gh(o),s=Gh(t);return zo.exports.merge(r,s)}function Gh(o){var t,r,s,a;const u={};if(!Hr(o))return u;for(const[l,f]of Object.entries(o)){const w=ia(l)?[l]:f.chains,_=f.methods||[],T=f.events||[],O=f.rpcMap||{},N=Oi(l);u[N]=iP(Ns(Ns({},u[N]),f),{chains:vo(w,(t=u[N])==null?void 0:t.chains),methods:vo(_,(r=u[N])==null?void 0:r.methods),events:vo(T,(s=u[N])==null?void 0:s.events),rpcMap:Ns(Ns({},O),(a=u[N])==null?void 0:a.rpcMap)})}return u}function oP(o){return o.includes(":")?o.split(":")[2]:o}function aP(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],f=ia(r)?[r]:s.chains?s.chains:Ll(s.accounts);t[r]={chains:f,methods:a,events:u,accounts:l}}return t}function So(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const kl={},ge=o=>kl[o],Oo=(o,t)=>{kl[o]=t};class cP{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class uP{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}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,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||ir(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(_r(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. 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}`)}}class hP{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class lP{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class pP{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=_r(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class dP{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class fP{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=_r(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Vt(new sr(s,ge("disableProviderPing")))}}class gP{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ge("events"),this.client=ge("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;const t=this.namespace.chains[0];if(!t)throw new 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,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||ir(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Bt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||ir(t,this.namespace);return typeof s>"u"?void 0:new Vt(new sr(s,ge("disableProviderPing")))}}var yP=Object.defineProperty,mP=Object.defineProperties,vP=Object.getOwnPropertyDescriptors,Qh=Object.getOwnPropertySymbols,wP=Object.prototype.hasOwnProperty,bP=Object.prototype.propertyIsEnumerable,Jh=(o,t,r)=>t in o?yP(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,Ts=(o,t)=>{for(var r in t||(t={}))wP.call(t,r)&&Jh(o,r,t[r]);if(Qh)for(var r of Qh(t))bP.call(t,r)&&Jh(o,r,t[r]);return o},Ro=(o,t)=>mP(o,vP(t));class ca{constructor(t){this.events=new Bo,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Ms(Ls({level:(t==null?void 0:t.logger)||Bh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new ca(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Ts({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,ks(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return 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 new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Ie("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=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 a().then(u=>{this.session=u,this.namespaces||(this.namespaces=aP(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Ul)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(yr(r)){for(const s of r)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: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const 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 jI.init({logger:this.providerOpts.logger||Bh,relayUrl:this.providerOpts.relayUrl||GI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>Oi(r)))];Oo("client",this.client),Oo("events",this.events),Oo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=sP(r,this.session),a=Ll(s),u=nP(this.namespaces,this.optionalNamespaces),l=Ro(Ts({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new uP({namespace:l});break;case"solana":this.rpcProviders[r]=new hP({namespace:l});break;case"cosmos":this.rpcProviders[r]=new lP({namespace:l});break;case"polkadot":this.rpcProviders[r]=new cP({namespace:l});break;case"cip34":this.rpcProviders[r]=new pP({namespace:l});break;case"elrond":this.rpcProviders[r]=new dP({namespace:l});break;case"multiversx":this.rpcProviders[r]=new fP({namespace:l});break;case"near":this.rpcProviders[r]=new gP({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&yr(a)&&this.events.emit("accountsChanged",a.map(oP))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=Oi(a),f=So(a)!==So(u)?`${l}:${So(u)}`:a;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=Ro(Ts({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",Ro(Ts({},Ie("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Bt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>Oi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=Oi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}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,r){this.client.core.storage.setItem(`${Kh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Kh}/${t}`)}}const _P=ca,EP="wc",IP="ethereum_provider",PP=`${EP}@2:${IP}:`,SP="https://rpc.walletconnect.com/v1/",Ho=["eth_sendTransaction","personal_sign"],OP=["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"],Vo=["chainChanged","accountsChanged"],RP=["chainChanged","accountsChanged","message","disconnect","connect"];var NP=Object.defineProperty,TP=Object.defineProperties,$P=Object.getOwnPropertyDescriptors,Yh=Object.getOwnPropertySymbols,AP=Object.prototype.hasOwnProperty,CP=Object.prototype.propertyIsEnumerable,Zh=(o,t,r)=>t in o?NP(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,Ni=(o,t)=>{for(var r in t||(t={}))AP.call(t,r)&&Zh(o,r,t[r]);if(Yh)for(var r of Yh(t))CP.call(t,r)&&Zh(o,r,t[r]);return o},Xh=(o,t)=>TP(o,$P(t));function js(o){return Number(o[0].split(":")[1])}function No(o){return`0x${o.toString(16)}`}function xP(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:f}=o;if(!To(t))throw new Error("Invalid chains");const w={chains:t,methods:s||Ho,events:u||Vo,rpcMap:Ni({},t.length?{[js(t)]:f[js(t)]}:{})},_=u==null?void 0:u.filter(U=>!Vo.includes(U)),T=s==null?void 0:s.filter(U=>!Ho.includes(U));if(!r&&!l&&!a&&!(_!=null&&_.length)&&!(T!=null&&T.length))return{required:t.length?w:void 0};const O=(_==null?void 0:_.length)&&(T==null?void 0:T.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:OP))],events:[...new Set(w.events.concat(l!=null&&l.length?l:RP))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class ua{constructor(){this.events=new It.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=PP,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new ua;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=xP(this.rpc);try{const a=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(_=>{!_.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Xh(Ni({namespaces:Ni({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(_=>{l(_)}).catch(_=>{f(new Error(_.message))})});if(!a)return;const u=n0(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:No(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}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=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",No(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",Xh(Ni({},a0("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||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 typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",No(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=a.length?(t==null?void 0:t.methods)||Ho:[],w=a.length?(t==null?void 0:t.events)||Vo:[],_=(t==null?void 0:t.optionalMethods)||[],T=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(U=>this.formatChainId(U)),optionalChains:u.map(U=>this.formatChainId(U)),methods:f,events:w,optionalMethods:_,optionalEvents:T,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?js(this.rpc.chains):js(this.rpc.optionalChains),this.signer=await _P.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Aw(()=>import("./index-BIQdJ2Hq.js").then(a=>a.i),__vite__mapDeps([0,1,2]));r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Ni({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&To(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&To(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${SP}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const ZP=ua;export{ZP as EthereumProvider,RP as OPTIONAL_EVENTS,OP as OPTIONAL_METHODS,Vo as REQUIRED_EVENTS,Ho as REQUIRED_METHODS,ua as default};
|