@wormhole-foundation/wormhole-connect 1.2.0-beta.0-development → 1.2.0

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 (82) hide show
  1. package/dist/assets/{ccip-DLVsVRZh.js → ccip-BOiV2uPM.js} +1 -1
  2. package/dist/assets/{evm-D7r3Ne49.js → evm-Dnr_4ZyM.js} +4 -4
  3. package/dist/assets/{index-5UpuI6jk.js → index-BzFCF-BP.js} +1 -1
  4. package/dist/assets/index-CLn3_NvB.js +2 -0
  5. package/dist/assets/{index.es-wOiA40sy.js → index.es-CMEJAwgo.js} +2 -2
  6. package/dist/main.js +3 -3
  7. package/lib/{aptos-BZuWMk3D.mjs → aptos-A7VVhV0v.mjs} +2 -2
  8. package/lib/{aptos-DcCwQMe7.js → aptos-BYnnjBjc.js} +2 -2
  9. package/lib/{aptos-DL1Hgg15.js → aptos-Bbo_sKqo.js} +1 -1
  10. package/lib/{aptos-2J8A-FZO.mjs → aptos-C_1y990s.mjs} +4 -4
  11. package/lib/{base64-Bit1A1if.js → base64-StaIc30r.js} +1 -1
  12. package/lib/{base64-BdSgqiJl.mjs → base64-a8hDslFH.mjs} +1 -1
  13. package/lib/{ccip-CMkUITDS.js → ccip-DIWd5CoD.js} +1 -1
  14. package/lib/{ccip-Cw8-T0j-.mjs → ccip-DhPBsU_B.mjs} +1 -1
  15. package/lib/{chunk-U2PRGW4O-CMIP41vB.mjs → chunk-U2PRGW4O-BuiGeu1u.mjs} +3 -3
  16. package/lib/{chunk-U2PRGW4O-CuEEOygo.js → chunk-U2PRGW4O-CWRFrwIM.js} +1 -1
  17. package/lib/{events-CpDIhB3C.mjs → events-Dz983PDv.mjs} +1 -1
  18. package/lib/{events-Bs7CEKn9.js → events-XGG02Ffv.js} +1 -1
  19. package/lib/{evm-1S_EvV1A.mjs → evm-Bh7GDRTT.mjs} +7 -7
  20. package/lib/{evm-D5NO24dh.js → evm-C8aUhPm9.js} +4 -4
  21. package/lib/{evm-DfX7cWQI.mjs → evm-Cp51KdvE.mjs} +5 -5
  22. package/lib/{evm-CK7UNFtq.js → evm-I2pf-HHY.js} +1 -1
  23. package/lib/{index-B96enquk.js → index---cHrxAO.js} +1 -1
  24. package/lib/{index-7Jgokx3S.js → index--WgS5tOK.js} +1 -1
  25. package/lib/{index-B-ZKCWaX.js → index-B1hBPUe6.js} +1 -1
  26. package/lib/{index-Bm1zXhFz.mjs → index-B65iKhSQ.mjs} +1 -1
  27. package/lib/{index-BzHjroj_.mjs → index-BGaqV_8O.mjs} +2 -2
  28. package/lib/{index-DKZeU-Xf.js → index-BH7q5v7m.js} +1 -1
  29. package/lib/{index-CXWWVJUC.js → index-BJKQ3MzX.js} +1 -1
  30. package/lib/{index-Q-iWWETw.mjs → index-BKH4K_0G.mjs} +2 -2
  31. package/lib/{index-BfBNSTY8.js → index-BQ6yGDA5.js} +1 -1
  32. package/lib/{index-C8__BuqK.mjs → index-BYuIyEnj.mjs} +1 -1
  33. package/lib/index-Be3OOifD.js +1 -0
  34. package/lib/{index-hk3iRhUd.mjs → index-BfuuKhzx.mjs} +4 -4
  35. package/lib/{index-CqfWDHV0.mjs → index-BgSnaWNu.mjs} +2 -2
  36. package/lib/{index-o0AEhklr.mjs → index-BiV20bWU.mjs} +2 -2
  37. package/lib/{index-hIJ0h_GZ.js → index-BkwW7sVl.js} +2 -2
  38. package/lib/{index-BXPqhxjc.js → index-BmnZ5fCq.js} +1 -1
  39. package/lib/{index-DbiW1-3L.mjs → index-BnIib66d.mjs} +1 -1
  40. package/lib/{index-8nlb2LGX.js → index-Bq6gyFEW.js} +1 -1
  41. package/lib/{index-B-UHVwW1.mjs → index-BulF4aYg.mjs} +2 -2
  42. package/lib/{index-BPtbGGHy.mjs → index-BvBSOS3S.mjs} +3 -3
  43. package/lib/{index-D_BTWvYp.mjs → index-BvTMu8c7.mjs} +2 -2
  44. package/lib/{index-D2Bw_LRJ.js → index-Bw-LFXds.js} +1 -1
  45. package/lib/{index-v3UQ6KEC.js → index-C-doWE_9.js} +1 -1
  46. package/lib/{index-C42d1PS9.js → index-CCljZ_lj.js} +1 -1
  47. package/lib/{index-Bq2G38s-.js → index-CGldT2Pu.js} +1 -1
  48. package/lib/{index-CbJWXG7l.mjs → index-CP6rlk6M.mjs} +2 -2
  49. package/lib/{index-Cqiy61ub.mjs → index-DAgJZWkt.mjs} +1 -1
  50. package/lib/{index-TVlE0v9D.js → index-DAxtlqpX.js} +1 -1
  51. package/lib/{index-D5xkWCZ3.mjs → index-DFqEZ0mm.mjs} +2 -2
  52. package/lib/{index-BNn38QYa.mjs → index-DNKLw-AP.mjs} +2 -2
  53. package/lib/{index-BDbrAqgW.mjs → index-DT-fcx_5.mjs} +1 -1
  54. package/lib/{index-CwNerYWM.js → index-DUglf3li.js} +1 -1
  55. package/lib/{index-wW7H3ciQ.mjs → index-HPZ-1CuH.mjs} +2 -2
  56. package/lib/{index-C6iaLaJq.mjs → index-VnCbpsUO.mjs} +15 -15
  57. package/lib/{index-vWXFBAHR.js → index-__Yey1yr.js} +1 -1
  58. package/lib/{index-7_XTrYay.js → index-ojJjsxFz.js} +1 -1
  59. package/lib/{index-DhxGcoTC.mjs → index-u7VSFFUI.mjs} +5 -5
  60. package/lib/{index-S1YybQMR.js → index-y9iU2q7j.js} +1 -1
  61. package/lib/{index.es-BnuWmVuS.mjs → index.es-BUeJCwsI.mjs} +5 -5
  62. package/lib/{index.es-DN28d137.js → index.es-GO3ktYpJ.js} +2 -2
  63. package/lib/index.js +1 -1
  64. package/lib/index.mjs +1 -1
  65. package/lib/{signer-YETmMcF8.js → signer-BCBltKYs.js} +1 -1
  66. package/lib/{signer-D5i4Nnyi.mjs → signer-OSsMsdDE.mjs} +1 -1
  67. package/lib/solana-3TnrZZQS.js +1 -0
  68. package/lib/{solana-DtBRFbad.mjs → solana-BCM3ZFY6.mjs} +4 -4
  69. package/lib/{solana-tevnHUxv.mjs → solana-C6737uHL.mjs} +5 -5
  70. package/lib/{solana-C7qBFXj3.js → solana-pMafkwtu.js} +1 -1
  71. package/lib/{solanaEmbed.esm-Bb5iLp3o.mjs → solanaEmbed.esm-BH_QMaNU.mjs} +2 -2
  72. package/lib/{solanaEmbed.esm-BER_HE9G.js → solanaEmbed.esm-DjXfyF5k.js} +1 -1
  73. package/lib/{sui-c1d9xieM.js → sui-BOInCXLd.js} +2 -2
  74. package/lib/{sui-DAyysPh2.mjs → sui-CFiY7cJ1.mjs} +5 -5
  75. package/lib/{sui-1QFb30Ta.mjs → sui-YN64mBRE.mjs} +1 -1
  76. package/lib/{sui-De3Fl_fo.js → sui-q1v-SeMl.js} +1 -1
  77. package/lib/{utf8-B-nUZvyF.js → utf8-D0Z0M4Kf.js} +1 -1
  78. package/lib/{utf8-BxTDE5Vo.mjs → utf8-RB5Z2Dys.mjs} +1 -1
  79. package/package.json +1 -1
  80. package/dist/assets/index-C0ho2skw.js +0 -2
  81. package/lib/index-CqSLXgKG.js +0 -1
  82. package/lib/solana-B9GQ_Umb.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const ct=require("./index-hIJ0h_GZ.js"),Dt=require("./index-vWXFBAHR.js");function Dr(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Br(t,r){r||(r=t.reduce((o,b)=>o+b.length,0));const n=Dr(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const wr={...Dt.identityBase,...Dt.base2,...Dt.base8,...Dt.base10,...Dt.base16,...Dt.base32,...Dt.base36,...Dt.base58,...Dt.base64,...Dt.base256emoji};function Kr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const vr=Kr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ye=Kr("ascii","a",t=>{let r="a";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r},t=>{t=t.substring(1);const r=Dr(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Ur={utf8:vr,"utf-8":vr,hex:wr.base16,latin1:Ye,ascii:Ye,binary:Ye,...wr};function he(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):n.decoder.decode(`${n.prefix}${t}`)}function Le(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}const kn={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},Xn=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,qn=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Yn=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Zn(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){Qn(t);return}return r}function Qn(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Be(t,r={}){if(typeof t!="string")return t;const n=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return n.slice(1,-1);if(n.length<=9){const c=n.toLowerCase();if(c==="true")return!0;if(c==="false")return!1;if(c==="undefined")return;if(c==="null")return null;if(c==="nan")return Number.NaN;if(c==="infinity")return Number.POSITIVE_INFINITY;if(c==="-infinity")return Number.NEGATIVE_INFINITY}if(!Yn.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Xn.test(t)||qn.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,Zn)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function ti(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tt(t,...r){try{return ti(t(...r))}catch(n){return Promise.reject(n)}}function ei(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function ri(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function He(t){if(ei(t))return String(t);if(ri(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return He(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const er="base64:";function ni(t){return typeof t=="string"?t:er+oi(t)}function ii(t){return typeof t!="string"||!t.startsWith(er)?t:si(t.slice(er.length))}function si(t){return globalThis.Buffer?ct.dist.Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),r=>r.codePointAt(0))}function oi(t){return globalThis.Buffer?ct.dist.Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ut(t){var r;return t&&((r=t.split("?")[0])==null?void 0:r.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function ai(...t){return Ut(t.join(":"))}function Ke(t){return t=Ut(t),t?t+":":""}const fi="memory",ci=()=>{const t=new Map;return{name:fi,getInstance:()=>t,hasItem(r){return t.has(r)},getItem(r){return t.get(r)??null},getItemRaw(r){return t.get(r)??null},setItem(r,n){t.set(r,n)},setItemRaw(r,n){t.set(r,n)},removeItem(r){t.delete(r)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function ui(t={}){const r={mounts:{"":t.driver||ci()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=s=>{for(const u of r.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:r.mounts[u]};return{base:"",relativeKey:s,driver:r.mounts[""]}},c=(s,u)=>r.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:r.mounts[y]})),o=(s,u)=>{if(r.watching){u=Ut(u);for(const y of r.watchListeners)y(s,u)}},b=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await Er(r.mounts[s],o,s)}},I=async()=>{if(r.watching){for(const s in r.unwatch)await r.unwatch[s]();r.unwatch={},r.watching=!1}},E=(s,u,y)=>{const v=new Map,w=x=>{let N=v.get(x.base);return N||(N={driver:x.driver,base:x.base,items:[]},v.set(x.base,N)),N};for(const x of s){const N=typeof x=="string",G=Ut(N?x:x.key),ut=N?void 0:x.value,M=N||!x.options?u:{...u,...x.options},Lt=n(G);w(Lt).items.push({key:G,value:ut,relativeKey:Lt.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.hasItem,y,u)},getItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.getItem,y,u).then(w=>Be(w))},getItems(s,u={}){return E(s,u,y=>y.driver.getItems?Tt(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:ai(y.base,w.key),value:Be(w.value)}))):Promise.all(y.items.map(v=>Tt(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:Be(w)})))))},getItemRaw(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Tt(v.getItemRaw,y,u):Tt(v.getItem,y,u).then(w=>ii(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Ut(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Tt(w.setItem,v,He(u),y),w.watch||o("update",s))},async setItems(s,u){await E(s,u,async y=>{if(y.driver.setItems)return Tt(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:He(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Tt(y.driver.setItem,v.relativeKey,He(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Ut(s);const{relativeKey:v,driver:w}=n(s);if(w.setItemRaw)await Tt(w.setItemRaw,v,u,y);else if(w.setItem)await Tt(w.setItem,v,ni(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s);v.removeItem&&(await Tt(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Tt(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Tt(v.getMeta,y,u)),!u.nativeOnly){const x=await Tt(v.getItem,y+"$",u).then(N=>Be(N));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=Ke(s);const y=c(s,!0);let v=[];const w=[];for(const x of y){const N=await Tt(x.driver.getKeys,x.relativeBase,u);for(const G of N){const ut=x.mountpoint+Ut(G);v.some(M=>ut.startsWith(M))||w.push(ut)}v=[x.mountpoint,...v.filter(G=>!G.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=Ke(s),await Promise.all(c(s,!1).map(async y=>{if(y.driver.clear)return Tt(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(s=>Ir(s)))},async watch(s){return await b(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await I()}},async unwatch(){r.watchListeners=[],await I()},mount(s,u){if(s=Ke(s),s&&r.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(r.mountpoints.push(s),r.mountpoints.sort((y,v)=>v.length-y.length)),r.mounts[s]=u,r.watching&&Promise.resolve(Er(u,o,s)).then(y=>{r.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){var y,v;s=Ke(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&((v=(y=r.unwatch)[s])==null||v.call(y),delete r.unwatch[s]),u&&await Ir(r.mounts[s]),r.mountpoints=r.mountpoints.filter(w=>w!==s),delete r.mounts[s])},getMount(s=""){s=Ut(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Ut(s),c(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function Er(t,r,n){return t.watch?t.watch((c,o)=>r(c,n+o)):()=>{}}async function Ir(t){typeof t.dispose=="function"&&await Tt(t.dispose)}function be(t){return new Promise((r,n)=>{t.oncomplete=t.onsuccess=()=>r(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Hr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=be(n);return(o,b)=>c.then(I=>b(I.transaction(r,o).objectStore(r)))}let Ze;function Ae(){return Ze||(Ze=Hr("keyval-store","keyval")),Ze}function Sr(t,r=Ae()){return r("readonly",n=>be(n.get(t)))}function li(t,r,n=Ae()){return n("readwrite",c=>(c.put(r,t),be(c.transaction)))}function di(t,r=Ae()){return r("readwrite",n=>(n.delete(t),be(n.transaction)))}function hi(t=Ae()){return t("readwrite",r=>(r.clear(),be(r.transaction)))}function bi(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},be(t.transaction)}function gi(t=Ae()){return t("readonly",r=>{if(r.getAllKeys)return be(r.getAllKeys());const n=[];return bi(r,c=>n.push(c.key)).then(()=>n)})}const yi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),_i=t=>{const r=/([\[:])?(\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,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Gr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return _i(t)}catch{return t}}function $r(t){return typeof t=="string"?t:yi(t)||""}const pi="idb-keyval";var mi=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Hr(t.dbName,t.storeName)),{name:pi,options:t,async hasItem(o){return!(typeof await Sr(n(o),c)>"u")},async getItem(o){return await Sr(n(o),c)??null},setItem(o,b){return li(n(o),b,c)},removeItem(o){return di(n(o),c)},getKeys(){return gi(c)},clear(){return hi(c)}}};const xi="WALLET_CONNECT_V2_INDEXED_DB",wi="keyvaluestorage";let vi=class{constructor(){this.indexedDb=ui({driver:mi({dbName:xi,storeName:wi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const n=await this.indexedDb.getItem(r);if(n!==null)return n}async setItem(r,n){await this.indexedDb.setItem(r,$r(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof ct.dist.global<"u"?ct.dist.global:typeof self<"u"?self:{},Ge={exports:{}};(function(){let t;function r(){}t=r,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,c){this[n]=String(c)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(c){n[c]=void 0,delete n[c]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qe<"u"&&Qe.localStorage?Ge.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?Ge.exports=window.localStorage:Ge.exports=new r})();function Ei(t){var r;return[t[0],Gr((r=t[1])!=null?r:"")]}class Ii{constructor(){this.localStorage=Ge.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ei)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return Gr(n)}async setItem(r,n){this.localStorage.setItem(r,$r(n))}async removeItem(r){this.localStorage.removeItem(r)}}const Si="wc_storage_version",Or=1,Oi=async(t,r,n)=>{const c=Si,o=await r.getItem(c);if(o&&o>=Or){n(r);return}const b=await t.getKeys();if(!b.length){n(r);return}const I=[];for(;b.length;){const E=b.shift();if(!E)continue;const g=E.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await t.getItem(E);await r.setItem(E,s),I.push(E)}}await r.setItem(c,Or),n(r),Ti(t,I)},Ti=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};class Li{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Ii;this.storage=r;try{const n=new vi;Oi(r,n,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,n){return await this.initialize(),this.storage.setItem(r,n)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),r())},20)})}}class Ai{}function Ri(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var ji=Pi;function Pi(t,r,n){var c=n&&n.stringify||Ri,o=1;if(typeof t=="object"&&t!==null){var b=r.length+o;if(b===1)return t;var I=new Array(b);I[0]=c(t);for(var E=1;E<b;E++)I[E]=c(r[E]);return I.join(" ")}if(typeof t!="string")return t;var g=r.length;if(g===0)return t;for(var s="",u=1-o,y=-1,v=t&&t.length||0,w=0;w<v;){if(t.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,t.charCodeAt(w+1)){case 100:case 102:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Number(r[u]),y=w+2,w++;break;case 105:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Math.floor(Number(r[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||r[u]===void 0)break;y<w&&(s+=t.slice(y,w));var x=typeof r[u];if(x==="string"){s+="'"+r[u]+"'",y=w+2,w++;break}if(x==="function"){s+=r[u].name||"<anonymous>",y=w+2,w++;break}s+=c(r[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=t.slice(y,w)),s+=String(r[u]),y=w+2,w++;break;case 37:y<w&&(s+=t.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?t:(y<v&&(s+=t.slice(y)),s)}const Tr=ji;var me=Qt;const Se=Gi().console||{},Ci={mapHttpRequest:Ue,mapHttpResponse:Ue,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:Ue,res:Ue,err:Bi};function Ni(t,r){return Array.isArray(t)?t.filter(function(c){return c!=="!stdSerializers.err"}):t===!0?Object.keys(r):!1}function Qt(t){t=t||{},t.browser=t.browser||{};const r=t.browser.transmit;if(r&&typeof r.send!="function")throw Error("pino: transmit option must have a send function");const n=t.browser.write||Se;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=Ni(t.browser.serialize,c);let b=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(b=!1);const I=["error","fatal","warn","info","debug","trace"];typeof n=="function"&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),t.enabled===!1&&(t.level="silent");const E=t.level||"info",g=Object.create(n);g.log||(g.log=Oe),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:r,serialize:o,asObject:t.browser.asObject,levels:I,timestamp:Ki(t)};g.levels=Qt.levels,g.level=E,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Oe,g.serializers=c,g._serialize=o,g._stdErrSerialize=b,g.child=w,r&&(g._logEvent=rr());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,_e(s,g,"error","log"),_e(s,g,"fatal","error"),_e(s,g,"warn","error"),_e(s,g,"info","log"),_e(s,g,"debug","log"),_e(s,g,"trace","log")}function w(x,N){if(!x)throw new Error("missing bindings for child Pino");N=N||{},o&&x.serializers&&(N.serializers=x.serializers);const G=N.serializers;if(o&&G){var ut=Object.assign({},c,G),M=t.browser.serialize===!0?Object.keys(ut):o;delete x.serializers,ke([x],M,ut,this._stdErrSerialize)}function Lt(gt){this._childLevel=(gt._childLevel|0)+1,this.error=pe(gt,x,"error"),this.fatal=pe(gt,x,"fatal"),this.warn=pe(gt,x,"warn"),this.info=pe(gt,x,"info"),this.debug=pe(gt,x,"debug"),this.trace=pe(gt,x,"trace"),ut&&(this.serializers=ut,this._serialize=M),r&&(this._logEvent=rr([].concat(gt._logEvent.bindings,x)))}return Lt.prototype=this,new Lt(this)}return g}Qt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qt.stdSerializers=Ci;Qt.stdTimeFunctions=Object.assign({},{nullTime:Fr,epochTime:Jr,unixTime:Ui,isoTime:Hi});function _e(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Se[n]||Se[c]||Oe,Mi(t,r,n)}function Mi(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const b=t.timestamp(),I=new Array(arguments.length),E=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Se?Se:this;for(var g=0;g<I.length;g++)I[g]=arguments[g];if(t.serialize&&!t.asObject&&ke(I,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(E,zi(this,n,I,b)):c.apply(E,I),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Di(this,{ts:b,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},I)}}}(r[n]))}function zi(t,r,n,c){t._serialize&&ke(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let b=o[0];const I={};c&&(I.time=c),I.level=Qt.levels.values[r];let E=(t._childLevel|0)+1;if(E<1&&(E=1),b!==null&&typeof b=="object"){for(;E--&&typeof o[0]=="object";)Object.assign(I,o.shift());b=o.length?Tr(o.shift(),o):void 0}else typeof b=="string"&&(b=Tr(o.shift(),o));return b!==void 0&&(I.msg=b),I}function ke(t,r,n,c){for(const o in t)if(c&&t[o]instanceof Error)t[o]=Qt.stdSerializers.err(t[o]);else if(typeof t[o]=="object"&&!Array.isArray(t[o]))for(const b in t[o])r&&r.indexOf(b)>-1&&b in n&&(t[o][b]=n[b](t[o][b]))}function pe(t,r,n){return function(){const c=new Array(1+arguments.length);c[0]=r;for(var o=1;o<c.length;o++)c[o]=arguments[o-1];return t[n].apply(this,c)}}function Di(t,r,n){const c=r.send,o=r.ts,b=r.methodLevel,I=r.methodValue,E=r.val,g=t._logEvent.bindings;ke(n,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(s){return g.indexOf(s)===-1}),t._logEvent.level.label=b,t._logEvent.level.value=I,c(b,t._logEvent,E),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Bi(t){const r={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)r[n]===void 0&&(r[n]=t[n]);return r}function Ki(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Fr:Jr}function Ue(){return{}}function tr(t){return t}function Oe(){}function Fr(){return!1}function Jr(){return Date.now()}function Ui(){return Math.round(Date.now()/1e3)}function Hi(){return new Date(Date.now()).toISOString()}function Gi(){function t(r){return typeof r<"u"&&r}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const or=ct.getDefaultExportFromCjs(me),$i=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Lr(t){return typeof t=="string"?t:$i(t)||""}const Fi={level:"info"},Re="custom_context",ar=1e3*1024;class Ji{constructor(r){this.nodeValue=r,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ar{constructor(r){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=r,this.sizeInBytes=0}append(r){const n=new Ji(r);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${r} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const r=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=r.size}toArray(){const r=[];let n=this.head;for(;n!==null;)r.push(n.value),n=n.next;return r}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let r=this.head;return{next:()=>{if(!r)return{done:!0,value:null};const n=r.value;return r=r.next,{done:!1,value:n}}}}}class Wr{constructor(r,n=ar){this.level=r??"error",this.levelValue=me.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(r,n){n===me.levels.values.error?console.error(r):n===me.levels.values.warn?console.warn(r):n===me.levels.values.debug?console.debug(r):n===me.levels.values.trace?console.trace(r):console.log(r)}appendToLogs(r){this.logs.append(Lr({timestamp:new Date().toISOString(),log:r}));const n=typeof r=="string"?JSON.parse(r).level:r.level;n>=this.levelValue&&this.forwardToConsole(r,n)}getLogs(){return this.logs}clearLogs(){this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(r){const n=this.getLogArray();return n.push(Lr({extraMetadata:r})),new Blob(n,{type:"application/json"})}}class Wi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}downloadLogsBlobInBrowser(r){const n=URL.createObjectURL(this.logsToBlob(r)),c=document.createElement("a");c.href=n,c.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(n)}}class Vi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}}var ki=Object.defineProperty,Xi=Object.defineProperties,qi=Object.getOwnPropertyDescriptors,Rr=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,jr=(t,r,n)=>r in t?ki(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,$e=(t,r)=>{for(var n in r||(r={}))Yi.call(r,n)&&jr(t,n,r[n]);if(Rr)for(var n of Rr(r))Zi.call(r,n)&&jr(t,n,r[n]);return t},Fe=(t,r)=>Xi(t,qi(r));function Qi(t){return Fe($e({},t),{level:(t==null?void 0:t.level)||Fi.level})}function ts(t,r=Re){return t[r]||""}function es(t,r,n=Re){return t[n]=r,t}function Vr(t,r=Re){let n="";return typeof t.bindings>"u"?n=ts(t,r):n=t.bindings().context||"",n}function rs(t,r,n=Re){const c=Vr(t,n);return c.trim()?`${c}/${r}`:r}function ns(t,r,n=Re){const c=rs(t,r,n),o=t.child({context:c});return es(o,c,n)}function is(t){var r,n;const c=new Wi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace",browser:Fe($e({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function ss(t){var r;const n=new Vi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function os(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?is(t):ss(t)}var fr={},kr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Dt.binary,n=Dt.wipe;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var c=function(){function E(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return E.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},E.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},E.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},E.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},E.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;r.writeUint32BE(y,this._buffer,w-8),r.writeUint32BE(v,this._buffer,w-4),b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)r.writeUint32BE(this._stateHi[x],g,x*8),r.writeUint32BE(this._stateLo[x],g,x*8+4);return this},E.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},E.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},E.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},E.prototype.cleanSavedState=function(g){n.wipe(g.stateHi),n.wipe(g.stateLo),g.buffer&&n.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},E}();t.SHA512=c;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function b(E,g,s,u,y,v,w){for(var x=s[0],N=s[1],G=s[2],ut=s[3],M=s[4],Lt=s[5],gt=s[6],Ct=s[7],$=u[0],C=u[1],Nt=u[2],te=u[3],yt=u[4],Wt=u[5],Ht=u[6],Xt=u[7],m,p,X,lt,A,S,O,L;w>=128;){for(var At=0;At<16;At++){var et=8*At+v;E[At]=r.readUint32BE(y,et),g[At]=r.readUint32BE(y,et+4)}for(var At=0;At<80;At++){var xe=x,z=N,ge=G,h=ut,d=M,l=Lt,e=gt,a=Ct,R=$,j=C,B=Nt,K=te,D=yt,U=Wt,Rt=Ht,dt=Xt;if(m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(M>>>14|yt<<18)^(M>>>18|yt<<14)^(yt>>>9|M<<23),p=(yt>>>14|M<<18)^(yt>>>18|M<<14)^(M>>>9|yt<<23),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=M&Lt^~M&gt,p=yt&Wt^~yt&Ht,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=o[At*2],p=o[At*2+1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=E[At%16],p=g[At%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,X=O&65535|L<<16,lt=A&65535|S<<16,m=X,p=lt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(x>>>28|$<<4)^($>>>2|x<<30)^($>>>7|x<<25),p=($>>>28|x<<4)^(x>>>2|$<<30)^(x>>>7|$<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&G^N&G,p=$&C^$&Nt^C&Nt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,a=O&65535|L<<16,dt=A&65535|S<<16,m=h,p=K,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=X,p=lt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,h=O&65535|L<<16,K=A&65535|S<<16,N=xe,G=z,ut=ge,M=h,Lt=d,gt=l,Ct=e,x=a,C=R,Nt=j,te=B,yt=K,Wt=D,Ht=U,Xt=Rt,$=dt,At%16===15)for(var et=0;et<16;et++)m=E[et],p=g[et],A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=E[(et+9)%16],p=g[(et+9)%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+1)%16],lt=g[(et+1)%16],m=(X>>>1|lt<<31)^(X>>>8|lt<<24)^X>>>7,p=(lt>>>1|X<<31)^(lt>>>8|X<<24)^(lt>>>7|X<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+14)%16],lt=g[(et+14)%16],m=(X>>>19|lt<<13)^(lt>>>29|X<<3)^X>>>6,p=(lt>>>19|X<<13)^(X>>>29|lt<<3)^(lt>>>6|X<<26),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,E[et]=O&65535|L<<16,g[et]=A&65535|S<<16}m=x,p=$,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[0],p=u[0],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=$=A&65535|S<<16,m=N,p=C,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[1],p=u[1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=C=A&65535|S<<16,m=G,p=Nt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[2],p=u[2],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[2]=G=O&65535|L<<16,u[2]=Nt=A&65535|S<<16,m=ut,p=te,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[3],p=u[3],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[3]=ut=O&65535|L<<16,u[3]=te=A&65535|S<<16,m=M,p=yt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[4],p=u[4],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=yt=A&65535|S<<16,m=Lt,p=Wt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[5],p=u[5],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[5]=Lt=O&65535|L<<16,u[5]=Wt=A&65535|S<<16,m=gt,p=Ht,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[6],p=u[6],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[6]=gt=O&65535|L<<16,u[6]=Ht=A&65535|S<<16,m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[7],p=u[7],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=Xt=A&65535|S<<16,v+=128,w-=128}return v}function I(E){var g=new c;g.update(E);var s=g.digest();return g.clean(),s}t.hash=I})(kr);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const r=Dt.random,n=kr,c=Dt.wipe;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(h){const d=new Float64Array(16);if(h)for(let l=0;l<h.length;l++)d[l]=h[l];return d}const b=new Uint8Array(32);b[0]=9;const I=o(),E=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(h,d){for(let l=0;l<16;l++)h[l]=d[l]|0}function x(h){let d=1;for(let l=0;l<16;l++){let e=h[l]+d+65535;d=Math.floor(e/65536),h[l]=e-d*65536}h[0]+=d-1+37*(d-1)}function N(h,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(h[a]^d[a]);h[a]^=R,d[a]^=R}}function G(h,d){const l=o(),e=o();for(let a=0;a<16;a++)e[a]=d[a];x(e),x(e),x(e);for(let a=0;a<2;a++){l[0]=e[0]-65517;for(let j=1;j<15;j++)l[j]=e[j]-65535-(l[j-1]>>16&1),l[j-1]&=65535;l[15]=e[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,N(e,l,1-R)}for(let a=0;a<16;a++)h[2*a]=e[a]&255,h[2*a+1]=e[a]>>8}function ut(h,d){let l=0;for(let e=0;e<32;e++)l|=h[e]^d[e];return(1&l-1>>>8)-1}function M(h,d){const l=new Uint8Array(32),e=new Uint8Array(32);return G(l,h),G(e,d),ut(l,e)}function Lt(h){const d=new Uint8Array(32);return G(d,h),d[0]&1}function gt(h,d){for(let l=0;l<16;l++)h[l]=d[2*l]+(d[2*l+1]<<8);h[15]&=32767}function Ct(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]+l[e]}function $(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]-l[e]}function C(h,d,l){let e,a,R=0,j=0,B=0,K=0,D=0,U=0,Rt=0,dt=0,jt=0,_t=0,ht=0,rt=0,tt=0,q=0,V=0,H=0,nt=0,pt=0,F=0,Mt=0,Bt=0,Gt=0,$t=0,Kt=0,qt=0,Zt=0,se=0,Ft=0,ce=0,we=0,je=0,it=l[0],Y=l[1],st=l[2],ot=l[3],at=l[4],Z=l[5],mt=l[6],xt=l[7],wt=l[8],vt=l[9],Et=l[10],bt=l[11],ft=l[12],W=l[13],It=l[14],St=l[15];e=d[0],R+=e*it,j+=e*Y,B+=e*st,K+=e*ot,D+=e*at,U+=e*Z,Rt+=e*mt,dt+=e*xt,jt+=e*wt,_t+=e*vt,ht+=e*Et,rt+=e*bt,tt+=e*ft,q+=e*W,V+=e*It,H+=e*St,e=d[1],j+=e*it,B+=e*Y,K+=e*st,D+=e*ot,U+=e*at,Rt+=e*Z,dt+=e*mt,jt+=e*xt,_t+=e*wt,ht+=e*vt,rt+=e*Et,tt+=e*bt,q+=e*ft,V+=e*W,H+=e*It,nt+=e*St,e=d[2],B+=e*it,K+=e*Y,D+=e*st,U+=e*ot,Rt+=e*at,dt+=e*Z,jt+=e*mt,_t+=e*xt,ht+=e*wt,rt+=e*vt,tt+=e*Et,q+=e*bt,V+=e*ft,H+=e*W,nt+=e*It,pt+=e*St,e=d[3],K+=e*it,D+=e*Y,U+=e*st,Rt+=e*ot,dt+=e*at,jt+=e*Z,_t+=e*mt,ht+=e*xt,rt+=e*wt,tt+=e*vt,q+=e*Et,V+=e*bt,H+=e*ft,nt+=e*W,pt+=e*It,F+=e*St,e=d[4],D+=e*it,U+=e*Y,Rt+=e*st,dt+=e*ot,jt+=e*at,_t+=e*Z,ht+=e*mt,rt+=e*xt,tt+=e*wt,q+=e*vt,V+=e*Et,H+=e*bt,nt+=e*ft,pt+=e*W,F+=e*It,Mt+=e*St,e=d[5],U+=e*it,Rt+=e*Y,dt+=e*st,jt+=e*ot,_t+=e*at,ht+=e*Z,rt+=e*mt,tt+=e*xt,q+=e*wt,V+=e*vt,H+=e*Et,nt+=e*bt,pt+=e*ft,F+=e*W,Mt+=e*It,Bt+=e*St,e=d[6],Rt+=e*it,dt+=e*Y,jt+=e*st,_t+=e*ot,ht+=e*at,rt+=e*Z,tt+=e*mt,q+=e*xt,V+=e*wt,H+=e*vt,nt+=e*Et,pt+=e*bt,F+=e*ft,Mt+=e*W,Bt+=e*It,Gt+=e*St,e=d[7],dt+=e*it,jt+=e*Y,_t+=e*st,ht+=e*ot,rt+=e*at,tt+=e*Z,q+=e*mt,V+=e*xt,H+=e*wt,nt+=e*vt,pt+=e*Et,F+=e*bt,Mt+=e*ft,Bt+=e*W,Gt+=e*It,$t+=e*St,e=d[8],jt+=e*it,_t+=e*Y,ht+=e*st,rt+=e*ot,tt+=e*at,q+=e*Z,V+=e*mt,H+=e*xt,nt+=e*wt,pt+=e*vt,F+=e*Et,Mt+=e*bt,Bt+=e*ft,Gt+=e*W,$t+=e*It,Kt+=e*St,e=d[9],_t+=e*it,ht+=e*Y,rt+=e*st,tt+=e*ot,q+=e*at,V+=e*Z,H+=e*mt,nt+=e*xt,pt+=e*wt,F+=e*vt,Mt+=e*Et,Bt+=e*bt,Gt+=e*ft,$t+=e*W,Kt+=e*It,qt+=e*St,e=d[10],ht+=e*it,rt+=e*Y,tt+=e*st,q+=e*ot,V+=e*at,H+=e*Z,nt+=e*mt,pt+=e*xt,F+=e*wt,Mt+=e*vt,Bt+=e*Et,Gt+=e*bt,$t+=e*ft,Kt+=e*W,qt+=e*It,Zt+=e*St,e=d[11],rt+=e*it,tt+=e*Y,q+=e*st,V+=e*ot,H+=e*at,nt+=e*Z,pt+=e*mt,F+=e*xt,Mt+=e*wt,Bt+=e*vt,Gt+=e*Et,$t+=e*bt,Kt+=e*ft,qt+=e*W,Zt+=e*It,se+=e*St,e=d[12],tt+=e*it,q+=e*Y,V+=e*st,H+=e*ot,nt+=e*at,pt+=e*Z,F+=e*mt,Mt+=e*xt,Bt+=e*wt,Gt+=e*vt,$t+=e*Et,Kt+=e*bt,qt+=e*ft,Zt+=e*W,se+=e*It,Ft+=e*St,e=d[13],q+=e*it,V+=e*Y,H+=e*st,nt+=e*ot,pt+=e*at,F+=e*Z,Mt+=e*mt,Bt+=e*xt,Gt+=e*wt,$t+=e*vt,Kt+=e*Et,qt+=e*bt,Zt+=e*ft,se+=e*W,Ft+=e*It,ce+=e*St,e=d[14],V+=e*it,H+=e*Y,nt+=e*st,pt+=e*ot,F+=e*at,Mt+=e*Z,Bt+=e*mt,Gt+=e*xt,$t+=e*wt,Kt+=e*vt,qt+=e*Et,Zt+=e*bt,se+=e*ft,Ft+=e*W,ce+=e*It,we+=e*St,e=d[15],H+=e*it,nt+=e*Y,pt+=e*st,F+=e*ot,Mt+=e*at,Bt+=e*Z,Gt+=e*mt,$t+=e*xt,Kt+=e*wt,qt+=e*vt,Zt+=e*Et,se+=e*bt,Ft+=e*ft,ce+=e*W,we+=e*It,je+=e*St,R+=38*nt,j+=38*pt,B+=38*F,K+=38*Mt,D+=38*Bt,U+=38*Gt,Rt+=38*$t,dt+=38*Kt,jt+=38*qt,_t+=38*Zt,ht+=38*se,rt+=38*Ft,tt+=38*ce,q+=38*we,V+=38*je,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),h[0]=R,h[1]=j,h[2]=B,h[3]=K,h[4]=D,h[5]=U,h[6]=Rt,h[7]=dt,h[8]=jt,h[9]=_t,h[10]=ht,h[11]=rt,h[12]=tt,h[13]=q,h[14]=V,h[15]=H}function Nt(h,d){C(h,d,d)}function te(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=253;e>=0;e--)Nt(l,l),e!==2&&e!==4&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function yt(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=250;e>=0;e--)Nt(l,l),e!==1&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function Wt(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o(),D=o(),U=o();$(l,h[1],h[0]),$(U,d[1],d[0]),C(l,l,U),Ct(e,h[0],h[1]),Ct(U,d[0],d[1]),C(e,e,U),C(a,h[3],d[3]),C(a,a,s),C(R,h[2],d[2]),Ct(R,R,R),$(j,e,l),$(B,R,a),Ct(K,R,a),Ct(D,e,l),C(h[0],j,B),C(h[1],D,K),C(h[2],K,B),C(h[3],j,D)}function Ht(h,d,l){for(let e=0;e<4;e++)N(h[e],d[e],l)}function Xt(h,d){const l=o(),e=o(),a=o();te(a,d[2]),C(l,d[0],a),C(e,d[1],a),G(h,e),h[31]^=Lt(l)<<7}function m(h,d,l){w(h[0],I),w(h[1],E),w(h[2],E),w(h[3],I);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;Ht(h,d,a),Wt(d,h),Wt(h,h),Ht(h,d,a)}}function p(h,d){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],E),C(l[3],u,y),m(h,l,d)}function X(h){if(h.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(h);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];p(e,d),Xt(l,e);const a=new Uint8Array(64);return a.set(h),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function lt(h){const d=(0,r.randomBytes)(32,h),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=lt;function A(h){if(h.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(h.subarray(32))}t.extractPublicKeyFromSecretKey=A;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(h,d){let l,e,a,R;for(e=63;e>=32;--e){for(l=0,a=e-32,R=e-12;a<R;++a)d[a]+=l-16*d[e]*S[a-(e-32)],l=Math.floor((d[a]+128)/256),d[a]-=l*256;d[a]+=l,d[e]=0}for(l=0,a=0;a<32;a++)d[a]+=l-(d[31]>>4)*S[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*S[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,h[e]=d[e]&255}function L(h){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=h[l];for(let l=0;l<64;l++)h[l]=0;O(h,d)}function At(h,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(h.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const j=new n.SHA512;j.update(R.subarray(32)),j.update(d);const B=j.digest();j.clean(),L(B),p(e,B),Xt(R,e),j.reset(),j.update(R.subarray(0,32)),j.update(h.subarray(32)),j.update(d);const K=j.digest();L(K);for(let D=0;D<32;D++)l[D]=B[D];for(let D=0;D<32;D++)for(let U=0;U<32;U++)l[D+U]+=K[D]*a[U];return O(R.subarray(32),l),R}t.sign=At;function et(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o();return w(h[2],E),gt(h[1],d),Nt(a,h[1]),C(R,a,g),$(a,a,h[2]),Ct(R,h[2],R),Nt(j,R),Nt(B,j),C(K,B,j),C(l,K,a),C(l,l,R),yt(l,l),C(l,l,a),C(l,l,R),C(l,l,R),C(h[0],l,R),Nt(e,h[0]),C(e,e,R),M(e,a)&&C(h[0],h[0],v),Nt(e,h[0]),C(e,e,R),M(e,a)?-1:(Lt(h[0])===d[31]>>7&&$(h[0],I,h[0]),C(h[3],h[0],h[1]),0)}function xe(h,d,l){const e=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(et(R,h))return!1;const j=new n.SHA512;j.update(l.subarray(0,32)),j.update(h),j.update(d);const B=j.digest();return L(B),m(a,R,B),p(R,l.subarray(32)),Wt(a,R),Xt(e,a),!ut(l,e)}t.verify=xe;function z(h){let d=[o(),o(),o(),o()];if(et(d,h))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,E,a),$(e,E,a),te(e,e),C(l,l,e);let R=new Uint8Array(32);return G(R,l),R}t.convertPublicKeyToX25519=z;function ge(h){const d=(0,n.hash)(h.subarray(0,32));d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(d.subarray(0,32));return(0,c.wipe)(d),l}t.convertSecretKeyToX25519=ge})(fr);const as="EdDSA",fs="JWT",Je=".",Xe="base64url",Xr="utf8",qr="utf8",cs=":",us="did",ls="key",Pr="base58btc",ds="z",hs="K36",bs=32,gs=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),ys=t=>{const r=/([\[:])?(\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,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function _s(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ys(t)}catch{return t}}function ps(t){return typeof t=="string"?t:gs(t)||""}function Cr(t){return _s(Le(he(t,Xe),Xr))}function We(t){return Le(he(ps(t),Xr),Xe)}function Yr(t){const r=he(hs,Pr),n=ds+Le(Br([r,t]),Pr);return[us,ls,n].join(cs)}function ms(t){return Le(t,Xe)}function xs(t){return he(t,Xe)}function ws(t){return he([We(t.header),We(t.payload)].join(Je),qr)}function vs(t){return[We(t.header),We(t.payload),ms(t.signature)].join(Je)}function Es(t){const r=t.split(Je),n=Cr(r[0]),c=Cr(r[1]),o=xs(r[2]),b=he(r.slice(0,2).join(Je),qr);return{header:n,payload:c,signature:o,data:b}}function Is(t=Dt.random.randomBytes(bs)){return fr.generateKeyPairFromSeed(t)}async function Ss(t,r,n,c,o=Dt.cjs.fromMiliseconds(Date.now())){const b={alg:as,typ:fs},I=Yr(c.publicKey),E=o+n,g={iss:I,sub:t,aud:r,iat:o,exp:E},s=ws({header:b,payload:g}),u=fr.sign(c.secretKey,s);return vs({header:b,payload:g,signature:u})}const Os="PARSE_ERROR",Ts="INVALID_REQUEST",Ls="METHOD_NOT_FOUND",As="INVALID_PARAMS",Zr="INTERNAL_ERROR",cr="SERVER_ERROR",Rs=[-32700,-32600,-32601,-32602,-32603],Ie={[Os]:{code:-32700,message:"Parse error"},[Ts]:{code:-32600,message:"Invalid Request"},[Ls]:{code:-32601,message:"Method not found"},[As]:{code:-32602,message:"Invalid params"},[Zr]:{code:-32603,message:"Internal error"},[cr]:{code:-32e3,message:"Server error"}},Qr=cr;function js(t){return Rs.includes(t)}function Nr(t){return Object.keys(Ie).includes(t)?Ie[t]:Ie[Qr]}function Ps(t){const r=Object.values(Ie).find(n=>n.code===t);return r||Ie[Qr]}function Cs(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var tn={};/*! *****************************************************************************
1
+ "use strict";const ct=require("./index-BkwW7sVl.js"),Dt=require("./index-__Yey1yr.js");function Dr(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Br(t,r){r||(r=t.reduce((o,b)=>o+b.length,0));const n=Dr(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const wr={...Dt.identityBase,...Dt.base2,...Dt.base8,...Dt.base10,...Dt.base16,...Dt.base32,...Dt.base36,...Dt.base58,...Dt.base64,...Dt.base256emoji};function Kr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const vr=Kr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ye=Kr("ascii","a",t=>{let r="a";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r},t=>{t=t.substring(1);const r=Dr(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Ur={utf8:vr,"utf-8":vr,hex:wr.base16,latin1:Ye,ascii:Ye,binary:Ye,...wr};function he(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):n.decoder.decode(`${n.prefix}${t}`)}function Le(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}const kn={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},Xn=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,qn=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Yn=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Zn(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){Qn(t);return}return r}function Qn(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Be(t,r={}){if(typeof t!="string")return t;const n=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return n.slice(1,-1);if(n.length<=9){const c=n.toLowerCase();if(c==="true")return!0;if(c==="false")return!1;if(c==="undefined")return;if(c==="null")return null;if(c==="nan")return Number.NaN;if(c==="infinity")return Number.POSITIVE_INFINITY;if(c==="-infinity")return Number.NEGATIVE_INFINITY}if(!Yn.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Xn.test(t)||qn.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,Zn)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function ti(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tt(t,...r){try{return ti(t(...r))}catch(n){return Promise.reject(n)}}function ei(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function ri(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function He(t){if(ei(t))return String(t);if(ri(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return He(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const er="base64:";function ni(t){return typeof t=="string"?t:er+oi(t)}function ii(t){return typeof t!="string"||!t.startsWith(er)?t:si(t.slice(er.length))}function si(t){return globalThis.Buffer?ct.dist.Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),r=>r.codePointAt(0))}function oi(t){return globalThis.Buffer?ct.dist.Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ut(t){var r;return t&&((r=t.split("?")[0])==null?void 0:r.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function ai(...t){return Ut(t.join(":"))}function Ke(t){return t=Ut(t),t?t+":":""}const fi="memory",ci=()=>{const t=new Map;return{name:fi,getInstance:()=>t,hasItem(r){return t.has(r)},getItem(r){return t.get(r)??null},getItemRaw(r){return t.get(r)??null},setItem(r,n){t.set(r,n)},setItemRaw(r,n){t.set(r,n)},removeItem(r){t.delete(r)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function ui(t={}){const r={mounts:{"":t.driver||ci()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=s=>{for(const u of r.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:r.mounts[u]};return{base:"",relativeKey:s,driver:r.mounts[""]}},c=(s,u)=>r.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:r.mounts[y]})),o=(s,u)=>{if(r.watching){u=Ut(u);for(const y of r.watchListeners)y(s,u)}},b=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await Er(r.mounts[s],o,s)}},I=async()=>{if(r.watching){for(const s in r.unwatch)await r.unwatch[s]();r.unwatch={},r.watching=!1}},E=(s,u,y)=>{const v=new Map,w=x=>{let N=v.get(x.base);return N||(N={driver:x.driver,base:x.base,items:[]},v.set(x.base,N)),N};for(const x of s){const N=typeof x=="string",G=Ut(N?x:x.key),ut=N?void 0:x.value,M=N||!x.options?u:{...u,...x.options},Lt=n(G);w(Lt).items.push({key:G,value:ut,relativeKey:Lt.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.hasItem,y,u)},getItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.getItem,y,u).then(w=>Be(w))},getItems(s,u={}){return E(s,u,y=>y.driver.getItems?Tt(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:ai(y.base,w.key),value:Be(w.value)}))):Promise.all(y.items.map(v=>Tt(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:Be(w)})))))},getItemRaw(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Tt(v.getItemRaw,y,u):Tt(v.getItem,y,u).then(w=>ii(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Ut(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Tt(w.setItem,v,He(u),y),w.watch||o("update",s))},async setItems(s,u){await E(s,u,async y=>{if(y.driver.setItems)return Tt(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:He(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Tt(y.driver.setItem,v.relativeKey,He(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Ut(s);const{relativeKey:v,driver:w}=n(s);if(w.setItemRaw)await Tt(w.setItemRaw,v,u,y);else if(w.setItem)await Tt(w.setItem,v,ni(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s);v.removeItem&&(await Tt(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Tt(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Tt(v.getMeta,y,u)),!u.nativeOnly){const x=await Tt(v.getItem,y+"$",u).then(N=>Be(N));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=Ke(s);const y=c(s,!0);let v=[];const w=[];for(const x of y){const N=await Tt(x.driver.getKeys,x.relativeBase,u);for(const G of N){const ut=x.mountpoint+Ut(G);v.some(M=>ut.startsWith(M))||w.push(ut)}v=[x.mountpoint,...v.filter(G=>!G.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=Ke(s),await Promise.all(c(s,!1).map(async y=>{if(y.driver.clear)return Tt(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(s=>Ir(s)))},async watch(s){return await b(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await I()}},async unwatch(){r.watchListeners=[],await I()},mount(s,u){if(s=Ke(s),s&&r.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(r.mountpoints.push(s),r.mountpoints.sort((y,v)=>v.length-y.length)),r.mounts[s]=u,r.watching&&Promise.resolve(Er(u,o,s)).then(y=>{r.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){var y,v;s=Ke(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&((v=(y=r.unwatch)[s])==null||v.call(y),delete r.unwatch[s]),u&&await Ir(r.mounts[s]),r.mountpoints=r.mountpoints.filter(w=>w!==s),delete r.mounts[s])},getMount(s=""){s=Ut(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Ut(s),c(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function Er(t,r,n){return t.watch?t.watch((c,o)=>r(c,n+o)):()=>{}}async function Ir(t){typeof t.dispose=="function"&&await Tt(t.dispose)}function be(t){return new Promise((r,n)=>{t.oncomplete=t.onsuccess=()=>r(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Hr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=be(n);return(o,b)=>c.then(I=>b(I.transaction(r,o).objectStore(r)))}let Ze;function Ae(){return Ze||(Ze=Hr("keyval-store","keyval")),Ze}function Sr(t,r=Ae()){return r("readonly",n=>be(n.get(t)))}function li(t,r,n=Ae()){return n("readwrite",c=>(c.put(r,t),be(c.transaction)))}function di(t,r=Ae()){return r("readwrite",n=>(n.delete(t),be(n.transaction)))}function hi(t=Ae()){return t("readwrite",r=>(r.clear(),be(r.transaction)))}function bi(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},be(t.transaction)}function gi(t=Ae()){return t("readonly",r=>{if(r.getAllKeys)return be(r.getAllKeys());const n=[];return bi(r,c=>n.push(c.key)).then(()=>n)})}const yi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),_i=t=>{const r=/([\[:])?(\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,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Gr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return _i(t)}catch{return t}}function $r(t){return typeof t=="string"?t:yi(t)||""}const pi="idb-keyval";var mi=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Hr(t.dbName,t.storeName)),{name:pi,options:t,async hasItem(o){return!(typeof await Sr(n(o),c)>"u")},async getItem(o){return await Sr(n(o),c)??null},setItem(o,b){return li(n(o),b,c)},removeItem(o){return di(n(o),c)},getKeys(){return gi(c)},clear(){return hi(c)}}};const xi="WALLET_CONNECT_V2_INDEXED_DB",wi="keyvaluestorage";let vi=class{constructor(){this.indexedDb=ui({driver:mi({dbName:xi,storeName:wi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const n=await this.indexedDb.getItem(r);if(n!==null)return n}async setItem(r,n){await this.indexedDb.setItem(r,$r(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof ct.dist.global<"u"?ct.dist.global:typeof self<"u"?self:{},Ge={exports:{}};(function(){let t;function r(){}t=r,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,c){this[n]=String(c)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(c){n[c]=void 0,delete n[c]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qe<"u"&&Qe.localStorage?Ge.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?Ge.exports=window.localStorage:Ge.exports=new r})();function Ei(t){var r;return[t[0],Gr((r=t[1])!=null?r:"")]}class Ii{constructor(){this.localStorage=Ge.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ei)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return Gr(n)}async setItem(r,n){this.localStorage.setItem(r,$r(n))}async removeItem(r){this.localStorage.removeItem(r)}}const Si="wc_storage_version",Or=1,Oi=async(t,r,n)=>{const c=Si,o=await r.getItem(c);if(o&&o>=Or){n(r);return}const b=await t.getKeys();if(!b.length){n(r);return}const I=[];for(;b.length;){const E=b.shift();if(!E)continue;const g=E.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await t.getItem(E);await r.setItem(E,s),I.push(E)}}await r.setItem(c,Or),n(r),Ti(t,I)},Ti=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};class Li{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Ii;this.storage=r;try{const n=new vi;Oi(r,n,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,n){return await this.initialize(),this.storage.setItem(r,n)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),r())},20)})}}class Ai{}function Ri(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var ji=Pi;function Pi(t,r,n){var c=n&&n.stringify||Ri,o=1;if(typeof t=="object"&&t!==null){var b=r.length+o;if(b===1)return t;var I=new Array(b);I[0]=c(t);for(var E=1;E<b;E++)I[E]=c(r[E]);return I.join(" ")}if(typeof t!="string")return t;var g=r.length;if(g===0)return t;for(var s="",u=1-o,y=-1,v=t&&t.length||0,w=0;w<v;){if(t.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,t.charCodeAt(w+1)){case 100:case 102:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Number(r[u]),y=w+2,w++;break;case 105:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Math.floor(Number(r[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||r[u]===void 0)break;y<w&&(s+=t.slice(y,w));var x=typeof r[u];if(x==="string"){s+="'"+r[u]+"'",y=w+2,w++;break}if(x==="function"){s+=r[u].name||"<anonymous>",y=w+2,w++;break}s+=c(r[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=t.slice(y,w)),s+=String(r[u]),y=w+2,w++;break;case 37:y<w&&(s+=t.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?t:(y<v&&(s+=t.slice(y)),s)}const Tr=ji;var me=Qt;const Se=Gi().console||{},Ci={mapHttpRequest:Ue,mapHttpResponse:Ue,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:Ue,res:Ue,err:Bi};function Ni(t,r){return Array.isArray(t)?t.filter(function(c){return c!=="!stdSerializers.err"}):t===!0?Object.keys(r):!1}function Qt(t){t=t||{},t.browser=t.browser||{};const r=t.browser.transmit;if(r&&typeof r.send!="function")throw Error("pino: transmit option must have a send function");const n=t.browser.write||Se;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=Ni(t.browser.serialize,c);let b=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(b=!1);const I=["error","fatal","warn","info","debug","trace"];typeof n=="function"&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),t.enabled===!1&&(t.level="silent");const E=t.level||"info",g=Object.create(n);g.log||(g.log=Oe),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:r,serialize:o,asObject:t.browser.asObject,levels:I,timestamp:Ki(t)};g.levels=Qt.levels,g.level=E,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Oe,g.serializers=c,g._serialize=o,g._stdErrSerialize=b,g.child=w,r&&(g._logEvent=rr());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,_e(s,g,"error","log"),_e(s,g,"fatal","error"),_e(s,g,"warn","error"),_e(s,g,"info","log"),_e(s,g,"debug","log"),_e(s,g,"trace","log")}function w(x,N){if(!x)throw new Error("missing bindings for child Pino");N=N||{},o&&x.serializers&&(N.serializers=x.serializers);const G=N.serializers;if(o&&G){var ut=Object.assign({},c,G),M=t.browser.serialize===!0?Object.keys(ut):o;delete x.serializers,ke([x],M,ut,this._stdErrSerialize)}function Lt(gt){this._childLevel=(gt._childLevel|0)+1,this.error=pe(gt,x,"error"),this.fatal=pe(gt,x,"fatal"),this.warn=pe(gt,x,"warn"),this.info=pe(gt,x,"info"),this.debug=pe(gt,x,"debug"),this.trace=pe(gt,x,"trace"),ut&&(this.serializers=ut,this._serialize=M),r&&(this._logEvent=rr([].concat(gt._logEvent.bindings,x)))}return Lt.prototype=this,new Lt(this)}return g}Qt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qt.stdSerializers=Ci;Qt.stdTimeFunctions=Object.assign({},{nullTime:Fr,epochTime:Jr,unixTime:Ui,isoTime:Hi});function _e(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Se[n]||Se[c]||Oe,Mi(t,r,n)}function Mi(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const b=t.timestamp(),I=new Array(arguments.length),E=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Se?Se:this;for(var g=0;g<I.length;g++)I[g]=arguments[g];if(t.serialize&&!t.asObject&&ke(I,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(E,zi(this,n,I,b)):c.apply(E,I),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Di(this,{ts:b,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},I)}}}(r[n]))}function zi(t,r,n,c){t._serialize&&ke(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let b=o[0];const I={};c&&(I.time=c),I.level=Qt.levels.values[r];let E=(t._childLevel|0)+1;if(E<1&&(E=1),b!==null&&typeof b=="object"){for(;E--&&typeof o[0]=="object";)Object.assign(I,o.shift());b=o.length?Tr(o.shift(),o):void 0}else typeof b=="string"&&(b=Tr(o.shift(),o));return b!==void 0&&(I.msg=b),I}function ke(t,r,n,c){for(const o in t)if(c&&t[o]instanceof Error)t[o]=Qt.stdSerializers.err(t[o]);else if(typeof t[o]=="object"&&!Array.isArray(t[o]))for(const b in t[o])r&&r.indexOf(b)>-1&&b in n&&(t[o][b]=n[b](t[o][b]))}function pe(t,r,n){return function(){const c=new Array(1+arguments.length);c[0]=r;for(var o=1;o<c.length;o++)c[o]=arguments[o-1];return t[n].apply(this,c)}}function Di(t,r,n){const c=r.send,o=r.ts,b=r.methodLevel,I=r.methodValue,E=r.val,g=t._logEvent.bindings;ke(n,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(s){return g.indexOf(s)===-1}),t._logEvent.level.label=b,t._logEvent.level.value=I,c(b,t._logEvent,E),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Bi(t){const r={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)r[n]===void 0&&(r[n]=t[n]);return r}function Ki(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Fr:Jr}function Ue(){return{}}function tr(t){return t}function Oe(){}function Fr(){return!1}function Jr(){return Date.now()}function Ui(){return Math.round(Date.now()/1e3)}function Hi(){return new Date(Date.now()).toISOString()}function Gi(){function t(r){return typeof r<"u"&&r}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const or=ct.getDefaultExportFromCjs(me),$i=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Lr(t){return typeof t=="string"?t:$i(t)||""}const Fi={level:"info"},Re="custom_context",ar=1e3*1024;class Ji{constructor(r){this.nodeValue=r,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ar{constructor(r){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=r,this.sizeInBytes=0}append(r){const n=new Ji(r);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${r} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const r=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=r.size}toArray(){const r=[];let n=this.head;for(;n!==null;)r.push(n.value),n=n.next;return r}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let r=this.head;return{next:()=>{if(!r)return{done:!0,value:null};const n=r.value;return r=r.next,{done:!1,value:n}}}}}class Wr{constructor(r,n=ar){this.level=r??"error",this.levelValue=me.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(r,n){n===me.levels.values.error?console.error(r):n===me.levels.values.warn?console.warn(r):n===me.levels.values.debug?console.debug(r):n===me.levels.values.trace?console.trace(r):console.log(r)}appendToLogs(r){this.logs.append(Lr({timestamp:new Date().toISOString(),log:r}));const n=typeof r=="string"?JSON.parse(r).level:r.level;n>=this.levelValue&&this.forwardToConsole(r,n)}getLogs(){return this.logs}clearLogs(){this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(r){const n=this.getLogArray();return n.push(Lr({extraMetadata:r})),new Blob(n,{type:"application/json"})}}class Wi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}downloadLogsBlobInBrowser(r){const n=URL.createObjectURL(this.logsToBlob(r)),c=document.createElement("a");c.href=n,c.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(n)}}class Vi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}}var ki=Object.defineProperty,Xi=Object.defineProperties,qi=Object.getOwnPropertyDescriptors,Rr=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,jr=(t,r,n)=>r in t?ki(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,$e=(t,r)=>{for(var n in r||(r={}))Yi.call(r,n)&&jr(t,n,r[n]);if(Rr)for(var n of Rr(r))Zi.call(r,n)&&jr(t,n,r[n]);return t},Fe=(t,r)=>Xi(t,qi(r));function Qi(t){return Fe($e({},t),{level:(t==null?void 0:t.level)||Fi.level})}function ts(t,r=Re){return t[r]||""}function es(t,r,n=Re){return t[n]=r,t}function Vr(t,r=Re){let n="";return typeof t.bindings>"u"?n=ts(t,r):n=t.bindings().context||"",n}function rs(t,r,n=Re){const c=Vr(t,n);return c.trim()?`${c}/${r}`:r}function ns(t,r,n=Re){const c=rs(t,r,n),o=t.child({context:c});return es(o,c,n)}function is(t){var r,n;const c=new Wi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace",browser:Fe($e({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function ss(t){var r;const n=new Vi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function os(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?is(t):ss(t)}var fr={},kr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Dt.binary,n=Dt.wipe;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var c=function(){function E(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return E.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},E.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},E.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},E.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},E.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;r.writeUint32BE(y,this._buffer,w-8),r.writeUint32BE(v,this._buffer,w-4),b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)r.writeUint32BE(this._stateHi[x],g,x*8),r.writeUint32BE(this._stateLo[x],g,x*8+4);return this},E.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},E.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},E.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},E.prototype.cleanSavedState=function(g){n.wipe(g.stateHi),n.wipe(g.stateLo),g.buffer&&n.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},E}();t.SHA512=c;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function b(E,g,s,u,y,v,w){for(var x=s[0],N=s[1],G=s[2],ut=s[3],M=s[4],Lt=s[5],gt=s[6],Ct=s[7],$=u[0],C=u[1],Nt=u[2],te=u[3],yt=u[4],Wt=u[5],Ht=u[6],Xt=u[7],m,p,X,lt,A,S,O,L;w>=128;){for(var At=0;At<16;At++){var et=8*At+v;E[At]=r.readUint32BE(y,et),g[At]=r.readUint32BE(y,et+4)}for(var At=0;At<80;At++){var xe=x,z=N,ge=G,h=ut,d=M,l=Lt,e=gt,a=Ct,R=$,j=C,B=Nt,K=te,D=yt,U=Wt,Rt=Ht,dt=Xt;if(m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(M>>>14|yt<<18)^(M>>>18|yt<<14)^(yt>>>9|M<<23),p=(yt>>>14|M<<18)^(yt>>>18|M<<14)^(M>>>9|yt<<23),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=M&Lt^~M&gt,p=yt&Wt^~yt&Ht,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=o[At*2],p=o[At*2+1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=E[At%16],p=g[At%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,X=O&65535|L<<16,lt=A&65535|S<<16,m=X,p=lt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(x>>>28|$<<4)^($>>>2|x<<30)^($>>>7|x<<25),p=($>>>28|x<<4)^(x>>>2|$<<30)^(x>>>7|$<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&G^N&G,p=$&C^$&Nt^C&Nt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,a=O&65535|L<<16,dt=A&65535|S<<16,m=h,p=K,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=X,p=lt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,h=O&65535|L<<16,K=A&65535|S<<16,N=xe,G=z,ut=ge,M=h,Lt=d,gt=l,Ct=e,x=a,C=R,Nt=j,te=B,yt=K,Wt=D,Ht=U,Xt=Rt,$=dt,At%16===15)for(var et=0;et<16;et++)m=E[et],p=g[et],A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=E[(et+9)%16],p=g[(et+9)%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+1)%16],lt=g[(et+1)%16],m=(X>>>1|lt<<31)^(X>>>8|lt<<24)^X>>>7,p=(lt>>>1|X<<31)^(lt>>>8|X<<24)^(lt>>>7|X<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+14)%16],lt=g[(et+14)%16],m=(X>>>19|lt<<13)^(lt>>>29|X<<3)^X>>>6,p=(lt>>>19|X<<13)^(X>>>29|lt<<3)^(lt>>>6|X<<26),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,E[et]=O&65535|L<<16,g[et]=A&65535|S<<16}m=x,p=$,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[0],p=u[0],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=$=A&65535|S<<16,m=N,p=C,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[1],p=u[1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=C=A&65535|S<<16,m=G,p=Nt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[2],p=u[2],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[2]=G=O&65535|L<<16,u[2]=Nt=A&65535|S<<16,m=ut,p=te,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[3],p=u[3],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[3]=ut=O&65535|L<<16,u[3]=te=A&65535|S<<16,m=M,p=yt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[4],p=u[4],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=yt=A&65535|S<<16,m=Lt,p=Wt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[5],p=u[5],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[5]=Lt=O&65535|L<<16,u[5]=Wt=A&65535|S<<16,m=gt,p=Ht,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[6],p=u[6],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[6]=gt=O&65535|L<<16,u[6]=Ht=A&65535|S<<16,m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[7],p=u[7],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=Xt=A&65535|S<<16,v+=128,w-=128}return v}function I(E){var g=new c;g.update(E);var s=g.digest();return g.clean(),s}t.hash=I})(kr);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const r=Dt.random,n=kr,c=Dt.wipe;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(h){const d=new Float64Array(16);if(h)for(let l=0;l<h.length;l++)d[l]=h[l];return d}const b=new Uint8Array(32);b[0]=9;const I=o(),E=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(h,d){for(let l=0;l<16;l++)h[l]=d[l]|0}function x(h){let d=1;for(let l=0;l<16;l++){let e=h[l]+d+65535;d=Math.floor(e/65536),h[l]=e-d*65536}h[0]+=d-1+37*(d-1)}function N(h,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(h[a]^d[a]);h[a]^=R,d[a]^=R}}function G(h,d){const l=o(),e=o();for(let a=0;a<16;a++)e[a]=d[a];x(e),x(e),x(e);for(let a=0;a<2;a++){l[0]=e[0]-65517;for(let j=1;j<15;j++)l[j]=e[j]-65535-(l[j-1]>>16&1),l[j-1]&=65535;l[15]=e[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,N(e,l,1-R)}for(let a=0;a<16;a++)h[2*a]=e[a]&255,h[2*a+1]=e[a]>>8}function ut(h,d){let l=0;for(let e=0;e<32;e++)l|=h[e]^d[e];return(1&l-1>>>8)-1}function M(h,d){const l=new Uint8Array(32),e=new Uint8Array(32);return G(l,h),G(e,d),ut(l,e)}function Lt(h){const d=new Uint8Array(32);return G(d,h),d[0]&1}function gt(h,d){for(let l=0;l<16;l++)h[l]=d[2*l]+(d[2*l+1]<<8);h[15]&=32767}function Ct(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]+l[e]}function $(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]-l[e]}function C(h,d,l){let e,a,R=0,j=0,B=0,K=0,D=0,U=0,Rt=0,dt=0,jt=0,_t=0,ht=0,rt=0,tt=0,q=0,V=0,H=0,nt=0,pt=0,F=0,Mt=0,Bt=0,Gt=0,$t=0,Kt=0,qt=0,Zt=0,se=0,Ft=0,ce=0,we=0,je=0,it=l[0],Y=l[1],st=l[2],ot=l[3],at=l[4],Z=l[5],mt=l[6],xt=l[7],wt=l[8],vt=l[9],Et=l[10],bt=l[11],ft=l[12],W=l[13],It=l[14],St=l[15];e=d[0],R+=e*it,j+=e*Y,B+=e*st,K+=e*ot,D+=e*at,U+=e*Z,Rt+=e*mt,dt+=e*xt,jt+=e*wt,_t+=e*vt,ht+=e*Et,rt+=e*bt,tt+=e*ft,q+=e*W,V+=e*It,H+=e*St,e=d[1],j+=e*it,B+=e*Y,K+=e*st,D+=e*ot,U+=e*at,Rt+=e*Z,dt+=e*mt,jt+=e*xt,_t+=e*wt,ht+=e*vt,rt+=e*Et,tt+=e*bt,q+=e*ft,V+=e*W,H+=e*It,nt+=e*St,e=d[2],B+=e*it,K+=e*Y,D+=e*st,U+=e*ot,Rt+=e*at,dt+=e*Z,jt+=e*mt,_t+=e*xt,ht+=e*wt,rt+=e*vt,tt+=e*Et,q+=e*bt,V+=e*ft,H+=e*W,nt+=e*It,pt+=e*St,e=d[3],K+=e*it,D+=e*Y,U+=e*st,Rt+=e*ot,dt+=e*at,jt+=e*Z,_t+=e*mt,ht+=e*xt,rt+=e*wt,tt+=e*vt,q+=e*Et,V+=e*bt,H+=e*ft,nt+=e*W,pt+=e*It,F+=e*St,e=d[4],D+=e*it,U+=e*Y,Rt+=e*st,dt+=e*ot,jt+=e*at,_t+=e*Z,ht+=e*mt,rt+=e*xt,tt+=e*wt,q+=e*vt,V+=e*Et,H+=e*bt,nt+=e*ft,pt+=e*W,F+=e*It,Mt+=e*St,e=d[5],U+=e*it,Rt+=e*Y,dt+=e*st,jt+=e*ot,_t+=e*at,ht+=e*Z,rt+=e*mt,tt+=e*xt,q+=e*wt,V+=e*vt,H+=e*Et,nt+=e*bt,pt+=e*ft,F+=e*W,Mt+=e*It,Bt+=e*St,e=d[6],Rt+=e*it,dt+=e*Y,jt+=e*st,_t+=e*ot,ht+=e*at,rt+=e*Z,tt+=e*mt,q+=e*xt,V+=e*wt,H+=e*vt,nt+=e*Et,pt+=e*bt,F+=e*ft,Mt+=e*W,Bt+=e*It,Gt+=e*St,e=d[7],dt+=e*it,jt+=e*Y,_t+=e*st,ht+=e*ot,rt+=e*at,tt+=e*Z,q+=e*mt,V+=e*xt,H+=e*wt,nt+=e*vt,pt+=e*Et,F+=e*bt,Mt+=e*ft,Bt+=e*W,Gt+=e*It,$t+=e*St,e=d[8],jt+=e*it,_t+=e*Y,ht+=e*st,rt+=e*ot,tt+=e*at,q+=e*Z,V+=e*mt,H+=e*xt,nt+=e*wt,pt+=e*vt,F+=e*Et,Mt+=e*bt,Bt+=e*ft,Gt+=e*W,$t+=e*It,Kt+=e*St,e=d[9],_t+=e*it,ht+=e*Y,rt+=e*st,tt+=e*ot,q+=e*at,V+=e*Z,H+=e*mt,nt+=e*xt,pt+=e*wt,F+=e*vt,Mt+=e*Et,Bt+=e*bt,Gt+=e*ft,$t+=e*W,Kt+=e*It,qt+=e*St,e=d[10],ht+=e*it,rt+=e*Y,tt+=e*st,q+=e*ot,V+=e*at,H+=e*Z,nt+=e*mt,pt+=e*xt,F+=e*wt,Mt+=e*vt,Bt+=e*Et,Gt+=e*bt,$t+=e*ft,Kt+=e*W,qt+=e*It,Zt+=e*St,e=d[11],rt+=e*it,tt+=e*Y,q+=e*st,V+=e*ot,H+=e*at,nt+=e*Z,pt+=e*mt,F+=e*xt,Mt+=e*wt,Bt+=e*vt,Gt+=e*Et,$t+=e*bt,Kt+=e*ft,qt+=e*W,Zt+=e*It,se+=e*St,e=d[12],tt+=e*it,q+=e*Y,V+=e*st,H+=e*ot,nt+=e*at,pt+=e*Z,F+=e*mt,Mt+=e*xt,Bt+=e*wt,Gt+=e*vt,$t+=e*Et,Kt+=e*bt,qt+=e*ft,Zt+=e*W,se+=e*It,Ft+=e*St,e=d[13],q+=e*it,V+=e*Y,H+=e*st,nt+=e*ot,pt+=e*at,F+=e*Z,Mt+=e*mt,Bt+=e*xt,Gt+=e*wt,$t+=e*vt,Kt+=e*Et,qt+=e*bt,Zt+=e*ft,se+=e*W,Ft+=e*It,ce+=e*St,e=d[14],V+=e*it,H+=e*Y,nt+=e*st,pt+=e*ot,F+=e*at,Mt+=e*Z,Bt+=e*mt,Gt+=e*xt,$t+=e*wt,Kt+=e*vt,qt+=e*Et,Zt+=e*bt,se+=e*ft,Ft+=e*W,ce+=e*It,we+=e*St,e=d[15],H+=e*it,nt+=e*Y,pt+=e*st,F+=e*ot,Mt+=e*at,Bt+=e*Z,Gt+=e*mt,$t+=e*xt,Kt+=e*wt,qt+=e*vt,Zt+=e*Et,se+=e*bt,Ft+=e*ft,ce+=e*W,we+=e*It,je+=e*St,R+=38*nt,j+=38*pt,B+=38*F,K+=38*Mt,D+=38*Bt,U+=38*Gt,Rt+=38*$t,dt+=38*Kt,jt+=38*qt,_t+=38*Zt,ht+=38*se,rt+=38*Ft,tt+=38*ce,q+=38*we,V+=38*je,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),h[0]=R,h[1]=j,h[2]=B,h[3]=K,h[4]=D,h[5]=U,h[6]=Rt,h[7]=dt,h[8]=jt,h[9]=_t,h[10]=ht,h[11]=rt,h[12]=tt,h[13]=q,h[14]=V,h[15]=H}function Nt(h,d){C(h,d,d)}function te(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=253;e>=0;e--)Nt(l,l),e!==2&&e!==4&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function yt(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=250;e>=0;e--)Nt(l,l),e!==1&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function Wt(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o(),D=o(),U=o();$(l,h[1],h[0]),$(U,d[1],d[0]),C(l,l,U),Ct(e,h[0],h[1]),Ct(U,d[0],d[1]),C(e,e,U),C(a,h[3],d[3]),C(a,a,s),C(R,h[2],d[2]),Ct(R,R,R),$(j,e,l),$(B,R,a),Ct(K,R,a),Ct(D,e,l),C(h[0],j,B),C(h[1],D,K),C(h[2],K,B),C(h[3],j,D)}function Ht(h,d,l){for(let e=0;e<4;e++)N(h[e],d[e],l)}function Xt(h,d){const l=o(),e=o(),a=o();te(a,d[2]),C(l,d[0],a),C(e,d[1],a),G(h,e),h[31]^=Lt(l)<<7}function m(h,d,l){w(h[0],I),w(h[1],E),w(h[2],E),w(h[3],I);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;Ht(h,d,a),Wt(d,h),Wt(h,h),Ht(h,d,a)}}function p(h,d){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],E),C(l[3],u,y),m(h,l,d)}function X(h){if(h.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(h);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];p(e,d),Xt(l,e);const a=new Uint8Array(64);return a.set(h),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function lt(h){const d=(0,r.randomBytes)(32,h),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=lt;function A(h){if(h.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(h.subarray(32))}t.extractPublicKeyFromSecretKey=A;const S=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(h,d){let l,e,a,R;for(e=63;e>=32;--e){for(l=0,a=e-32,R=e-12;a<R;++a)d[a]+=l-16*d[e]*S[a-(e-32)],l=Math.floor((d[a]+128)/256),d[a]-=l*256;d[a]+=l,d[e]=0}for(l=0,a=0;a<32;a++)d[a]+=l-(d[31]>>4)*S[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*S[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,h[e]=d[e]&255}function L(h){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=h[l];for(let l=0;l<64;l++)h[l]=0;O(h,d)}function At(h,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(h.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const j=new n.SHA512;j.update(R.subarray(32)),j.update(d);const B=j.digest();j.clean(),L(B),p(e,B),Xt(R,e),j.reset(),j.update(R.subarray(0,32)),j.update(h.subarray(32)),j.update(d);const K=j.digest();L(K);for(let D=0;D<32;D++)l[D]=B[D];for(let D=0;D<32;D++)for(let U=0;U<32;U++)l[D+U]+=K[D]*a[U];return O(R.subarray(32),l),R}t.sign=At;function et(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o();return w(h[2],E),gt(h[1],d),Nt(a,h[1]),C(R,a,g),$(a,a,h[2]),Ct(R,h[2],R),Nt(j,R),Nt(B,j),C(K,B,j),C(l,K,a),C(l,l,R),yt(l,l),C(l,l,a),C(l,l,R),C(l,l,R),C(h[0],l,R),Nt(e,h[0]),C(e,e,R),M(e,a)&&C(h[0],h[0],v),Nt(e,h[0]),C(e,e,R),M(e,a)?-1:(Lt(h[0])===d[31]>>7&&$(h[0],I,h[0]),C(h[3],h[0],h[1]),0)}function xe(h,d,l){const e=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(et(R,h))return!1;const j=new n.SHA512;j.update(l.subarray(0,32)),j.update(h),j.update(d);const B=j.digest();return L(B),m(a,R,B),p(R,l.subarray(32)),Wt(a,R),Xt(e,a),!ut(l,e)}t.verify=xe;function z(h){let d=[o(),o(),o(),o()];if(et(d,h))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,E,a),$(e,E,a),te(e,e),C(l,l,e);let R=new Uint8Array(32);return G(R,l),R}t.convertPublicKeyToX25519=z;function ge(h){const d=(0,n.hash)(h.subarray(0,32));d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(d.subarray(0,32));return(0,c.wipe)(d),l}t.convertSecretKeyToX25519=ge})(fr);const as="EdDSA",fs="JWT",Je=".",Xe="base64url",Xr="utf8",qr="utf8",cs=":",us="did",ls="key",Pr="base58btc",ds="z",hs="K36",bs=32,gs=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),ys=t=>{const r=/([\[:])?(\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,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function _s(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ys(t)}catch{return t}}function ps(t){return typeof t=="string"?t:gs(t)||""}function Cr(t){return _s(Le(he(t,Xe),Xr))}function We(t){return Le(he(ps(t),Xr),Xe)}function Yr(t){const r=he(hs,Pr),n=ds+Le(Br([r,t]),Pr);return[us,ls,n].join(cs)}function ms(t){return Le(t,Xe)}function xs(t){return he(t,Xe)}function ws(t){return he([We(t.header),We(t.payload)].join(Je),qr)}function vs(t){return[We(t.header),We(t.payload),ms(t.signature)].join(Je)}function Es(t){const r=t.split(Je),n=Cr(r[0]),c=Cr(r[1]),o=xs(r[2]),b=he(r.slice(0,2).join(Je),qr);return{header:n,payload:c,signature:o,data:b}}function Is(t=Dt.random.randomBytes(bs)){return fr.generateKeyPairFromSeed(t)}async function Ss(t,r,n,c,o=Dt.cjs.fromMiliseconds(Date.now())){const b={alg:as,typ:fs},I=Yr(c.publicKey),E=o+n,g={iss:I,sub:t,aud:r,iat:o,exp:E},s=ws({header:b,payload:g}),u=fr.sign(c.secretKey,s);return vs({header:b,payload:g,signature:u})}const Os="PARSE_ERROR",Ts="INVALID_REQUEST",Ls="METHOD_NOT_FOUND",As="INVALID_PARAMS",Zr="INTERNAL_ERROR",cr="SERVER_ERROR",Rs=[-32700,-32600,-32601,-32602,-32603],Ie={[Os]:{code:-32700,message:"Parse error"},[Ts]:{code:-32600,message:"Invalid Request"},[Ls]:{code:-32601,message:"Method not found"},[As]:{code:-32602,message:"Invalid params"},[Zr]:{code:-32603,message:"Internal error"},[cr]:{code:-32e3,message:"Server error"}},Qr=cr;function js(t){return Rs.includes(t)}function Nr(t){return Object.keys(Ie).includes(t)?Ie[t]:Ie[Qr]}function Ps(t){const r=Object.values(Ie).find(n=>n.code===t);return r||Ie[Qr]}function Cs(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var tn={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1,7 +1,7 @@
1
- import { e as gt, s as xo } from "./events-CpDIhB3C.mjs";
2
- import { cl as Do, cm as $w, V as J, aw as Cw, ck as $u } from "./index-C6iaLaJq.mjs";
3
- import { c as F, s as Fo, x as Vh, r as Bh, H as Aw, a as Kh, q as Ss } from "./index-Bm1zXhFz.mjs";
4
- import { I as lr, f as ft, t as nt, c as Cu, C as Tw, r as xw, a as Dr, g as Wh, i as bt, b as $s, d as Au, e as Dw, h as Fw, j as Cs, p as Gh, _ as qw, E as ke, y as Qe, T as As, k as Ts, l as jw, m as Tu, n as Uw, s as Mw, o as qo, q as xs, u as Wt, v as Lw, w as xu } from "./index-wW7H3ciQ.mjs";
1
+ import { e as gt, s as xo } from "./events-Dz983PDv.mjs";
2
+ import { cl as Do, cm as $w, V as J, aw as Cw, ck as $u } from "./index-VnCbpsUO.mjs";
3
+ import { c as F, s as Fo, x as Vh, r as Bh, H as Aw, a as Kh, q as Ss } from "./index-B65iKhSQ.mjs";
4
+ import { I as lr, f as ft, t as nt, c as Cu, C as Tw, r as xw, a as Dr, g as Wh, i as bt, b as $s, d as Au, e as Dw, h as Fw, j as Cs, p as Gh, _ as qw, E as ke, y as Qe, T as As, k as Ts, l as jw, m as Tu, n as Uw, s as Mw, o as qo, q as xs, u as Wt, v as Lw, w as xu } from "./index-HPZ-1CuH.mjs";
5
5
  var se = {};
6
6
  Object.defineProperty(se, "__esModule", { value: !0 });
7
7
  se.getLocalStorage = se.getLocalStorageOrThrow = se.getCrypto = se.getCryptoOrThrow = se.getLocation = se.getLocationOrThrow = se.getNavigator = se.getNavigatorOrThrow = se.getDocument = se.getDocumentOrThrow = se.getFromWindowOrThrow = se.getFromWindow = void 0;
@@ -7825,7 +7825,7 @@ class Jo {
7825
7825
  if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? Ns(this.rpc.chains) : Ns(this.rpc.optionalChains), this.signer = await uP.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
7826
7826
  let r;
7827
7827
  try {
7828
- const { WalletConnectModal: s } = await import("./index-B-UHVwW1.mjs").then((o) => o.i);
7828
+ const { WalletConnectModal: s } = await import("./index-BulF4aYg.mjs").then((o) => o.i);
7829
7829
  r = s;
7830
7830
  } catch {
7831
7831
  throw new Error("To use QR modal, please install @walletconnect/modal package");
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("./events-Bs7CEKn9.js"),H=require("./index-hIJ0h_GZ.js"),T=require("./index-vWXFBAHR.js"),E=require("./index-S1YybQMR.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function or(a){let t;return typeof window<"u"&&typeof window[a]<"u"&&(t=window[a]),t}ne.getFromWindow=or;function $r(a){const t=or(a);if(!t)throw new Error(`${a} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function sw(){return $r("document")}ne.getDocumentOrThrow=sw;function nw(){return or("document")}ne.getDocument=nw;function ow(){return $r("navigator")}ne.getNavigatorOrThrow=ow;function aw(){return or("navigator")}ne.getNavigator=aw;function cw(){return $r("location")}ne.getLocationOrThrow=cw;function uw(){return or("location")}ne.getLocation=uw;function hw(){return $r("crypto")}ne.getCryptoOrThrow=hw;function lw(){return or("crypto")}ne.getCrypto=lw;function pw(){return $r("localStorage")}ne.getLocalStorageOrThrow=pw;function dw(){return or("localStorage")}ne.getLocalStorage=dw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const pu=ne;function fw(){let a,t;try{a=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=a.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const D=O[q],K=D.getAttribute("rel");if(K&&K.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let G=t.protocol+"//"+t.host;if(F.indexOf("/")===0)G+=F;else{const de=t.pathname.split("/");de.pop();const Z=de.join("/");G+=Z+"/"+F}N.push(G)}else if(F.indexOf("//")===0){const G=t.protocol+F;N.push(G)}else N.push(F)}}return N}function s(...O){const N=a.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const D=N[q],K=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?O.includes(F):!1);if(K.length&&K){const F=D.getAttribute("content");if(F)return F}}return""}function o(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=a.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=o(),f=u(),w=t.origin,b=r();return{description:f,url:w,icons:b,name:l}}bo.getWindowMetadata=fw;function gw(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const yw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function vw(a,t){const{message:r,code:s}=yw[a];return{message:r,code:s}}function co(a,t){return!!Array.isArray(a)}var Ar={};/*! *****************************************************************************
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("./events-XGG02Ffv.js"),H=require("./index-BkwW7sVl.js"),T=require("./index-__Yey1yr.js"),E=require("./index-y9iU2q7j.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function or(a){let t;return typeof window<"u"&&typeof window[a]<"u"&&(t=window[a]),t}ne.getFromWindow=or;function $r(a){const t=or(a);if(!t)throw new Error(`${a} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function sw(){return $r("document")}ne.getDocumentOrThrow=sw;function nw(){return or("document")}ne.getDocument=nw;function ow(){return $r("navigator")}ne.getNavigatorOrThrow=ow;function aw(){return or("navigator")}ne.getNavigator=aw;function cw(){return $r("location")}ne.getLocationOrThrow=cw;function uw(){return or("location")}ne.getLocation=uw;function hw(){return $r("crypto")}ne.getCryptoOrThrow=hw;function lw(){return or("crypto")}ne.getCrypto=lw;function pw(){return $r("localStorage")}ne.getLocalStorageOrThrow=pw;function dw(){return or("localStorage")}ne.getLocalStorage=dw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const pu=ne;function fw(){let a,t;try{a=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=a.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const D=O[q],K=D.getAttribute("rel");if(K&&K.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let G=t.protocol+"//"+t.host;if(F.indexOf("/")===0)G+=F;else{const de=t.pathname.split("/");de.pop();const Z=de.join("/");G+=Z+"/"+F}N.push(G)}else if(F.indexOf("//")===0){const G=t.protocol+F;N.push(G)}else N.push(F)}}return N}function s(...O){const N=a.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const D=N[q],K=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?O.includes(F):!1);if(K.length&&K){const F=D.getAttribute("content");if(F)return F}}return""}function o(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=a.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=o(),f=u(),w=t.origin,b=r();return{description:f,url:w,icons:b,name:l}}bo.getWindowMetadata=fw;function gw(a,t=[]){const r=[];return Object.keys(a).forEach(s=>{if(t.length&&!t.includes(s))return;const o=a[s];r.push(...o.accounts)}),r}const yw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function vw(a,t){const{message:r,code:s}=yw[a];return{message:r,code:s}}function co(a,t){return!!Array.isArray(a)}var Ar={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -43,4 +43,4 @@ __p += '`),Y&&(R+=`' +
43
43
  function print() { __p += __j.call(arguments, '') }
44
44
  `:`;
45
45
  `)+R+`return __p
46
- }`;var B=uu(function(){return ee(d,j+"return "+R).apply(r,g)});if(B.source=R,Un(B))throw B;return B}function lm(e){return te(e).toLowerCase()}function pm(e){return te(e).toUpperCase()}function dm(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Be(i)))return e;var c=at(e),h=at(i),d=wa(c,h),g=_a(c,h)+1;return kt(c,d,g).join("")}function fm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Be(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function gm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Be(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function ym(e,i){var n=cl,c=ul;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?V(i.length):n,c="omission"in i?Be(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var g=at(e);d=g.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=g?kt(g,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(g&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Be(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function vm(e){return e=te(e),e&&Rl.test(e)?e.replace(qo,Bp):e}var mm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?Lp(e)?Jp(e):Ap(e):e.match(i)||[]}var uu=W(function(e,i){try{return He(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),wm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function _m(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],W(function(c){for(var h=-1;++h<i;){var d=e[h];if(He(d[0],this,c))return He(d[1],this,c)}})}function bm(e){return Bd(et(e,O))}function Hn(e){return function(){return e}}function Em(e,i){return e==null||e!==e?i:e}var Im=pc(),Pm=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function Sm(e){return Va(et(e,O))}function Om(e,i){return Ba(e,et(i,O))}var Rm=W(function(e,i){return function(n){return Yr(n,e,i)}}),Nm=W(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,g=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,g&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Cm(){return Ie._===this&&(Ie._=ed),this}function Kn(){}function $m(e){return e=V(e),W(function(i){return Ka(i,e)})}var Am=In(ue),Tm=In(da),xm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):uf(e)}function Dm(e){return function(i){return e==null?r:Xt(e,i)}}var Fm=fc(),jm=fc(!0);function Wn(){return[]}function Jn(){return!1}function qm(){return{}}function Um(){return""}function Mm(){return!0}function Lm(e,i){if(e=V(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function km(e){return z(e)?ue(e,yt):Ke(e)?[e]:Fe($c(te(e)))}function zm(e){var i=++Zp;return te(e)+i}var Hm=Zi(function(e,i){return e+i},0),Vm=Pn("ceil"),Bm=Zi(function(e,i){return e/i},1),Km=Pn("floor");function Wm(e){return e&&e.length?Bi(e,Ue,un):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Gm(e){return ya(e,Ue)}function Qm(e,i){return ya(e,U(i,2))}function Ym(e){return e&&e.length?Bi(e,Ue,dn):r}function Zm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Xm=Zi(function(e,i){return e*i},1),ew=Pn("round"),tw=Zi(function(e,i){return e-i},0);function rw(e){return e&&e.length?Qs(e,Ue):0}function iw(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=Sy,p.ary=kc,p.assign=pv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=dv,p.at=fv,p.before=zc,p.bind=jn,p.bindAll=wm,p.bindKey=Hc,p.castArray=qy,p.chain=Uc,p.chunk=Kf,p.compact=Wf,p.concat=Jf,p.cond=_m,p.conforms=bm,p.constant=Hn,p.countBy=ry,p.create=gv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=yv,p.defaultsDeep=vv,p.defer=Oy,p.delay=Ry,p.difference=Gf,p.differenceBy=Qf,p.differenceWith=Yf,p.drop=Zf,p.dropRight=Xf,p.dropRightWhile=eg,p.dropWhile=tg,p.fill=rg,p.filter=sy,p.flatMap=ay,p.flatMapDeep=cy,p.flatMapDepth=uy,p.flatten=Dc,p.flattenDeep=ig,p.flattenDepth=sg,p.flip=Ny,p.flow=Im,p.flowRight=Pm,p.fromPairs=ng,p.functions=Pv,p.functionsIn=Sv,p.groupBy=hy,p.initial=ag,p.intersection=cg,p.intersectionBy=ug,p.intersectionWith=hg,p.invert=Rv,p.invertBy=Nv,p.invokeMap=py,p.iteratee=Vn,p.keyBy=dy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=$v,p.mapValues=Av,p.matches=Sm,p.matchesProperty=Om,p.memoize=as,p.merge=Tv,p.mergeWith=ru,p.method=Rm,p.methodOf=Nm,p.mixin=Bn,p.negate=cs,p.nthArg=$m,p.omit=xv,p.omitBy=Dv,p.once=Cy,p.orderBy=fy,p.over=Am,p.overArgs=$y,p.overEvery=Tm,p.overSome=xm,p.partial=qn,p.partialRight=Wc,p.partition=gy,p.pick=Fv,p.pickBy=iu,p.property=hu,p.propertyOf=Dm,p.pull=fg,p.pullAll=jc,p.pullAllBy=gg,p.pullAllWith=yg,p.pullAt=vg,p.range=Fm,p.rangeRight=jm,p.rearg=Ay,p.reject=my,p.remove=mg,p.rest=Ty,p.reverse=Dn,p.sampleSize=_y,p.set=qv,p.setWith=Uv,p.shuffle=by,p.slice=wg,p.sortBy=Py,p.sortedUniq=Og,p.sortedUniqBy=Rg,p.split=am,p.spread=xy,p.tail=Ng,p.take=Cg,p.takeRight=$g,p.takeRightWhile=Ag,p.takeWhile=Tg,p.tap=Wg,p.throttle=Dy,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=km,p.toPlainObject=eu,p.transform=Mv,p.unary=Fy,p.union=xg,p.unionBy=Dg,p.unionWith=Fg,p.uniq=jg,p.uniqBy=qg,p.uniqWith=Ug,p.unset=Lv,p.unzip=Fn,p.unzipWith=qc,p.update=kv,p.updateWith=zv,p.values=Sr,p.valuesIn=Hv,p.without=Mg,p.words=cu,p.wrap=jy,p.xor=Lg,p.xorBy=kg,p.xorWith=zg,p.zip=Hg,p.zipObject=Vg,p.zipObjectDeep=Bg,p.zipWith=Kg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Hm,p.attempt=uu,p.camelCase=Wv,p.capitalize=ou,p.ceil=Vm,p.clamp=Vv,p.clone=Uy,p.cloneDeep=Ly,p.cloneDeepWith=ky,p.cloneWith=My,p.conformsTo=zy,p.deburr=au,p.defaultTo=Em,p.divide=Bm,p.endsWith=Jv,p.eq=ut,p.escape=Gv,p.escapeRegExp=Qv,p.every=iy,p.find=ny,p.findIndex=Tc,p.findKey=mv,p.findLast=oy,p.findLastIndex=xc,p.findLastKey=wv,p.floor=Km,p.forEach=Mc,p.forEachRight=Lc,p.forIn=_v,p.forInRight=bv,p.forOwn=Ev,p.forOwnRight=Iv,p.get=Ln,p.gt=Hy,p.gte=Vy,p.has=Ov,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ly,p.indexOf=og,p.inRange=Bv,p.invoke=Cv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=By,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=Ky,p.isBuffer=zt,p.isDate=Wy,p.isElement=Jy,p.isEmpty=Gy,p.isEqual=Qy,p.isEqualWith=Yy,p.isError=Un,p.isFinite=Zy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Xy,p.isMatchWith=ev,p.isNaN=tv,p.isNative=rv,p.isNil=sv,p.isNull=iv,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=nv,p.isSet=Yc,p.isString=hs,p.isSymbol=Ke,p.isTypedArray=Pr,p.isUndefined=ov,p.isWeakMap=av,p.isWeakSet=cv,p.join=lg,p.kebabCase=Yv,p.last=rt,p.lastIndexOf=pg,p.lowerCase=Zv,p.lowerFirst=Xv,p.lt=uv,p.lte=hv,p.max=Wm,p.maxBy=Jm,p.mean=Gm,p.meanBy=Qm,p.min=Ym,p.minBy=Zm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=qm,p.stubString=Um,p.stubTrue=Mm,p.multiply=Xm,p.nth=dg,p.noConflict=Cm,p.noop=Kn,p.now=os,p.pad=em,p.padEnd=tm,p.padStart=rm,p.parseInt=im,p.random=Kv,p.reduce=yy,p.reduceRight=vy,p.repeat=sm,p.replace=nm,p.result=jv,p.round=ew,p.runInContext=v,p.sample=wy,p.size=Ey,p.snakeCase=om,p.some=Iy,p.sortedIndex=_g,p.sortedIndexBy=bg,p.sortedIndexOf=Eg,p.sortedLastIndex=Ig,p.sortedLastIndexBy=Pg,p.sortedLastIndexOf=Sg,p.startCase=cm,p.startsWith=um,p.subtract=tw,p.sum=rw,p.sumBy=iw,p.template=hm,p.times=Lm,p.toFinite=Ot,p.toInteger=V,p.toLength=Xc,p.toLower=lm,p.toNumber=it,p.toSafeInteger=lv,p.toString=te,p.toUpper=pm,p.trim=dm,p.trimEnd=fm,p.trimStart=gm,p.truncate=ym,p.unescape=vm,p.uniqueId=zm,p.upperCase=mm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(V(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==dl;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=W(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=V(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=V(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,m=g instanceof Q,P=y[0],S=m||z(g),R=function(J){var Y=h.apply(p,Ft([J],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,B=m&&!j;if(!d&&S){g=B?g:new Q(this);var L=e.apply(g,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&B?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(g){return i.apply(z(g)?g:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=yd,Q.prototype.reverse=vd,Q.prototype.value=md,p.prototype.at=Jg,p.prototype.chain=Gg,p.prototype.commit=Qg,p.prototype.next=Yg,p.prototype.plant=Xg,p.prototype.reverse=ey,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ty,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Zg),p},yr=Gp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,gh=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,fs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&gh(a,r,t[r]);if(fh)for(var r of fh(t))aI.call(t,r)&&gh(a,r,t[r]);return a},cI=(a,t)=>sI(a,nI(t));function Bt(a,t,r){var s;const o=C0(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${rI}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function ur(a){return a.includes(":")?a.split(":")[1]:a}function sl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function uI(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function hI(a={},t={}){const r=yh(a),s=yh(t);return _o.exports.merge(r,s)}function yh(a){var t,r,s,o;const u={};if(!Cr(a))return u;for(const[l,f]of Object.entries(a)){const w=No(l)?[l]:f.chains,b=f.methods||[],C=f.events||[],O=f.rpcMap||{},N=li(l);u[N]=cI(fs(fs({},u[N]),f),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function lI(a){return a.includes(":")?a.split(":")[2]:a}function pI(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],f=No(r)?[r]:s.chains?s.chains:sl(s.accounts);t[r]={chains:f,methods:o,events:u,accounts:l}}return t}function so(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const nl={},he=a=>nl[a],no=(a,t)=>{nl[a]=t};class dI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(ur(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class gI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class yI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class vI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=ur(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class mI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class wI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class _I{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var bI=Object.defineProperty,EI=Object.defineProperties,II=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,PI=Object.prototype.hasOwnProperty,SI=Object.prototype.propertyIsEnumerable,mh=(a,t,r)=>t in a?bI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))PI.call(t,r)&&mh(a,r,t[r]);if(vh)for(var r of vh(t))SI.call(t,r)&&mh(a,r,t[r]);return a},oo=(a,t)=>EI(a,II(t));class xo{constructor(t){this.events=new ze.ss,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:E.Tt(E.k({level:(t==null?void 0:t.logger)||ph})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=pI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==rl)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await zE.init({logger:this.providerOpts.logger||ph,relayUrl:this.providerOpts.relayUrl||XE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=uI(r,this.session),o=sl(s),u=hI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new fI({namespace:l});break;case"solana":this.rpcProviders[r]=new gI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new yI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new dI({namespace:l});break;case"cip34":this.rpcProviders[r]=new vI({namespace:l});break;case"elrond":this.rpcProviders[r]=new mI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new wI({namespace:l});break;case"near":this.rpcProviders[r]=new _I({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&nr(o)&&this.events.emit("accountsChanged",o.map(lI))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=li(o),f=so(o)!==so(u)?`${l}:${so(u)}`:o;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${dh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${dh}/${t}`)}}const OI=xo,RI="wc",NI="ethereum_provider",CI=`${RI}@2:${NI}:`,$I="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],ol=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],al=["chainChanged","accountsChanged","message","disconnect","connect"];var AI=Object.defineProperty,TI=Object.defineProperties,xI=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,DI=Object.prototype.hasOwnProperty,FI=Object.prototype.propertyIsEnumerable,_h=(a,t,r)=>t in a?AI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,di=(a,t)=>{for(var r in t||(t={}))DI.call(t,r)&&_h(a,r,t[r]);if(wh)for(var r of wh(t))FI.call(t,r)&&_h(a,r,t[r]);return a},bh=(a,t)=>TI(a,xI(t));function Es(a){return Number(a[0].split(":")[1])}function ao(a){return`0x${a.toString(16)}`}function jI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:f}=a;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:f[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:ol))],events:[...new Set(w.events.concat(l!=null&&l.length?l:al))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new ze.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=jI(this.rpc);try{const o=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(bh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{f(new Error(b.message))})});if(!o)return;const u=gw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",bh(di({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=o.length?(t==null?void 0:t.methods)||_s:[],w=o.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:f,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await OI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-CqSLXgKG.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${$I}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const qI=Os;exports.EthereumProvider=qI;exports.OPTIONAL_EVENTS=al;exports.OPTIONAL_METHODS=ol;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
46
+ }`;var B=uu(function(){return ee(d,j+"return "+R).apply(r,g)});if(B.source=R,Un(B))throw B;return B}function lm(e){return te(e).toLowerCase()}function pm(e){return te(e).toUpperCase()}function dm(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Be(i)))return e;var c=at(e),h=at(i),d=wa(c,h),g=_a(c,h)+1;return kt(c,d,g).join("")}function fm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Be(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function gm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Be(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function ym(e,i){var n=cl,c=ul;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?V(i.length):n,c="omission"in i?Be(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var g=at(e);d=g.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=g?kt(g,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(g&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Be(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function vm(e){return e=te(e),e&&Rl.test(e)?e.replace(qo,Bp):e}var mm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?Lp(e)?Jp(e):Ap(e):e.match(i)||[]}var uu=W(function(e,i){try{return He(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),wm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function _m(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],W(function(c){for(var h=-1;++h<i;){var d=e[h];if(He(d[0],this,c))return He(d[1],this,c)}})}function bm(e){return Bd(et(e,O))}function Hn(e){return function(){return e}}function Em(e,i){return e==null||e!==e?i:e}var Im=pc(),Pm=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function Sm(e){return Va(et(e,O))}function Om(e,i){return Ba(e,et(i,O))}var Rm=W(function(e,i){return function(n){return Yr(n,e,i)}}),Nm=W(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,g=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,g&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Cm(){return Ie._===this&&(Ie._=ed),this}function Kn(){}function $m(e){return e=V(e),W(function(i){return Ka(i,e)})}var Am=In(ue),Tm=In(da),xm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):uf(e)}function Dm(e){return function(i){return e==null?r:Xt(e,i)}}var Fm=fc(),jm=fc(!0);function Wn(){return[]}function Jn(){return!1}function qm(){return{}}function Um(){return""}function Mm(){return!0}function Lm(e,i){if(e=V(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function km(e){return z(e)?ue(e,yt):Ke(e)?[e]:Fe($c(te(e)))}function zm(e){var i=++Zp;return te(e)+i}var Hm=Zi(function(e,i){return e+i},0),Vm=Pn("ceil"),Bm=Zi(function(e,i){return e/i},1),Km=Pn("floor");function Wm(e){return e&&e.length?Bi(e,Ue,un):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Gm(e){return ya(e,Ue)}function Qm(e,i){return ya(e,U(i,2))}function Ym(e){return e&&e.length?Bi(e,Ue,dn):r}function Zm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Xm=Zi(function(e,i){return e*i},1),ew=Pn("round"),tw=Zi(function(e,i){return e-i},0);function rw(e){return e&&e.length?Qs(e,Ue):0}function iw(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=Sy,p.ary=kc,p.assign=pv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=dv,p.at=fv,p.before=zc,p.bind=jn,p.bindAll=wm,p.bindKey=Hc,p.castArray=qy,p.chain=Uc,p.chunk=Kf,p.compact=Wf,p.concat=Jf,p.cond=_m,p.conforms=bm,p.constant=Hn,p.countBy=ry,p.create=gv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=yv,p.defaultsDeep=vv,p.defer=Oy,p.delay=Ry,p.difference=Gf,p.differenceBy=Qf,p.differenceWith=Yf,p.drop=Zf,p.dropRight=Xf,p.dropRightWhile=eg,p.dropWhile=tg,p.fill=rg,p.filter=sy,p.flatMap=ay,p.flatMapDeep=cy,p.flatMapDepth=uy,p.flatten=Dc,p.flattenDeep=ig,p.flattenDepth=sg,p.flip=Ny,p.flow=Im,p.flowRight=Pm,p.fromPairs=ng,p.functions=Pv,p.functionsIn=Sv,p.groupBy=hy,p.initial=ag,p.intersection=cg,p.intersectionBy=ug,p.intersectionWith=hg,p.invert=Rv,p.invertBy=Nv,p.invokeMap=py,p.iteratee=Vn,p.keyBy=dy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=$v,p.mapValues=Av,p.matches=Sm,p.matchesProperty=Om,p.memoize=as,p.merge=Tv,p.mergeWith=ru,p.method=Rm,p.methodOf=Nm,p.mixin=Bn,p.negate=cs,p.nthArg=$m,p.omit=xv,p.omitBy=Dv,p.once=Cy,p.orderBy=fy,p.over=Am,p.overArgs=$y,p.overEvery=Tm,p.overSome=xm,p.partial=qn,p.partialRight=Wc,p.partition=gy,p.pick=Fv,p.pickBy=iu,p.property=hu,p.propertyOf=Dm,p.pull=fg,p.pullAll=jc,p.pullAllBy=gg,p.pullAllWith=yg,p.pullAt=vg,p.range=Fm,p.rangeRight=jm,p.rearg=Ay,p.reject=my,p.remove=mg,p.rest=Ty,p.reverse=Dn,p.sampleSize=_y,p.set=qv,p.setWith=Uv,p.shuffle=by,p.slice=wg,p.sortBy=Py,p.sortedUniq=Og,p.sortedUniqBy=Rg,p.split=am,p.spread=xy,p.tail=Ng,p.take=Cg,p.takeRight=$g,p.takeRightWhile=Ag,p.takeWhile=Tg,p.tap=Wg,p.throttle=Dy,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=km,p.toPlainObject=eu,p.transform=Mv,p.unary=Fy,p.union=xg,p.unionBy=Dg,p.unionWith=Fg,p.uniq=jg,p.uniqBy=qg,p.uniqWith=Ug,p.unset=Lv,p.unzip=Fn,p.unzipWith=qc,p.update=kv,p.updateWith=zv,p.values=Sr,p.valuesIn=Hv,p.without=Mg,p.words=cu,p.wrap=jy,p.xor=Lg,p.xorBy=kg,p.xorWith=zg,p.zip=Hg,p.zipObject=Vg,p.zipObjectDeep=Bg,p.zipWith=Kg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Hm,p.attempt=uu,p.camelCase=Wv,p.capitalize=ou,p.ceil=Vm,p.clamp=Vv,p.clone=Uy,p.cloneDeep=Ly,p.cloneDeepWith=ky,p.cloneWith=My,p.conformsTo=zy,p.deburr=au,p.defaultTo=Em,p.divide=Bm,p.endsWith=Jv,p.eq=ut,p.escape=Gv,p.escapeRegExp=Qv,p.every=iy,p.find=ny,p.findIndex=Tc,p.findKey=mv,p.findLast=oy,p.findLastIndex=xc,p.findLastKey=wv,p.floor=Km,p.forEach=Mc,p.forEachRight=Lc,p.forIn=_v,p.forInRight=bv,p.forOwn=Ev,p.forOwnRight=Iv,p.get=Ln,p.gt=Hy,p.gte=Vy,p.has=Ov,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ly,p.indexOf=og,p.inRange=Bv,p.invoke=Cv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=By,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=Ky,p.isBuffer=zt,p.isDate=Wy,p.isElement=Jy,p.isEmpty=Gy,p.isEqual=Qy,p.isEqualWith=Yy,p.isError=Un,p.isFinite=Zy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Xy,p.isMatchWith=ev,p.isNaN=tv,p.isNative=rv,p.isNil=sv,p.isNull=iv,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=nv,p.isSet=Yc,p.isString=hs,p.isSymbol=Ke,p.isTypedArray=Pr,p.isUndefined=ov,p.isWeakMap=av,p.isWeakSet=cv,p.join=lg,p.kebabCase=Yv,p.last=rt,p.lastIndexOf=pg,p.lowerCase=Zv,p.lowerFirst=Xv,p.lt=uv,p.lte=hv,p.max=Wm,p.maxBy=Jm,p.mean=Gm,p.meanBy=Qm,p.min=Ym,p.minBy=Zm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=qm,p.stubString=Um,p.stubTrue=Mm,p.multiply=Xm,p.nth=dg,p.noConflict=Cm,p.noop=Kn,p.now=os,p.pad=em,p.padEnd=tm,p.padStart=rm,p.parseInt=im,p.random=Kv,p.reduce=yy,p.reduceRight=vy,p.repeat=sm,p.replace=nm,p.result=jv,p.round=ew,p.runInContext=v,p.sample=wy,p.size=Ey,p.snakeCase=om,p.some=Iy,p.sortedIndex=_g,p.sortedIndexBy=bg,p.sortedIndexOf=Eg,p.sortedLastIndex=Ig,p.sortedLastIndexBy=Pg,p.sortedLastIndexOf=Sg,p.startCase=cm,p.startsWith=um,p.subtract=tw,p.sum=rw,p.sumBy=iw,p.template=hm,p.times=Lm,p.toFinite=Ot,p.toInteger=V,p.toLength=Xc,p.toLower=lm,p.toNumber=it,p.toSafeInteger=lv,p.toString=te,p.toUpper=pm,p.trim=dm,p.trimEnd=fm,p.trimStart=gm,p.truncate=ym,p.unescape=vm,p.uniqueId=zm,p.upperCase=mm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(V(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==dl;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=W(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=V(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=V(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,m=g instanceof Q,P=y[0],S=m||z(g),R=function(J){var Y=h.apply(p,Ft([J],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,B=m&&!j;if(!d&&S){g=B?g:new Q(this);var L=e.apply(g,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&B?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(g){return i.apply(z(g)?g:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=yd,Q.prototype.reverse=vd,Q.prototype.value=md,p.prototype.at=Jg,p.prototype.chain=Gg,p.prototype.commit=Qg,p.prototype.next=Yg,p.prototype.plant=Xg,p.prototype.reverse=ey,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ty,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Zg),p},yr=Gp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var iI=Object.defineProperty,sI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,oI=Object.prototype.hasOwnProperty,aI=Object.prototype.propertyIsEnumerable,gh=(a,t,r)=>t in a?iI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,fs=(a,t)=>{for(var r in t||(t={}))oI.call(t,r)&&gh(a,r,t[r]);if(fh)for(var r of fh(t))aI.call(t,r)&&gh(a,r,t[r]);return a},cI=(a,t)=>sI(a,nI(t));function Bt(a,t,r){var s;const o=C0(a);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${rI}?chainId=${o.namespace}:${o.reference}&projectId=${r}`}function ur(a){return a.includes(":")?a.split(":")[1]:a}function sl(a){return a.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function uI(a,t){const r=Object.keys(t.namespaces).filter(o=>o.includes(a));if(!r.length)return[];const s=[];return r.forEach(o=>{const u=t.namespaces[o].accounts;s.push(...u)}),s}function hI(a={},t={}){const r=yh(a),s=yh(t);return _o.exports.merge(r,s)}function yh(a){var t,r,s,o;const u={};if(!Cr(a))return u;for(const[l,f]of Object.entries(a)){const w=No(l)?[l]:f.chains,b=f.methods||[],C=f.events||[],O=f.rpcMap||{},N=li(l);u[N]=cI(fs(fs({},u[N]),f),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(o=u[N])==null?void 0:o.rpcMap)})}return u}function lI(a){return a.includes(":")?a.split(":")[2]:a}function pI(a){const t={};for(const[r,s]of Object.entries(a)){const o=s.methods||[],u=s.events||[],l=s.accounts||[],f=No(r)?[r]:s.chains?s.chains:sl(s.accounts);t[r]={chains:f,methods:o,events:u,accounts:l}}return t}function so(a){return typeof a=="number"?a:a.includes("0x")?parseInt(a,16):a.includes(":")?Number(a.split(":")[1]):Number(a)}const nl={},he=a=>nl[a],no=(a,t)=>{nl[a]=t};class dI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=parseInt(ur(r));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let o=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const u=parseInt(o,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class gI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class yI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class vI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),o=ur(r);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class mI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class wI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const o=ur(r);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class _I{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var bI=Object.defineProperty,EI=Object.defineProperties,II=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,PI=Object.prototype.hasOwnProperty,SI=Object.prototype.propertyIsEnumerable,mh=(a,t,r)=>t in a?bI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,gs=(a,t)=>{for(var r in t||(t={}))PI.call(t,r)&&mh(a,r,t[r]);if(vh)for(var r of vh(t))SI.call(t,r)&&mh(a,r,t[r]);return a},oo=(a,t)=>EI(a,II(t));class xo{constructor(t){this.events=new ze.ss,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:E.Tt(E.k({level:(t==null?void 0:t.logger)||ph})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${o}`,topic:this.session.topic})}sendAsync(t,r,s){const o=new Date().getTime();this.request(t,s).then(u=>r(null,E.formatJsonRpcResult(o,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(u=>{this.session=u,this.namespaces||(this.namespaces=pI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==rl)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,o]=this.validateChain(t);this.getProvider(s).setDefaultChain(o,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await zE.init({logger:this.providerOpts.logger||ph,relayUrl:this.providerOpts.relayUrl||XE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=uI(r,this.session),o=sl(s),u=hI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:o});switch(r){case"eip155":this.rpcProviders[r]=new fI({namespace:l});break;case"solana":this.rpcProviders[r]=new gI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new yI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new dI({namespace:l});break;case"cip34":this.rpcProviders[r]=new vI({namespace:l});break;case"elrond":this.rpcProviders[r]=new mI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new wI({namespace:l});break;case"near":this.rpcProviders[r]=new _I({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const o=s.data;o&&nr(o)&&this.events.emit("accountsChanged",o.map(lI))}else if(s.name==="chainChanged"){const o=r.chainId,u=r.event.data,l=li(o),f=so(o)!==so(u)?`${l}:${so(u)}`:o;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:o}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:o}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const o=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[o].getDefaultChain();return[o,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[o,u]=this.validateChain(t);r||this.getProvider(o).setDefaultChain(u),((s=this.namespaces[o])!=null?s:this.namespaces[`${o}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${dh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${dh}/${t}`)}}const OI=xo,RI="wc",NI="ethereum_provider",CI=`${RI}@2:${NI}:`,$I="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],ol=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],al=["chainChanged","accountsChanged","message","disconnect","connect"];var AI=Object.defineProperty,TI=Object.defineProperties,xI=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,DI=Object.prototype.hasOwnProperty,FI=Object.prototype.propertyIsEnumerable,_h=(a,t,r)=>t in a?AI(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,di=(a,t)=>{for(var r in t||(t={}))DI.call(t,r)&&_h(a,r,t[r]);if(wh)for(var r of wh(t))FI.call(t,r)&&_h(a,r,t[r]);return a},bh=(a,t)=>TI(a,xI(t));function Es(a){return Number(a[0].split(":")[1])}function ao(a){return`0x${a.toString(16)}`}function jI(a){const{chains:t,optionalChains:r,methods:s,optionalMethods:o,events:u,optionalEvents:l,rpcMap:f}=a;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:f[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!o&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(o!=null&&o.length?o:ol))],events:[...new Set(w.events.concat(l!=null&&l.length?l:al))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new ze.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=jI(this.rpc);try{const o=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(bh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{f(new Error(b.message))})});if(!o)return;const u=gw(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",bh(di({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,o]=t.split(":");return{chainId:`${r}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const o=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=o.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=o.length?(t==null?void 0:t.methods)||_s:[],w=o.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:f,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await OI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-Be3OOifD.js")).then(o=>o.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:o}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(o==null?void 0:o[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${$I}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const qI=Os;exports.EthereumProvider=qI;exports.OPTIONAL_EVENTS=al;exports.OPTIONAL_METHODS=ol;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-hIJ0h_GZ.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticPorticoRoute=t.AutomaticPorticoRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.buildConfig=t.buildConfig;exports.default=t.WormholeConnect;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;exports.wormholeConnectHosted=t.wormholeConnectHosted;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-BkwW7sVl.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticPorticoRoute=t.AutomaticPorticoRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.buildConfig=t.buildConfig;exports.default=t.WormholeConnect;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;exports.wormholeConnectHosted=t.wormholeConnectHosted;
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { cQ as o, cS as c, cO as e, cR as s, cK as u, cH as R, cT as n, cV as T, cW as i, cU as M, cI as C, cP as m, cJ as r, cG as A, cM as d, cN as E, cL as P, cX as l } from "./index-C6iaLaJq.mjs";
1
+ import { cQ as o, cS as c, cO as e, cR as s, cK as u, cH as R, cT as n, cV as T, cW as i, cU as M, cI as C, cP as m, cJ as r, cG as A, cM as d, cN as E, cL as P, cX as l } from "./index-VnCbpsUO.mjs";
2
2
  export {
3
3
  o as AutomaticCCTPRoute,
4
4
  c as AutomaticPorticoRoute,
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var B=(r,t,e)=>t in r?P(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var h=(r,t,e)=>B(r,typeof t!="symbol"?t+"":t,e);const c=require("./index-hIJ0h_GZ.js"),y=.5,F=1,E=1,T=1e9,b=5,w=25e4;async function x(r,t,e){const[n,i]=await c.SolanaPlatform.chainFromRpc(r),d=typeof t=="string"?c.Keypair.fromSecretKey(c.b58.decode(t)):t;if(e!=null&&e.priorityFee&&e.priorityFee.percentile&&e.priorityFee.percentile>1)throw new Error("priorityFeePercentile must be a number between 0 and 1");return new I(r,i,d,(e==null?void 0:e.debug)??!1,(e==null?void 0:e.priorityFee)??{},(e==null?void 0:e.retries)??b,e==null?void 0:e.sendOpts)}class I{constructor(t,e,n,i=!1,d,u=b,g){h(this,"_rpc");h(this,"_chain");h(this,"_keypair");h(this,"_debug");h(this,"_priorityFee");h(this,"_maxResubmits");h(this,"_sendOpts");this._rpc=t,this._chain=e,this._keypair=n,this._debug=i,this._priorityFee=d,this._maxResubmits=u,this._sendOpts=g,this._sendOpts=this._sendOpts??{preflightCommitment:this._rpc.commitment}}chain(){return this._chain}address(){return this._keypair.publicKey.toBase58()}retryable(t){var n;if(t instanceof c.TransactionExpiredBlockheightExceededError)return!0;if(!(t instanceof c.SendTransactionError)||!t.message.includes("Transaction simulation failed"))return!1;if(t.message.includes("Blockhash not found"))return!0;const e=(n=t.logs)==null?void 0:n.find(i=>i.startsWith("Program log: Error: "));return e?!!(e.includes("Not enough bytes")||e.includes("Unexpected length of input")):!1}async signAndSend(t){var g;let{blockhash:e,lastValidBlockHeight:n}=await c.SolanaPlatform.latestBlock(this._rpc);const i=[];for(const o of t){const{description:l,transaction:{transaction:a,signers:s}}=o;this._debug&&console.log(`Signing: ${l} for ${this.address()}`);let m;(g=this._priorityFee)!=null&&g.percentile&&this._priorityFee.percentile>0&&(m=await M(this._rpc,a,this._priorityFee.percentile,this._priorityFee.percentileMultiple,this._priorityFee.min,this._priorityFee.max)),this._debug&&A(a);for(let f=0;f<this._maxResubmits;f++)try{if(c.isVersionedTransaction(a)){if(m&&f===0){const _=c.TransactionMessage.decompile(a.message);_.instructions.push(...m),a.message=_.compileToV0Message()}a.message.recentBlockhash=e,a.sign([this._keypair,...s??[]])}else m&&f===0&&a.add(...m),a.recentBlockhash=e,a.lastValidBlockHeight=n,a.partialSign(this._keypair,...s??[]);this._debug&&console.log("Submitting transactions ");const{signature:p}=await c.SolanaPlatform.sendTxWithRetry(this._rpc,a.serialize(),this._sendOpts);i.push(p);break}catch(p){if(f===this._maxResubmits-1||!this.retryable(p))throw p;this._debug&&console.log(`Failed to send transaction on attempt ${f}, retrying: `,p);const{blockhash:_,lastValidBlockHeight:k}=await c.SolanaPlatform.latestBlock(this._rpc);n=k,e=_}}this._debug&&console.log("Waiting for confirmation for: ",i);const u=(await Promise.all(i.map(async o=>{try{return await this._rpc.confirmTransaction({signature:o,blockhash:e,lastValidBlockHeight:n},this._rpc.commitment)}catch(l){throw console.error("Failed to confirm transaction: ",l),l}}))).filter(o=>o.value.err).map(o=>o.value.err);if(u.length>0)throw new Error(`Failed to confirm transaction: ${u}`);return i}}function A(r){if(c.isVersionedTransaction(r)){console.log(r.signatures);const t=r.message,e=t.getAccountKeys();t.compiledInstructions.forEach(n=>{console.log("Program",e.get(n.programIdIndex).toBase58()),console.log("Data: ",c.hex.encode(n.data)),console.log("Keys: ",n.accountKeyIndexes.map(i=>[i,e.get(i).toBase58()]))})}else console.log(r.signatures),console.log(r.feePayer),r.instructions.forEach(t=>{console.log("Program",t.programId.toBase58()),console.log("Data: ",t.data.toString("hex")),console.log("Keys: ",t.keys.map(e=>[e,e.pubkey.toBase58()]))})}async function M(r,t,e=y,n=F,i=E,d=T){const[u,g]=await Promise.all([R(r,t),S(r,t,e,n,i,d)]);return[c.ComputeBudgetProgram.setComputeUnitLimit({units:u}),c.ComputeBudgetProgram.setComputeUnitPrice({microLamports:g})]}async function R(r,t){var n;let e=w;try{const i=await(c.isVersionedTransaction(t),r.simulateTransaction(t));i.value.err&&console.error(`Error simulating Solana transaction: ${i.value.err}`),(n=i==null?void 0:i.value)!=null&&n.unitsConsumed&&(e=Math.round(i.value.unitsConsumed*1.2))}catch(i){console.error(`Failed to calculate compute unit limit for Solana transaction: ${i}`)}return e}async function S(r,t,e=y,n=F,i=E,d=T){let u=i,g=[];if(c.isVersionedTransaction(t)){const o=(await Promise.all(t.message.addressTableLookups.map(s=>r.getAddressLookupTable(s.accountKey)))).map(s=>s.value).filter(s=>s!==null),l=t.message,a=l.getAccountKeys({addressLookupTableAccounts:o??void 0});g=l.compiledInstructions.flatMap(s=>s.accountKeyIndexes).map(s=>l.isAccountWritable(s)?a.get(s):null).filter(s=>s!==null)}else g=t.instructions.flatMap(o=>o.keys).map(o=>o.isWritable?o.pubkey:null).filter(o=>o!==null);try{const o=await r.getRecentPrioritizationFees({lockedWritableAccounts:g});if(o){const l=o.map(s=>s.prioritizationFee).sort((s,m)=>s-m),a=Math.ceil(l.length*e);if(l.length>a){let s=l[a];n>0&&(s*=n),u=Math.max(u,s)}}}catch(o){console.error("Error fetching Solana recent fees",o)}return Math.min(Math.max(u,i),d)}exports.determinePriorityFee=S;exports.getSolanaSignAndSendSigner=x;
1
+ "use strict";var P=Object.defineProperty;var B=(r,t,e)=>t in r?P(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var h=(r,t,e)=>B(r,typeof t!="symbol"?t+"":t,e);const c=require("./index-BkwW7sVl.js"),y=.5,F=1,E=1,T=1e9,b=5,w=25e4;async function x(r,t,e){const[n,i]=await c.SolanaPlatform.chainFromRpc(r),d=typeof t=="string"?c.Keypair.fromSecretKey(c.b58.decode(t)):t;if(e!=null&&e.priorityFee&&e.priorityFee.percentile&&e.priorityFee.percentile>1)throw new Error("priorityFeePercentile must be a number between 0 and 1");return new I(r,i,d,(e==null?void 0:e.debug)??!1,(e==null?void 0:e.priorityFee)??{},(e==null?void 0:e.retries)??b,e==null?void 0:e.sendOpts)}class I{constructor(t,e,n,i=!1,d,u=b,g){h(this,"_rpc");h(this,"_chain");h(this,"_keypair");h(this,"_debug");h(this,"_priorityFee");h(this,"_maxResubmits");h(this,"_sendOpts");this._rpc=t,this._chain=e,this._keypair=n,this._debug=i,this._priorityFee=d,this._maxResubmits=u,this._sendOpts=g,this._sendOpts=this._sendOpts??{preflightCommitment:this._rpc.commitment}}chain(){return this._chain}address(){return this._keypair.publicKey.toBase58()}retryable(t){var n;if(t instanceof c.TransactionExpiredBlockheightExceededError)return!0;if(!(t instanceof c.SendTransactionError)||!t.message.includes("Transaction simulation failed"))return!1;if(t.message.includes("Blockhash not found"))return!0;const e=(n=t.logs)==null?void 0:n.find(i=>i.startsWith("Program log: Error: "));return e?!!(e.includes("Not enough bytes")||e.includes("Unexpected length of input")):!1}async signAndSend(t){var g;let{blockhash:e,lastValidBlockHeight:n}=await c.SolanaPlatform.latestBlock(this._rpc);const i=[];for(const o of t){const{description:l,transaction:{transaction:a,signers:s}}=o;this._debug&&console.log(`Signing: ${l} for ${this.address()}`);let m;(g=this._priorityFee)!=null&&g.percentile&&this._priorityFee.percentile>0&&(m=await M(this._rpc,a,this._priorityFee.percentile,this._priorityFee.percentileMultiple,this._priorityFee.min,this._priorityFee.max)),this._debug&&A(a);for(let f=0;f<this._maxResubmits;f++)try{if(c.isVersionedTransaction(a)){if(m&&f===0){const _=c.TransactionMessage.decompile(a.message);_.instructions.push(...m),a.message=_.compileToV0Message()}a.message.recentBlockhash=e,a.sign([this._keypair,...s??[]])}else m&&f===0&&a.add(...m),a.recentBlockhash=e,a.lastValidBlockHeight=n,a.partialSign(this._keypair,...s??[]);this._debug&&console.log("Submitting transactions ");const{signature:p}=await c.SolanaPlatform.sendTxWithRetry(this._rpc,a.serialize(),this._sendOpts);i.push(p);break}catch(p){if(f===this._maxResubmits-1||!this.retryable(p))throw p;this._debug&&console.log(`Failed to send transaction on attempt ${f}, retrying: `,p);const{blockhash:_,lastValidBlockHeight:k}=await c.SolanaPlatform.latestBlock(this._rpc);n=k,e=_}}this._debug&&console.log("Waiting for confirmation for: ",i);const u=(await Promise.all(i.map(async o=>{try{return await this._rpc.confirmTransaction({signature:o,blockhash:e,lastValidBlockHeight:n},this._rpc.commitment)}catch(l){throw console.error("Failed to confirm transaction: ",l),l}}))).filter(o=>o.value.err).map(o=>o.value.err);if(u.length>0)throw new Error(`Failed to confirm transaction: ${u}`);return i}}function A(r){if(c.isVersionedTransaction(r)){console.log(r.signatures);const t=r.message,e=t.getAccountKeys();t.compiledInstructions.forEach(n=>{console.log("Program",e.get(n.programIdIndex).toBase58()),console.log("Data: ",c.hex.encode(n.data)),console.log("Keys: ",n.accountKeyIndexes.map(i=>[i,e.get(i).toBase58()]))})}else console.log(r.signatures),console.log(r.feePayer),r.instructions.forEach(t=>{console.log("Program",t.programId.toBase58()),console.log("Data: ",t.data.toString("hex")),console.log("Keys: ",t.keys.map(e=>[e,e.pubkey.toBase58()]))})}async function M(r,t,e=y,n=F,i=E,d=T){const[u,g]=await Promise.all([R(r,t),S(r,t,e,n,i,d)]);return[c.ComputeBudgetProgram.setComputeUnitLimit({units:u}),c.ComputeBudgetProgram.setComputeUnitPrice({microLamports:g})]}async function R(r,t){var n;let e=w;try{const i=await(c.isVersionedTransaction(t),r.simulateTransaction(t));i.value.err&&console.error(`Error simulating Solana transaction: ${i.value.err}`),(n=i==null?void 0:i.value)!=null&&n.unitsConsumed&&(e=Math.round(i.value.unitsConsumed*1.2))}catch(i){console.error(`Failed to calculate compute unit limit for Solana transaction: ${i}`)}return e}async function S(r,t,e=y,n=F,i=E,d=T){let u=i,g=[];if(c.isVersionedTransaction(t)){const o=(await Promise.all(t.message.addressTableLookups.map(s=>r.getAddressLookupTable(s.accountKey)))).map(s=>s.value).filter(s=>s!==null),l=t.message,a=l.getAccountKeys({addressLookupTableAccounts:o??void 0});g=l.compiledInstructions.flatMap(s=>s.accountKeyIndexes).map(s=>l.isAccountWritable(s)?a.get(s):null).filter(s=>s!==null)}else g=t.instructions.flatMap(o=>o.keys).map(o=>o.isWritable?o.pubkey:null).filter(o=>o!==null);try{const o=await r.getRecentPrioritizationFees({lockedWritableAccounts:g});if(o){const l=o.map(s=>s.prioritizationFee).sort((s,m)=>s-m),a=Math.ceil(l.length*e);if(l.length>a){let s=l[a];n>0&&(s*=n),u=Math.max(u,s)}}}catch(o){console.error("Error fetching Solana recent fees",o)}return Math.min(Math.max(u,i),d)}exports.determinePriorityFee=S;exports.getSolanaSignAndSendSigner=x;
@@ -1,7 +1,7 @@
1
1
  var S = Object.defineProperty;
2
2
  var x = (r, t, e) => t in r ? S(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
3
  var h = (r, t, e) => x(r, typeof t != "symbol" ? t + "" : t, e);
4
- import { e as _, ao as I, ap as P, aq as A, ar as M, aj as y, ak as R, s as L, am as F } from "./index-C6iaLaJq.mjs";
4
+ import { e as _, ao as I, ap as P, aq as A, ar as M, aj as y, ak as R, s as L, am as F } from "./index-VnCbpsUO.mjs";
5
5
  const E = 0.5, b = 1, T = 1, k = 1e9, B = 5, U = 25e4;
6
6
  async function V(r, t, e) {
7
7
  const [n, i] = await _.chainFromRpc(r), g = typeof t == "string" ? I.fromSecretKey(P.decode(t)) : t;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BkwW7sVl.js"),i=require("./signer-BCBltKYs.js"),a={Address:e.SolanaAddress,Platform:e.SolanaPlatform,getSigner:i.getSolanaSignAndSendSigner,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-BkwW7sVl.js")).then(r=>r.index$2),TokenBridge:()=>Promise.resolve().then(()=>require("./index-DAxtlqpX.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-Bq6gyFEW.js"))},getChain:(r,o,n)=>new e.SolanaChain(o,new e.SolanaPlatform(r,e.applyChainsConfigConfigOverrides(r,e._platform$1,{[o]:n})))};exports.default=a;