@dcl/auth-site 4.11.11-22780609840.commit-e44c784 → 4.11.11-22781234551.commit-a40fcb5

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.
Files changed (105) hide show
  1. package/assets/{ConstantsUtil-B-sZzc8-.js → ConstantsUtil-CjfY5C-V.js} +1 -1
  2. package/assets/{ContentfulRichText-Ccpv7Lzj.js → ContentfulRichText-szjY841w.js} +1 -1
  3. package/assets/{ExchangeController-orrE6Nio.js → ExchangeController-BxlO08VE.js} +1 -1
  4. package/assets/{HelpersUtil-BtxBkNVn.js → HelpersUtil-x0nt3nwH.js} +1 -1
  5. package/assets/{NetworkUtil-Dk2XkqgR.js → NetworkUtil-DyGEI2VU.js} +1 -1
  6. package/assets/{SwapController-Dv1Unies.js → SwapController-DAha2q3K.js} +1 -1
  7. package/assets/{biconomy-C94bNQlx.js → biconomy-BWJI8-90.js} +1 -1
  8. package/assets/{browser-CK8iqnbk.js → browser-Gy4muUgP.js} +1 -1
  9. package/assets/{ccip-mVr-tE5q.js → ccip-dnE5Gm4E.js} +1 -1
  10. package/assets/{chains-_WmAMt8E.js → chains-BQMES5fn.js} +1 -1
  11. package/assets/{common-BeTeJ79_.js → common-BwQpTD2S.js} +1 -1
  12. package/assets/{controller-S8AJz7IQ.js → controller-CENj7ssg.js} +2 -2
  13. package/assets/{data-capture-BiVktbB2.js → data-capture-7PtfHEPa.js} +1 -1
  14. package/assets/{email-DyjR89V8.js → email-B8CHtzF2.js} +1 -1
  15. package/assets/{embedded-wallet-CUGzvWBK.js → embedded-wallet-jhtNHRSi.js} +1 -1
  16. package/assets/{engine-CrpqAN94.js → engine-B-sLcGE6.js} +1 -1
  17. package/assets/{estimate-l1-fee-Dj0EK8C8.js → estimate-l1-fee-DvZ2MwG5.js} +1 -1
  18. package/assets/{ethereum-DiBu66K_.js → ethereum-CU54uKiY.js} +1 -1
  19. package/assets/{extractIPFS-CwI02199.js → extractIPFS-2crcE-_t.js} +1 -1
  20. package/assets/{features-f_U-e3U3.js → features-B_WmiTww.js} +1 -1
  21. package/assets/{fetchTokenMetadata-BOaoq9ve.js → fetchTokenMetadata-Ceua2KIn.js} +1 -1
  22. package/assets/{fortmatic-BVQECIvS.js → fortmatic-yVXO0yZW.js} +1 -1
  23. package/assets/{get-ecosystem-wallet-info-D--2Y_LX.js → get-ecosystem-wallet-info-B_7ytUYe.js} +1 -1
  24. package/assets/{getBalance-Bljzcw8d.js → getBalance-DcAZ2csr.js} +1 -1
  25. package/assets/{getInstalledModules-3NuWmx6H.js → getInstalledModules-D79Kuh8U.js} +1 -1
  26. package/assets/{getNFT-CExHiTUn.js → getNFT-DN9RHF-M.js} +1 -1
  27. package/assets/{getNFT-BEH-J_91.js → getNFT-DUZ6No5e.js} +2 -2
  28. package/assets/{if-defined-DVs7PzBK.js → if-defined-CqgEBRxN.js} +1 -1
  29. package/assets/{in-app-wallet-calls-7FNKXkCG.js → in-app-wallet-calls-UIMPhVJo.js} +1 -1
  30. package/assets/{index-TkCk8xFw.js → index-B165ulUE.js} +1 -1
  31. package/assets/{index-CvOJOeJT.js → index-B2Q1CT7c.js} +1 -1
  32. package/assets/{index-CJMcrknO.js → index-B6SgqrmH.js} +1 -1
  33. package/assets/{index-By7lRlf2.js → index-B6T1KJ1a.js} +1 -1
  34. package/assets/{index-Bi80QxtG.js → index-BHh0Bich.js} +1 -1
  35. package/assets/{index-BDspt6bT.js → index-BeY6Xcp6.js} +1 -1
  36. package/assets/{index-DZd2rlXc.js → index-Bg87PnLr.js} +1 -1
  37. package/assets/{index-tBBVa87h.js → index-BgyCIdOx.js} +1 -1
  38. package/assets/{index-6VCcVS8k.js → index-BklW2i4j.js} +1 -1
  39. package/assets/{index-l8l-Sxk1.js → index-Bn1VdTkw.js} +1 -1
  40. package/assets/{index-8L8KqbqP.js → index-BskQgjhW.js} +1 -1
  41. package/assets/{index-BE2fw_0H.js → index-C5BEhAhY.js} +1 -1
  42. package/assets/{index-C0WYuLMU.js → index-CIYBVIoe.js} +1 -1
  43. package/assets/{index-IIOIPqcZ.js → index-CLIcHT0k.js} +1 -1
  44. package/assets/{index-3NiKdMWY.js → index-CU_6wCKS.js} +1 -1
  45. package/assets/{index-Cdk8z_im.js → index-CZ91DYoU.js} +1 -1
  46. package/assets/{index-CWbqt-Mn.js → index-Ca9x4uaU.js} +1 -1
  47. package/assets/{index-Cjm8RwIQ.js → index-CeDc0IRR.js} +1 -1
  48. package/assets/{index-Di2MrHuB.js → index-Cpooy3VZ.js} +1 -1
  49. package/assets/{index-CPMnouv1.js → index-CrWBowap.js} +1 -1
  50. package/assets/{index-CVgh8Aoh.js → index-D17YLbFA.js} +1 -1
  51. package/assets/{index-DQWUBxzp.js → index-D4lStigW.js} +1 -1
  52. package/assets/{index-ntNDFase.css → index-D5WCaIXi.css} +1 -1
  53. package/assets/{index-BUn9uhHE.js → index-DGYKp76B.js} +1 -1
  54. package/assets/{index-Dm7W5prB.js → index-DJ9r-7tM.js} +1 -1
  55. package/assets/{index-B2X2nnXu.js → index-DJTjzLoX.js} +1 -1
  56. package/assets/{index-BLcdj2co.js → index-DPAVOgtG.js} +1 -1
  57. package/assets/{index-BPkKLwJV.js → index-DhIWDUep.js} +1 -1
  58. package/assets/{index-BoEFpa8a.js → index-DhmjgeRg.js} +1 -1
  59. package/assets/{index-BBrCsupE.js → index-DjxtFL12.js} +1 -1
  60. package/assets/{index-uTsulT42.js → index-DlJpbE2s.js} +4 -4
  61. package/assets/{index-Cr12aXcp.js → index-DqCllZmU.js} +9 -9
  62. package/assets/{index-BXjqI-FE.js → index-DsplgcA8.js} +1 -1
  63. package/assets/{index-5IERNKw1.js → index-DzbCeBg6.js} +1 -1
  64. package/assets/{index-P2ss7rbi.js → index-HR8oNGff.js} +1 -1
  65. package/assets/{index-jK-oawDU.js → index-LLbUDVYo.js} +1 -1
  66. package/assets/{index-eoe33P3F.js → index-Ll0kcRaD.js} +1 -1
  67. package/assets/{index-DnbPfiOR.js → index-R5vun4_E.js} +1 -1
  68. package/assets/{index-TraCrStM.js → index-SjW5RHkq.js} +1 -1
  69. package/assets/{index-ob9veW1f.js → index-UTENqpWu.js} +2 -2
  70. package/assets/{index--hYgDev-.js → index-VJieSQmj.js} +1 -1
  71. package/assets/{index-BEN7MFpX.js → index-WLS_xOYz.js} +1 -1
  72. package/assets/{index-MfYvZ93M.js → index-bkTRLdQY.js} +1 -1
  73. package/assets/{index-_qqrF-Bd.js → index-pn3vytwl.js} +1 -1
  74. package/assets/{index.es-C7arMpND.js → index.es-BCx6xUtt.js} +1 -1
  75. package/assets/{index.es-oerS1AwE.js → index.es-BnzT8PVF.js} +1 -1
  76. package/assets/{index.es-D2lGFJIJ.js → index.es-P6lUA9Z2.js} +1 -1
  77. package/assets/{native-CHAeAoOQ.js → native-CWH_Zm1G.js} +1 -1
  78. package/assets/{networks-D_8bj-ev.js → networks-CkRQpNao.js} +1 -1
  79. package/assets/{onramp-C1kK-rfG.js → onramp-DyAnvzdq.js} +1 -1
  80. package/assets/{openzeppelin-D4Z-xyFE.js → openzeppelin-BAH5OrQ5.js} +1 -1
  81. package/assets/{ownerOf-C5RZsXNq.js → ownerOf-DRP6yklc.js} +1 -1
  82. package/assets/{parseNft-b1_RtGq5.js → parseNft-B8a7Sbca.js} +2 -2
  83. package/assets/{pay-with-exchange-d3EUSHTA.js → pay-with-exchange-B47f-Bsd.js} +1 -1
  84. package/assets/{qr-overlay-CACeuZNX.js → qr-overlay-CYWSMaE-.js} +3 -3
  85. package/assets/{receive-CxwWHkr8.js → receive-nct88A9K.js} +1 -1
  86. package/assets/{ref-DSqHrm2R.js → ref-DyWZcPyi.js} +1 -1
  87. package/assets/{resolveImplementation-D8CuyZVs.js → resolveImplementation-JoZxpNAV.js} +1 -1
  88. package/assets/{secp256k1-DzGoR7dw.js → secp256k1-DC9srQyO.js} +1 -1
  89. package/assets/{send-DVVPh4P5.js → send-DyhpQBjA.js} +1 -1
  90. package/assets/{send-eip712-transaction-DlPgyWb1.js → send-eip712-transaction-3hq8ocTr.js} +1 -1
  91. package/assets/{send-gasless-transaction-4iVhDjmL.js → send-gasless-transaction-nk4Swq0A.js} +2 -2
  92. package/assets/{session-proposal-CWgCRaBn.js → session-proposal-BspeaRVh.js} +1 -1
  93. package/assets/{session-request-BF2G1TqK.js → session-request-CNIOGy4K.js} +2 -2
  94. package/assets/{socials-BImi7Rqr.js → socials-LItdDbpf.js} +1 -1
  95. package/assets/{swaps-BX7FtLkE.js → swaps-Duit2P7p.js} +1 -1
  96. package/assets/{thirdweb-BVDpE57w.js → thirdweb-BICh3dVr.js} +5 -5
  97. package/assets/{totalSupply-Dc6xbAs9.js → totalSupply-ftx7uAcf.js} +1 -1
  98. package/assets/{transactions-B6yM2CSt.js → transactions-BZwTuQCF.js} +1 -1
  99. package/assets/{ui-DpaWI-pw.js → ui-Bkpvk8Cf.js} +5 -5
  100. package/assets/{vendor-DeraAStG.js → vendor-CoK8zP4N.js} +1 -1
  101. package/assets/{w3m-modal-CU-yEJrr.js → w3m-modal-CPEg1Lyr.js} +1 -1
  102. package/assets/{wallets-DPYHr-D6.js → wallets-mFIrGikY.js} +5 -5
  103. package/assets/{web-connector-BWKlPYhQ.js → web-connector-D12uHf9B.js} +3 -3
  104. package/index.html +5 -5
  105. package/package.json +3 -3
