@wormhole-foundation/wormhole-connect 2.1.0 → 2.2.0-beta.1-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/dist/main.js +98 -98
- package/dist/src/AppRouter.d.ts.map +1 -1
- package/dist/src/components/AssetBadge.d.ts.map +1 -1
- package/dist/src/components/DemoApp/index.d.ts.map +1 -1
- package/dist/src/components/ExplorerLink.d.ts +8 -0
- package/dist/src/components/ExplorerLink.d.ts.map +1 -0
- package/dist/src/components/v2/Button.d.ts.map +1 -1
- package/dist/src/config/events.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +5 -5
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/consts/wallet.d.ts.map +1 -1
- package/dist/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/dist/src/hooks/useGetTokenBalances.d.ts.map +1 -1
- package/dist/src/hooks/useRoutesQuotesBulk.d.ts.map +1 -1
- package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
- package/dist/src/icons/ChainIcons.d.ts.map +1 -1
- package/dist/src/icons/TokenIcons.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/telemetry/types.d.ts +1 -1
- package/dist/src/telemetry/types.d.ts.map +1 -1
- package/dist/src/theme.d.ts +7 -23
- package/dist/src/theme.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +2 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/style.d.ts.map +1 -1
- package/dist/src/utils/theme.d.ts +11 -0
- package/dist/src/utils/theme.d.ts.map +1 -0
- package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/ChainList.d.ts +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/ChainList.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/SearchableList/SearchInput.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts +1 -0
- package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/WalletConnector/Controller.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/WalletConnector/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/dist/src/views/v2/TxHistory/Item/index.d.ts.map +1 -1
- package/dist/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -1
- package/lib/{aptos-C7pCAbUg.js → aptos-31PA2rFX.js} +2 -2
- package/lib/{aptos-DYNyya4r.js → aptos-B8jsnVoS.js} +1 -1
- package/lib/{aptos-hNRlQB2L.mjs → aptos-CCgGvZjs.mjs} +5 -5
- package/lib/{aptos-BqK7cMly.mjs → aptos-DVYbmFJJ.mjs} +2 -2
- package/lib/{base64-KSl9zI2U.js → base64-5kcPH2Ry.js} +1 -1
- package/lib/{base64-BVPj2zYr.mjs → base64-CL9tkFGP.mjs} +1 -1
- package/lib/{ccip-zobR3MWX.js → ccip--zj9SMHN.js} +1 -1
- package/lib/{ccip-B6vHFB5O.mjs → ccip-javMNNCd.mjs} +1 -1
- package/lib/{chunk-IMTC3J2M-Clcv-kNR.js → chunk-IMTC3J2M-BcLXY1O4.js} +1 -1
- package/lib/{chunk-IMTC3J2M-D7LWAYQa.mjs → chunk-IMTC3J2M-DeAwWSAu.mjs} +3 -3
- package/lib/{events-FSoXRy3T.mjs → events-BIr0rmUF.mjs} +1 -1
- package/lib/{events-bGzCAvB8.js → events-ZTJJzzwL.js} +1 -1
- package/lib/{evm-CN1iRHbr.mjs → evm-BdJvPk3J.mjs} +5 -5
- package/lib/{evm-CG-xuonQ.js → evm-BmG93aNU.js} +3 -3
- package/lib/{evm-BLO6Qv4a.mjs → evm-CYdShX9n.mjs} +21 -21
- package/lib/{evm-DYzdDx7h.js → evm-DWNU26Tx.js} +1 -1
- package/lib/{index-DK3F1NhB.mjs → index-B39ftYxK.mjs} +4 -4
- package/lib/{index-Ba7hi5Nv.mjs → index-BUHmIbm1.mjs} +2 -2
- package/lib/{index-BDTERphb.js → index-BbiyKg6p.js} +1 -1
- package/lib/{index-BztaZVVL.mjs → index-BhqFkgz5.mjs} +2 -2
- package/lib/{index-BdpPXZHn.mjs → index-Bn7RXnWl.mjs} +2 -2
- package/lib/{index-IzqkKy3R.js → index-C0yUUgWL.js} +1 -1
- package/lib/{index-Bu6Mzk1B.js → index-C89319ht.js} +1 -1
- package/lib/{index-D27hH8sY.js → index-CGCa-j7o.js} +1 -1
- package/lib/{index-DGrbzOIm.js → index-CGW6Ztd2.js} +1 -1
- package/lib/{index-DdL20a7t.mjs → index-CLGrfUbL.mjs} +2 -2
- package/lib/{index-BwcOlw60.js → index-CMzehyQ8.js} +1 -1
- package/lib/{index-0sRAi_-E.mjs → index-CNRoD0cV.mjs} +4639 -4522
- package/lib/{index-BK9yAEqb.mjs → index-Ck1M3TS1.mjs} +2 -2
- package/lib/{index-BxEy7t5U.mjs → index-Co3Xxu9O.mjs} +2 -2
- package/lib/{index-O6PU89nP.mjs → index-CtfLRYM0.mjs} +2 -2
- package/lib/{index-iaMEYhF5.js → index-CvDrTlD5.js} +1 -1
- package/lib/{index-D75bWNLu.js → index-D0onBS9d.js} +1 -1
- package/lib/{index-B4iVrVli.mjs → index-DCC8GaVH.mjs} +2 -2
- package/lib/{index-DJMHyNjD.mjs → index-DGB2Fxry.mjs} +2 -2
- package/lib/{index-B5H5W-MP.js → index-DOGZjt2S.js} +96 -96
- package/lib/{index-QgCTXUa6.mjs → index-DUaJiMqI.mjs} +3 -3
- package/lib/{index-DqmfSmiO.js → index-DWtG2bDp.js} +1 -1
- package/lib/{index-yt4URWzh.mjs → index-DYiI6lkY.mjs} +1 -1
- package/lib/{index-BnZRt2Rd.js → index-D_2bb1Pv.js} +1 -1
- package/lib/{index-D1_1z7Wk.mjs → index-D_elFvDQ.mjs} +1 -1
- package/lib/{index-DcrVBUpc.mjs → index-DdvuhkPU.mjs} +1 -1
- package/lib/{index-CEyJtiJA.js → index-Dg_F5gMq.js} +1 -1
- package/lib/{index-zb82e-lE.mjs → index-Dsfz-oia.mjs} +3 -3
- package/lib/{index-QtOAv51B.js → index-DvkkJ_AY.js} +1 -1
- package/lib/{index-grCrWNvp.mjs → index-SEUn7gSU.mjs} +1 -1
- package/lib/{index-gn107iCo.js → index-Upxa6-Ok.js} +1 -1
- package/lib/{index-nCiFssoC.mjs → index-YTBFGtnw.mjs} +1 -1
- package/lib/{index-D8RCiuJ0.js → index-ZSnwMbPW.js} +1 -1
- package/lib/{index-D_LeK8MJ.js → index-ZjwERA88.js} +1 -1
- package/lib/{index-xTX46Yw9.mjs → index-cugw_66S.mjs} +1 -1
- package/lib/{index--GEXYLpJ.js → index-gdamBcoQ.js} +1 -1
- package/lib/{index-CtaGVEFZ.js → index-i9soDbgm.js} +1 -1
- package/lib/{index-DI6kRBN0.mjs → index-kwKTcApr.mjs} +5 -5
- package/lib/{index-CIr2v4IG.js → index-rzStwWOM.js} +1 -1
- package/lib/{index-DVHcJTqD.mjs → index-x4yUWfDi.mjs} +1 -1
- package/lib/{index-Bb1cX9pM.js → index-xI8bbCGj.js} +1 -1
- package/lib/{index-C-Fyx20B.js → index-yQD0Xsib.js} +1 -1
- package/lib/{index.es-ffyJdlAz.mjs → index.es-Cw1Vg7NX.mjs} +6 -6
- package/lib/{index.es-DCYCSMuK.js → index.es-D1p0ce-Y.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +12 -11
- package/lib/{signer-C8bS-IbV.js → signer-C1_tDQTi.js} +1 -1
- package/lib/{signer-BBbBI9Ch.mjs → signer-C4Jm9zsl.mjs} +1 -1
- package/lib/{solana-BfVL9dAW.mjs → solana--vtCR0-G.mjs} +4 -4
- package/lib/{solana-BVyz5H3z.js → solana-BtM4z8cN.js} +1 -1
- package/lib/solana-LXeQ1tV1.js +1 -0
- package/lib/solana-Q8lVR5YD.mjs +16 -0
- package/lib/{solanaEmbed.esm-BXeUQQ1f.mjs → solanaEmbed.esm-BvXjTkVM.mjs} +2 -2
- package/lib/{solanaEmbed.esm-BylLsCAU.js → solanaEmbed.esm-DsV8Nqbb.js} +1 -1
- package/lib/src/AppRouter.d.ts.map +1 -1
- package/lib/src/components/AssetBadge.d.ts.map +1 -1
- package/lib/src/components/DemoApp/index.d.ts.map +1 -1
- package/lib/src/components/ExplorerLink.d.ts +8 -0
- package/lib/src/components/ExplorerLink.d.ts.map +1 -0
- package/lib/src/components/v2/Button.d.ts.map +1 -1
- package/lib/src/config/events.d.ts.map +1 -1
- package/lib/src/config/types.d.ts +5 -5
- package/lib/src/config/types.d.ts.map +1 -1
- package/lib/src/consts/wallet.d.ts.map +1 -1
- package/lib/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/lib/src/hooks/useGetTokenBalances.d.ts.map +1 -1
- package/lib/src/hooks/useRoutesQuotesBulk.d.ts.map +1 -1
- package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
- package/lib/src/icons/ChainIcons.d.ts.map +1 -1
- package/lib/src/icons/TokenIcons.d.ts.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/telemetry/types.d.ts +1 -1
- package/lib/src/telemetry/types.d.ts.map +1 -1
- package/lib/src/theme.d.ts +7 -23
- package/lib/src/theme.d.ts.map +1 -1
- package/lib/src/utils/index.d.ts +2 -1
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/style.d.ts.map +1 -1
- package/lib/src/utils/theme.d.ts +11 -0
- package/lib/src/utils/theme.d.ts.map +1 -0
- package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/ChainList.d.ts +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/ChainList.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/SearchableList/SearchInput.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts +1 -0
- package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/WalletConnector/Controller.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/WalletConnector/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/lib/src/views/v2/TxHistory/Item/index.d.ts.map +1 -1
- package/lib/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -1
- package/lib/{sui-CBeaWzBm.mjs → sui-B6LQdf1S.mjs} +1 -1
- package/lib/{sui-NQaMhA2C.mjs → sui-C9At-twC.mjs} +5 -5
- package/lib/{sui-fKD7sV9G.js → sui-CdyyFA7x.js} +2 -2
- package/lib/{sui-BcGOZHgb.js → sui-CsDZcGdt.js} +1 -1
- package/package.json +3 -2
- package/dist/development.css +0 -4
- package/lib/development.css +0 -4
- package/lib/solana-7uRxf9WX.mjs +0 -16
- package/lib/solana-DPZR_Eze.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const He=require("./events-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const He=require("./events-ZTJJzzwL.js"),W=require("./index-DOGZjt2S.js"),ze=require("./evm-BmG93aNU.js"),j=require("./index-CGCa-j7o.js"),E=require("./index-Upxa6-Ok.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function nr(a){let t;return typeof window<"u"&&typeof window[a]<"u"&&(t=window[a]),t}ne.getFromWindow=nr;function $r(a){const t=nr(a);if(!t)throw new Error(`${a} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function rw(){return $r("document")}ne.getDocumentOrThrow=rw;function iw(){return nr("document")}ne.getDocument=iw;function sw(){return $r("navigator")}ne.getNavigatorOrThrow=sw;function nw(){return nr("navigator")}ne.getNavigator=nw;function ow(){return $r("location")}ne.getLocationOrThrow=ow;function aw(){return nr("location")}ne.getLocation=aw;function cw(){return $r("crypto")}ne.getCryptoOrThrow=cw;function uw(){return nr("crypto")}ne.getCrypto=uw;function hw(){return $r("localStorage")}ne.getLocalStorageOrThrow=hw;function lw(){return nr("localStorage")}ne.getLocalStorage=lw;var Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.getWindowMetadata=void 0;const pu=ne;function pw(){let a,t;try{a=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=a.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const x=O[q],K=x.getAttribute("rel");if(K&&K.toLowerCase().indexOf("icon")>-1){const D=x.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let Q=t.protocol+"//"+t.host;if(D.indexOf("/")===0)Q+=D;else{const fe=t.pathname.split("/");fe.pop();const Z=fe.join("/");Q+=Z+"/"+D}N.push(Q)}else if(D.indexOf("//")===0){const Q=t.protocol+D;N.push(Q)}else N.push(D)}}return N}function s(...O){const N=a.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const x=N[q],K=["itemprop","property","name"].map(D=>x.getAttribute(D)).filter(D=>D?O.includes(D):!1);if(K.length&&K){const D=x.getAttribute("content");if(D)return D}}return""}function o(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=a.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=o(),g=u(),w=t.origin,b=r();return{description:g,url:w,icons:b,name:l}}Eo.getWindowMetadata=pw;function fw(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const dw={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 gw(a,t){const{message:r,code:s}=dw[a];return{message:r,code:s}}function uo(a,t){return!!Array.isArray(a)}var Tr={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -43,4 +43,4 @@ __p += '`),Y&&(R+=`' +
|
|
|
43
43
|
function print() { __p += __j.call(arguments, '') }
|
|
44
44
|
`:`;
|
|
45
45
|
`)+R+`return __p
|
|
46
|
-
}`;var V=uu(function(){return X(f,F+"return "+R).apply(r,d)});if(V.source=R,Mn(V))throw V;return V}function um(e){return te(e).toLowerCase()}function hm(e){return te(e).toUpperCase()}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Be(i)))return e;var c=ct(e),h=ct(i),f=wa(c,h),d=_a(c,h)+1;return kt(c,f,d).join("")}function pm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Be(i)))return e;var c=ct(e),h=_a(c,ct(i))+1;return kt(c,0,h).join("")}function fm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(Us,"");if(!e||!(i=Be(i)))return e;var c=ct(e),h=wa(c,ct(i));return kt(c,h).join("")}function dm(e,i){var n=ol,c=al;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?H(i.length):n,c="omission"in i?Be(i.omission):c}e=te(e);var f=e.length;if(dr(e)){var d=ct(e);f=d.length}if(n>=f)return e;var y=n-gr(c);if(y<1)return c;var m=d?kt(d,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(d&&(y+=m.length-y),Ln(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=tn(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Be(h),y)!=y){var T=m.lastIndexOf(h);T>-1&&(m=m.slice(0,T))}return m+c}function gm(e){return e=te(e),e&&Sl.test(e)?e.replace(qo,Hp):e}var ym=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Hn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?Up(e)?Bp(e):Cp(e):e.match(i)||[]}var uu=B(function(e,i){try{return Ve(e,r,i)}catch(n){return Mn(n)?n:new k(n)}}),vm=Pt(function(e,i){return Ze(i,function(n){n=vt(n),Et(e,n,qn(e[n],e))}),e});function mm(e){var i=e==null?0:e.length,n=U();return e=i?ce(e,function(c){if(typeof c[1]!="function")throw new Xe(l);return[n(c[0]),c[1]]}):[],B(function(c){for(var h=-1;++h<i;){var f=e[h];if(Ve(f[0],this,c))return Ve(f[1],this,c)}})}function wm(e){return Vf(tt(e,O))}function Vn(e){return function(){return e}}function _m(e,i){return e==null||e!==e?i:e}var bm=pc(),Em=pc(!0);function Me(e){return e}function Kn(e){return za(typeof e=="function"?e:tt(e,O))}function Im(e){return Va(tt(e,O))}function Pm(e,i){return Ka(e,tt(i,O))}var Sm=B(function(e,i){return function(n){return Yr(n,e,i)}}),Om=B(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Wi(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Wi(i,be(i)));var f=!(le(n)&&"chain"in n)||!!n.chain,d=Ot(e);return Ze(h,function(y){var m=i[y];e[y]=m,d&&(e.prototype[y]=function(){var P=this.__chain__;if(f||P){var S=e(this.__wrapped__),R=S.__actions__=je(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Rm(){return Ie._===this&&(Ie._=Zp),this}function Wn(){}function Nm(e){return e=H(e),B(function(i){return Ba(i,e)})}var Cm=Pn(ce),$m=Pn(fa),Tm=Pn(Js);function hu(e){return Tn(e)?Gs(vt(e)):ad(e)}function Am(e){return function(i){return e==null?r:Zt(e,i)}}var xm=dc(),Dm=dc(!0);function Jn(){return[]}function Gn(){return!1}function Fm(){return{}}function jm(){return""}function qm(){return!0}function Um(e,i){if(e=H(e),e<1||e>ur)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Zs(c,i);++n<e;)i(n);return h}function Mm(e){return z(e)?ce(e,vt):We(e)?[e]:je($c(te(e)))}function Lm(e){var i=++Qp;return te(e)+i}var km=Xi(function(e,i){return e+i},0),zm=Sn("ceil"),Hm=Xi(function(e,i){return e/i},1),Vm=Sn("floor");function Km(e){return e&&e.length?Bi(e,Me,hn):r}function Bm(e,i){return e&&e.length?Bi(e,U(i,2),hn):r}function Wm(e){return ya(e,Me)}function Jm(e,i){return ya(e,U(i,2))}function Gm(e){return e&&e.length?Bi(e,Me,dn):r}function Qm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Ym=Xi(function(e,i){return e*i},1),Zm=Sn("round"),Xm=Xi(function(e,i){return e-i},0);function ew(e){return e&&e.length?Ys(e,Me):0}function tw(e,i){return e&&e.length?Ys(e,U(i,2)):0}return p.after=Iy,p.ary=kc,p.assign=hv,p.assignIn=tu,p.assignInWith=ps,p.assignWith=lv,p.at=pv,p.before=zc,p.bind=qn,p.bindAll=vm,p.bindKey=Hc,p.castArray=Fy,p.chain=Uc,p.chunk=Vd,p.compact=Kd,p.concat=Bd,p.cond=mm,p.conforms=wm,p.constant=Vn,p.countBy=ey,p.create=fv,p.curry=Vc,p.curryRight=Kc,p.debounce=Bc,p.defaults=dv,p.defaultsDeep=gv,p.defer=Py,p.delay=Sy,p.difference=Wd,p.differenceBy=Jd,p.differenceWith=Gd,p.drop=Qd,p.dropRight=Yd,p.dropRightWhile=Zd,p.dropWhile=Xd,p.fill=eg,p.filter=ry,p.flatMap=ny,p.flatMapDeep=oy,p.flatMapDepth=ay,p.flatten=Dc,p.flattenDeep=tg,p.flattenDepth=rg,p.flip=Oy,p.flow=bm,p.flowRight=Em,p.fromPairs=ig,p.functions=Ev,p.functionsIn=Iv,p.groupBy=cy,p.initial=ng,p.intersection=og,p.intersectionBy=ag,p.intersectionWith=cg,p.invert=Sv,p.invertBy=Ov,p.invokeMap=hy,p.iteratee=Kn,p.keyBy=ly,p.keys=be,p.keysIn=Ue,p.map=os,p.mapKeys=Nv,p.mapValues=Cv,p.matches=Im,p.matchesProperty=Pm,p.memoize=cs,p.merge=$v,p.mergeWith=ru,p.method=Sm,p.methodOf=Om,p.mixin=Bn,p.negate=us,p.nthArg=Nm,p.omit=Tv,p.omitBy=Av,p.once=Ry,p.orderBy=py,p.over=Cm,p.overArgs=Ny,p.overEvery=$m,p.overSome=Tm,p.partial=Un,p.partialRight=Wc,p.partition=fy,p.pick=xv,p.pickBy=iu,p.property=hu,p.propertyOf=Am,p.pull=pg,p.pullAll=jc,p.pullAllBy=fg,p.pullAllWith=dg,p.pullAt=gg,p.range=xm,p.rangeRight=Dm,p.rearg=Cy,p.reject=yy,p.remove=yg,p.rest=$y,p.reverse=Fn,p.sampleSize=my,p.set=Fv,p.setWith=jv,p.shuffle=wy,p.slice=vg,p.sortBy=Ey,p.sortedUniq=Pg,p.sortedUniqBy=Sg,p.split=nm,p.spread=Ty,p.tail=Og,p.take=Rg,p.takeRight=Ng,p.takeRightWhile=Cg,p.takeWhile=$g,p.tap=Kg,p.throttle=Ay,p.thru=ns,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=Mm,p.toPlainObject=eu,p.transform=qv,p.unary=xy,p.union=Tg,p.unionBy=Ag,p.unionWith=xg,p.uniq=Dg,p.uniqBy=Fg,p.uniqWith=jg,p.unset=Uv,p.unzip=jn,p.unzipWith=qc,p.update=Mv,p.updateWith=Lv,p.values=Sr,p.valuesIn=kv,p.without=qg,p.words=cu,p.wrap=Dy,p.xor=Ug,p.xorBy=Mg,p.xorWith=Lg,p.zip=kg,p.zipObject=zg,p.zipObjectDeep=Hg,p.zipWith=Vg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ps,Bn(p,p),p.add=km,p.attempt=uu,p.camelCase=Kv,p.capitalize=ou,p.ceil=zm,p.clamp=zv,p.clone=jy,p.cloneDeep=Uy,p.cloneDeepWith=My,p.cloneWith=qy,p.conformsTo=Ly,p.deburr=au,p.defaultTo=_m,p.divide=Hm,p.endsWith=Bv,p.eq=ht,p.escape=Wv,p.escapeRegExp=Jv,p.every=ty,p.find=iy,p.findIndex=Ac,p.findKey=yv,p.findLast=sy,p.findLastIndex=xc,p.findLastKey=vv,p.floor=Vm,p.forEach=Mc,p.forEachRight=Lc,p.forIn=mv,p.forInRight=wv,p.forOwn=_v,p.forOwnRight=bv,p.get=kn,p.gt=ky,p.gte=zy,p.has=Pv,p.hasIn=zn,p.head=Fc,p.identity=Me,p.includes=uy,p.indexOf=sg,p.inRange=Hv,p.invoke=Rv,p.isArguments=tr,p.isArray=z,p.isArrayBuffer=Hy,p.isArrayLike=qe,p.isArrayLikeObject=ge,p.isBoolean=Vy,p.isBuffer=zt,p.isDate=Ky,p.isElement=By,p.isEmpty=Wy,p.isEqual=Jy,p.isEqualWith=Gy,p.isError=Mn,p.isFinite=Qy,p.isFunction=Ot,p.isInteger=Jc,p.isLength=hs,p.isMap=Gc,p.isMatch=Yy,p.isMatchWith=Zy,p.isNaN=Xy,p.isNative=ev,p.isNil=rv,p.isNull=tv,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Ln,p.isSafeInteger=iv,p.isSet=Yc,p.isString=ls,p.isSymbol=We,p.isTypedArray=Pr,p.isUndefined=sv,p.isWeakMap=nv,p.isWeakSet=ov,p.join=ug,p.kebabCase=Gv,p.last=it,p.lastIndexOf=hg,p.lowerCase=Qv,p.lowerFirst=Yv,p.lt=av,p.lte=cv,p.max=Km,p.maxBy=Bm,p.mean=Wm,p.meanBy=Jm,p.min=Gm,p.minBy=Qm,p.stubArray=Jn,p.stubFalse=Gn,p.stubObject=Fm,p.stubString=jm,p.stubTrue=qm,p.multiply=Ym,p.nth=lg,p.noConflict=Rm,p.noop=Wn,p.now=as,p.pad=Zv,p.padEnd=Xv,p.padStart=em,p.parseInt=tm,p.random=Vv,p.reduce=dy,p.reduceRight=gy,p.repeat=rm,p.replace=im,p.result=Dv,p.round=Zm,p.runInContext=v,p.sample=vy,p.size=_y,p.snakeCase=sm,p.some=by,p.sortedIndex=mg,p.sortedIndexBy=wg,p.sortedIndexOf=_g,p.sortedLastIndex=bg,p.sortedLastIndexBy=Eg,p.sortedLastIndexOf=Ig,p.startCase=om,p.startsWith=am,p.subtract=Xm,p.sum=ew,p.sumBy=tw,p.template=cm,p.times=Um,p.toFinite=Rt,p.toInteger=H,p.toLength=Xc,p.toLower=um,p.toNumber=st,p.toSafeInteger=uv,p.toString=te,p.toUpper=hm,p.trim=lm,p.trimEnd=pm,p.trimStart=fm,p.truncate=dm,p.unescape=gm,p.uniqueId=Lm,p.upperCase=ym,p.upperFirst=Hn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return gt(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ze(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ze(["drop","take"],function(e,i){G.prototype[e]=function(n){n=n===r?1:_e(H(n),0);var c=this.__filtered__&&!i?new G(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},G.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ze(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==ll;G.prototype[e]=function(h){var f=this.clone();return f.__iteratees__.push({iteratee:U(h,3),type:n}),f.__filtered__=f.__filtered__||c,f}}),Ze(["head","last"],function(e,i){var n="take"+(i?"Right":"");G.prototype[e]=function(){return this[n](1).value()[0]}}),Ze(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");G.prototype[e]=function(){return this.__filtered__?new G(this):this[n](1)}}),G.prototype.compact=function(){return this.filter(Me)},G.prototype.find=function(e){return this.filter(e).head()},G.prototype.findLast=function(e){return this.reverse().find(e)},G.prototype.invokeMap=B(function(e,i){return typeof e=="function"?new G(this):this.map(function(n){return Yr(n,e,i)})}),G.prototype.reject=function(e){return this.filter(us(U(e)))},G.prototype.slice=function(e,i){e=H(e);var n=this;return n.__filtered__&&(e>0||i<0)?new G(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=H(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},G.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},G.prototype.toArray=function(){return this.take(dt)},gt(G.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],f=c||/^find/.test(i);h&&(p.prototype[i]=function(){var d=this.__wrapped__,y=c?[1]:arguments,m=d instanceof G,P=y[0],S=m||z(d),R=function(J){var Y=h.apply(p,Ft([J],y));return c&&T?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var T=this.__chain__,F=!!this.__actions__.length,M=f&&!T,V=m&&!F;if(!f&&S){d=V?d:new G(this);var L=e.apply(d,y);return L.__actions__.push({func:ns,args:[R],thisArg:r}),new et(L,T)}return M&&V?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ze(["pop","push","shift","sort","splice","unshift"],function(e){var i=Ti[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 f=this.value();return i.apply(z(f)?f:[],h)}return this[n](function(d){return i.apply(z(d)?d:[],h)})}}),gt(G.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Zi(r,Q).name]=[{name:"wrapper",func:r}],G.prototype.clone=gf,G.prototype.reverse=yf,G.prototype.value=vf,p.prototype.at=Bg,p.prototype.chain=Wg,p.prototype.commit=Jg,p.prototype.next=Gg,p.prototype.plant=Yg,p.prototype.reverse=Zg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Xg,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Qg),p},yr=Wp();Wt?((Wt.exports=yr)._=yr,Vs._=yr):Ie._=yr}).call(hi)})(bo,bo.exports);var LE=Object.defineProperty,kE=Object.defineProperties,zE=Object.getOwnPropertyDescriptors,lh=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,ph=(a,t,r)=>t in a?LE(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))HE.call(t,r)&&ph(a,r,t[r]);if(lh)for(var r of lh(t))VE.call(t,r)&&ph(a,r,t[r]);return a},KE=(a,t)=>kE(a,zE(t));function Kt(a,t,r){var s;const o=f_(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${ME}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function cr(a){return a.includes(":")?a.split(":")[1]:a}function rl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function BE(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function WE(a={},t={}){const r=fh(a),s=fh(t);return bo.exports.merge(r,s)}function fh(a){var t,r,s,o;const u={};if(!Cr(a))return u;for(const[l,g]of Object.entries(a)){const w=Co(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=li(l);u[N]=KE(gs(gs({},u[N]),g),{chains:Zn(w,(t=u[N])==null?void 0:t.chains),methods:Zn(b,(r=u[N])==null?void 0:r.methods),events:Zn(C,(s=u[N])==null?void 0:s.events),rpcMap:gs(gs({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function JE(a){return a.includes(":")?a.split(":")[2]:a}function GE(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],g=Co(r)?[r]:s.chains?s.chains:rl(s.accounts);t[r]={chains:g,methods:o,events:u,accounts:l}}return t}function no(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const il={},ue=a=>il[a],oo=(a,t)=>{il[a]=t};class QE{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class YE{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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||Kt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("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 o=parseInt(cr(r));t[o]=this.createHttpProvider(o,(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 o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,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:o}]},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 ZE{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class XE{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class eI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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),o=cr(r);t[o]=this.createHttpProvider(o,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 Tt(new Bt(s,ue("disableProviderPing")))}}class tI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class rI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class iI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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||Kt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.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||Kt(t,this.namespace);return typeof s>"u"?void 0:new Tt(new Bt(s,ue("disableProviderPing")))}}var sI=Object.defineProperty,nI=Object.defineProperties,oI=Object.getOwnPropertyDescriptors,dh=Object.getOwnPropertySymbols,aI=Object.prototype.hasOwnProperty,cI=Object.prototype.propertyIsEnumerable,gh=(a,t,r)=>t in a?sI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ys=(a,t)=>{for(var r in t||(t={}))aI.call(t,r)&&gh(a,r,t[r]);if(dh)for(var r of dh(t))cI.call(t,r)&&gh(a,r,t[r]);return a},ao=(a,t)=>nI(a,oI(t));class xo{constructor(t){this.events=new He.ss,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:E.Tt(E.k({level:(t==null?void 0:t.logger)||uh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:ys({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,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:ve("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:o}=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 o().then(u=>{this.session=u,this.namespaces||(this.namespaces=GE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==el)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,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(sr(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 SE.init({logger:this.providerOpts.logger||uh,relayUrl:this.providerOpts.relayUrl||jE,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=>li(r)))];oo("client",this.client),oo("events",this.events),oo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=BE(r,this.session),o=rl(s),u=WE(this.namespaces,this.optionalNamespaces),l=ao(ys({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new YE({namespace:l});break;case"solana":this.rpcProviders[r]=new ZE({namespace:l});break;case"cosmos":this.rpcProviders[r]=new XE({namespace:l});break;case"polkadot":this.rpcProviders[r]=new QE({namespace:l});break;case"cip34":this.rpcProviders[r]=new eI({namespace:l});break;case"elrond":this.rpcProviders[r]=new tI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new rI({namespace:l});break;case"near":this.rpcProviders[r]=new iI({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 o=s.data;o&&sr(o)&&this.events.emit("accountsChanged",o.map(JE))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=li(o),g=no(o)!==no(u)?`${l}:${no(u)}`:o;this.onChainChanged(g)}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:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=ao(ys({},u),{namespaces:o}),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",ao(ys({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.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:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,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=>li(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 o=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${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(`${hh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${hh}/${t}`)}}const uI=xo,hI="wc",lI="ethereum_provider",pI=`${hI}@2:${lI}:`,fI="https://rpc.walletconnect.com/v1/",bs=["eth_sendTransaction","personal_sign"],sl=["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"],Es=["chainChanged","accountsChanged"],nl=["chainChanged","accountsChanged","message","disconnect","connect"];var dI=Object.defineProperty,gI=Object.defineProperties,yI=Object.getOwnPropertyDescriptors,yh=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,mI=Object.prototype.propertyIsEnumerable,vh=(a,t,r)=>t in a?dI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,fi=(a,t)=>{for(var r in t||(t={}))vI.call(t,r)&&vh(a,r,t[r]);if(yh)for(var r of yh(t))mI.call(t,r)&&vh(a,r,t[r]);return a},mh=(a,t)=>gI(a,yI(t));function Is(a){return Number(a[0].split(":")[1])}function co(a){return`0x${a.toString(16)}`}function wI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:g}=a;if(!uo(t))throw new Error("Invalid chains");const w={chains:t,methods:s||bs,events:u||Es,rpcMap:fi({},t.length?{[Is(t)]:g[Is(t)]}:{})},b=u==null?void 0:u.filter(q=>!Es.includes(q)),C=s==null?void 0:s.filter(q=>!bs.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:sl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:nl))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Rs{constructor(){this.events=new He.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=pI,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 Rs;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}=wI(this.rpc);try{const o=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(mh(fi({namespaces:fi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!o)return;const u=fw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:co(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}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",co(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",mh(fi({},gw("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",co(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,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}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 o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=o.length?(t==null?void 0:t.methods)||bs:[],w=o.length?(t==null?void 0:t.events)||Es:[],b=(t==null?void 0:t.optionalMethods)||[],C=(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:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Is(this.rpc.chains):Is(this.rpc.optionalChains),this.signer=await uI.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 Promise.resolve().then(()=>require("./index-BDTERphb.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(fi({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:o}=t;r&&uo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&uo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${fI}?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 _I=Rs;exports.EthereumProvider=_I;exports.OPTIONAL_EVENTS=nl;exports.OPTIONAL_METHODS=sl;exports.REQUIRED_EVENTS=Es;exports.REQUIRED_METHODS=bs;exports.default=Rs;
|
|
46
|
+
}`;var V=uu(function(){return X(f,F+"return "+R).apply(r,d)});if(V.source=R,Mn(V))throw V;return V}function um(e){return te(e).toLowerCase()}function hm(e){return te(e).toUpperCase()}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Be(i)))return e;var c=ct(e),h=ct(i),f=wa(c,h),d=_a(c,h)+1;return kt(c,f,d).join("")}function pm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Be(i)))return e;var c=ct(e),h=_a(c,ct(i))+1;return kt(c,0,h).join("")}function fm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(Us,"");if(!e||!(i=Be(i)))return e;var c=ct(e),h=wa(c,ct(i));return kt(c,h).join("")}function dm(e,i){var n=ol,c=al;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?H(i.length):n,c="omission"in i?Be(i.omission):c}e=te(e);var f=e.length;if(dr(e)){var d=ct(e);f=d.length}if(n>=f)return e;var y=n-gr(c);if(y<1)return c;var m=d?kt(d,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(d&&(y+=m.length-y),Ln(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=tn(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Be(h),y)!=y){var T=m.lastIndexOf(h);T>-1&&(m=m.slice(0,T))}return m+c}function gm(e){return e=te(e),e&&Sl.test(e)?e.replace(qo,Hp):e}var ym=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Hn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?Up(e)?Bp(e):Cp(e):e.match(i)||[]}var uu=B(function(e,i){try{return Ve(e,r,i)}catch(n){return Mn(n)?n:new k(n)}}),vm=Pt(function(e,i){return Ze(i,function(n){n=vt(n),Et(e,n,qn(e[n],e))}),e});function mm(e){var i=e==null?0:e.length,n=U();return e=i?ce(e,function(c){if(typeof c[1]!="function")throw new Xe(l);return[n(c[0]),c[1]]}):[],B(function(c){for(var h=-1;++h<i;){var f=e[h];if(Ve(f[0],this,c))return Ve(f[1],this,c)}})}function wm(e){return Vf(tt(e,O))}function Vn(e){return function(){return e}}function _m(e,i){return e==null||e!==e?i:e}var bm=pc(),Em=pc(!0);function Me(e){return e}function Kn(e){return za(typeof e=="function"?e:tt(e,O))}function Im(e){return Va(tt(e,O))}function Pm(e,i){return Ka(e,tt(i,O))}var Sm=B(function(e,i){return function(n){return Yr(n,e,i)}}),Om=B(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Wi(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Wi(i,be(i)));var f=!(le(n)&&"chain"in n)||!!n.chain,d=Ot(e);return Ze(h,function(y){var m=i[y];e[y]=m,d&&(e.prototype[y]=function(){var P=this.__chain__;if(f||P){var S=e(this.__wrapped__),R=S.__actions__=je(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Rm(){return Ie._===this&&(Ie._=Zp),this}function Wn(){}function Nm(e){return e=H(e),B(function(i){return Ba(i,e)})}var Cm=Pn(ce),$m=Pn(fa),Tm=Pn(Js);function hu(e){return Tn(e)?Gs(vt(e)):ad(e)}function Am(e){return function(i){return e==null?r:Zt(e,i)}}var xm=dc(),Dm=dc(!0);function Jn(){return[]}function Gn(){return!1}function Fm(){return{}}function jm(){return""}function qm(){return!0}function Um(e,i){if(e=H(e),e<1||e>ur)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Zs(c,i);++n<e;)i(n);return h}function Mm(e){return z(e)?ce(e,vt):We(e)?[e]:je($c(te(e)))}function Lm(e){var i=++Qp;return te(e)+i}var km=Xi(function(e,i){return e+i},0),zm=Sn("ceil"),Hm=Xi(function(e,i){return e/i},1),Vm=Sn("floor");function Km(e){return e&&e.length?Bi(e,Me,hn):r}function Bm(e,i){return e&&e.length?Bi(e,U(i,2),hn):r}function Wm(e){return ya(e,Me)}function Jm(e,i){return ya(e,U(i,2))}function Gm(e){return e&&e.length?Bi(e,Me,dn):r}function Qm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Ym=Xi(function(e,i){return e*i},1),Zm=Sn("round"),Xm=Xi(function(e,i){return e-i},0);function ew(e){return e&&e.length?Ys(e,Me):0}function tw(e,i){return e&&e.length?Ys(e,U(i,2)):0}return p.after=Iy,p.ary=kc,p.assign=hv,p.assignIn=tu,p.assignInWith=ps,p.assignWith=lv,p.at=pv,p.before=zc,p.bind=qn,p.bindAll=vm,p.bindKey=Hc,p.castArray=Fy,p.chain=Uc,p.chunk=Vd,p.compact=Kd,p.concat=Bd,p.cond=mm,p.conforms=wm,p.constant=Vn,p.countBy=ey,p.create=fv,p.curry=Vc,p.curryRight=Kc,p.debounce=Bc,p.defaults=dv,p.defaultsDeep=gv,p.defer=Py,p.delay=Sy,p.difference=Wd,p.differenceBy=Jd,p.differenceWith=Gd,p.drop=Qd,p.dropRight=Yd,p.dropRightWhile=Zd,p.dropWhile=Xd,p.fill=eg,p.filter=ry,p.flatMap=ny,p.flatMapDeep=oy,p.flatMapDepth=ay,p.flatten=Dc,p.flattenDeep=tg,p.flattenDepth=rg,p.flip=Oy,p.flow=bm,p.flowRight=Em,p.fromPairs=ig,p.functions=Ev,p.functionsIn=Iv,p.groupBy=cy,p.initial=ng,p.intersection=og,p.intersectionBy=ag,p.intersectionWith=cg,p.invert=Sv,p.invertBy=Ov,p.invokeMap=hy,p.iteratee=Kn,p.keyBy=ly,p.keys=be,p.keysIn=Ue,p.map=os,p.mapKeys=Nv,p.mapValues=Cv,p.matches=Im,p.matchesProperty=Pm,p.memoize=cs,p.merge=$v,p.mergeWith=ru,p.method=Sm,p.methodOf=Om,p.mixin=Bn,p.negate=us,p.nthArg=Nm,p.omit=Tv,p.omitBy=Av,p.once=Ry,p.orderBy=py,p.over=Cm,p.overArgs=Ny,p.overEvery=$m,p.overSome=Tm,p.partial=Un,p.partialRight=Wc,p.partition=fy,p.pick=xv,p.pickBy=iu,p.property=hu,p.propertyOf=Am,p.pull=pg,p.pullAll=jc,p.pullAllBy=fg,p.pullAllWith=dg,p.pullAt=gg,p.range=xm,p.rangeRight=Dm,p.rearg=Cy,p.reject=yy,p.remove=yg,p.rest=$y,p.reverse=Fn,p.sampleSize=my,p.set=Fv,p.setWith=jv,p.shuffle=wy,p.slice=vg,p.sortBy=Ey,p.sortedUniq=Pg,p.sortedUniqBy=Sg,p.split=nm,p.spread=Ty,p.tail=Og,p.take=Rg,p.takeRight=Ng,p.takeRightWhile=Cg,p.takeWhile=$g,p.tap=Kg,p.throttle=Ay,p.thru=ns,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=Mm,p.toPlainObject=eu,p.transform=qv,p.unary=xy,p.union=Tg,p.unionBy=Ag,p.unionWith=xg,p.uniq=Dg,p.uniqBy=Fg,p.uniqWith=jg,p.unset=Uv,p.unzip=jn,p.unzipWith=qc,p.update=Mv,p.updateWith=Lv,p.values=Sr,p.valuesIn=kv,p.without=qg,p.words=cu,p.wrap=Dy,p.xor=Ug,p.xorBy=Mg,p.xorWith=Lg,p.zip=kg,p.zipObject=zg,p.zipObjectDeep=Hg,p.zipWith=Vg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ps,Bn(p,p),p.add=km,p.attempt=uu,p.camelCase=Kv,p.capitalize=ou,p.ceil=zm,p.clamp=zv,p.clone=jy,p.cloneDeep=Uy,p.cloneDeepWith=My,p.cloneWith=qy,p.conformsTo=Ly,p.deburr=au,p.defaultTo=_m,p.divide=Hm,p.endsWith=Bv,p.eq=ht,p.escape=Wv,p.escapeRegExp=Jv,p.every=ty,p.find=iy,p.findIndex=Ac,p.findKey=yv,p.findLast=sy,p.findLastIndex=xc,p.findLastKey=vv,p.floor=Vm,p.forEach=Mc,p.forEachRight=Lc,p.forIn=mv,p.forInRight=wv,p.forOwn=_v,p.forOwnRight=bv,p.get=kn,p.gt=ky,p.gte=zy,p.has=Pv,p.hasIn=zn,p.head=Fc,p.identity=Me,p.includes=uy,p.indexOf=sg,p.inRange=Hv,p.invoke=Rv,p.isArguments=tr,p.isArray=z,p.isArrayBuffer=Hy,p.isArrayLike=qe,p.isArrayLikeObject=ge,p.isBoolean=Vy,p.isBuffer=zt,p.isDate=Ky,p.isElement=By,p.isEmpty=Wy,p.isEqual=Jy,p.isEqualWith=Gy,p.isError=Mn,p.isFinite=Qy,p.isFunction=Ot,p.isInteger=Jc,p.isLength=hs,p.isMap=Gc,p.isMatch=Yy,p.isMatchWith=Zy,p.isNaN=Xy,p.isNative=ev,p.isNil=rv,p.isNull=tv,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Ln,p.isSafeInteger=iv,p.isSet=Yc,p.isString=ls,p.isSymbol=We,p.isTypedArray=Pr,p.isUndefined=sv,p.isWeakMap=nv,p.isWeakSet=ov,p.join=ug,p.kebabCase=Gv,p.last=it,p.lastIndexOf=hg,p.lowerCase=Qv,p.lowerFirst=Yv,p.lt=av,p.lte=cv,p.max=Km,p.maxBy=Bm,p.mean=Wm,p.meanBy=Jm,p.min=Gm,p.minBy=Qm,p.stubArray=Jn,p.stubFalse=Gn,p.stubObject=Fm,p.stubString=jm,p.stubTrue=qm,p.multiply=Ym,p.nth=lg,p.noConflict=Rm,p.noop=Wn,p.now=as,p.pad=Zv,p.padEnd=Xv,p.padStart=em,p.parseInt=tm,p.random=Vv,p.reduce=dy,p.reduceRight=gy,p.repeat=rm,p.replace=im,p.result=Dv,p.round=Zm,p.runInContext=v,p.sample=vy,p.size=_y,p.snakeCase=sm,p.some=by,p.sortedIndex=mg,p.sortedIndexBy=wg,p.sortedIndexOf=_g,p.sortedLastIndex=bg,p.sortedLastIndexBy=Eg,p.sortedLastIndexOf=Ig,p.startCase=om,p.startsWith=am,p.subtract=Xm,p.sum=ew,p.sumBy=tw,p.template=cm,p.times=Um,p.toFinite=Rt,p.toInteger=H,p.toLength=Xc,p.toLower=um,p.toNumber=st,p.toSafeInteger=uv,p.toString=te,p.toUpper=hm,p.trim=lm,p.trimEnd=pm,p.trimStart=fm,p.truncate=dm,p.unescape=gm,p.uniqueId=Lm,p.upperCase=ym,p.upperFirst=Hn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return gt(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ze(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ze(["drop","take"],function(e,i){G.prototype[e]=function(n){n=n===r?1:_e(H(n),0);var c=this.__filtered__&&!i?new G(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},G.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ze(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==ll;G.prototype[e]=function(h){var f=this.clone();return f.__iteratees__.push({iteratee:U(h,3),type:n}),f.__filtered__=f.__filtered__||c,f}}),Ze(["head","last"],function(e,i){var n="take"+(i?"Right":"");G.prototype[e]=function(){return this[n](1).value()[0]}}),Ze(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");G.prototype[e]=function(){return this.__filtered__?new G(this):this[n](1)}}),G.prototype.compact=function(){return this.filter(Me)},G.prototype.find=function(e){return this.filter(e).head()},G.prototype.findLast=function(e){return this.reverse().find(e)},G.prototype.invokeMap=B(function(e,i){return typeof e=="function"?new G(this):this.map(function(n){return Yr(n,e,i)})}),G.prototype.reject=function(e){return this.filter(us(U(e)))},G.prototype.slice=function(e,i){e=H(e);var n=this;return n.__filtered__&&(e>0||i<0)?new G(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=H(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},G.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},G.prototype.toArray=function(){return this.take(dt)},gt(G.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],f=c||/^find/.test(i);h&&(p.prototype[i]=function(){var d=this.__wrapped__,y=c?[1]:arguments,m=d instanceof G,P=y[0],S=m||z(d),R=function(J){var Y=h.apply(p,Ft([J],y));return c&&T?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var T=this.__chain__,F=!!this.__actions__.length,M=f&&!T,V=m&&!F;if(!f&&S){d=V?d:new G(this);var L=e.apply(d,y);return L.__actions__.push({func:ns,args:[R],thisArg:r}),new et(L,T)}return M&&V?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ze(["pop","push","shift","sort","splice","unshift"],function(e){var i=Ti[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 f=this.value();return i.apply(z(f)?f:[],h)}return this[n](function(d){return i.apply(z(d)?d:[],h)})}}),gt(G.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Zi(r,Q).name]=[{name:"wrapper",func:r}],G.prototype.clone=gf,G.prototype.reverse=yf,G.prototype.value=vf,p.prototype.at=Bg,p.prototype.chain=Wg,p.prototype.commit=Jg,p.prototype.next=Gg,p.prototype.plant=Yg,p.prototype.reverse=Zg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Xg,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Qg),p},yr=Wp();Wt?((Wt.exports=yr)._=yr,Vs._=yr):Ie._=yr}).call(hi)})(bo,bo.exports);var LE=Object.defineProperty,kE=Object.defineProperties,zE=Object.getOwnPropertyDescriptors,lh=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable,ph=(a,t,r)=>t in a?LE(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))HE.call(t,r)&&ph(a,r,t[r]);if(lh)for(var r of lh(t))VE.call(t,r)&&ph(a,r,t[r]);return a},KE=(a,t)=>kE(a,zE(t));function Kt(a,t,r){var s;const o=f_(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${ME}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function cr(a){return a.includes(":")?a.split(":")[1]:a}function rl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function BE(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function WE(a={},t={}){const r=fh(a),s=fh(t);return bo.exports.merge(r,s)}function fh(a){var t,r,s,o;const u={};if(!Cr(a))return u;for(const[l,g]of Object.entries(a)){const w=Co(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=li(l);u[N]=KE(gs(gs({},u[N]),g),{chains:Zn(w,(t=u[N])==null?void 0:t.chains),methods:Zn(b,(r=u[N])==null?void 0:r.methods),events:Zn(C,(s=u[N])==null?void 0:s.events),rpcMap:gs(gs({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function JE(a){return a.includes(":")?a.split(":")[2]:a}function GE(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],g=Co(r)?[r]:s.chains?s.chains:rl(s.accounts);t[r]={chains:g,methods:o,events:u,accounts:l}}return t}function no(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const il={},ue=a=>il[a],oo=(a,t)=>{il[a]=t};class QE{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class YE{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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||Kt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("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 o=parseInt(cr(r));t[o]=this.createHttpProvider(o,(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 o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,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:o}]},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 ZE{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class XE{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class eI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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),o=cr(r);t[o]=this.createHttpProvider(o,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 Tt(new Bt(s,ue("disableProviderPing")))}}class tI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class rI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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(At.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 o=cr(r);t[o]=this.createHttpProvider(o,(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||Kt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Tt(new Bt(s,ue("disableProviderPing")))}}class iI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ue("events"),this.client=ue("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||Kt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.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||Kt(t,this.namespace);return typeof s>"u"?void 0:new Tt(new Bt(s,ue("disableProviderPing")))}}var sI=Object.defineProperty,nI=Object.defineProperties,oI=Object.getOwnPropertyDescriptors,dh=Object.getOwnPropertySymbols,aI=Object.prototype.hasOwnProperty,cI=Object.prototype.propertyIsEnumerable,gh=(a,t,r)=>t in a?sI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,ys=(a,t)=>{for(var r in t||(t={}))aI.call(t,r)&&gh(a,r,t[r]);if(dh)for(var r of dh(t))cI.call(t,r)&&gh(a,r,t[r]);return a},ao=(a,t)=>nI(a,oI(t));class xo{constructor(t){this.events=new He.ss,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:E.Tt(E.k({level:(t==null?void 0:t.logger)||uh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:ys({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,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:ve("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:o}=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 o().then(u=>{this.session=u,this.namespaces||(this.namespaces=GE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==el)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,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(sr(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 SE.init({logger:this.providerOpts.logger||uh,relayUrl:this.providerOpts.relayUrl||jE,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=>li(r)))];oo("client",this.client),oo("events",this.events),oo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=BE(r,this.session),o=rl(s),u=WE(this.namespaces,this.optionalNamespaces),l=ao(ys({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new YE({namespace:l});break;case"solana":this.rpcProviders[r]=new ZE({namespace:l});break;case"cosmos":this.rpcProviders[r]=new XE({namespace:l});break;case"polkadot":this.rpcProviders[r]=new QE({namespace:l});break;case"cip34":this.rpcProviders[r]=new eI({namespace:l});break;case"elrond":this.rpcProviders[r]=new tI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new rI({namespace:l});break;case"near":this.rpcProviders[r]=new iI({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 o=s.data;o&&sr(o)&&this.events.emit("accountsChanged",o.map(JE))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=li(o),g=no(o)!==no(u)?`${l}:${no(u)}`:o;this.onChainChanged(g)}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:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=ao(ys({},u),{namespaces:o}),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",ao(ys({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.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:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,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=>li(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 o=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${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(`${hh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${hh}/${t}`)}}const uI=xo,hI="wc",lI="ethereum_provider",pI=`${hI}@2:${lI}:`,fI="https://rpc.walletconnect.com/v1/",bs=["eth_sendTransaction","personal_sign"],sl=["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"],Es=["chainChanged","accountsChanged"],nl=["chainChanged","accountsChanged","message","disconnect","connect"];var dI=Object.defineProperty,gI=Object.defineProperties,yI=Object.getOwnPropertyDescriptors,yh=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,mI=Object.prototype.propertyIsEnumerable,vh=(a,t,r)=>t in a?dI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,fi=(a,t)=>{for(var r in t||(t={}))vI.call(t,r)&&vh(a,r,t[r]);if(yh)for(var r of yh(t))mI.call(t,r)&&vh(a,r,t[r]);return a},mh=(a,t)=>gI(a,yI(t));function Is(a){return Number(a[0].split(":")[1])}function co(a){return`0x${a.toString(16)}`}function wI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:g}=a;if(!uo(t))throw new Error("Invalid chains");const w={chains:t,methods:s||bs,events:u||Es,rpcMap:fi({},t.length?{[Is(t)]:g[Is(t)]}:{})},b=u==null?void 0:u.filter(q=>!Es.includes(q)),C=s==null?void 0:s.filter(q=>!bs.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:sl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:nl))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Rs{constructor(){this.events=new He.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=pI,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 Rs;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}=wI(this.rpc);try{const o=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(mh(fi({namespaces:fi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!o)return;const u=fw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:co(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}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",co(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",mh(fi({},gw("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",co(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,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}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 o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=o.length?(t==null?void 0:t.methods)||bs:[],w=o.length?(t==null?void 0:t.events)||Es:[],b=(t==null?void 0:t.optionalMethods)||[],C=(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:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Is(this.rpc.chains):Is(this.rpc.optionalChains),this.signer=await uI.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 Promise.resolve().then(()=>require("./index-BbiyKg6p.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(fi({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:o}=t;r&&uo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&uo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${fI}?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 _I=Rs;exports.EthereumProvider=_I;exports.OPTIONAL_EVENTS=nl;exports.OPTIONAL_METHODS=sl;exports.REQUIRED_EVENTS=Es;exports.REQUIRED_METHODS=bs;exports.default=Rs;
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-DOGZjt2S.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticPorticoRoute=t.AutomaticPorticoRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSHUTTLE=t.MayanRouteSHUTTLE;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.buildConfig=t.buildConfig;exports.default=t.WormholeConnect;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;exports.wormholeConnectHosted=t.wormholeConnectHosted;
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cR as o, cT as c, cP as e, cS as s, cL as u, cI as R, cU as
|
|
1
|
+
import { cR as o, cT as c, cP as e, cS as s, cL as u, cI as R, cU as T, cW as n, cY as i, cX as M, cV as C, cJ as m, cQ as r, cK as A, cH as E, cN as d, cO as y, cM as P, cZ as S } from "./index-CNRoD0cV.mjs";
|
|
2
2
|
export {
|
|
3
3
|
o as AutomaticCCTPRoute,
|
|
4
4
|
c as AutomaticPorticoRoute,
|
|
@@ -6,16 +6,17 @@ export {
|
|
|
6
6
|
s as CCTPRoute,
|
|
7
7
|
u as DEFAULT_ROUTES,
|
|
8
8
|
R as MAINNET,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
i as
|
|
12
|
-
M as
|
|
13
|
-
C as
|
|
14
|
-
m as
|
|
15
|
-
r as
|
|
16
|
-
A as
|
|
9
|
+
T as MayanRoute,
|
|
10
|
+
n as MayanRouteMCTP,
|
|
11
|
+
i as MayanRouteSHUTTLE,
|
|
12
|
+
M as MayanRouteSWIFT,
|
|
13
|
+
C as MayanRouteWH,
|
|
14
|
+
m as TESTNET,
|
|
15
|
+
r as TokenBridgeRoute,
|
|
16
|
+
A as buildConfig,
|
|
17
|
+
E as default,
|
|
17
18
|
d as nttAutomaticRoute,
|
|
18
|
-
|
|
19
|
+
y as nttManualRoute,
|
|
19
20
|
P as nttRoutes,
|
|
20
|
-
|
|
21
|
+
S as wormholeConnectHosted
|
|
21
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var B=(i,t,e)=>t in i?k(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var f=(i,t,e)=>B(i,typeof t!="symbol"?t+"":t,e);const a=require("./index-
|
|
1
|
+
"use strict";var k=Object.defineProperty;var B=(i,t,e)=>t in i?k(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var f=(i,t,e)=>B(i,typeof t!="symbol"?t+"":t,e);const a=require("./index-DOGZjt2S.js"),y=.5,F=1,b=1,E=1e8,T=5,x=25e4;async function I(i,t,e){const[n,r]=await a.SolanaPlatform.chainFromRpc(i),s=typeof t=="string"?a.Keypair.fromSecretKey(a.b58.decode(t)):t;if(e!=null&&e.priorityFee&&e.priorityFee.percentile&&e.priorityFee.percentile>1)throw new Error("priorityFeePercentile must be a number between 0 and 1");return new R(i,r,s,(e==null?void 0:e.debug)??!1,(e==null?void 0:e.priorityFee)??{},(e==null?void 0:e.retries)??T,e==null?void 0:e.sendOpts)}class R{constructor(t,e,n,r=!1,s,c=T,d){f(this,"_rpc");f(this,"_chain");f(this,"_keypair");f(this,"_debug");f(this,"_priorityFee");f(this,"_maxResubmits");f(this,"_sendOpts");this._rpc=t,this._chain=e,this._keypair=n,this._debug=r,this._priorityFee=s,this._maxResubmits=c,this._sendOpts=d,this._sendOpts=this._sendOpts??{preflightCommitment:this._rpc.commitment}}chain(){return this._chain}address(){return this._keypair.publicKey.toBase58()}retryable(t){var n;if(t instanceof a.TransactionExpiredBlockheightExceededError)return!0;if(!(t instanceof a.SendTransactionError)||!t.message.includes("Transaction simulation failed"))return!1;if(t.message.includes("Blockhash not found"))return!0;const e=(n=t.logs)==null?void 0:n.find(r=>r.startsWith("Program log: Error: "));return e?!!(e.includes("Not enough bytes")||e.includes("Unexpected length of input")):!1}async signAndSend(t){var d;let{blockhash:e,lastValidBlockHeight:n}=await a.SolanaPlatform.latestBlock(this._rpc);const r=[];for(const l of t){const{description:g,transaction:{transaction:o,signers:u}}=l;this._debug&&console.log(`Signing: ${g} for ${this.address()}`);let h;(d=this._priorityFee)!=null&&d.percentile&&this._priorityFee.percentile>0&&(h=await M(this._rpc,o,this._priorityFee.percentile,this._priorityFee.percentileMultiple,this._priorityFee.min,this._priorityFee.max)),this._debug&&A(o);for(let m=0;m<this._maxResubmits;m++)try{if(a.isVersionedTransaction(o)){if(h&&m===0){const _=a.TransactionMessage.decompile(o.message);_.instructions.push(...h),o.message=_.compileToV0Message()}o.message.recentBlockhash=e,o.sign([this._keypair,...u??[]])}else h&&m===0&&o.add(...h),o.recentBlockhash=e,o.lastValidBlockHeight=n,o.partialSign(this._keypair,...u??[]);this._debug&&console.log("Submitting transactions ");const{signature:p}=await a.SolanaPlatform.sendTxWithRetry(this._rpc,o.serialize(),this._sendOpts);r.push(p);break}catch(p){if(m===this._maxResubmits-1||!this.retryable(p))throw p;this._debug&&console.log(`Failed to send transaction on attempt ${m}, retrying: `,p);const{blockhash:_,lastValidBlockHeight:S}=await a.SolanaPlatform.latestBlock(this._rpc);n=S,e=_}}this._debug&&console.log("Waiting for confirmation for: ",r);const c=(await Promise.all(r.map(async l=>{try{return await this._rpc.confirmTransaction({signature:l,blockhash:e,lastValidBlockHeight:n},this._rpc.commitment)}catch(g){throw console.error("Failed to confirm transaction: ",g),g}}))).filter(l=>l.value.err).map(l=>l.value.err);if(c.length>0)throw new Error(`Failed to confirm transaction: ${c}`);return r}}function A(i){if(a.isVersionedTransaction(i)){console.log(i.signatures);const t=i.message,e=t.getAccountKeys();t.compiledInstructions.forEach(n=>{console.log("Program",e.get(n.programIdIndex).toBase58()),console.log("Data: ",a.hex.encode(n.data)),console.log("Keys: ",n.accountKeyIndexes.map(r=>[r,e.get(r).toBase58()]))})}else console.log(i.signatures),console.log(i.feePayer),i.instructions.forEach(t=>{console.log("Program",t.programId.toBase58()),console.log("Data: ",t.data.toString("hex")),console.log("Keys: ",t.keys.map(e=>[e,e.pubkey.toBase58()]))})}async function M(i,t,e=y,n=F,r=b,s=E){const[c,d]=await Promise.all([L(i,t),P(i,t,e,n,r,s)]);return[a.ComputeBudgetProgram.setComputeUnitLimit({units:c}),a.ComputeBudgetProgram.setComputeUnitPrice({microLamports:d})]}async function L(i,t){var n;let e=x;try{const r=await(a.isVersionedTransaction(t),i.simulateTransaction(t));r.value.err&&console.error(`Error simulating Solana transaction: ${r.value.err}`),(n=r==null?void 0:r.value)!=null&&n.unitsConsumed&&(e=Math.round(r.value.unitsConsumed*1.2))}catch(r){console.error(`Failed to calculate compute unit limit for Solana transaction: ${r}`)}return e}async function w(i,t){if(a.isVersionedTransaction(t)){const e=(await Promise.all(t.message.addressTableLookups.map(s=>i.getAddressLookupTable(s.accountKey)))).map(s=>s.value).filter(s=>s!==null),n=t.message,r=n.getAccountKeys({addressLookupTableAccounts:e??void 0});return n.compiledInstructions.flatMap(s=>s.accountKeyIndexes).map(s=>n.isAccountWritable(s)?r.get(s):null).filter(Boolean)}else return t.instructions.flatMap(e=>e.keys).map(e=>e.isWritable?e.pubkey:null).filter(Boolean)}async function P(i,t,e=y,n=F,r=b,s=E){let c=r;const d=await w(i,t);try{const l=await i.getRecentPrioritizationFees({lockedWritableAccounts:d});if(l){const g=l.map(u=>u.prioritizationFee).sort((u,h)=>u-h),o=Math.ceil(g.length*e);if(g.length>o){let u=g[o];n>0&&(u*=n),c=Math.max(c,u)}}}catch(l){console.error("Error fetching Solana recent fees",l)}return Math.min(Math.max(c,r),s)}async function U(i,t,e=y,n=F,r=b,s=E){const c=e*1e4;if(c<1||c>1e4)throw new Error("percentile must be between 0.0001 and 1");const d=i._rpcRequest,g=[await w(i,t),{percentile:c}],o=await d("getRecentPrioritizationFees",g);if(o.error)throw new Error(o.error);const u=o.result.map(m=>m.prioritizationFee);if(u.length===0)return r;const h=Math.floor(a.median(u)*(n>0?n:1));return a.bound(h,r,s)}exports.determinePriorityFee=P;exports.determinePriorityFeeTritonOne=U;exports.getSolanaSignAndSendSigner=I;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
2
|
var x = (i, t, e) => t in i ? S(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
3
|
var m = (i, t, e) => x(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { ar as I, as as R, aj as y, e as _, at as A, au as M, av as L, aw as U, ak as O, am as w, r as C } from "./index-
|
|
4
|
+
import { ar as I, as as R, aj as y, e as _, at as A, au as M, av as L, aw as U, ak as O, am as w, r as C } from "./index-CNRoD0cV.mjs";
|
|
5
5
|
const F = 0.5, b = 1, E = 1, T = 1e8, k = 5, D = 25e4;
|
|
6
6
|
async function N(i, t, e) {
|
|
7
7
|
const [s, r] = await _.chainFromRpc(i), n = typeof t == "string" ? A.fromSecretKey(M.decode(t)) : t;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { X as Zt, ae as O, af as st, Z as Yt, ag as It, a3 as ht, a8 as $, ah as Nt, ai as wt, aj as ct, ak as Qt, al as dt, am as Dt, ac as Z, an as Ut, ao as kt, ap as St, aq as Wt } from "./index-
|
|
1
|
+
import { X as Zt, ae as O, af as st, Z as Yt, ag as It, a3 as ht, a8 as $, ah as Nt, ai as wt, aj as ct, ak as Qt, al as dt, am as Dt, ac as Z, an as Ut, ao as kt, ap as St, aq as Wt } from "./index-CNRoD0cV.mjs";
|
|
2
2
|
import { a as Gt } from "./util--bw7gFPs.mjs";
|
|
3
3
|
import { g as _t } from "./wallets-B2tqS5lZ.mjs";
|
|
4
|
-
import { d as vt, a as Pt } from "./signer-
|
|
4
|
+
import { d as vt, a as Pt } from "./signer-C4Jm9zsl.mjs";
|
|
5
5
|
var xt = { exports: {} };
|
|
6
6
|
(function(s) {
|
|
7
7
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
@@ -769,7 +769,7 @@ class oe extends q {
|
|
|
769
769
|
this._connecting = !0;
|
|
770
770
|
let e;
|
|
771
771
|
try {
|
|
772
|
-
e = (await import("./solanaEmbed.esm-
|
|
772
|
+
e = (await import("./solanaEmbed.esm-BvXjTkVM.mjs")).default;
|
|
773
773
|
} catch (a) {
|
|
774
774
|
throw new Et(a == null ? void 0 : a.message, a);
|
|
775
775
|
}
|
|
@@ -925,7 +925,7 @@ class ge extends gt {
|
|
|
925
925
|
this._connecting = !0;
|
|
926
926
|
let e, t;
|
|
927
927
|
try {
|
|
928
|
-
({ WalletConnectWallet: e, WalletConnectChainID: t } = await import("./index-
|
|
928
|
+
({ WalletConnectWallet: e, WalletConnectChainID: t } = await import("./index-kwKTcApr.mjs"));
|
|
929
929
|
} catch (a) {
|
|
930
930
|
throw new Et(a == null ? void 0 : a.message, a);
|
|
931
931
|
}
|