@@ -1 +1 @@
1
- import{B as M}from"./ui-DpaWI-pw.js";import{B as Tt,q as Mt,K as ot,r as J,t as Bt,Y as F,P as $t,F as B,V as R,u as z,v as At,w as Lt}from"./wallets-DPYHr-D6.js";import{f as Jt,o as g,a as Et}from"./index.es-oerS1AwE.js";import{f as P}from"./index.es-D2lGFJIJ.js";import{d0 as zt}from"./index-Cr12aXcp.js";import"./vendor-DeraAStG.js";import"./thirdweb-BVDpE57w.js";import"./ethereum-DiBu66K_.js";const ct="error",Gt="wss://relay.walletconnect.org",Vt="wc",Kt="universal_provider",x=`${Vt}@2:${Kt}:`,St="https://rpc.walletconnect.org/v1/",qt="generic",Wt=`${St}bundler`,_="call_status",Yt=86400,v={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function it(i){return i==null||typeof i!="object"&&typeof i!="function"}function Nt(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Dt(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Qt="[object RegExp]",_t="[object String]",Ft="[object Number]",Rt="[object Boolean]",xt="[object Arguments]",Xt="[object Symbol]",Zt="[object Date]",te="[object Map]",ee="[object Set]",ie="[object Array]",se="[object ArrayBuffer]",re="[object Object]",ne="[object DataView]",ae="[object Uint8Array]",oe="[object Uint8ClampedArray]",ce="[object Uint16Array]",he="[object Uint32Array]",pe="[object Int8Array]",ue="[object Int16Array]",le="[object Int32Array]",de="[object Float32Array]",fe="[object Float64Array]";function st(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function me(i,t){return D(i,void 0,i,new Map,t)}function D(i,t,e,s=new Map,n=void 0){const a=n==null?void 0:n(i,t,e,s);if(a!=null)return a;if(it(i))return i;if(s.has(i))return s.get(i);if(Array.isArray(i)){const r=new Array(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return Object.hasOwn(i,"index")&&(r.index=i.index),Object.hasOwn(i,"input")&&(r.input=i.input),r}if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){const r=new RegExp(i.source,i.flags);return r.lastIndex=i.lastIndex,r}if(i instanceof Map){const r=new Map;s.set(i,r);for(const[o,c]of i)r.set(o,D(c,o,e,s,n));return r}if(i instanceof Set){const r=new Set;s.set(i,r);for(const o of i)r.add(D(o,void 0,e,s,n));return r}if(typeof M<"u"&&M.isBuffer(i))return i.subarray();if(st(i)){const r=new(Object.getPrototypeOf(i)).constructor(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return r}if(i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);if(i instanceof DataView){const r=new DataView(i.buffer.slice(0),i.byteOffset,i.byteLength);return s.set(i,r),y(r,i,e,s,n),r}if(typeof File<"u"&&i instanceof File){const r=new File([i],i.name,{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Blob){const r=new Blob([i],{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Error){const r=new i.constructor;return s.set(i,r),r.message=i.message,r.name=i.name,r.stack=i.stack,r.cause=i.cause,y(r,i,e,s,n),r}if(typeof i=="object"&&ve(i)){const r=Object.create(Object.getPrototypeOf(i));return s.set(i,r),y(r,i,e,s,n),r}return i}function y(i,t,e=i,s,n){const a=[...Object.keys(t),...Nt(t)];for(let r=0;r<a.length;r++){const o=a[r],c=Object.getOwnPropertyDescriptor(i,o);(c==null||c.writable)&&(i[o]=D(t[o],o,e,s,n))}}function ve(i){switch(Dt(i)){case xt:case ie:case se:case ne:case Rt:case Zt:case de:case fe:case pe:case ue:case le:case te:case Ft:case re:case Qt:case ee:case _t:case Xt:case ae:case oe:case ce:case he:return!0;default:return!1}}function ge(i,t){return me(i,(e,s,n,a)=>{if(typeof i=="object")switch(Object.prototype.toString.call(i)){case Ft:case _t:case Rt:{const r=new i.constructor(i==null?void 0:i.valueOf());return y(r,i),r}case xt:{const r={};return y(r,i),r.length=i.length,r[Symbol.iterator]=i[Symbol.iterator],r}default:return}})}function ht(i){return ge(i)}function pt(i){return i!==null&&typeof i=="object"&&Dt(i)==="[object Arguments]"}function ut(i){return typeof i=="object"&&i!==null}function Pe(){}function we(i){return st(i)}function be(i){var e;if(typeof i!="object"||i==null)return!1;if(Object.getPrototypeOf(i)===null)return!0;if(Object.prototype.toString.call(i)!=="[object Object]"){const s=i[Symbol.toStringTag];return s==null||!((e=Object.getOwnPropertyDescriptor(i,Symbol.toStringTag))!=null&&e.writable)?!1:i.toString()===`[object ${s}]`}let t=i;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(i)===t}function ye(i){if(it(i))return i;if(Array.isArray(i)||st(i)||i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);const t=Object.getPrototypeOf(i),e=t.constructor;if(i instanceof Date||i instanceof Map||i instanceof Set)return new e(i);if(i instanceof RegExp){const s=new e(i);return s.lastIndex=i.lastIndex,s}if(i instanceof DataView)return new e(i.buffer.slice(0));if(i instanceof Error){const s=new e(i.message);return s.stack=i.stack,s.name=i.name,s.cause=i.cause,s}if(typeof File<"u"&&i instanceof File)return new e([i],i.name,{type:i.type,lastModified:i.lastModified});if(typeof i=="object"){const s=Object.create(t);return Object.assign(s,i)}return i}function Ce(i,...t){const e=t.slice(0,-1),s=t[t.length-1];let n=i;for(let a=0;a<e.length;a++){const r=e[a];n=Z(n,r,s,new Map)}return n}function Z(i,t,e,s){if(it(i)&&(i=Object(i)),t==null||typeof t!="object")return i;if(s.has(t))return ye(s.get(t));if(s.set(t,i),Array.isArray(t)){t=t.slice();for(let a=0;a<t.length;a++)t[a]=t[a]??void 0}const n=[...Object.keys(t),...Nt(t)];for(let a=0;a<n.length;a++){const r=n[a];let o=t[r],c=i[r];if(pt(o)&&(o={...o}),pt(c)&&(c={...c}),typeof M<"u"&&M.isBuffer(o)&&(o=ht(o)),Array.isArray(o))if(typeof c=="object"&&c!=null){const l=[],h=Reflect.ownKeys(c);for(let w=0;w<h.length;w++){const d=h[w];l[d]=c[d]}c=l}else c=[];const u=e(c,o,r,i,t,s);u!=null?i[r]=u:Array.isArray(o)||ut(c)&&ut(o)?i[r]=Z(c,o,e,s):c==null&&be(o)?i[r]=Z({},o,e,s):c==null&&we(o)?i[r]=ht(o):(c===void 0||o!==void 0)&&(i[r]=o)}return i}function Ie(i,...t){return Ce(i,...t,Pe)}var Oe=Object.defineProperty,je=Object.defineProperties,He=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,dt=(i,t,e)=>t in i?Oe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,U=(i,t)=>{for(var e in t||(t={}))$e.call(t,e)&&dt(i,e,t[e]);if(lt)for(var e of lt(t))Ae.call(t,e)&&dt(i,e,t[e]);return i},Ee=(i,t)=>je(i,He(t));function f(i,t,e){var s;const n=B(i);return((s=t.rpcMap)==null?void 0:s[n.reference])||`${St}?chainId=${n.namespace}:${n.reference}&projectId=${e}`}function C(i){return i.includes(":")?i.split(":")[1]:i}function Ut(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Se(i,t){const e=Object.keys(t.namespaces).filter(n=>n.includes(i));if(!e.length)return[];const s=[];return e.forEach(n=>{const a=t.namespaces[n].accounts;s.push(...a)}),s}function ft(i){return Object.fromEntries(Object.entries(i).filter(([t,e])=>{var s,n;return((s=e==null?void 0:e.chains)==null?void 0:s.length)&&((n=e==null?void 0:e.chains)==null?void 0:n.length)>0}))}function k(i={},t={}){const e=ft(mt(i)),s=ft(mt(t));return Ie(e,s)}function mt(i){var t,e,s,n,a;const r={};if(!R(i))return r;for(const[o,c]of Object.entries(i)){const u=$t(o)?[o]:c.chains,l=c.methods||[],h=c.events||[],w=c.rpcMap||{},d=F(o);r[d]=Ee(U(U({},r[d]),c),{chains:z(u,(t=r[d])==null?void 0:t.chains),methods:z(l,(e=r[d])==null?void 0:e.methods),events:z(h,(s=r[d])==null?void 0:s.events)}),(R(w)||R(((n=r[d])==null?void 0:n.rpcMap)||{}))&&(r[d].rpcMap=U(U({},w),(a=r[d])==null?void 0:a.rpcMap))}return r}function vt(i){return i.includes(":")?i.split(":")[2]:i}function gt(i){const t={};for(const[e,s]of Object.entries(i)){const n=s.methods||[],a=s.events||[],r=s.accounts||[],o=$t(e)?[e]:s.chains?s.chains:Ut(s.accounts);t[e]={chains:o,methods:n,events:a,accounts:r}}return t}function G(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}function qe(i){try{const t=JSON.parse(i);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const kt={},p=i=>kt[i],V=(i,t)=>{kt[i]=t};var Ne=Object.defineProperty,Pt=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,wt=(i,t,e)=>t in i?Ne(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bt=(i,t)=>{for(var e in t||(t={}))De.call(t,e)&&wt(i,e,t[e]);if(Pt)for(var e of Pt(t))_e.call(t,e)&&wt(i,e,t[e]);return i};const yt="eip155",Fe=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],Re=i=>i&&i.startsWith("0x")?BigInt(i).toString(10):i,K=i=>i&&i.startsWith("0x")?i:`0x${BigInt(i).toString(16)}`,Ct=i=>Object.keys(i).filter(t=>Fe.includes(t)).reduce((t,e)=>(t[e]=xe(i[e]),t),{}),xe=i=>typeof i=="string"&&qe(i)?JSON.parse(i):i,Ue=(i,t,e)=>{const{sessionProperties:s={},scopedProperties:n={}}=i,a={};if(!R(n)&&!R(s))return;const r=Ct(s);for(const o of e){const c=Re(o);if(!c)continue;a[K(c)]=r;const u=n==null?void 0:n[`${yt}:${c}`];if(u){const l=u==null?void 0:u[`${yt}:${c}:${t}`];a[K(c)]=bt(bt({},a[K(c)]),Ct(l||u))}}for(const[o,c]of Object.entries(a))Object.keys(c).length===0&&delete a[o];return Object.keys(a).length>0?a:void 0};var ke=Object.defineProperty,Te=(i,t,e)=>t in i?ke(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>Te(i,t+"",e);let W;class rt{constructor(t){Me(this,"storage"),this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,e){return await this.storage.setItem(t,e)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return W||(W=new rt(t)),W}}var Be=Object.defineProperty,Le=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,It=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ot=(i,t,e)=>t in i?Be(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t)=>{for(var e in t||(t={}))ze.call(t,e)&&Ot(i,e,t[e]);if(It)for(var e of It(t))Ge.call(t,e)&&Ot(i,e,t[e]);return i},Ke=(i,t)=>Le(i,Je(t));async function We(i,t){const e=B(i.result.capabilities.caip345.caip2),s=i.result.capabilities.caip345.transactionHashes,n=await Promise.allSettled(s.map(h=>Ye(e.reference,h,t))),a=n.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);n.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const r=!a.length||a.some(h=>!h),o=a.every(h=>(h==null?void 0:h.status)==="0x1"),c=a.every(h=>(h==null?void 0:h.status)==="0x0"),u=a.some(h=>(h==null?void 0:h.status)==="0x0");let l;return r?l=100:o?l=200:c?l=500:u&&(l=600),{id:i.result.id,version:i.request.version,atomic:i.request.atomicRequired,chainId:i.request.chainId,capabilities:i.result.capabilities,receipts:a,status:l}}async function Ye(i,t,e){return await e(parseInt(i)).request(Et("eth_getTransactionReceipt",[t]))}async function Qe({sendCalls:i,storage:t}){const e=await t.getItem(_);await t.setItem(_,Ke(Ve({},e),{[i.result.id]:{request:i.request,result:i.result,expiry:Lt(Yt)}}))}async function Xe({resultId:i,storage:t}){const e=await t.getItem(_);if(e){delete e[i],await t.setItem(_,e);for(const s in e)At(e[s].expiry)&&delete e[s];await t.setItem(_,e)}}async function Ze({resultId:i,storage:t}){const e=await t.getItem(_),s=e==null?void 0:e[i];if(s&&!At(s.expiry))return s;await Xe({resultId:i,storage:t})}var ti=Object.defineProperty,ei=(i,t,e)=>t in i?ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,I=(i,t,e)=>ei(i,typeof t!="symbol"?t+"":t,e);class ii{constructor(t){I(this,"name","polkadot"),I(this,"client"),I(this,"httpProviders"),I(this,"events"),I(this,"namespace"),I(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var si=Object.defineProperty,ri=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,tt=(i,t,e)=>t in i?si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t)=>{for(var e in t||(t={}))ai.call(t,e)&&tt(i,e,t[e]);if(jt)for(var e of jt(t))oi.call(t,e)&&tt(i,e,t[e]);return i},Q=(i,t)=>ri(i,ni(t)),b=(i,t,e)=>tt(i,typeof t!="symbol"?t+"":t,e);class ci{constructor(t){b(this,"name","eip155"),b(this,"client"),b(this,"chainId"),b(this,"namespace"),b(this,"httpProviders"),b(this,"events"),b(this,"storage"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=rt.getStorage(this.client.core.storage)}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());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(v.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,e){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=parseInt(C(e));t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(t){const e=t||this.chainId;return this.httpProviders[e]||(this.httpProviders=Q(Y({},this.httpProviders),{[e]:this.createHttpProvider(e)}),this.httpProviders[e])}async handleSwitchChain(t){var e,s;let n=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:n}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,n,a,r;const o=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0],c=((a=(n=t.request)==null?void 0:n.params)==null?void 0:a[1])||[];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((r=u==null?void 0:u.sessionProperties)==null?void 0:r.capabilities)||{},h=`${o}${c.join(",")}`,w=l==null?void 0:l[h];if(w)return w;let d;try{d=Ue(u,o,c)}catch(L){console.warn("Failed to extract capabilities from session",L)}if(d)return d;const at=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:Q(Y({},u.sessionProperties||{}),{capabilities:Q(Y({},l||{}),{[h]:at})})})}catch(L){console.warn("Failed to update session with capabilities",L)}return at}async getCallStatus(t){var e,s,n;const a=this.client.session.get(t.topic),r=(e=a.sessionProperties)==null?void 0:e.bundler_name;if(r){const u=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(u,t)}catch(l){console.warn("Failed to fetch call status from bundler",l,u)}}const o=(s=a.sessionProperties)==null?void 0:s.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,o)}const c=await Ze({resultId:(n=t.request.params)==null?void 0:n[0],storage:this.storage});if(c)try{return await We(c,this.getHttpProvider.bind(this))}catch(u){console.warn("Failed to fetch call status from stored send calls",u,c)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var s;const n=new URL(t),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Et("eth_getUserOperationReceipt",[(s=e.request.params)==null?void 0:s[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(t,e){return`${Wt}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}async sendCalls(t){var e,s,n;const a=await this.client.request(t),r=(e=t.request.params)==null?void 0:e[0],o=a==null?void 0:a.id,c=(a==null?void 0:a.capabilities)||{},u=(s=c==null?void 0:c.caip345)==null?void 0:s.caip2,l=(n=c==null?void 0:c.caip345)==null?void 0:n.transactionHashes;return!o||!u||!(l!=null&&l.length)||await Qe({sendCalls:{request:r,result:a},storage:this.storage}),a}}var hi=Object.defineProperty,pi=(i,t,e)=>t in i?hi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t,e)=>pi(i,typeof t!="symbol"?t+"":t,e);class ui{constructor(t){O(this,"name","solana"),O(this,"client"),O(this,"httpProviders"),O(this,"events"),O(this,"namespace"),O(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var li=Object.defineProperty,di=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,j=(i,t,e)=>di(i,typeof t!="symbol"?t+"":t,e);class fi{constructor(t){j(this,"name","cosmos"),j(this,"client"),j(this,"httpProviders"),j(this,"events"),j(this,"namespace"),j(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var mi=Object.defineProperty,vi=(i,t,e)=>t in i?mi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,H=(i,t,e)=>vi(i,typeof t!="symbol"?t+"":t,e);class gi{constructor(t){H(this,"name","algorand"),H(this,"client"),H(this,"httpProviders"),H(this,"events"),H(this,"namespace"),H(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Pi=Object.defineProperty,wi=(i,t,e)=>t in i?Pi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$=(i,t,e)=>wi(i,typeof t!="symbol"?t+"":t,e);class bi{constructor(t){$(this,"name","cip34"),$(this,"client"),$(this,"httpProviders"),$(this,"events"),$(this,"namespace"),$(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),n=C(e);t[n]=this.createHttpProvider(n,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var yi=Object.defineProperty,Ci=(i,t,e)=>t in i?yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,A=(i,t,e)=>Ci(i,typeof t!="symbol"?t+"":t,e);class Ii{constructor(t){A(this,"name","elrond"),A(this,"client"),A(this,"httpProviders"),A(this,"events"),A(this,"namespace"),A(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Oi=Object.defineProperty,ji=(i,t,e)=>t in i?Oi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t,e)=>ji(i,typeof t!="symbol"?t+"":t,e);class Hi{constructor(t){E(this,"name","multiversx"),E(this,"client"),E(this,"httpProviders"),E(this,"events"),E(this,"namespace"),E(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var $i=Object.defineProperty,Ai=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t,e)=>Ai(i,typeof t!="symbol"?t+"":t,e);class Ei{constructor(t){S(this,"name","near"),S(this,"client"),S(this,"httpProviders"),S(this,"events"),S(this,"namespace"),S(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Si=Object.defineProperty,qi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,q=(i,t,e)=>qi(i,typeof t!="symbol"?t+"":t,e);class Ni{constructor(t){q(this,"name","tezos"),q(this,"client"),q(this,"httpProviders"),q(this,"events"),q(this,"namespace"),q(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{t[e]=this.createHttpProvider(e)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s))}}var Di=Object.defineProperty,_i=(i,t,e)=>t in i?Di(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,N=(i,t,e)=>_i(i,typeof t!="symbol"?t+"":t,e);class Fi{constructor(t){N(this,"name",qt),N(this,"client"),N(this,"httpProviders"),N(this,"events"),N(this,"namespace"),N(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return B(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(n=>{const a=B(n);s[a.reference]=this.createHttpProvider(n)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Ri=Object.defineProperty,xi=Object.defineProperties,Ui=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,ki=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,et=(i,t,e)=>t in i?Ri(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,T=(i,t)=>{for(var e in t||(t={}))ki.call(t,e)&&et(i,e,t[e]);if(Ht)for(var e of Ht(t))Ti.call(t,e)&&et(i,e,t[e]);return i},X=(i,t)=>xi(i,Ui(t)),m=(i,t,e)=>et(i,typeof t!="symbol"?t+"":t,e);class nt{constructor(t){m(this,"client"),m(this,"namespaces"),m(this,"optionalNamespaces"),m(this,"sessionProperties"),m(this,"scopedProperties"),m(this,"events",new zt),m(this,"rpcProviders",{}),m(this,"session"),m(this,"providerOpts"),m(this,"logger"),m(this,"uri"),m(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:Tt(Mt({level:(t==null?void 0:t.logger)||ct})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new nt(t);return await e.initialize(),e}async request(t,e,s){const[n,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:T({},t),chainId:`${n}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,n){const a=new Date().getTime();this.request(t,s,n).then(r=>e(null,Jt(a,r))).catch(r=>e(r,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,scopedProperties:this.scopedProperties}),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:ot("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:s,response:n}=await this.client.authenticate(t,e);s&&(this.uri=s,this.events.emit("display_uri",s));const a=await n();if(this.session=a.session,this.session){const r=gt(this.session.namespaces);this.namespaces=k(this.namespaces,r),await this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){const{uri:e,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});e&&(this.uri=e,this.events.emit("display_uri",e));const n=await s();this.session=n;const a=gt(n.namespaces);return this.namespaces=k(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,n]=this.validateChain(t);this.getProvider(s).setDefaultChain(n,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(!J(e))return;for(const s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}catch(e){this.logger.warn("Failed to cleanup pending pairings",e)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,e;if(this.client=this.providerOpts.client||await Bt.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ct,relayUrl:this.providerOpts.relayUrl||Gt,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(s){throw this.logger.error("Failed to get session",s),new Error(`The provided session: ${(e=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:e.topic} doesn't exist in the Sign client`)}else{const s=this.client.session.getAll();this.session=s[0]}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(e=>F(e)))];V("client",this.client),V("events",this.events),V("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=Se(e,this.session);if((s==null?void 0:s.length)===0)return;const n=Ut(s),a=k(this.namespaces,this.optionalNamespaces),r=X(T({},a[e]),{accounts:s,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new ci({namespace:r});break;case"algorand":this.rpcProviders[e]=new gi({namespace:r});break;case"solana":this.rpcProviders[e]=new ui({namespace:r});break;case"cosmos":this.rpcProviders[e]=new fi({namespace:r});break;case"polkadot":this.rpcProviders[e]=new ii({namespace:r});break;case"cip34":this.rpcProviders[e]=new bi({namespace:r});break;case"elrond":this.rpcProviders[e]=new Ii({namespace:r});break;case"multiversx":this.rpcProviders[e]=new Hi({namespace:r});break;case"near":this.rpcProviders[e]=new Ei({namespace:r});break;case"tezos":this.rpcProviders[e]=new Ni({namespace:r});break;default:this.rpcProviders[e]=new Fi({namespace:r})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var e;const{topic:s}=t;s===((e=this.session)==null?void 0:e.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var e;const{params:s,topic:n}=t;if(n!==((e=this.session)==null?void 0:e.topic))return;const{event:a}=s;if(a.name==="accountsChanged"){const r=a.data;r&&J(r)&&this.events.emit("accountsChanged",r.map(vt))}else if(a.name==="chainChanged"){const r=s.chainId,o=s.event.data,c=F(r),u=G(r)!==G(o)?`${c}:${G(o)}`:r;this.onChainChanged(u)}else this.events.emit(a.name,a.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s,n;if(t!==((s=this.session)==null?void 0:s.topic))return;const{namespaces:a}=e,r=(n=this.client)==null?void 0:n.session.get(t);this.session=X(T({},r),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{var e;t.topic===((e=this.session)==null?void 0:e.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",X(T({},ot("USER_DISCONNECTED")),{data:t.topic})))}),this.on(v.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[qt]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e={},optionalNamespaces:s={},sessionProperties:n,scopedProperties:a}=t;this.optionalNamespaces=k(e,s),this.sessionProperties=n,this.scopedProperties=a}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(r=>F(r)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const n=F(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,n]=this.validateChain(t);if(!n)return;this.updateNamespaceChain(s,n);const a=this.getProvider(s).getDefaultChain();e?(this.events.emit("chainChanged",n),this.emitAccountsChangedOnChainChange({namespace:s,previousChainId:a,newChainId:t})):this.getProvider(s).setDefaultChain(n),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:e,newChainId:s}){var n,a;try{if(e===s)return;const r=(a=(n=this.session)==null?void 0:n.namespaces[t])==null?void 0:a.accounts;if(!r)return;const o=r.filter(c=>c.includes(`${s}:`)).map(vt);if(!J(o))return;this.events.emit("accountsChanged",o)}catch(r){this.logger.warn("Failed to emit accountsChanged on chain change",r)}}updateNamespaceChain(t,e){if(!this.namespaces)return;const s=this.namespaces[t]?t:`${t}:${e}`,n={chains:[],methods:[],events:[],defaultChain:e};this.namespaces[s]?this.namespaces[s]&&(this.namespaces[s].defaultChain=e):this.namespaces[s]=n}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,e){var s;const n=((s=this.session)==null?void 0:s.topic)||"";await this.client.core.storage.setItem(`${x}/${t}${n}`,e)}async getFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";return await this.client.core.storage.getItem(`${x}/${t}${s}`)}async deleteFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";await this.client.core.storage.removeItem(`${x}/${t}${s}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const e=await this.client.core.storage.getKeys();for(const s of e)s.startsWith(x)&&await this.client.core.storage.removeItem(s)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}const Wi=nt;export{Wi as UniversalProvider,nt as default};
1
+ import{B as M}from"./ui-Bkpvk8Cf.js";import{B as Tt,q as Mt,K as ot,r as J,t as Bt,Y as F,P as $t,F as B,V as R,u as z,v as At,w as Lt}from"./wallets-mFIrGikY.js";import{f as Jt,o as g,a as Et}from"./index.es-BnzT8PVF.js";import{f as P}from"./index.es-P6lUA9Z2.js";import{d0 as zt}from"./index-DqCllZmU.js";import"./vendor-CoK8zP4N.js";import"./thirdweb-BICh3dVr.js";import"./ethereum-CU54uKiY.js";const ct="error",Gt="wss://relay.walletconnect.org",Vt="wc",Kt="universal_provider",x=`${Vt}@2:${Kt}:`,St="https://rpc.walletconnect.org/v1/",qt="generic",Wt=`${St}bundler`,_="call_status",Yt=86400,v={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function it(i){return i==null||typeof i!="object"&&typeof i!="function"}function Nt(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function Dt(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Qt="[object RegExp]",_t="[object String]",Ft="[object Number]",Rt="[object Boolean]",xt="[object Arguments]",Xt="[object Symbol]",Zt="[object Date]",te="[object Map]",ee="[object Set]",ie="[object Array]",se="[object ArrayBuffer]",re="[object Object]",ne="[object DataView]",ae="[object Uint8Array]",oe="[object Uint8ClampedArray]",ce="[object Uint16Array]",he="[object Uint32Array]",pe="[object Int8Array]",ue="[object Int16Array]",le="[object Int32Array]",de="[object Float32Array]",fe="[object Float64Array]";function st(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function me(i,t){return D(i,void 0,i,new Map,t)}function D(i,t,e,s=new Map,n=void 0){const a=n==null?void 0:n(i,t,e,s);if(a!=null)return a;if(it(i))return i;if(s.has(i))return s.get(i);if(Array.isArray(i)){const r=new Array(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return Object.hasOwn(i,"index")&&(r.index=i.index),Object.hasOwn(i,"input")&&(r.input=i.input),r}if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){const r=new RegExp(i.source,i.flags);return r.lastIndex=i.lastIndex,r}if(i instanceof Map){const r=new Map;s.set(i,r);for(const[o,c]of i)r.set(o,D(c,o,e,s,n));return r}if(i instanceof Set){const r=new Set;s.set(i,r);for(const o of i)r.add(D(o,void 0,e,s,n));return r}if(typeof M<"u"&&M.isBuffer(i))return i.subarray();if(st(i)){const r=new(Object.getPrototypeOf(i)).constructor(i.length);s.set(i,r);for(let o=0;o<i.length;o++)r[o]=D(i[o],o,e,s,n);return r}if(i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);if(i instanceof DataView){const r=new DataView(i.buffer.slice(0),i.byteOffset,i.byteLength);return s.set(i,r),y(r,i,e,s,n),r}if(typeof File<"u"&&i instanceof File){const r=new File([i],i.name,{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Blob){const r=new Blob([i],{type:i.type});return s.set(i,r),y(r,i,e,s,n),r}if(i instanceof Error){const r=new i.constructor;return s.set(i,r),r.message=i.message,r.name=i.name,r.stack=i.stack,r.cause=i.cause,y(r,i,e,s,n),r}if(typeof i=="object"&&ve(i)){const r=Object.create(Object.getPrototypeOf(i));return s.set(i,r),y(r,i,e,s,n),r}return i}function y(i,t,e=i,s,n){const a=[...Object.keys(t),...Nt(t)];for(let r=0;r<a.length;r++){const o=a[r],c=Object.getOwnPropertyDescriptor(i,o);(c==null||c.writable)&&(i[o]=D(t[o],o,e,s,n))}}function ve(i){switch(Dt(i)){case xt:case ie:case se:case ne:case Rt:case Zt:case de:case fe:case pe:case ue:case le:case te:case Ft:case re:case Qt:case ee:case _t:case Xt:case ae:case oe:case ce:case he:return!0;default:return!1}}function ge(i,t){return me(i,(e,s,n,a)=>{if(typeof i=="object")switch(Object.prototype.toString.call(i)){case Ft:case _t:case Rt:{const r=new i.constructor(i==null?void 0:i.valueOf());return y(r,i),r}case xt:{const r={};return y(r,i),r.length=i.length,r[Symbol.iterator]=i[Symbol.iterator],r}default:return}})}function ht(i){return ge(i)}function pt(i){return i!==null&&typeof i=="object"&&Dt(i)==="[object Arguments]"}function ut(i){return typeof i=="object"&&i!==null}function Pe(){}function we(i){return st(i)}function be(i){var e;if(typeof i!="object"||i==null)return!1;if(Object.getPrototypeOf(i)===null)return!0;if(Object.prototype.toString.call(i)!=="[object Object]"){const s=i[Symbol.toStringTag];return s==null||!((e=Object.getOwnPropertyDescriptor(i,Symbol.toStringTag))!=null&&e.writable)?!1:i.toString()===`[object ${s}]`}let t=i;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(i)===t}function ye(i){if(it(i))return i;if(Array.isArray(i)||st(i)||i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer)return i.slice(0);const t=Object.getPrototypeOf(i),e=t.constructor;if(i instanceof Date||i instanceof Map||i instanceof Set)return new e(i);if(i instanceof RegExp){const s=new e(i);return s.lastIndex=i.lastIndex,s}if(i instanceof DataView)return new e(i.buffer.slice(0));if(i instanceof Error){const s=new e(i.message);return s.stack=i.stack,s.name=i.name,s.cause=i.cause,s}if(typeof File<"u"&&i instanceof File)return new e([i],i.name,{type:i.type,lastModified:i.lastModified});if(typeof i=="object"){const s=Object.create(t);return Object.assign(s,i)}return i}function Ce(i,...t){const e=t.slice(0,-1),s=t[t.length-1];let n=i;for(let a=0;a<e.length;a++){const r=e[a];n=Z(n,r,s,new Map)}return n}function Z(i,t,e,s){if(it(i)&&(i=Object(i)),t==null||typeof t!="object")return i;if(s.has(t))return ye(s.get(t));if(s.set(t,i),Array.isArray(t)){t=t.slice();for(let a=0;a<t.length;a++)t[a]=t[a]??void 0}const n=[...Object.keys(t),...Nt(t)];for(let a=0;a<n.length;a++){const r=n[a];let o=t[r],c=i[r];if(pt(o)&&(o={...o}),pt(c)&&(c={...c}),typeof M<"u"&&M.isBuffer(o)&&(o=ht(o)),Array.isArray(o))if(typeof c=="object"&&c!=null){const l=[],h=Reflect.ownKeys(c);for(let w=0;w<h.length;w++){const d=h[w];l[d]=c[d]}c=l}else c=[];const u=e(c,o,r,i,t,s);u!=null?i[r]=u:Array.isArray(o)||ut(c)&&ut(o)?i[r]=Z(c,o,e,s):c==null&&be(o)?i[r]=Z({},o,e,s):c==null&&we(o)?i[r]=ht(o):(c===void 0||o!==void 0)&&(i[r]=o)}return i}function Ie(i,...t){return Ce(i,...t,Pe)}var Oe=Object.defineProperty,je=Object.defineProperties,He=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,dt=(i,t,e)=>t in i?Oe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,U=(i,t)=>{for(var e in t||(t={}))$e.call(t,e)&&dt(i,e,t[e]);if(lt)for(var e of lt(t))Ae.call(t,e)&&dt(i,e,t[e]);return i},Ee=(i,t)=>je(i,He(t));function f(i,t,e){var s;const n=B(i);return((s=t.rpcMap)==null?void 0:s[n.reference])||`${St}?chainId=${n.namespace}:${n.reference}&projectId=${e}`}function C(i){return i.includes(":")?i.split(":")[1]:i}function Ut(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function Se(i,t){const e=Object.keys(t.namespaces).filter(n=>n.includes(i));if(!e.length)return[];const s=[];return e.forEach(n=>{const a=t.namespaces[n].accounts;s.push(...a)}),s}function ft(i){return Object.fromEntries(Object.entries(i).filter(([t,e])=>{var s,n;return((s=e==null?void 0:e.chains)==null?void 0:s.length)&&((n=e==null?void 0:e.chains)==null?void 0:n.length)>0}))}function k(i={},t={}){const e=ft(mt(i)),s=ft(mt(t));return Ie(e,s)}function mt(i){var t,e,s,n,a;const r={};if(!R(i))return r;for(const[o,c]of Object.entries(i)){const u=$t(o)?[o]:c.chains,l=c.methods||[],h=c.events||[],w=c.rpcMap||{},d=F(o);r[d]=Ee(U(U({},r[d]),c),{chains:z(u,(t=r[d])==null?void 0:t.chains),methods:z(l,(e=r[d])==null?void 0:e.methods),events:z(h,(s=r[d])==null?void 0:s.events)}),(R(w)||R(((n=r[d])==null?void 0:n.rpcMap)||{}))&&(r[d].rpcMap=U(U({},w),(a=r[d])==null?void 0:a.rpcMap))}return r}function vt(i){return i.includes(":")?i.split(":")[2]:i}function gt(i){const t={};for(const[e,s]of Object.entries(i)){const n=s.methods||[],a=s.events||[],r=s.accounts||[],o=$t(e)?[e]:s.chains?s.chains:Ut(s.accounts);t[e]={chains:o,methods:n,events:a,accounts:r}}return t}function G(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}function qe(i){try{const t=JSON.parse(i);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const kt={},p=i=>kt[i],V=(i,t)=>{kt[i]=t};var Ne=Object.defineProperty,Pt=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,wt=(i,t,e)=>t in i?Ne(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bt=(i,t)=>{for(var e in t||(t={}))De.call(t,e)&&wt(i,e,t[e]);if(Pt)for(var e of Pt(t))_e.call(t,e)&&wt(i,e,t[e]);return i};const yt="eip155",Fe=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],Re=i=>i&&i.startsWith("0x")?BigInt(i).toString(10):i,K=i=>i&&i.startsWith("0x")?i:`0x${BigInt(i).toString(16)}`,Ct=i=>Object.keys(i).filter(t=>Fe.includes(t)).reduce((t,e)=>(t[e]=xe(i[e]),t),{}),xe=i=>typeof i=="string"&&qe(i)?JSON.parse(i):i,Ue=(i,t,e)=>{const{sessionProperties:s={},scopedProperties:n={}}=i,a={};if(!R(n)&&!R(s))return;const r=Ct(s);for(const o of e){const c=Re(o);if(!c)continue;a[K(c)]=r;const u=n==null?void 0:n[`${yt}:${c}`];if(u){const l=u==null?void 0:u[`${yt}:${c}:${t}`];a[K(c)]=bt(bt({},a[K(c)]),Ct(l||u))}}for(const[o,c]of Object.entries(a))Object.keys(c).length===0&&delete a[o];return Object.keys(a).length>0?a:void 0};var ke=Object.defineProperty,Te=(i,t,e)=>t in i?ke(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>Te(i,t+"",e);let W;class rt{constructor(t){Me(this,"storage"),this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,e){return await this.storage.setItem(t,e)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return W||(W=new rt(t)),W}}var Be=Object.defineProperty,Le=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,It=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ot=(i,t,e)=>t in i?Be(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t)=>{for(var e in t||(t={}))ze.call(t,e)&&Ot(i,e,t[e]);if(It)for(var e of It(t))Ge.call(t,e)&&Ot(i,e,t[e]);return i},Ke=(i,t)=>Le(i,Je(t));async function We(i,t){const e=B(i.result.capabilities.caip345.caip2),s=i.result.capabilities.caip345.transactionHashes,n=await Promise.allSettled(s.map(h=>Ye(e.reference,h,t))),a=n.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);n.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const r=!a.length||a.some(h=>!h),o=a.every(h=>(h==null?void 0:h.status)==="0x1"),c=a.every(h=>(h==null?void 0:h.status)==="0x0"),u=a.some(h=>(h==null?void 0:h.status)==="0x0");let l;return r?l=100:o?l=200:c?l=500:u&&(l=600),{id:i.result.id,version:i.request.version,atomic:i.request.atomicRequired,chainId:i.request.chainId,capabilities:i.result.capabilities,receipts:a,status:l}}async function Ye(i,t,e){return await e(parseInt(i)).request(Et("eth_getTransactionReceipt",[t]))}async function Qe({sendCalls:i,storage:t}){const e=await t.getItem(_);await t.setItem(_,Ke(Ve({},e),{[i.result.id]:{request:i.request,result:i.result,expiry:Lt(Yt)}}))}async function Xe({resultId:i,storage:t}){const e=await t.getItem(_);if(e){delete e[i],await t.setItem(_,e);for(const s in e)At(e[s].expiry)&&delete e[s];await t.setItem(_,e)}}async function Ze({resultId:i,storage:t}){const e=await t.getItem(_),s=e==null?void 0:e[i];if(s&&!At(s.expiry))return s;await Xe({resultId:i,storage:t})}var ti=Object.defineProperty,ei=(i,t,e)=>t in i?ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,I=(i,t,e)=>ei(i,typeof t!="symbol"?t+"":t,e);class ii{constructor(t){I(this,"name","polkadot"),I(this,"client"),I(this,"httpProviders"),I(this,"events"),I(this,"namespace"),I(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var si=Object.defineProperty,ri=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,tt=(i,t,e)=>t in i?si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Y=(i,t)=>{for(var e in t||(t={}))ai.call(t,e)&&tt(i,e,t[e]);if(jt)for(var e of jt(t))oi.call(t,e)&&tt(i,e,t[e]);return i},Q=(i,t)=>ri(i,ni(t)),b=(i,t,e)=>tt(i,typeof t!="symbol"?t+"":t,e);class ci{constructor(t){b(this,"name","eip155"),b(this,"client"),b(this,"chainId"),b(this,"namespace"),b(this,"httpProviders"),b(this,"events"),b(this,"storage"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=rt.getStorage(this.client.core.storage)}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());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(v.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,e){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=parseInt(C(e));t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(t){const e=t||this.chainId;return this.httpProviders[e]||(this.httpProviders=Q(Y({},this.httpProviders),{[e]:this.createHttpProvider(e)}),this.httpProviders[e])}async handleSwitchChain(t){var e,s;let n=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:n}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,n,a,r;const o=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0],c=((a=(n=t.request)==null?void 0:n.params)==null?void 0:a[1])||[];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((r=u==null?void 0:u.sessionProperties)==null?void 0:r.capabilities)||{},h=`${o}${c.join(",")}`,w=l==null?void 0:l[h];if(w)return w;let d;try{d=Ue(u,o,c)}catch(L){console.warn("Failed to extract capabilities from session",L)}if(d)return d;const at=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:Q(Y({},u.sessionProperties||{}),{capabilities:Q(Y({},l||{}),{[h]:at})})})}catch(L){console.warn("Failed to update session with capabilities",L)}return at}async getCallStatus(t){var e,s,n;const a=this.client.session.get(t.topic),r=(e=a.sessionProperties)==null?void 0:e.bundler_name;if(r){const u=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(u,t)}catch(l){console.warn("Failed to fetch call status from bundler",l,u)}}const o=(s=a.sessionProperties)==null?void 0:s.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,o)}const c=await Ze({resultId:(n=t.request.params)==null?void 0:n[0],storage:this.storage});if(c)try{return await We(c,this.getHttpProvider.bind(this))}catch(u){console.warn("Failed to fetch call status from stored send calls",u,c)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var s;const n=new URL(t),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Et("eth_getUserOperationReceipt",[(s=e.request.params)==null?void 0:s[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(t,e){return`${Wt}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}async sendCalls(t){var e,s,n;const a=await this.client.request(t),r=(e=t.request.params)==null?void 0:e[0],o=a==null?void 0:a.id,c=(a==null?void 0:a.capabilities)||{},u=(s=c==null?void 0:c.caip345)==null?void 0:s.caip2,l=(n=c==null?void 0:c.caip345)==null?void 0:n.transactionHashes;return!o||!u||!(l!=null&&l.length)||await Qe({sendCalls:{request:r,result:a},storage:this.storage}),a}}var hi=Object.defineProperty,pi=(i,t,e)=>t in i?hi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,O=(i,t,e)=>pi(i,typeof t!="symbol"?t+"":t,e);class ui{constructor(t){O(this,"name","solana"),O(this,"client"),O(this,"httpProviders"),O(this,"events"),O(this,"namespace"),O(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var li=Object.defineProperty,di=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,j=(i,t,e)=>di(i,typeof t!="symbol"?t+"":t,e);class fi{constructor(t){j(this,"name","cosmos"),j(this,"client"),j(this,"httpProviders"),j(this,"events"),j(this,"namespace"),j(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var mi=Object.defineProperty,vi=(i,t,e)=>t in i?mi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,H=(i,t,e)=>vi(i,typeof t!="symbol"?t+"":t,e);class gi{constructor(t){H(this,"name","algorand"),H(this,"client"),H(this,"httpProviders"),H(this,"events"),H(this,"namespace"),H(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Pi=Object.defineProperty,wi=(i,t,e)=>t in i?Pi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$=(i,t,e)=>wi(i,typeof t!="symbol"?t+"":t,e);class bi{constructor(t){$(this,"name","cip34"),$(this,"client"),$(this,"httpProviders"),$(this,"events"),$(this,"namespace"),$(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),n=C(e);t[n]=this.createHttpProvider(n,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var yi=Object.defineProperty,Ci=(i,t,e)=>t in i?yi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,A=(i,t,e)=>Ci(i,typeof t!="symbol"?t+"":t,e);class Ii{constructor(t){A(this,"name","elrond"),A(this,"client"),A(this,"httpProviders"),A(this,"events"),A(this,"namespace"),A(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Oi=Object.defineProperty,ji=(i,t,e)=>t in i?Oi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,E=(i,t,e)=>ji(i,typeof t!="symbol"?t+"":t,e);class Hi{constructor(t){E(this,"name","multiversx"),E(this,"client"),E(this,"httpProviders"),E(this,"events"),E(this,"namespace"),E(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const n=C(e);t[n]=this.createHttpProvider(n,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var $i=Object.defineProperty,Ai=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t,e)=>Ai(i,typeof t!="symbol"?t+"":t,e);class Ei{constructor(t){S(this,"name","near"),S(this,"client"),S(this,"httpProviders"),S(this,"events"),S(this,"namespace"),S(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s,p("disableProviderPing")))}}var Si=Object.defineProperty,qi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,q=(i,t,e)=>qi(i,typeof t!="symbol"?t+"":t,e);class Ni{constructor(t){q(this,"name","tezos"),q(this,"client"),q(this,"httpProviders"),q(this,"events"),q(this,"namespace"),q(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("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,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||f(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(v.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{t[e]=this.createHttpProvider(e)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace);return typeof s>"u"?void 0:new g(new P(s))}}var Di=Object.defineProperty,_i=(i,t,e)=>t in i?Di(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,N=(i,t,e)=>_i(i,typeof t!="symbol"?t+"":t,e);class Fi{constructor(t){N(this,"name",qt),N(this,"client"),N(this,"httpProviders"),N(this,"events"),N(this,"namespace"),N(this,"chainId"),this.namespace=t.namespace,this.events=p("events"),this.client=p("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(v.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]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return B(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(n=>{const a=B(n);s[a.reference]=this.createHttpProvider(n)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||f(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new g(new P(s,p("disableProviderPing")))}}var Ri=Object.defineProperty,xi=Object.defineProperties,Ui=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertySymbols,ki=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,et=(i,t,e)=>t in i?Ri(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,T=(i,t)=>{for(var e in t||(t={}))ki.call(t,e)&&et(i,e,t[e]);if(Ht)for(var e of Ht(t))Ti.call(t,e)&&et(i,e,t[e]);return i},X=(i,t)=>xi(i,Ui(t)),m=(i,t,e)=>et(i,typeof t!="symbol"?t+"":t,e);class nt{constructor(t){m(this,"client"),m(this,"namespaces"),m(this,"optionalNamespaces"),m(this,"sessionProperties"),m(this,"scopedProperties"),m(this,"events",new zt),m(this,"rpcProviders",{}),m(this,"session"),m(this,"providerOpts"),m(this,"logger"),m(this,"uri"),m(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:Tt(Mt({level:(t==null?void 0:t.logger)||ct})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new nt(t);return await e.initialize(),e}async request(t,e,s){const[n,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:T({},t),chainId:`${n}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,n){const a=new Date().getTime();this.request(t,s,n).then(r=>e(null,Jt(a,r))).catch(r=>e(r,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,scopedProperties:this.scopedProperties}),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:ot("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:s,response:n}=await this.client.authenticate(t,e);s&&(this.uri=s,this.events.emit("display_uri",s));const a=await n();if(this.session=a.session,this.session){const r=gt(this.session.namespaces);this.namespaces=k(this.namespaces,r),await this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){const{uri:e,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});e&&(this.uri=e,this.events.emit("display_uri",e));const n=await s();this.session=n;const a=gt(n.namespaces);return this.namespaces=k(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,n]=this.validateChain(t);this.getProvider(s).setDefaultChain(n,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(!J(e))return;for(const s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}catch(e){this.logger.warn("Failed to cleanup pending pairings",e)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,e;if(this.client=this.providerOpts.client||await Bt.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ct,relayUrl:this.providerOpts.relayUrl||Gt,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(s){throw this.logger.error("Failed to get session",s),new Error(`The provided session: ${(e=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:e.topic} doesn't exist in the Sign client`)}else{const s=this.client.session.getAll();this.session=s[0]}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(e=>F(e)))];V("client",this.client),V("events",this.events),V("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=Se(e,this.session);if((s==null?void 0:s.length)===0)return;const n=Ut(s),a=k(this.namespaces,this.optionalNamespaces),r=X(T({},a[e]),{accounts:s,chains:n});switch(e){case"eip155":this.rpcProviders[e]=new ci({namespace:r});break;case"algorand":this.rpcProviders[e]=new gi({namespace:r});break;case"solana":this.rpcProviders[e]=new ui({namespace:r});break;case"cosmos":this.rpcProviders[e]=new fi({namespace:r});break;case"polkadot":this.rpcProviders[e]=new ii({namespace:r});break;case"cip34":this.rpcProviders[e]=new bi({namespace:r});break;case"elrond":this.rpcProviders[e]=new Ii({namespace:r});break;case"multiversx":this.rpcProviders[e]=new Hi({namespace:r});break;case"near":this.rpcProviders[e]=new Ei({namespace:r});break;case"tezos":this.rpcProviders[e]=new Ni({namespace:r});break;default:this.rpcProviders[e]=new Fi({namespace:r})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var e;const{topic:s}=t;s===((e=this.session)==null?void 0:e.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var e;const{params:s,topic:n}=t;if(n!==((e=this.session)==null?void 0:e.topic))return;const{event:a}=s;if(a.name==="accountsChanged"){const r=a.data;r&&J(r)&&this.events.emit("accountsChanged",r.map(vt))}else if(a.name==="chainChanged"){const r=s.chainId,o=s.event.data,c=F(r),u=G(r)!==G(o)?`${c}:${G(o)}`:r;this.onChainChanged(u)}else this.events.emit(a.name,a.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s,n;if(t!==((s=this.session)==null?void 0:s.topic))return;const{namespaces:a}=e,r=(n=this.client)==null?void 0:n.session.get(t);this.session=X(T({},r),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{var e;t.topic===((e=this.session)==null?void 0:e.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",X(T({},ot("USER_DISCONNECTED")),{data:t.topic})))}),this.on(v.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[qt]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e={},optionalNamespaces:s={},sessionProperties:n,scopedProperties:a}=t;this.optionalNamespaces=k(e,s),this.sessionProperties=n,this.scopedProperties=a}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(r=>F(r)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const n=F(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,n]=this.validateChain(t);if(!n)return;this.updateNamespaceChain(s,n);const a=this.getProvider(s).getDefaultChain();e?(this.events.emit("chainChanged",n),this.emitAccountsChangedOnChainChange({namespace:s,previousChainId:a,newChainId:t})):this.getProvider(s).setDefaultChain(n),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:e,newChainId:s}){var n,a;try{if(e===s)return;const r=(a=(n=this.session)==null?void 0:n.namespaces[t])==null?void 0:a.accounts;if(!r)return;const o=r.filter(c=>c.includes(`${s}:`)).map(vt);if(!J(o))return;this.events.emit("accountsChanged",o)}catch(r){this.logger.warn("Failed to emit accountsChanged on chain change",r)}}updateNamespaceChain(t,e){if(!this.namespaces)return;const s=this.namespaces[t]?t:`${t}:${e}`,n={chains:[],methods:[],events:[],defaultChain:e};this.namespaces[s]?this.namespaces[s]&&(this.namespaces[s].defaultChain=e):this.namespaces[s]=n}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,e){var s;const n=((s=this.session)==null?void 0:s.topic)||"";await this.client.core.storage.setItem(`${x}/${t}${n}`,e)}async getFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";return await this.client.core.storage.getItem(`${x}/${t}${s}`)}async deleteFromStore(t){var e;const s=((e=this.session)==null?void 0:e.topic)||"";await this.client.core.storage.removeItem(`${x}/${t}${s}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const e=await this.client.core.storage.getKeys();for(const s of e)s.startsWith(x)&&await this.client.core.storage.removeItem(s)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}const Wi=nt;export{Wi as UniversalProvider,nt as default};
@@ -1,4 +1,4 @@
1
- import{d6 as Ot}from"./index-Cr12aXcp.js";import{a as Yr,p as le,c as be}from"./thirdweb-BVDpE57w.js";import{g as Se}from"./ui-DpaWI-pw.js";var Ge,Zt;function Cf(){if(Zt)return Ge;Zt=1;function t(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}Ge=e;function e(r,n,i){var o=i&&i.stringify||t,s=1;if(typeof r=="object"&&r!==null){var a=n.length+s;if(a===1)return r;var u=new Array(a);u[0]=o(r);for(var c=1;c<a;c++)u[c]=o(n[c]);return u.join(" ")}if(typeof r!="string")return r;var f=n.length;if(f===0)return r;for(var w="",b=1-s,D=-1,h=r&&r.length||0,d=0;d<h;){if(r.charCodeAt(d)===37&&d+1<h){switch(D=D>-1?D:0,r.charCodeAt(d+1)){case 100:case 102:if(b>=f||n[b]==null)break;D<d&&(w+=r.slice(D,d)),w+=Number(n[b]),D=d+2,d++;break;case 105:if(b>=f||n[b]==null)break;D<d&&(w+=r.slice(D,d)),w+=Math.floor(Number(n[b])),D=d+2,d++;break;case 79:case 111:case 106:if(b>=f||n[b]===void 0)break;D<d&&(w+=r.slice(D,d));var g=typeof n[b];if(g==="string"){w+="'"+n[b]+"'",D=d+2,d++;break}if(g==="function"){w+=n[b].name||"<anonymous>",D=d+2,d++;break}w+=o(n[b]),D=d+2,d++;break;case 115:if(b>=f)break;D<d&&(w+=r.slice(D,d)),w+=String(n[b]),D=d+2,d++;break;case 37:D<d&&(w+=r.slice(D,d)),w+="%",D=d+2,d++,b--;break}++b}++d}return D===-1?r:(D<h&&(w+=r.slice(D)),w)}return Ge}const ni=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),ii=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Gr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ii(t)}catch{return t}}function Jr(t){return typeof t=="string"?t:ni(t)||""}var Je={};/*! *****************************************************************************
1
+ import{d6 as Ot}from"./index-DqCllZmU.js";import{a as Yr,p as le,c as be}from"./thirdweb-BICh3dVr.js";import{g as Se}from"./ui-Bkpvk8Cf.js";var Ge,Zt;function Cf(){if(Zt)return Ge;Zt=1;function t(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}Ge=e;function e(r,n,i){var o=i&&i.stringify||t,s=1;if(typeof r=="object"&&r!==null){var a=n.length+s;if(a===1)return r;var u=new Array(a);u[0]=o(r);for(var c=1;c<a;c++)u[c]=o(n[c]);return u.join(" ")}if(typeof r!="string")return r;var f=n.length;if(f===0)return r;for(var w="",b=1-s,D=-1,h=r&&r.length||0,d=0;d<h;){if(r.charCodeAt(d)===37&&d+1<h){switch(D=D>-1?D:0,r.charCodeAt(d+1)){case 100:case 102:if(b>=f||n[b]==null)break;D<d&&(w+=r.slice(D,d)),w+=Number(n[b]),D=d+2,d++;break;case 105:if(b>=f||n[b]==null)break;D<d&&(w+=r.slice(D,d)),w+=Math.floor(Number(n[b])),D=d+2,d++;break;case 79:case 111:case 106:if(b>=f||n[b]===void 0)break;D<d&&(w+=r.slice(D,d));var g=typeof n[b];if(g==="string"){w+="'"+n[b]+"'",D=d+2,d++;break}if(g==="function"){w+=n[b].name||"<anonymous>",D=d+2,d++;break}w+=o(n[b]),D=d+2,d++;break;case 115:if(b>=f)break;D<d&&(w+=r.slice(D,d)),w+=String(n[b]),D=d+2,d++;break;case 37:D<d&&(w+=r.slice(D,d)),w+="%",D=d+2,d++,b--;break}++b}++d}return D===-1?r:(D<h&&(w+=r.slice(D)),w)}return Ge}const ni=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),ii=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Gr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ii(t)}catch{return t}}function Jr(t){return typeof t=="string"?t:ni(t)||""}var Je={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- import{d5 as d,d6 as u}from"./index-Cr12aXcp.js";import{g as y}from"./thirdweb-BVDpE57w.js";import{i as o,s as a,b,c as m,p as P}from"./index.es-oerS1AwE.js";var w=d();const l=y(w);var E=Object.defineProperty,O=Object.defineProperties,j=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,c=(s,e,t)=>e in s?E(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,p=(s,e)=>{for(var t in e||(e={}))L.call(e,t)&&c(s,t,e[t]);if(h)for(var t of h(e))x.call(e,t)&&c(s,t,e[t]);return s},v=(s,e)=>O(s,j(e));const T={Accept:"application/json","Content-Type":"application/json"},C="POST",f={headers:T,method:C},g=10;class S{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new u.EventEmitter,this.isAvailable=!1,this.registering=!1,!o(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=a(e),r=await(await l(this.url,v(p({},f),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!o(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((r,i)=>{this.events.once("register_error",n=>{this.resetMaxListeners(),i(n)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));r()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=a({id:1,jsonrpc:"2.0",method:"test",params:[]});await l(e,v(p({},f),{body:t}))}this.onOpen()}catch(t){const r=this.parseError(t);throw this.events.emit("register_error",r),this.onClose(),r}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?b(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const r=this.parseError(t),i=r.message||r.toString(),n=m(e,i);this.events.emit("payload",n)}parseError(e,t=this.url){return P(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g&&this.events.setMaxListeners(g)}}export{S as f};
1
+ import{d5 as d,d6 as u}from"./index-DqCllZmU.js";import{g as y}from"./thirdweb-BICh3dVr.js";import{i as o,s as a,b,c as m,p as P}from"./index.es-BnzT8PVF.js";var w=d();const l=y(w);var E=Object.defineProperty,O=Object.defineProperties,j=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,c=(s,e,t)=>e in s?E(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,p=(s,e)=>{for(var t in e||(e={}))L.call(e,t)&&c(s,t,e[t]);if(h)for(var t of h(e))x.call(e,t)&&c(s,t,e[t]);return s},v=(s,e)=>O(s,j(e));const T={Accept:"application/json","Content-Type":"application/json"},C="POST",f={headers:T,method:C},g=10;class S{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new u.EventEmitter,this.isAvailable=!1,this.registering=!1,!o(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=a(e),r=await(await l(this.url,v(p({},f),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!o(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((r,i)=>{this.events.once("register_error",n=>{this.resetMaxListeners(),i(n)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));r()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=a({id:1,jsonrpc:"2.0",method:"test",params:[]});await l(e,v(p({},f),{body:t}))}this.onOpen()}catch(t){const r=this.parseError(t);throw this.events.emit("register_error",r),this.onClose(),r}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?b(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const r=this.parseError(t),i=r.message||r.toString(),n=m(e,i);this.events.emit("payload",n)}parseError(e,t=this.url){return P(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g&&this.events.setMaxListeners(g)}}export{S as f};
@@ -1 +1 @@
1
- import{g as e}from"./ui-DpaWI-pw.js";import"./vendor-DeraAStG.js";import"./thirdweb-BVDpE57w.js";function t(){if(typeof WebSocket<"u")return WebSocket;if(typeof e.WebSocket<"u")return e.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const r=t();export{r as WebSocket};
1
+ import{g as e}from"./ui-Bkpvk8Cf.js";import"./vendor-CoK8zP4N.js";import"./thirdweb-BICh3dVr.js";function t(){if(typeof WebSocket<"u")return WebSocket;if(typeof e.WebSocket<"u")return e.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const r=t();export{r as WebSocket};