@wormhole-foundation/wormhole-connect 1.1.2-beta.1-development → 1.1.2

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 (104) hide show
  1. package/dist/assets/{ccip-DG5PxfxZ.js → ccip-DI-56zRJ.js} +1 -1
  2. package/dist/assets/{evm-CpEqLT_y.js → evm-0teEmKN1.js} +4 -4
  3. package/dist/assets/index-B-0vsM22.js +2 -0
  4. package/dist/assets/{index-CsGdgxew.js → index-BzxxtumF.js} +1 -1
  5. package/dist/assets/{index-CDRpv8fM.js → index-VdBo9Lrk.js} +1 -1
  6. package/dist/assets/{index.es-uOIRXoHK.js → index.es-Bu6qFU8A.js} +2 -2
  7. package/dist/main.js +3 -3
  8. package/lib/{algorand-Dm6TKWo1.mjs → algorand-BvImDZOY.mjs} +3 -3
  9. package/lib/{algorand-DZQLtCs3.js → algorand-DE9FRXgN.js} +1 -1
  10. package/lib/{aptos-BgGyOa6d.js → aptos-3DXmnj_V.js} +1 -1
  11. package/lib/{aptos-Oi2w7M7g.js → aptos-BlW8I71o.js} +2 -2
  12. package/lib/{aptos-C2XVzOAY.mjs → aptos-CB-AuU77.mjs} +1 -1
  13. package/lib/{aptos-CuJuzlQ4.mjs → aptos-XAeIff0t.mjs} +3 -3
  14. package/lib/{ccip-DpMplNou.js → ccip-9n_Qxt0R.js} +1 -1
  15. package/lib/{ccip-dAqJN7S0.mjs → ccip-D4nJdg4A.mjs} +1 -1
  16. package/lib/{cosmos-90bGYuhD.js → cosmos-CCyOFdEG.js} +11 -11
  17. package/lib/{cosmos-zIwOBV8H.mjs → cosmos-CwD_DJf3.mjs} +5 -5
  18. package/lib/{cosmwasm-CrtL_ala.js → cosmwasm-DpoXBVof.js} +3 -3
  19. package/lib/{cosmwasm-B90CBMmk.mjs → cosmwasm-Il1aGHnW.mjs} +3545 -3545
  20. package/lib/{events-COwefqOt.js → events-CtBArP61.js} +1 -1
  21. package/lib/{events-CkXgb0qh.mjs → events-DfpxB97c.mjs} +1 -1
  22. package/lib/{evm-ETVyy1bF.mjs → evm-BpuQtJ8_.mjs} +7 -7
  23. package/lib/{evm-DOnB2oR6.mjs → evm-CN7tgAvo.mjs} +6 -6
  24. package/lib/{evm-BdVnM5pA.js → evm-DaPdv30H.js} +1 -1
  25. package/lib/{evm-BN522EMV.js → evm-DpeDk5Nh.js} +4 -4
  26. package/lib/{index-CszotuUi.mjs → index-ApLQaDxZ.mjs} +801 -802
  27. package/lib/{index-2r-kWsjk.mjs → index-BFwJgm6v.mjs} +26 -26
  28. package/lib/{index-q0kjBXQA.js → index-BHCgxQwZ.js} +1 -1
  29. package/lib/{index-CKK14LS0.js → index-BKOVTycI.js} +1 -1
  30. package/lib/{index-CngGxdSU.mjs → index-BKPjri19.mjs} +3 -3
  31. package/lib/{index-RBlsEf3k.js → index-BL_MFlnD.js} +1 -1
  32. package/lib/{index-Dv2SHpnV.mjs → index-BM-VcJTM.mjs} +2 -2
  33. package/lib/{index-Be9Bg4au.js → index-BRjEp0OC.js} +1 -1
  34. package/lib/{index-B8U_Gr4R.mjs → index-BfeLH5sq.mjs} +1 -1
  35. package/lib/{index-kIexF0uT.js → index-BftGQ9Od.js} +1 -1
  36. package/lib/{index-DXkh0tUi.js → index-BgFwiloS.js} +1 -1
  37. package/lib/{index-DxTkOnq6.js → index-BotFZLPy.js} +1 -1
  38. package/lib/{index-BiEcDoCp.mjs → index-BwIgDsNh.mjs} +3 -3
  39. package/lib/{index-CfsjU0i8.mjs → index-BzaBnueC.mjs} +2 -2
  40. package/lib/{index-B5_WNdeb.js → index-C5CCTl6l.js} +1 -1
  41. package/lib/{index-CcPZaBV3.js → index-C8scDSKY.js} +1 -1
  42. package/lib/{index-_6ORrwJQ.js → index-CBF49TfW.js} +1 -1
  43. package/lib/{index-Oa-p0V5E.mjs → index-CDOGnmS6.mjs} +15 -15
  44. package/lib/{index-Dnfo149P.js → index-CJW6Pm_4.js} +1 -1
  45. package/lib/{index-B3rePQFd.mjs → index-CLC5CDh5.mjs} +18 -18
  46. package/lib/index-COw96Rua.js +1 -0
  47. package/lib/{index-CTVxLNgQ.mjs → index-CQWae6d6.mjs} +225 -225
  48. package/lib/{index-CAO9VKRh.mjs → index-CUGz5TgW.mjs} +1 -1
  49. package/lib/{index-Cx4LuiA1.mjs → index-CWJ0_bh7.mjs} +7 -7
  50. package/lib/{index-Dx54Fq-M.js → index-Cm2uDBOI.js} +1 -1
  51. package/lib/{index-BUJ1M7Ob.mjs → index-CvGX-2FX.mjs} +15 -15
  52. package/lib/{index-CKEOPl_r.js → index-CyWI3U2D.js} +1 -1
  53. package/lib/{index-CUNm43cC.mjs → index-D1-QjqzB.mjs} +30 -30
  54. package/lib/{index-D_IvJasJ.mjs → index-D71mFhtN.mjs} +2 -2
  55. package/lib/{index-CotIM_QM.js → index-DCQ0-LVj.js} +16 -16
  56. package/lib/{index-CjaaWCsQ.js → index-DH03XiQv.js} +92 -92
  57. package/lib/{index-CVFSCRrp.js → index-DOmtY-kF.js} +1 -1
  58. package/lib/{index-S-6g7te9.mjs → index-DXgyXjNC.mjs} +9 -9
  59. package/lib/{index-DUnWVA2t.js → index-DccWI0fu.js} +1 -1
  60. package/lib/{index-BK5v6OjI.mjs → index-Digj9HEk.mjs} +2 -2
  61. package/lib/{index-DG4r6BgI.js → index-DsHHiKBN.js} +1 -1
  62. package/lib/{index-qCDztmW8.mjs → index-DyztyLbi.mjs} +10 -10
  63. package/lib/{index-B_6I_1KE.mjs → index-DzrleM1Z.mjs} +6 -6
  64. package/lib/{index-uEx_Ty6H.mjs → index-HiefsQrl.mjs} +2 -2
  65. package/lib/{index-DgwozKZn.js → index-S2WRTxH-.js} +1 -1
  66. package/lib/{index-COovR23o.mjs → index-UJ_qrh-M.mjs} +45 -45
  67. package/lib/{index-GIMIwhEX.js → index-V2r6aK-J.js} +1 -1
  68. package/lib/{index-C4PiSpuF.js → index-jOVG08il.js} +1 -1
  69. package/lib/{index-t3NbnUgt.mjs → index-o4OiQdMB.mjs} +2 -2
  70. package/lib/{index-DCFAlA0r.mjs → index-v0XYnBH4.mjs} +19946 -19949
  71. package/lib/{index-SHXZG1qD.js → index-wBRzX5oo.js} +1 -1
  72. package/lib/{index.es-DXLvY_D0.js → index.es-BKqCA7ne.js} +2 -2
  73. package/lib/{index.es-DV0FLIto.mjs → index.es-ByBOztm1.mjs} +5 -5
  74. package/lib/index.js +1 -1
  75. package/lib/index.mjs +1 -1
  76. package/lib/{keccak-BIz1wVpA.js → keccak-B8a5MZK6.js} +1 -1
  77. package/lib/{keccak-BUByz5uF.mjs → keccak-CN5ySxFz.mjs} +1 -1
  78. package/lib/{libsodium-wrappers-fP6c9wsa.js → libsodium-wrappers-B0ICcimj.js} +1 -1
  79. package/lib/{libsodium-wrappers-Cor7IUex.mjs → libsodium-wrappers-GDaUPjg5.mjs} +1 -1
  80. package/lib/{pako.esm-CYeKGWZL.js → pako.esm-BWZpDuN6.js} +1 -1
  81. package/lib/{pako.esm-ZR78Kcp_.mjs → pako.esm-DW3UrHMz.mjs} +2 -2
  82. package/lib/{pbkdf2-CtnM_vol.js → pbkdf2-C38M4tlq.js} +1 -1
  83. package/lib/{pbkdf2-BXETruEi.mjs → pbkdf2-DBGCUA93.mjs} +1 -1
  84. package/lib/{sei-83rTGsK7.mjs → sei-B0Uph54D.mjs} +3 -3
  85. package/lib/{sei-BVrV8RIX.js → sei-GBctDPzY.js} +1 -1
  86. package/lib/{signer-DrIAzvo5.js → signer-D8gvviAH.js} +1 -1
  87. package/lib/{signer-nBgWI7Cp.mjs → signer-OgAKCQT2.mjs} +1 -1
  88. package/lib/solana-CWeQVpv5.mjs +16 -0
  89. package/lib/{solana-DfDEsqum.mjs → solana-Ckn17au5.mjs} +4 -4
  90. package/lib/solana-DBi9TLXj.js +1 -0
  91. package/lib/{solana-BHhb_iN6.js → solana-DT94CRt4.js} +1 -1
  92. package/lib/{solanaEmbed.esm-THCQirO0.mjs → solanaEmbed.esm-BtctroDi.mjs} +3 -3
  93. package/lib/{solanaEmbed.esm-NdMQEmdv.js → solanaEmbed.esm-D5ruhN0-.js} +1 -1
  94. package/lib/{sui-2OJrRkLv.js → sui-BrF_h9G6.js} +1 -1
  95. package/lib/{sui-DZw78j9M.mjs → sui-CfzZWVl4.mjs} +1 -1
  96. package/lib/{sui-yf1o5y4o.js → sui-QiHC32Xq.js} +2 -2
  97. package/lib/{sui-BCKOTjLA.mjs → sui-hGBpwcAg.mjs} +4 -4
  98. package/lib/{unsignedTransaction-CWcOEDGs.mjs → unsignedTransaction-CH8BOEp4.mjs} +2 -2
  99. package/lib/{unsignedTransaction-BOL13zs_.js → unsignedTransaction-YyhZZvTR.js} +1 -1
  100. package/package.json +1 -1
  101. package/dist/assets/index-tcDQieq-.js +0 -2
  102. package/lib/index-B03mlZnU.js +0 -1
  103. package/lib/solana-BgoFdxcd.js +0 -1
  104. package/lib/solana-CDYc5Kkf.mjs +0 -16
@@ -1,7 +1,7 @@
1
1
  var Pt = Object.defineProperty;
2
2
  var _t = (e, t, r) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var f = (e, t, r) => _t(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { aZ as c, bA as A, bE as z, bD as U, h as l, cg as le, bF as G, bC as S, bB as V, ch as Ge, ci as Ze, cj as Wt, ck as It, cl as Ut, cm as Nt, cn as O, co as E, a8 as y, cp as T, cq as Ft, cr as ye, ca as dt, cs as xt, ct as lt, cu as zt, cv as Ot, cw as Q, cx as Lt, cy as Z, cz as H, cA as Dt, cB as qt, cC as Kt, cD as Vt, cE as Se, cF as Gt, cG as v, cH as Zt, e as oe, S as k, c9 as Ce, bO as Ht, p as j, cf as Be, cI as Yt, cJ as Qt, b8 as se, b1 as L, a5 as Xt, cK as ft, bU as mt, g as gt } from "./index-DCFAlA0r.mjs";
4
+ import { aY as c, bz as A, bD as z, bC as U, h as l, cf as le, bE as G, bB as S, bA as V, cg as Ge, ch as He, ci as Wt, cj as It, ck as Ut, cl as Nt, cm as O, cn as E, a8 as y, co as T, cp as Ft, cq as ye, c9 as dt, cr as xt, cs as lt, ct as zt, cu as Ot, cv as Q, cw as Lt, cx as H, cy as Z, cz as Dt, cA as qt, cB as Kt, cC as Vt, cD as Se, cE as Gt, cF as v, cG as Ht, e as oe, S as k, c8 as Ce, bN as Zt, p as j, ce as Be, cH as Yt, cI as Qt, b7 as se, b0 as L, a5 as Xt, cJ as ft, bT as mt, g as gt } from "./index-v0XYnBH4.mjs";
5
5
  const M = new c("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
6
6
  new c("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
7
7
  const Ae = new c("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), D = new c("So11111111111111111111111111111111111111112");
@@ -58,13 +58,13 @@ function Ee(e, t, r) {
58
58
  e.push({ pubkey: t, isSigner: !0, isWritable: !1 });
59
59
  return e;
60
60
  }
61
- const He = A([z("instruction"), U("amount")]);
61
+ const Ze = A([z("instruction"), U("amount")]);
62
62
  function $t(e, t, r, n, i = [], s = M) {
63
63
  const o = Ee([
64
64
  { pubkey: e, isSigner: !1, isWritable: !0 },
65
65
  { pubkey: t, isSigner: !1, isWritable: !1 }
66
- ], r, i), a = l.Buffer.alloc(He.span);
67
- return He.encode({
66
+ ], r, i), a = l.Buffer.alloc(Ze.span);
67
+ return Ze.encode({
68
68
  instruction: $.Approve,
69
69
  amount: BigInt(n)
70
70
  }, a), new le({ keys: o, programId: s, data: a });
@@ -212,9 +212,9 @@ function We(e, t, r = !1, n = M, i = Ae) {
212
212
  const on = A([G("lockCpi")]), cn = on.span, un = A([z("state")]), dn = un.span, ln = A([]), fn = ln.span, mn = A([
213
213
  S("rateAuthority"),
214
214
  Ge("initializationTimestamp"),
215
- Ze("preUpdateAverageRate"),
215
+ He("preUpdateAverageRate"),
216
216
  Ge("lastUpdateTimestamp"),
217
- Ze("currentRate")
217
+ He("currentRate")
218
218
  ]), gn = mn.span, hn = A([G("requireIncomingTransferMemos")]), pn = hn.span, wn = A([
219
219
  S("authority"),
220
220
  S("metadataAddress")
@@ -506,9 +506,9 @@ class Vn {
506
506
  case "initialize":
507
507
  return Gn(r);
508
508
  case "attestToken":
509
- return Zn(r);
510
- case "completeNative":
511
509
  return Hn(r);
510
+ case "completeNative":
511
+ return Zn(r);
512
512
  case "completeWrapped":
513
513
  return Yn(r);
514
514
  case "transferWrapped":
@@ -545,11 +545,11 @@ function Gn({ wormhole: e }) {
545
545
  const t = l.Buffer.alloc(32);
546
546
  return t.write(new c(e).toBuffer().toString("hex"), 0, "hex"), N(P.Initialize, t);
547
547
  }
548
- function Zn({ nonce: e }) {
548
+ function Hn({ nonce: e }) {
549
549
  const t = l.Buffer.alloc(4);
550
550
  return t.writeUInt32LE(e, 0), N(P.AttestToken, t);
551
551
  }
552
- function Hn({}) {
552
+ function Zn({}) {
553
553
  return N(P.CompleteNative);
554
554
  }
555
555
  function Yn({}) {
@@ -1767,8 +1767,8 @@ function cr(e, t, r, n, i) {
1767
1767
  return {
1768
1768
  payer: new c(r),
1769
1769
  config: B(e),
1770
- vaa: Z(t, l.Buffer.from(n.hash)),
1771
- claim: H(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1770
+ vaa: H(t, l.Buffer.from(n.hash)),
1771
+ claim: Z(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1772
1772
  endpoint: te(e, y(n.emitterChain), n.emitterAddress.toUint8Array()),
1773
1773
  to: new c(n.payload.to.address.toUint8Array()),
1774
1774
  toFees: new c(i === void 0 ? n.payload.to.address.toUint8Array() : i),
@@ -1796,8 +1796,8 @@ function dr(e, t, r, n, i) {
1796
1796
  return {
1797
1797
  payer: new c(r),
1798
1798
  config: B(e),
1799
- vaa: Z(t, l.Buffer.from(n.hash)),
1800
- claim: H(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1799
+ vaa: H(t, l.Buffer.from(n.hash)),
1800
+ claim: Z(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1801
1801
  endpoint: te(e, y(n.emitterChain), n.emitterAddress.toUint8Array()),
1802
1802
  to: new c(n.payload.to.address.toUint8Array()),
1803
1803
  toFees: new c(i === void 0 ? n.payload.to.address.toUint8Array() : i),
@@ -1826,8 +1826,8 @@ function fr(e, t, r, n) {
1826
1826
  payer: new c(r),
1827
1827
  config: B(e),
1828
1828
  endpoint: te(e, y(n.emitterChain), n.emitterAddress.toUint8Array()),
1829
- vaa: Z(t, l.Buffer.from(n.hash)),
1830
- claim: H(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1829
+ vaa: H(t, l.Buffer.from(n.hash)),
1830
+ claim: Z(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1831
1831
  mint: i,
1832
1832
  wrappedMeta: Y(e, i),
1833
1833
  splMetadata: Te(i),
@@ -1872,8 +1872,8 @@ function gr(e, t, r, n) {
1872
1872
  payer: new c(r),
1873
1873
  config: B(e),
1874
1874
  endpoint: te(e, y(n.payload.actionArgs.foreignChain), n.payload.actionArgs.foreignAddress.toUint8Array()),
1875
- vaa: Z(t, l.Buffer.from(n.hash)),
1876
- claim: H(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1875
+ vaa: H(t, l.Buffer.from(n.hash)),
1876
+ claim: Z(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1877
1877
  rent: O,
1878
1878
  systemProgram: E.programId,
1879
1879
  wormholeProgram: new c(t)
@@ -1892,8 +1892,8 @@ function Ir(e, t, r, n, i) {
1892
1892
  function hr(e, t, r, n, i) {
1893
1893
  return {
1894
1894
  payer: new c(r),
1895
- vaa: Z(t, l.Buffer.from(n.hash)),
1896
- claim: H(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1895
+ vaa: H(t, l.Buffer.from(n.hash)),
1896
+ claim: Z(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
1897
1897
  upgradeAuthority: Dt(e),
1898
1898
  spill: new c(i === void 0 ? r : i),
1899
1899
  implementation: new c(n.payload.actionArgs.newContract),
@@ -2101,8 +2101,8 @@ function Nr(e, t, r, n, i) {
2101
2101
  return {
2102
2102
  payer: new c(r),
2103
2103
  tokenBridgeConfig: B(e),
2104
- vaa: Z(t, l.Buffer.from(n.hash)),
2105
- tokenBridgeClaim: H(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
2104
+ vaa: H(t, l.Buffer.from(n.hash)),
2105
+ tokenBridgeClaim: Z(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
2106
2106
  tokenBridgeForeignEndpoint: te(e, y(n.emitterChain), n.emitterAddress.toUint8Array()),
2107
2107
  toTokenAccount: new c(i),
2108
2108
  tokenBridgeRedeemer: ze(o),
@@ -2121,8 +2121,8 @@ function Fr(e, t, r, n, i) {
2121
2121
  return {
2122
2122
  payer: new c(r),
2123
2123
  tokenBridgeConfig: B(e),
2124
- vaa: Z(t, l.Buffer.from(n.hash)),
2125
- tokenBridgeClaim: H(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
2124
+ vaa: H(t, l.Buffer.from(n.hash)),
2125
+ tokenBridgeClaim: Z(e, n.emitterAddress.toUint8Array(), y(n.emitterChain), n.sequence),
2126
2126
  tokenBridgeForeignEndpoint: te(e, y(n.emitterChain), n.emitterAddress.toUint8Array()),
2127
2127
  toTokenAccount: new c(i),
2128
2128
  tokenBridgeRedeemer: ze(o),
@@ -4171,7 +4171,7 @@ class qe {
4171
4171
  const s = i.tokenBridge;
4172
4172
  if (!s)
4173
4173
  throw new Error(`TokenBridge contract Address for chain ${r} not found`);
4174
- this.tokenBridge = W(s, n), this.coreBridge = new Zt(t, r, n, i);
4174
+ this.tokenBridge = W(s, n), this.coreBridge = new Ht(t, r, n, i);
4175
4175
  }
4176
4176
  static async fromRpc(t, r) {
4177
4177
  const [n, i] = await oe.chainFromRpc(t), s = r[i];
@@ -4192,7 +4192,7 @@ class qe {
4192
4192
  chain: this.chain,
4193
4193
  address: new k(n.toBytes()).toUniversalAddress()
4194
4194
  } : {
4195
- chain: Ht(i.chain),
4195
+ chain: Zt(i.chain),
4196
4196
  address: new dt(new Uint8Array(i.tokenAddress))
4197
4197
  };
4198
4198
  } catch {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CjaaWCsQ.js");class o extends Error{constructor(r){super(r)}}class s extends o{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const n=e.struct([e.u32("mintAuthorityOption"),e.publicKey("mintAuthority"),e.u64("supply"),e.u8("decimals"),e.bool("isInitialized"),e.u32("freezeAuthorityOption"),e.publicKey("freezeAuthority")]);n.span;async function f(t,r,u=!1,i=e.TOKEN_PROGRAM_ID,O=e.ASSOCIATED_TOKEN_PROGRAM_ID){if(!u&&!e.PublicKey.isOnCurve(r.toBuffer()))throw new s;const[c]=await e.PublicKey.findProgramAddress([r.toBuffer(),i.toBuffer(),t.toBuffer()],O);return c}exports.ASSOCIATED_TOKEN_PROGRAM_ID=e.ASSOCIATED_TOKEN_PROGRAM_ID;exports.TOKEN_PROGRAM_ID=e.TOKEN_PROGRAM_ID;exports.MintLayout=n;exports.TokenError=o;exports.TokenOwnerOffCurveError=s;exports.getAssociatedTokenAddress=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DH03XiQv.js");class o extends Error{constructor(r){super(r)}}class s extends o{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const n=e.struct([e.u32("mintAuthorityOption"),e.publicKey("mintAuthority"),e.u64("supply"),e.u8("decimals"),e.bool("isInitialized"),e.u32("freezeAuthorityOption"),e.publicKey("freezeAuthority")]);n.span;async function f(t,r,u=!1,i=e.TOKEN_PROGRAM_ID,O=e.ASSOCIATED_TOKEN_PROGRAM_ID){if(!u&&!e.PublicKey.isOnCurve(r.toBuffer()))throw new s;const[c]=await e.PublicKey.findProgramAddress([r.toBuffer(),i.toBuffer(),t.toBuffer()],O);return c}exports.ASSOCIATED_TOKEN_PROGRAM_ID=e.ASSOCIATED_TOKEN_PROGRAM_ID;exports.TOKEN_PROGRAM_ID=e.TOKEN_PROGRAM_ID;exports.MintLayout=n;exports.TokenError=o;exports.TokenOwnerOffCurveError=s;exports.getAssociatedTokenAddress=f;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-B03mlZnU.js"),kr=require("./dijkstra-CtFxn7S9.js"),Mr=require("./index-CjaaWCsQ.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-COw96Rua.js"),kr=require("./dijkstra-CtFxn7S9.js"),Mr=require("./index-DH03XiQv.js");/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,6 +1,6 @@
1
- import { h as Gt, ac as Dr, a1 as Yn, X as Zt } from "./index-DCFAlA0r.mjs";
2
- import { i as qn, b as Zn, d as Qn, e as ti, f as ei, g as ri, h as ni, j as ii, k as si, l as oi, m as ai, w as $r, r as Kr, c as fi } from "./index-B8U_Gr4R.mjs";
3
- import { e as ci } from "./events-CkXgb0qh.mjs";
1
+ import { h as Gt, ac as Dr, a1 as Yn, X as Zt } from "./index-v0XYnBH4.mjs";
2
+ import { i as qn, b as Zn, d as Qn, e as ti, f as ei, g as ri, h as ni, j as ii, k as si, l as oi, m as ai, w as $r, r as Kr, c as fi } from "./index-BfeLH5sq.mjs";
3
+ import { e as ci } from "./events-DfpxB97c.mjs";
4
4
  function Ur(t = 0) {
5
5
  return globalThis.Buffer != null && globalThis.Buffer.allocUnsafe != null ? globalThis.Buffer.allocUnsafe(t) : new Uint8Array(t);
6
6
  }
@@ -1,4 +1,4 @@
1
- "use strict";const H=require("./index-CjaaWCsQ.js"),Bt=require("./index-CcPZaBV3.js"),ti=require("./events-COwefqOt.js");function Kr(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Ur(t,r){r||(r=t.reduce((o,h)=>o+h.length,0));const n=Kr(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const wr={...Bt.identityBase,...Bt.base2,...Bt.base8,...Bt.base10,...Bt.base16,...Bt.base32,...Bt.base36,...Bt.base58,...Bt.base64,...Bt.base256emoji};function Hr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const vr=Hr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ye=Hr("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=Kr(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Gr={utf8:vr,"utf-8":vr,hex:wr.base16,latin1:Ye,ascii:Ye,binary:Ye,...wr};function de(t,r="utf8"){const n=Gr[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=Gr[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 ei={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"}},ri=/"(?:_|\\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*:/,ni=/"(?: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*:/,ii=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function si(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){oi(t);return}return r}function oi(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function De(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(!ii.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(ri.test(t)||ni.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,si)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function ai(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tt(t,...r){try{return ai(t(...r))}catch(n){return Promise.reject(n)}}function fi(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function ci(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function Ue(t){if(fi(t))return String(t);if(ci(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Ue(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Jr(){if(typeof H.dist.Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const er="base64:";function ui(t){if(typeof t=="string")return t;Jr();const r=H.dist.Buffer.from(t).toString("base64");return er+r}function li(t){return typeof t!="string"||!t.startsWith(er)?t:(Jr(),H.dist.Buffer.from(t.slice(er.length),"base64"))}function Kt(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function hi(...t){return Kt(t.join(":"))}function $e(t){return t=Kt(t),t?t+":":""}const di="memory",bi=()=>{const t=new Map;return{name:di,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 gi(t={}){const r={mounts:{"":t.driver||bi()},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=Kt(u);for(const y of r.watchListeners)y(s,u)}},h=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await Er(r.mounts[s],o,s)}},S=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=Kt(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=Kt(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.hasItem,y,u)},getItem(s,u={}){s=Kt(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.getItem,y,u).then(w=>De(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:hi(y.base,w.key),value:De(w.value)}))):Promise.all(y.items.map(v=>Tt(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:De(w)})))))},getItemRaw(s,u={}){s=Kt(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Tt(v.getItemRaw,y,u):Tt(v.getItem,y,u).then(w=>li(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Kt(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Tt(w.setItem,v,Ue(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:Ue(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Tt(y.driver.setItem,v.relativeKey,Ue(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Kt(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,ui(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Kt(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=Kt(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=>De(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=$e(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+Kt(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=$e(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=>Sr(s)))},async watch(s){return await h(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await S()}},async unwatch(){r.watchListeners=[],await S()},mount(s,u){if(s=$e(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){s=$e(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&(r.unwatch[s](),delete r.unwatch[s]),u&&await Sr(r.mounts[s]),r.mountpoints=r.mountpoints.filter(y=>y!==s),delete r.mounts[s])},getMount(s=""){s=Kt(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Kt(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 Sr(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 Fr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=be(n);return(o,h)=>c.then(S=>h(S.transaction(r,o).objectStore(r)))}let Ze;function Ae(){return Ze||(Ze=Fr("keyval-store","keyval")),Ze}function Ir(t,r=Ae()){return r("readonly",n=>be(n.get(t)))}function yi(t,r,n=Ae()){return n("readwrite",c=>(c.put(r,t),be(c.transaction)))}function pi(t,r=Ae()){return r("readwrite",n=>(n.delete(t),be(n.transaction)))}function _i(t=Ae()){return t("readwrite",r=>(r.clear(),be(r.transaction)))}function mi(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},be(t.transaction)}function xi(t=Ae()){return t("readonly",r=>{if(r.getAllKeys)return be(r.getAllKeys());const n=[];return mi(r,c=>n.push(c.key)).then(()=>n)})}const wi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),vi=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 kr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return vi(t)}catch{return t}}function Wr(t){return typeof t=="string"?t:wi(t)||""}const Ei="idb-keyval";var Si=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Fr(t.dbName,t.storeName)),{name:Ei,options:t,async hasItem(o){return!(typeof await Ir(n(o),c)>"u")},async getItem(o){return await Ir(n(o),c)??null},setItem(o,h){return yi(n(o),h,c)},removeItem(o){return pi(n(o),c)},getKeys(){return xi(c)},clear(){return _i(c)}}};const Ii="WALLET_CONNECT_V2_INDEXED_DB",Oi="keyvaluestorage";let Ti=class{constructor(){this.indexedDb=gi({driver:Si({dbName:Ii,storeName:Oi})})}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,Wr(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof H.dist.global<"u"?H.dist.global:typeof self<"u"?self:{},He={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?He.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?He.exports=window.localStorage:He.exports=new r})();function Li(t){var r;return[t[0],kr((r=t[1])!=null?r:"")]}class Ai{constructor(){this.localStorage=He.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Li)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return kr(n)}async setItem(r,n){this.localStorage.setItem(r,Wr(n))}async removeItem(r){this.localStorage.removeItem(r)}}const Ri="wc_storage_version",Or=1,Pi=async(t,r,n)=>{const c=Ri,o=await r.getItem(c);if(o&&o>=Or){n(r);return}const h=await t.getKeys();if(!h.length){n(r);return}const S=[];for(;h.length;){const E=h.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),S.push(E)}}await r.setItem(c,Or),n(r),ji(t,S)},ji=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};let Ci=class{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Ai;this.storage=r;try{const n=new Ti;Pi(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 Ni{}function Mi(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var zi=Bi;function Bi(t,r,n){var c=n&&n.stringify||Mi,o=1;if(typeof t=="object"&&t!==null){var h=r.length+o;if(h===1)return t;var S=new Array(h);S[0]=c(t);for(var E=1;E<h;E++)S[E]=c(r[E]);return S.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=zi;var me=Qt;const Ie=Wi().console||{},Di={mapHttpRequest:Ke,mapHttpResponse:Ke,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:Ke,res:Ke,err:Gi};function $i(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||Ie;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=$i(t.browser.serialize,c);let h=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const S=["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:S,timestamp:Ji(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=h,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,pe(s,g,"error","log"),pe(s,g,"fatal","error"),pe(s,g,"warn","error"),pe(s,g,"info","log"),pe(s,g,"debug","log"),pe(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,Ve([x],M,ut,this._stdErrSerialize)}function Lt(gt){this._childLevel=(gt._childLevel|0)+1,this.error=_e(gt,x,"error"),this.fatal=_e(gt,x,"fatal"),this.warn=_e(gt,x,"warn"),this.info=_e(gt,x,"info"),this.debug=_e(gt,x,"debug"),this.trace=_e(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=Di;Qt.stdTimeFunctions=Object.assign({},{nullTime:Vr,epochTime:qr,unixTime:Fi,isoTime:ki});function pe(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Ie[n]||Ie[c]||Oe,Ki(t,r,n)}function Ki(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const h=t.timestamp(),S=new Array(arguments.length),E=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ie?Ie:this;for(var g=0;g<S.length;g++)S[g]=arguments[g];if(t.serialize&&!t.asObject&&Ve(S,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(E,Ui(this,n,S,h)):c.apply(E,S),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Hi(this,{ts:h,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},S)}}}(r[n]))}function Ui(t,r,n,c){t._serialize&&Ve(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let h=o[0];const S={};c&&(S.time=c),S.level=Qt.levels.values[r];let E=(t._childLevel|0)+1;if(E<1&&(E=1),h!==null&&typeof h=="object"){for(;E--&&typeof o[0]=="object";)Object.assign(S,o.shift());h=o.length?Tr(o.shift(),o):void 0}else typeof h=="string"&&(h=Tr(o.shift(),o));return h!==void 0&&(S.msg=h),S}function Ve(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 h in t[o])r&&r.indexOf(h)>-1&&h in n&&(t[o][h]=n[h](t[o][h]))}function _e(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 Hi(t,r,n){const c=r.send,o=r.ts,h=r.methodLevel,S=r.methodValue,E=r.val,g=t._logEvent.bindings;Ve(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=h,t._logEvent.level.value=S,c(h,t._logEvent,E),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Gi(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 Ji(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Vr:qr}function Ke(){return{}}function tr(t){return t}function Oe(){}function Vr(){return!1}function qr(){return Date.now()}function Fi(){return Math.round(Date.now()/1e3)}function ki(){return new Date(Date.now()).toISOString()}function Wi(){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=H.getDefaultExportFromCjs(me),Vi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Lr(t){return typeof t=="string"?t:Vi(t)||""}const qi={level:"info"},Re="custom_context",ar=1e3*1024;class Xi{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 Xi(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 Xr{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 Yi{constructor(r,n=ar){this.baseChunkLogger=new Xr(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 Zi{constructor(r,n=ar){this.baseChunkLogger=new Xr(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 Qi=Object.defineProperty,ts=Object.defineProperties,es=Object.getOwnPropertyDescriptors,Rr=Object.getOwnPropertySymbols,rs=Object.prototype.hasOwnProperty,ns=Object.prototype.propertyIsEnumerable,Pr=(t,r,n)=>r in t?Qi(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,Ge=(t,r)=>{for(var n in r||(r={}))rs.call(r,n)&&Pr(t,n,r[n]);if(Rr)for(var n of Rr(r))ns.call(r,n)&&Pr(t,n,r[n]);return t},Je=(t,r)=>ts(t,es(r));function is(t){return Je(Ge({},t),{level:(t==null?void 0:t.level)||qi.level})}function ss(t,r=Re){return t[r]||""}function os(t,r,n=Re){return t[n]=r,t}function Yr(t,r=Re){let n="";return typeof t.bindings>"u"?n=ss(t,r):n=t.bindings().context||"",n}function as(t,r,n=Re){const c=Yr(t,n);return c.trim()?`${c}/${r}`:r}function fs(t,r,n=Re){const c=as(t,r,n),o=t.child({context:c});return os(o,c,n)}function cs(t){var r,n;const c=new Yi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Je(Ge({},t.opts),{level:"trace",browser:Je(Ge({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function us(t){var r;const n=new Zi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Je(Ge({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function ls(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?cs(t):us(t)}var fr={},Zr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Bt.binary,n=Bt.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&&(h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=h(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),h(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 h(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],J=u[0],C=u[1],Nt=u[2],te=u[3],yt=u[4],kt=u[5],Ut=u[6],qt=u[7],m,_,X,lt,A,I,O,L;w>=128;){for(var At=0;At<16;At++){var rt=8*At+v;E[At]=r.readUint32BE(y,rt),g[At]=r.readUint32BE(y,rt+4)}for(var At=0;At<80;At++){var xe=x,z=N,ge=G,b=ut,d=M,l=Lt,e=gt,a=Ct,R=J,P=C,D=Nt,$=te,B=yt,K=kt,Rt=Ut,ht=qt;if(m=Ct,_=qt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(M>>>14|yt<<18)^(M>>>18|yt<<14)^(yt>>>9|M<<23),_=(yt>>>14|M<<18)^(yt>>>18|M<<14)^(M>>>9|yt<<23),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=M&Lt^~M&gt,_=yt&kt^~yt&Ut,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=o[At*2],_=o[At*2+1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=E[At%16],_=g[At%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,X=O&65535|L<<16,lt=A&65535|I<<16,m=X,_=lt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(x>>>28|J<<4)^(J>>>2|x<<30)^(J>>>7|x<<25),_=(J>>>28|x<<4)^(x>>>2|J<<30)^(x>>>7|J<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&G^N&G,_=J&C^J&Nt^C&Nt,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,a=O&65535|L<<16,ht=A&65535|I<<16,m=b,_=$,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=X,_=lt,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,b=O&65535|L<<16,$=A&65535|I<<16,N=xe,G=z,ut=ge,M=b,Lt=d,gt=l,Ct=e,x=a,C=R,Nt=P,te=D,yt=$,kt=B,Ut=K,qt=Rt,J=ht,At%16===15)for(var rt=0;rt<16;rt++)m=E[rt],_=g[rt],A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=E[(rt+9)%16],_=g[(rt+9)%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=E[(rt+1)%16],lt=g[(rt+1)%16],m=(X>>>1|lt<<31)^(X>>>8|lt<<24)^X>>>7,_=(lt>>>1|X<<31)^(lt>>>8|X<<24)^(lt>>>7|X<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=E[(rt+14)%16],lt=g[(rt+14)%16],m=(X>>>19|lt<<13)^(lt>>>29|X<<3)^X>>>6,_=(lt>>>19|X<<13)^(X>>>29|lt<<3)^(lt>>>6|X<<26),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,E[rt]=O&65535|L<<16,g[rt]=A&65535|I<<16}m=x,_=J,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[0],_=u[0],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=J=A&65535|I<<16,m=N,_=C,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[1],_=u[1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=C=A&65535|I<<16,m=G,_=Nt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[2],_=u[2],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[2]=G=O&65535|L<<16,u[2]=Nt=A&65535|I<<16,m=ut,_=te,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[3],_=u[3],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[3]=ut=O&65535|L<<16,u[3]=te=A&65535|I<<16,m=M,_=yt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[4],_=u[4],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=yt=A&65535|I<<16,m=Lt,_=kt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[5],_=u[5],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[5]=Lt=O&65535|L<<16,u[5]=kt=A&65535|I<<16,m=gt,_=Ut,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[6],_=u[6],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[6]=gt=O&65535|L<<16,u[6]=Ut=A&65535|I<<16,m=Ct,_=qt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[7],_=u[7],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=qt=A&65535|I<<16,v+=128,w-=128}return v}function S(E){var g=new c;g.update(E);var s=g.digest();return g.clean(),s}t.hash=S})(Zr);(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=Bt.random,n=Zr,c=Bt.wipe;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(b){const d=new Float64Array(16);if(b)for(let l=0;l<b.length;l++)d[l]=b[l];return d}const h=new Uint8Array(32);h[0]=9;const S=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(b,d){for(let l=0;l<16;l++)b[l]=d[l]|0}function x(b){let d=1;for(let l=0;l<16;l++){let e=b[l]+d+65535;d=Math.floor(e/65536),b[l]=e-d*65536}b[0]+=d-1+37*(d-1)}function N(b,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(b[a]^d[a]);b[a]^=R,d[a]^=R}}function G(b,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 P=1;P<15;P++)l[P]=e[P]-65535-(l[P-1]>>16&1),l[P-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++)b[2*a]=e[a]&255,b[2*a+1]=e[a]>>8}function ut(b,d){let l=0;for(let e=0;e<32;e++)l|=b[e]^d[e];return(1&l-1>>>8)-1}function M(b,d){const l=new Uint8Array(32),e=new Uint8Array(32);return G(l,b),G(e,d),ut(l,e)}function Lt(b){const d=new Uint8Array(32);return G(d,b),d[0]&1}function gt(b,d){for(let l=0;l<16;l++)b[l]=d[2*l]+(d[2*l+1]<<8);b[15]&=32767}function Ct(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]+l[e]}function J(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]-l[e]}function C(b,d,l){let e,a,R=0,P=0,D=0,$=0,B=0,K=0,Rt=0,ht=0,Pt=0,pt=0,dt=0,nt=0,et=0,Y=0,V=0,U=0,it=0,_t=0,F=0,Mt=0,Dt=0,Ht=0,Gt=0,$t=0,Xt=0,Zt=0,se=0,Jt=0,ce=0,we=0,Pe=0,st=l[0],Z=l[1],ot=l[2],at=l[3],ft=l[4],Q=l[5],mt=l[6],xt=l[7],wt=l[8],vt=l[9],Et=l[10],bt=l[11],ct=l[12],W=l[13],St=l[14],It=l[15];e=d[0],R+=e*st,P+=e*Z,D+=e*ot,$+=e*at,B+=e*ft,K+=e*Q,Rt+=e*mt,ht+=e*xt,Pt+=e*wt,pt+=e*vt,dt+=e*Et,nt+=e*bt,et+=e*ct,Y+=e*W,V+=e*St,U+=e*It,e=d[1],P+=e*st,D+=e*Z,$+=e*ot,B+=e*at,K+=e*ft,Rt+=e*Q,ht+=e*mt,Pt+=e*xt,pt+=e*wt,dt+=e*vt,nt+=e*Et,et+=e*bt,Y+=e*ct,V+=e*W,U+=e*St,it+=e*It,e=d[2],D+=e*st,$+=e*Z,B+=e*ot,K+=e*at,Rt+=e*ft,ht+=e*Q,Pt+=e*mt,pt+=e*xt,dt+=e*wt,nt+=e*vt,et+=e*Et,Y+=e*bt,V+=e*ct,U+=e*W,it+=e*St,_t+=e*It,e=d[3],$+=e*st,B+=e*Z,K+=e*ot,Rt+=e*at,ht+=e*ft,Pt+=e*Q,pt+=e*mt,dt+=e*xt,nt+=e*wt,et+=e*vt,Y+=e*Et,V+=e*bt,U+=e*ct,it+=e*W,_t+=e*St,F+=e*It,e=d[4],B+=e*st,K+=e*Z,Rt+=e*ot,ht+=e*at,Pt+=e*ft,pt+=e*Q,dt+=e*mt,nt+=e*xt,et+=e*wt,Y+=e*vt,V+=e*Et,U+=e*bt,it+=e*ct,_t+=e*W,F+=e*St,Mt+=e*It,e=d[5],K+=e*st,Rt+=e*Z,ht+=e*ot,Pt+=e*at,pt+=e*ft,dt+=e*Q,nt+=e*mt,et+=e*xt,Y+=e*wt,V+=e*vt,U+=e*Et,it+=e*bt,_t+=e*ct,F+=e*W,Mt+=e*St,Dt+=e*It,e=d[6],Rt+=e*st,ht+=e*Z,Pt+=e*ot,pt+=e*at,dt+=e*ft,nt+=e*Q,et+=e*mt,Y+=e*xt,V+=e*wt,U+=e*vt,it+=e*Et,_t+=e*bt,F+=e*ct,Mt+=e*W,Dt+=e*St,Ht+=e*It,e=d[7],ht+=e*st,Pt+=e*Z,pt+=e*ot,dt+=e*at,nt+=e*ft,et+=e*Q,Y+=e*mt,V+=e*xt,U+=e*wt,it+=e*vt,_t+=e*Et,F+=e*bt,Mt+=e*ct,Dt+=e*W,Ht+=e*St,Gt+=e*It,e=d[8],Pt+=e*st,pt+=e*Z,dt+=e*ot,nt+=e*at,et+=e*ft,Y+=e*Q,V+=e*mt,U+=e*xt,it+=e*wt,_t+=e*vt,F+=e*Et,Mt+=e*bt,Dt+=e*ct,Ht+=e*W,Gt+=e*St,$t+=e*It,e=d[9],pt+=e*st,dt+=e*Z,nt+=e*ot,et+=e*at,Y+=e*ft,V+=e*Q,U+=e*mt,it+=e*xt,_t+=e*wt,F+=e*vt,Mt+=e*Et,Dt+=e*bt,Ht+=e*ct,Gt+=e*W,$t+=e*St,Xt+=e*It,e=d[10],dt+=e*st,nt+=e*Z,et+=e*ot,Y+=e*at,V+=e*ft,U+=e*Q,it+=e*mt,_t+=e*xt,F+=e*wt,Mt+=e*vt,Dt+=e*Et,Ht+=e*bt,Gt+=e*ct,$t+=e*W,Xt+=e*St,Zt+=e*It,e=d[11],nt+=e*st,et+=e*Z,Y+=e*ot,V+=e*at,U+=e*ft,it+=e*Q,_t+=e*mt,F+=e*xt,Mt+=e*wt,Dt+=e*vt,Ht+=e*Et,Gt+=e*bt,$t+=e*ct,Xt+=e*W,Zt+=e*St,se+=e*It,e=d[12],et+=e*st,Y+=e*Z,V+=e*ot,U+=e*at,it+=e*ft,_t+=e*Q,F+=e*mt,Mt+=e*xt,Dt+=e*wt,Ht+=e*vt,Gt+=e*Et,$t+=e*bt,Xt+=e*ct,Zt+=e*W,se+=e*St,Jt+=e*It,e=d[13],Y+=e*st,V+=e*Z,U+=e*ot,it+=e*at,_t+=e*ft,F+=e*Q,Mt+=e*mt,Dt+=e*xt,Ht+=e*wt,Gt+=e*vt,$t+=e*Et,Xt+=e*bt,Zt+=e*ct,se+=e*W,Jt+=e*St,ce+=e*It,e=d[14],V+=e*st,U+=e*Z,it+=e*ot,_t+=e*at,F+=e*ft,Mt+=e*Q,Dt+=e*mt,Ht+=e*xt,Gt+=e*wt,$t+=e*vt,Xt+=e*Et,Zt+=e*bt,se+=e*ct,Jt+=e*W,ce+=e*St,we+=e*It,e=d[15],U+=e*st,it+=e*Z,_t+=e*ot,F+=e*at,Mt+=e*ft,Dt+=e*Q,Ht+=e*mt,Gt+=e*xt,$t+=e*wt,Xt+=e*vt,Zt+=e*Et,se+=e*bt,Jt+=e*ct,ce+=e*W,we+=e*St,Pe+=e*It,R+=38*it,P+=38*_t,D+=38*F,$+=38*Mt,B+=38*Dt,K+=38*Ht,Rt+=38*Gt,ht+=38*$t,Pt+=38*Xt,pt+=38*Zt,dt+=38*se,nt+=38*Jt,et+=38*ce,Y+=38*we,V+=38*Pe,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=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=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=Pt+a+65535,a=Math.floor(e/65536),Pt=e-a*65536,e=pt+a+65535,a=Math.floor(e/65536),pt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=nt+a+65535,a=Math.floor(e/65536),nt=e-a*65536,e=et+a+65535,a=Math.floor(e/65536),et=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=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=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=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=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=Pt+a+65535,a=Math.floor(e/65536),Pt=e-a*65536,e=pt+a+65535,a=Math.floor(e/65536),pt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=nt+a+65535,a=Math.floor(e/65536),nt=e-a*65536,e=et+a+65535,a=Math.floor(e/65536),et=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,R+=a-1+37*(a-1),b[0]=R,b[1]=P,b[2]=D,b[3]=$,b[4]=B,b[5]=K,b[6]=Rt,b[7]=ht,b[8]=Pt,b[9]=pt,b[10]=dt,b[11]=nt,b[12]=et,b[13]=Y,b[14]=V,b[15]=U}function Nt(b,d){C(b,d,d)}function te(b,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++)b[e]=l[e]}function yt(b,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++)b[e]=l[e]}function kt(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o(),B=o(),K=o();J(l,b[1],b[0]),J(K,d[1],d[0]),C(l,l,K),Ct(e,b[0],b[1]),Ct(K,d[0],d[1]),C(e,e,K),C(a,b[3],d[3]),C(a,a,s),C(R,b[2],d[2]),Ct(R,R,R),J(P,e,l),J(D,R,a),Ct($,R,a),Ct(B,e,l),C(b[0],P,D),C(b[1],B,$),C(b[2],$,D),C(b[3],P,B)}function Ut(b,d,l){for(let e=0;e<4;e++)N(b[e],d[e],l)}function qt(b,d){const l=o(),e=o(),a=o();te(a,d[2]),C(l,d[0],a),C(e,d[1],a),G(b,e),b[31]^=Lt(l)<<7}function m(b,d,l){w(b[0],S),w(b[1],E),w(b[2],E),w(b[3],S);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;Ut(b,d,a),kt(d,b),kt(b,b),Ut(b,d,a)}}function _(b,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(b,l,d)}function X(b){if(b.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(b);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];_(e,d),qt(l,e);const a=new Uint8Array(64);return a.set(b),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function lt(b){const d=(0,r.randomBytes)(32,b),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=lt;function A(b){if(b.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(b.subarray(32))}t.extractPublicKeyFromSecretKey=A;const I=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(b,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]*I[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)*I[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*I[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,b[e]=d[e]&255}function L(b){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=b[l];for(let l=0;l<64;l++)b[l]=0;O(b,d)}function At(b,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(b.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const P=new n.SHA512;P.update(R.subarray(32)),P.update(d);const D=P.digest();P.clean(),L(D),_(e,D),qt(R,e),P.reset(),P.update(R.subarray(0,32)),P.update(b.subarray(32)),P.update(d);const $=P.digest();L($);for(let B=0;B<32;B++)l[B]=D[B];for(let B=0;B<32;B++)for(let K=0;K<32;K++)l[B+K]+=$[B]*a[K];return O(R.subarray(32),l),R}t.sign=At;function rt(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o();return w(b[2],E),gt(b[1],d),Nt(a,b[1]),C(R,a,g),J(a,a,b[2]),Ct(R,b[2],R),Nt(P,R),Nt(D,P),C($,D,P),C(l,$,a),C(l,l,R),yt(l,l),C(l,l,a),C(l,l,R),C(l,l,R),C(b[0],l,R),Nt(e,b[0]),C(e,e,R),M(e,a)&&C(b[0],b[0],v),Nt(e,b[0]),C(e,e,R),M(e,a)?-1:(Lt(b[0])===d[31]>>7&&J(b[0],S,b[0]),C(b[3],b[0],b[1]),0)}function xe(b,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(rt(R,b))return!1;const P=new n.SHA512;P.update(l.subarray(0,32)),P.update(b),P.update(d);const D=P.digest();return L(D),m(a,R,D),_(R,l.subarray(32)),kt(a,R),qt(e,a),!ut(l,e)}t.verify=xe;function z(b){let d=[o(),o(),o(),o()];if(rt(d,b))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,E,a),J(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(b){const d=(0,n.hash)(b.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 hs="EdDSA",ds="JWT",Fe=".",qe="base64url",Qr="utf8",tn="utf8",bs=":",gs="did",ys="key",jr="base58btc",ps="z",_s="K36",ms=32,xs=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),ws=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 vs(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ws(t)}catch{return t}}function Es(t){return typeof t=="string"?t:xs(t)||""}function Cr(t){return vs(Le(de(t,qe),Qr))}function ke(t){return Le(de(Es(t),Qr),qe)}function en(t){const r=de(_s,jr),n=ps+Le(Ur([r,t]),jr);return[gs,ys,n].join(bs)}function Ss(t){return Le(t,qe)}function Is(t){return de(t,qe)}function Os(t){return de([ke(t.header),ke(t.payload)].join(Fe),tn)}function Ts(t){return[ke(t.header),ke(t.payload),Ss(t.signature)].join(Fe)}function Ls(t){const r=t.split(Fe),n=Cr(r[0]),c=Cr(r[1]),o=Is(r[2]),h=de(r.slice(0,2).join(Fe),tn);return{header:n,payload:c,signature:o,data:h}}function As(t=Bt.random.randomBytes(ms)){return fr.generateKeyPairFromSeed(t)}async function Rs(t,r,n,c,o=Bt.cjs.fromMiliseconds(Date.now())){const h={alg:hs,typ:ds},S=en(c.publicKey),E=o+n,g={iss:S,sub:t,aud:r,iat:o,exp:E},s=Os({header:h,payload:g}),u=fr.sign(c.secretKey,s);return Ts({header:h,payload:g,signature:u})}const Ps="PARSE_ERROR",js="INVALID_REQUEST",Cs="METHOD_NOT_FOUND",Ns="INVALID_PARAMS",rn="INTERNAL_ERROR",cr="SERVER_ERROR",Ms=[-32700,-32600,-32601,-32602,-32603],Se={[Ps]:{code:-32700,message:"Parse error"},[js]:{code:-32600,message:"Invalid Request"},[Cs]:{code:-32601,message:"Method not found"},[Ns]:{code:-32602,message:"Invalid params"},[rn]:{code:-32603,message:"Internal error"},[cr]:{code:-32e3,message:"Server error"}},nn=cr;function zs(t){return Ms.includes(t)}function Nr(t){return Object.keys(Se).includes(t)?Se[t]:Se[nn]}function Bs(t){const r=Object.values(Se).find(n=>n.code===t);return r||Se[nn]}function sn(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var on={};/*! *****************************************************************************
1
+ "use strict";const H=require("./index-DH03XiQv.js"),Bt=require("./index-C8scDSKY.js"),ti=require("./events-CtBArP61.js");function Kr(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Ur(t,r){r||(r=t.reduce((o,h)=>o+h.length,0));const n=Kr(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const wr={...Bt.identityBase,...Bt.base2,...Bt.base8,...Bt.base10,...Bt.base16,...Bt.base32,...Bt.base36,...Bt.base58,...Bt.base64,...Bt.base256emoji};function Hr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const vr=Hr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ye=Hr("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=Kr(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Gr={utf8:vr,"utf-8":vr,hex:wr.base16,latin1:Ye,ascii:Ye,binary:Ye,...wr};function de(t,r="utf8"){const n=Gr[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=Gr[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 ei={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"}},ri=/"(?:_|\\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*:/,ni=/"(?: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*:/,ii=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function si(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){oi(t);return}return r}function oi(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function De(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(!ii.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(ri.test(t)||ni.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,si)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function ai(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tt(t,...r){try{return ai(t(...r))}catch(n){return Promise.reject(n)}}function fi(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function ci(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function Ue(t){if(fi(t))return String(t);if(ci(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Ue(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Jr(){if(typeof H.dist.Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const er="base64:";function ui(t){if(typeof t=="string")return t;Jr();const r=H.dist.Buffer.from(t).toString("base64");return er+r}function li(t){return typeof t!="string"||!t.startsWith(er)?t:(Jr(),H.dist.Buffer.from(t.slice(er.length),"base64"))}function Kt(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function hi(...t){return Kt(t.join(":"))}function $e(t){return t=Kt(t),t?t+":":""}const di="memory",bi=()=>{const t=new Map;return{name:di,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 gi(t={}){const r={mounts:{"":t.driver||bi()},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=Kt(u);for(const y of r.watchListeners)y(s,u)}},h=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await Er(r.mounts[s],o,s)}},S=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=Kt(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=Kt(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.hasItem,y,u)},getItem(s,u={}){s=Kt(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.getItem,y,u).then(w=>De(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:hi(y.base,w.key),value:De(w.value)}))):Promise.all(y.items.map(v=>Tt(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:De(w)})))))},getItemRaw(s,u={}){s=Kt(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Tt(v.getItemRaw,y,u):Tt(v.getItem,y,u).then(w=>li(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Kt(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Tt(w.setItem,v,Ue(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:Ue(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Tt(y.driver.setItem,v.relativeKey,Ue(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Kt(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,ui(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Kt(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=Kt(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=>De(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=$e(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+Kt(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=$e(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=>Sr(s)))},async watch(s){return await h(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await S()}},async unwatch(){r.watchListeners=[],await S()},mount(s,u){if(s=$e(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){s=$e(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&(r.unwatch[s](),delete r.unwatch[s]),u&&await Sr(r.mounts[s]),r.mountpoints=r.mountpoints.filter(y=>y!==s),delete r.mounts[s])},getMount(s=""){s=Kt(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Kt(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 Sr(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 Fr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=be(n);return(o,h)=>c.then(S=>h(S.transaction(r,o).objectStore(r)))}let Ze;function Ae(){return Ze||(Ze=Fr("keyval-store","keyval")),Ze}function Ir(t,r=Ae()){return r("readonly",n=>be(n.get(t)))}function yi(t,r,n=Ae()){return n("readwrite",c=>(c.put(r,t),be(c.transaction)))}function pi(t,r=Ae()){return r("readwrite",n=>(n.delete(t),be(n.transaction)))}function _i(t=Ae()){return t("readwrite",r=>(r.clear(),be(r.transaction)))}function mi(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},be(t.transaction)}function xi(t=Ae()){return t("readonly",r=>{if(r.getAllKeys)return be(r.getAllKeys());const n=[];return mi(r,c=>n.push(c.key)).then(()=>n)})}const wi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),vi=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 kr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return vi(t)}catch{return t}}function Wr(t){return typeof t=="string"?t:wi(t)||""}const Ei="idb-keyval";var Si=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Fr(t.dbName,t.storeName)),{name:Ei,options:t,async hasItem(o){return!(typeof await Ir(n(o),c)>"u")},async getItem(o){return await Ir(n(o),c)??null},setItem(o,h){return yi(n(o),h,c)},removeItem(o){return pi(n(o),c)},getKeys(){return xi(c)},clear(){return _i(c)}}};const Ii="WALLET_CONNECT_V2_INDEXED_DB",Oi="keyvaluestorage";let Ti=class{constructor(){this.indexedDb=gi({driver:Si({dbName:Ii,storeName:Oi})})}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,Wr(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof H.dist.global<"u"?H.dist.global:typeof self<"u"?self:{},He={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?He.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?He.exports=window.localStorage:He.exports=new r})();function Li(t){var r;return[t[0],kr((r=t[1])!=null?r:"")]}class Ai{constructor(){this.localStorage=He.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Li)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return kr(n)}async setItem(r,n){this.localStorage.setItem(r,Wr(n))}async removeItem(r){this.localStorage.removeItem(r)}}const Ri="wc_storage_version",Or=1,Pi=async(t,r,n)=>{const c=Ri,o=await r.getItem(c);if(o&&o>=Or){n(r);return}const h=await t.getKeys();if(!h.length){n(r);return}const S=[];for(;h.length;){const E=h.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),S.push(E)}}await r.setItem(c,Or),n(r),ji(t,S)},ji=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};let Ci=class{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Ai;this.storage=r;try{const n=new Ti;Pi(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 Ni{}function Mi(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var zi=Bi;function Bi(t,r,n){var c=n&&n.stringify||Mi,o=1;if(typeof t=="object"&&t!==null){var h=r.length+o;if(h===1)return t;var S=new Array(h);S[0]=c(t);for(var E=1;E<h;E++)S[E]=c(r[E]);return S.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=zi;var me=Qt;const Ie=Wi().console||{},Di={mapHttpRequest:Ke,mapHttpResponse:Ke,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:Ke,res:Ke,err:Gi};function $i(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||Ie;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=$i(t.browser.serialize,c);let h=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const S=["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:S,timestamp:Ji(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=h,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,pe(s,g,"error","log"),pe(s,g,"fatal","error"),pe(s,g,"warn","error"),pe(s,g,"info","log"),pe(s,g,"debug","log"),pe(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,Ve([x],M,ut,this._stdErrSerialize)}function Lt(gt){this._childLevel=(gt._childLevel|0)+1,this.error=_e(gt,x,"error"),this.fatal=_e(gt,x,"fatal"),this.warn=_e(gt,x,"warn"),this.info=_e(gt,x,"info"),this.debug=_e(gt,x,"debug"),this.trace=_e(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=Di;Qt.stdTimeFunctions=Object.assign({},{nullTime:Vr,epochTime:qr,unixTime:Fi,isoTime:ki});function pe(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Ie[n]||Ie[c]||Oe,Ki(t,r,n)}function Ki(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const h=t.timestamp(),S=new Array(arguments.length),E=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ie?Ie:this;for(var g=0;g<S.length;g++)S[g]=arguments[g];if(t.serialize&&!t.asObject&&Ve(S,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(E,Ui(this,n,S,h)):c.apply(E,S),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Hi(this,{ts:h,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},S)}}}(r[n]))}function Ui(t,r,n,c){t._serialize&&Ve(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let h=o[0];const S={};c&&(S.time=c),S.level=Qt.levels.values[r];let E=(t._childLevel|0)+1;if(E<1&&(E=1),h!==null&&typeof h=="object"){for(;E--&&typeof o[0]=="object";)Object.assign(S,o.shift());h=o.length?Tr(o.shift(),o):void 0}else typeof h=="string"&&(h=Tr(o.shift(),o));return h!==void 0&&(S.msg=h),S}function Ve(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 h in t[o])r&&r.indexOf(h)>-1&&h in n&&(t[o][h]=n[h](t[o][h]))}function _e(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 Hi(t,r,n){const c=r.send,o=r.ts,h=r.methodLevel,S=r.methodValue,E=r.val,g=t._logEvent.bindings;Ve(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=h,t._logEvent.level.value=S,c(h,t._logEvent,E),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Gi(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 Ji(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Vr:qr}function Ke(){return{}}function tr(t){return t}function Oe(){}function Vr(){return!1}function qr(){return Date.now()}function Fi(){return Math.round(Date.now()/1e3)}function ki(){return new Date(Date.now()).toISOString()}function Wi(){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=H.getDefaultExportFromCjs(me),Vi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Lr(t){return typeof t=="string"?t:Vi(t)||""}const qi={level:"info"},Re="custom_context",ar=1e3*1024;class Xi{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 Xi(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 Xr{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 Yi{constructor(r,n=ar){this.baseChunkLogger=new Xr(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 Zi{constructor(r,n=ar){this.baseChunkLogger=new Xr(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 Qi=Object.defineProperty,ts=Object.defineProperties,es=Object.getOwnPropertyDescriptors,Rr=Object.getOwnPropertySymbols,rs=Object.prototype.hasOwnProperty,ns=Object.prototype.propertyIsEnumerable,Pr=(t,r,n)=>r in t?Qi(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,Ge=(t,r)=>{for(var n in r||(r={}))rs.call(r,n)&&Pr(t,n,r[n]);if(Rr)for(var n of Rr(r))ns.call(r,n)&&Pr(t,n,r[n]);return t},Je=(t,r)=>ts(t,es(r));function is(t){return Je(Ge({},t),{level:(t==null?void 0:t.level)||qi.level})}function ss(t,r=Re){return t[r]||""}function os(t,r,n=Re){return t[n]=r,t}function Yr(t,r=Re){let n="";return typeof t.bindings>"u"?n=ss(t,r):n=t.bindings().context||"",n}function as(t,r,n=Re){const c=Yr(t,n);return c.trim()?`${c}/${r}`:r}function fs(t,r,n=Re){const c=as(t,r,n),o=t.child({context:c});return os(o,c,n)}function cs(t){var r,n;const c=new Yi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Je(Ge({},t.opts),{level:"trace",browser:Je(Ge({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function us(t){var r;const n=new Zi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Je(Ge({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function ls(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?cs(t):us(t)}var fr={},Zr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Bt.binary,n=Bt.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&&(h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=h(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),h(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 h(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],J=u[0],C=u[1],Nt=u[2],te=u[3],yt=u[4],kt=u[5],Ut=u[6],qt=u[7],m,_,X,lt,A,I,O,L;w>=128;){for(var At=0;At<16;At++){var rt=8*At+v;E[At]=r.readUint32BE(y,rt),g[At]=r.readUint32BE(y,rt+4)}for(var At=0;At<80;At++){var xe=x,z=N,ge=G,b=ut,d=M,l=Lt,e=gt,a=Ct,R=J,P=C,D=Nt,$=te,B=yt,K=kt,Rt=Ut,ht=qt;if(m=Ct,_=qt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(M>>>14|yt<<18)^(M>>>18|yt<<14)^(yt>>>9|M<<23),_=(yt>>>14|M<<18)^(yt>>>18|M<<14)^(M>>>9|yt<<23),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=M&Lt^~M&gt,_=yt&kt^~yt&Ut,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=o[At*2],_=o[At*2+1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=E[At%16],_=g[At%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,X=O&65535|L<<16,lt=A&65535|I<<16,m=X,_=lt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(x>>>28|J<<4)^(J>>>2|x<<30)^(J>>>7|x<<25),_=(J>>>28|x<<4)^(x>>>2|J<<30)^(x>>>7|J<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&G^N&G,_=J&C^J&Nt^C&Nt,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,a=O&65535|L<<16,ht=A&65535|I<<16,m=b,_=$,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=X,_=lt,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,b=O&65535|L<<16,$=A&65535|I<<16,N=xe,G=z,ut=ge,M=b,Lt=d,gt=l,Ct=e,x=a,C=R,Nt=P,te=D,yt=$,kt=B,Ut=K,qt=Rt,J=ht,At%16===15)for(var rt=0;rt<16;rt++)m=E[rt],_=g[rt],A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=E[(rt+9)%16],_=g[(rt+9)%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=E[(rt+1)%16],lt=g[(rt+1)%16],m=(X>>>1|lt<<31)^(X>>>8|lt<<24)^X>>>7,_=(lt>>>1|X<<31)^(lt>>>8|X<<24)^(lt>>>7|X<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=E[(rt+14)%16],lt=g[(rt+14)%16],m=(X>>>19|lt<<13)^(lt>>>29|X<<3)^X>>>6,_=(lt>>>19|X<<13)^(X>>>29|lt<<3)^(lt>>>6|X<<26),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,E[rt]=O&65535|L<<16,g[rt]=A&65535|I<<16}m=x,_=J,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[0],_=u[0],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=J=A&65535|I<<16,m=N,_=C,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[1],_=u[1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=C=A&65535|I<<16,m=G,_=Nt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[2],_=u[2],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[2]=G=O&65535|L<<16,u[2]=Nt=A&65535|I<<16,m=ut,_=te,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[3],_=u[3],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[3]=ut=O&65535|L<<16,u[3]=te=A&65535|I<<16,m=M,_=yt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[4],_=u[4],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=yt=A&65535|I<<16,m=Lt,_=kt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[5],_=u[5],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[5]=Lt=O&65535|L<<16,u[5]=kt=A&65535|I<<16,m=gt,_=Ut,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[6],_=u[6],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[6]=gt=O&65535|L<<16,u[6]=Ut=A&65535|I<<16,m=Ct,_=qt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[7],_=u[7],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=qt=A&65535|I<<16,v+=128,w-=128}return v}function S(E){var g=new c;g.update(E);var s=g.digest();return g.clean(),s}t.hash=S})(Zr);(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=Bt.random,n=Zr,c=Bt.wipe;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(b){const d=new Float64Array(16);if(b)for(let l=0;l<b.length;l++)d[l]=b[l];return d}const h=new Uint8Array(32);h[0]=9;const S=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(b,d){for(let l=0;l<16;l++)b[l]=d[l]|0}function x(b){let d=1;for(let l=0;l<16;l++){let e=b[l]+d+65535;d=Math.floor(e/65536),b[l]=e-d*65536}b[0]+=d-1+37*(d-1)}function N(b,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(b[a]^d[a]);b[a]^=R,d[a]^=R}}function G(b,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 P=1;P<15;P++)l[P]=e[P]-65535-(l[P-1]>>16&1),l[P-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++)b[2*a]=e[a]&255,b[2*a+1]=e[a]>>8}function ut(b,d){let l=0;for(let e=0;e<32;e++)l|=b[e]^d[e];return(1&l-1>>>8)-1}function M(b,d){const l=new Uint8Array(32),e=new Uint8Array(32);return G(l,b),G(e,d),ut(l,e)}function Lt(b){const d=new Uint8Array(32);return G(d,b),d[0]&1}function gt(b,d){for(let l=0;l<16;l++)b[l]=d[2*l]+(d[2*l+1]<<8);b[15]&=32767}function Ct(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]+l[e]}function J(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]-l[e]}function C(b,d,l){let e,a,R=0,P=0,D=0,$=0,B=0,K=0,Rt=0,ht=0,Pt=0,pt=0,dt=0,nt=0,et=0,Y=0,V=0,U=0,it=0,_t=0,F=0,Mt=0,Dt=0,Ht=0,Gt=0,$t=0,Xt=0,Zt=0,se=0,Jt=0,ce=0,we=0,Pe=0,st=l[0],Z=l[1],ot=l[2],at=l[3],ft=l[4],Q=l[5],mt=l[6],xt=l[7],wt=l[8],vt=l[9],Et=l[10],bt=l[11],ct=l[12],W=l[13],St=l[14],It=l[15];e=d[0],R+=e*st,P+=e*Z,D+=e*ot,$+=e*at,B+=e*ft,K+=e*Q,Rt+=e*mt,ht+=e*xt,Pt+=e*wt,pt+=e*vt,dt+=e*Et,nt+=e*bt,et+=e*ct,Y+=e*W,V+=e*St,U+=e*It,e=d[1],P+=e*st,D+=e*Z,$+=e*ot,B+=e*at,K+=e*ft,Rt+=e*Q,ht+=e*mt,Pt+=e*xt,pt+=e*wt,dt+=e*vt,nt+=e*Et,et+=e*bt,Y+=e*ct,V+=e*W,U+=e*St,it+=e*It,e=d[2],D+=e*st,$+=e*Z,B+=e*ot,K+=e*at,Rt+=e*ft,ht+=e*Q,Pt+=e*mt,pt+=e*xt,dt+=e*wt,nt+=e*vt,et+=e*Et,Y+=e*bt,V+=e*ct,U+=e*W,it+=e*St,_t+=e*It,e=d[3],$+=e*st,B+=e*Z,K+=e*ot,Rt+=e*at,ht+=e*ft,Pt+=e*Q,pt+=e*mt,dt+=e*xt,nt+=e*wt,et+=e*vt,Y+=e*Et,V+=e*bt,U+=e*ct,it+=e*W,_t+=e*St,F+=e*It,e=d[4],B+=e*st,K+=e*Z,Rt+=e*ot,ht+=e*at,Pt+=e*ft,pt+=e*Q,dt+=e*mt,nt+=e*xt,et+=e*wt,Y+=e*vt,V+=e*Et,U+=e*bt,it+=e*ct,_t+=e*W,F+=e*St,Mt+=e*It,e=d[5],K+=e*st,Rt+=e*Z,ht+=e*ot,Pt+=e*at,pt+=e*ft,dt+=e*Q,nt+=e*mt,et+=e*xt,Y+=e*wt,V+=e*vt,U+=e*Et,it+=e*bt,_t+=e*ct,F+=e*W,Mt+=e*St,Dt+=e*It,e=d[6],Rt+=e*st,ht+=e*Z,Pt+=e*ot,pt+=e*at,dt+=e*ft,nt+=e*Q,et+=e*mt,Y+=e*xt,V+=e*wt,U+=e*vt,it+=e*Et,_t+=e*bt,F+=e*ct,Mt+=e*W,Dt+=e*St,Ht+=e*It,e=d[7],ht+=e*st,Pt+=e*Z,pt+=e*ot,dt+=e*at,nt+=e*ft,et+=e*Q,Y+=e*mt,V+=e*xt,U+=e*wt,it+=e*vt,_t+=e*Et,F+=e*bt,Mt+=e*ct,Dt+=e*W,Ht+=e*St,Gt+=e*It,e=d[8],Pt+=e*st,pt+=e*Z,dt+=e*ot,nt+=e*at,et+=e*ft,Y+=e*Q,V+=e*mt,U+=e*xt,it+=e*wt,_t+=e*vt,F+=e*Et,Mt+=e*bt,Dt+=e*ct,Ht+=e*W,Gt+=e*St,$t+=e*It,e=d[9],pt+=e*st,dt+=e*Z,nt+=e*ot,et+=e*at,Y+=e*ft,V+=e*Q,U+=e*mt,it+=e*xt,_t+=e*wt,F+=e*vt,Mt+=e*Et,Dt+=e*bt,Ht+=e*ct,Gt+=e*W,$t+=e*St,Xt+=e*It,e=d[10],dt+=e*st,nt+=e*Z,et+=e*ot,Y+=e*at,V+=e*ft,U+=e*Q,it+=e*mt,_t+=e*xt,F+=e*wt,Mt+=e*vt,Dt+=e*Et,Ht+=e*bt,Gt+=e*ct,$t+=e*W,Xt+=e*St,Zt+=e*It,e=d[11],nt+=e*st,et+=e*Z,Y+=e*ot,V+=e*at,U+=e*ft,it+=e*Q,_t+=e*mt,F+=e*xt,Mt+=e*wt,Dt+=e*vt,Ht+=e*Et,Gt+=e*bt,$t+=e*ct,Xt+=e*W,Zt+=e*St,se+=e*It,e=d[12],et+=e*st,Y+=e*Z,V+=e*ot,U+=e*at,it+=e*ft,_t+=e*Q,F+=e*mt,Mt+=e*xt,Dt+=e*wt,Ht+=e*vt,Gt+=e*Et,$t+=e*bt,Xt+=e*ct,Zt+=e*W,se+=e*St,Jt+=e*It,e=d[13],Y+=e*st,V+=e*Z,U+=e*ot,it+=e*at,_t+=e*ft,F+=e*Q,Mt+=e*mt,Dt+=e*xt,Ht+=e*wt,Gt+=e*vt,$t+=e*Et,Xt+=e*bt,Zt+=e*ct,se+=e*W,Jt+=e*St,ce+=e*It,e=d[14],V+=e*st,U+=e*Z,it+=e*ot,_t+=e*at,F+=e*ft,Mt+=e*Q,Dt+=e*mt,Ht+=e*xt,Gt+=e*wt,$t+=e*vt,Xt+=e*Et,Zt+=e*bt,se+=e*ct,Jt+=e*W,ce+=e*St,we+=e*It,e=d[15],U+=e*st,it+=e*Z,_t+=e*ot,F+=e*at,Mt+=e*ft,Dt+=e*Q,Ht+=e*mt,Gt+=e*xt,$t+=e*wt,Xt+=e*vt,Zt+=e*Et,se+=e*bt,Jt+=e*ct,ce+=e*W,we+=e*St,Pe+=e*It,R+=38*it,P+=38*_t,D+=38*F,$+=38*Mt,B+=38*Dt,K+=38*Ht,Rt+=38*Gt,ht+=38*$t,Pt+=38*Xt,pt+=38*Zt,dt+=38*se,nt+=38*Jt,et+=38*ce,Y+=38*we,V+=38*Pe,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=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=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=Pt+a+65535,a=Math.floor(e/65536),Pt=e-a*65536,e=pt+a+65535,a=Math.floor(e/65536),pt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=nt+a+65535,a=Math.floor(e/65536),nt=e-a*65536,e=et+a+65535,a=Math.floor(e/65536),et=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=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=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=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=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=Pt+a+65535,a=Math.floor(e/65536),Pt=e-a*65536,e=pt+a+65535,a=Math.floor(e/65536),pt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=nt+a+65535,a=Math.floor(e/65536),nt=e-a*65536,e=et+a+65535,a=Math.floor(e/65536),et=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,R+=a-1+37*(a-1),b[0]=R,b[1]=P,b[2]=D,b[3]=$,b[4]=B,b[5]=K,b[6]=Rt,b[7]=ht,b[8]=Pt,b[9]=pt,b[10]=dt,b[11]=nt,b[12]=et,b[13]=Y,b[14]=V,b[15]=U}function Nt(b,d){C(b,d,d)}function te(b,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++)b[e]=l[e]}function yt(b,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++)b[e]=l[e]}function kt(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o(),B=o(),K=o();J(l,b[1],b[0]),J(K,d[1],d[0]),C(l,l,K),Ct(e,b[0],b[1]),Ct(K,d[0],d[1]),C(e,e,K),C(a,b[3],d[3]),C(a,a,s),C(R,b[2],d[2]),Ct(R,R,R),J(P,e,l),J(D,R,a),Ct($,R,a),Ct(B,e,l),C(b[0],P,D),C(b[1],B,$),C(b[2],$,D),C(b[3],P,B)}function Ut(b,d,l){for(let e=0;e<4;e++)N(b[e],d[e],l)}function qt(b,d){const l=o(),e=o(),a=o();te(a,d[2]),C(l,d[0],a),C(e,d[1],a),G(b,e),b[31]^=Lt(l)<<7}function m(b,d,l){w(b[0],S),w(b[1],E),w(b[2],E),w(b[3],S);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;Ut(b,d,a),kt(d,b),kt(b,b),Ut(b,d,a)}}function _(b,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(b,l,d)}function X(b){if(b.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(b);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];_(e,d),qt(l,e);const a=new Uint8Array(64);return a.set(b),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function lt(b){const d=(0,r.randomBytes)(32,b),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=lt;function A(b){if(b.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(b.subarray(32))}t.extractPublicKeyFromSecretKey=A;const I=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(b,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]*I[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)*I[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*I[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,b[e]=d[e]&255}function L(b){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=b[l];for(let l=0;l<64;l++)b[l]=0;O(b,d)}function At(b,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(b.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const P=new n.SHA512;P.update(R.subarray(32)),P.update(d);const D=P.digest();P.clean(),L(D),_(e,D),qt(R,e),P.reset(),P.update(R.subarray(0,32)),P.update(b.subarray(32)),P.update(d);const $=P.digest();L($);for(let B=0;B<32;B++)l[B]=D[B];for(let B=0;B<32;B++)for(let K=0;K<32;K++)l[B+K]+=$[B]*a[K];return O(R.subarray(32),l),R}t.sign=At;function rt(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o();return w(b[2],E),gt(b[1],d),Nt(a,b[1]),C(R,a,g),J(a,a,b[2]),Ct(R,b[2],R),Nt(P,R),Nt(D,P),C($,D,P),C(l,$,a),C(l,l,R),yt(l,l),C(l,l,a),C(l,l,R),C(l,l,R),C(b[0],l,R),Nt(e,b[0]),C(e,e,R),M(e,a)&&C(b[0],b[0],v),Nt(e,b[0]),C(e,e,R),M(e,a)?-1:(Lt(b[0])===d[31]>>7&&J(b[0],S,b[0]),C(b[3],b[0],b[1]),0)}function xe(b,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(rt(R,b))return!1;const P=new n.SHA512;P.update(l.subarray(0,32)),P.update(b),P.update(d);const D=P.digest();return L(D),m(a,R,D),_(R,l.subarray(32)),kt(a,R),qt(e,a),!ut(l,e)}t.verify=xe;function z(b){let d=[o(),o(),o(),o()];if(rt(d,b))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,E,a),J(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(b){const d=(0,n.hash)(b.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 hs="EdDSA",ds="JWT",Fe=".",qe="base64url",Qr="utf8",tn="utf8",bs=":",gs="did",ys="key",jr="base58btc",ps="z",_s="K36",ms=32,xs=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),ws=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 vs(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ws(t)}catch{return t}}function Es(t){return typeof t=="string"?t:xs(t)||""}function Cr(t){return vs(Le(de(t,qe),Qr))}function ke(t){return Le(de(Es(t),Qr),qe)}function en(t){const r=de(_s,jr),n=ps+Le(Ur([r,t]),jr);return[gs,ys,n].join(bs)}function Ss(t){return Le(t,qe)}function Is(t){return de(t,qe)}function Os(t){return de([ke(t.header),ke(t.payload)].join(Fe),tn)}function Ts(t){return[ke(t.header),ke(t.payload),Ss(t.signature)].join(Fe)}function Ls(t){const r=t.split(Fe),n=Cr(r[0]),c=Cr(r[1]),o=Is(r[2]),h=de(r.slice(0,2).join(Fe),tn);return{header:n,payload:c,signature:o,data:h}}function As(t=Bt.random.randomBytes(ms)){return fr.generateKeyPairFromSeed(t)}async function Rs(t,r,n,c,o=Bt.cjs.fromMiliseconds(Date.now())){const h={alg:hs,typ:ds},S=en(c.publicKey),E=o+n,g={iss:S,sub:t,aud:r,iat:o,exp:E},s=Os({header:h,payload:g}),u=fr.sign(c.secretKey,s);return Ts({header:h,payload:g,signature:u})}const Ps="PARSE_ERROR",js="INVALID_REQUEST",Cs="METHOD_NOT_FOUND",Ns="INVALID_PARAMS",rn="INTERNAL_ERROR",cr="SERVER_ERROR",Ms=[-32700,-32600,-32601,-32602,-32603],Se={[Ps]:{code:-32700,message:"Parse error"},[js]:{code:-32600,message:"Invalid Request"},[Cs]:{code:-32601,message:"Method not found"},[Ns]:{code:-32602,message:"Invalid params"},[rn]:{code:-32603,message:"Internal error"},[cr]:{code:-32e3,message:"Server error"}},nn=cr;function zs(t){return Ms.includes(t)}function Nr(t){return Object.keys(Se).includes(t)?Se[t]:Se[nn]}function Bs(t){const r=Object.values(Se).find(n=>n.code===t);return r||Se[nn]}function sn(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var on={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1,6 +1,6 @@
1
1
  const fe = Symbol(), ee = Object.getPrototypeOf, G = /* @__PURE__ */ new WeakMap(), me = (e) => e && (G.has(e) ? G.get(e) : ee(e) === Object.prototype || ee(e) === Array.prototype), ge = (e) => me(e) && e[fe] || null, te = (e, t = !0) => {
2
2
  G.set(e, t);
3
- }, z = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "a40a8d0e151502ca2bd050b2db7ef84c4a08170b", REACT_APP_CONNECT_VERSION: "1.1.2-beta.1-development", SSR: !1 }, q = (e) => typeof e == "object" && e !== null, A = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakSet(), he = (e = Object.is, t = (n, h) => new Proxy(n, h), s = (n) => q(n) && !x.has(n) && (Array.isArray(n) || !(Symbol.iterator in n)) && !(n instanceof WeakMap) && !(n instanceof WeakSet) && !(n instanceof Error) && !(n instanceof Number) && !(n instanceof Date) && !(n instanceof String) && !(n instanceof RegExp) && !(n instanceof ArrayBuffer), r = (n) => {
3
+ }, z = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "a40a8d0e151502ca2bd050b2db7ef84c4a08170b", REACT_APP_CONNECT_VERSION: "1.1.2", SSR: !1 }, q = (e) => typeof e == "object" && e !== null, A = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakSet(), he = (e = Object.is, t = (n, h) => new Proxy(n, h), s = (n) => q(n) && !x.has(n) && (Array.isArray(n) || !(Symbol.iterator in n)) && !(n instanceof WeakMap) && !(n instanceof WeakSet) && !(n instanceof Error) && !(n instanceof Number) && !(n instanceof Date) && !(n instanceof String) && !(n instanceof RegExp) && !(n instanceof ArrayBuffer), r = (n) => {
4
4
  switch (n.status) {
5
5
  case "fulfilled":
6
6
  return n.value;
@@ -375,7 +375,7 @@ class _e {
375
375
  }
376
376
  async initUi() {
377
377
  if (typeof window < "u") {
378
- await import("./index-uEx_Ty6H.mjs");
378
+ await import("./index-HiefsQrl.mjs");
379
379
  const t = document.createElement("wcm-modal");
380
380
  document.body.insertAdjacentElement("beforeend", t), w.setIsUiLoaded(!0);
381
381
  }
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-C4PiSpuF.js"),e=require("./index-CjaaWCsQ.js"),v=require("./algorand-DZQLtCs3.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
1
+ "use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-jOVG08il.js"),e=require("./index-DH03XiQv.js"),v=require("./algorand-DE9FRXgN.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
@@ -1,4 +1,4 @@
1
- import { dC as Tt, $ as Mt, a1 as xt } from "./index-DCFAlA0r.mjs";
1
+ import { dB as Tt, $ as Mt, a1 as xt } from "./index-v0XYnBH4.mjs";
2
2
  var Lt = {}, Me = {}, B = {}, _t = {};
3
3
  (function(e) {
4
4
  Object.defineProperty(e, "__esModule", { value: !0 });
@@ -1 +1 @@
1
- "use strict";var T=Object.defineProperty;var C=(m,e,t)=>e in m?T(m,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):m[e]=t;var d=(m,e,t)=>C(m,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DgwozKZn.js");const c=require("./cosmwasm-CrtL_ala.js"),i=require("./unsignedTransaction-BOL13zs_.js"),s=require("./index-CjaaWCsQ.js");class l{constructor(e,t,r,n){d(this,"network");d(this,"chain");d(this,"rpc");d(this,"contracts");d(this,"tokenBridge");d(this,"translator");this.network=e,this.chain=t,this.rpc=r,this.contracts=n;const a=this.contracts.tokenBridge;if(!a)throw new Error(`Wormhole Token Bridge contract for domain ${t} not found`);if(this.tokenBridge=a,this.translator=this.contracts.translator,this.translator!==void 0&&this.translator==="")throw new Error("Translator address may be undefined but not empty string")}static async fromRpc(e,t){const[r,n]=await c.CosmwasmPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error(`Network mismatch: ${a.network} != ${r}`);return new l(r,n,e,t[n].contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{}return!1}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(e.chain===this.chain)throw new Error(`Expected foreign chain, got ${e.chain}`);if(s.isNative(e.address))throw new Error("Native asset cannot be a wrapped asset");const t=s.b64.encode(e.address.toUniversalAddress().toUint8Array()),{address:r}=await this.rpc.queryContractSmart(this.tokenBridge,{wrapped_registry:{chain:s.toChainId(e.chain),address:t}});return s.toNative(this.chain,r)}async getOriginalAsset(e){let t=new s.CosmwasmAddress(e);t.denomType==="factory"&&(t=c.Gateway.factoryToCw20(t));const r=await this.rpc.queryContractSmart(t.toString(),{wrapped_asset_info:{}}),n=s.toChain(r.asset_chain),a=s.b64.decode(r.asset_address);return{chain:n,address:new s.UniversalAddress(new Uint8Array(a))}}async getTokenUniversalAddress(e){return new s.CosmwasmAddress(e).toUniversalAddress()}async getTokenNativeAddress(e,t){return new s.CosmwasmAddress(t).toNative()}async isTransferCompleted(e){const t=s.b64.encode(s.serialize(e));return(await this.rpc.queryContractSmart(this.tokenBridge,{is_vaa_redeemed:{vaa:t}})).is_redeemed}async*createAttestation(e,t){if(!t)throw new Error("Payer required to create attestation");const r=new s.CosmwasmAddress(e).toString(),n=new s.CosmwasmAddress(t).toString(),a=0,w=s.isNative(e)?{native_token:{denom:c.CosmwasmPlatform.getNativeDenom(this.network,this.chain)}}:{token:{contract_addr:r}};yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(n,this.tokenBridge,{create_asset_meta:{asset_info:w,nonce:a}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Create Attestation"},"TokenBridge.createAttestation")}async*submitAttestation(e,t){if(!t)throw new Error("Payer required to submit attestation");const r=new s.CosmwasmAddress(t).toString();yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(r,this.tokenBridge,{submit_vaa:{data:s.serialize(e)}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Submit Attestation"},"TokenBridge.submitAttestation")}async*transfer(e,t,r,n,a){const w=Math.round(Math.random()*1e5),u="0",k=s.toChainId(t.chain),A=s.b64.encode(t.address.toUniversalAddress().toUint8Array()),v=c.CosmwasmPlatform.getNativeDenom(this.network,this.chain),f=s.isNative(r);let o=f?v:r.toString();o.startsWith("factory")&&(o=c.Gateway.factoryToCw20(new s.CosmwasmAddress(o)).toString());const g=new s.CosmwasmAddress(e).toString(),p=h=>{const y={asset:{amount:n.toString(),info:h},recipient_chain:k,recipient:A,fee:u,nonce:w};return a?{initiate_transfer_with_payload:{...y,payload:s.b64.encode(a)}}:{initiate_transfer:y}};if(f){const h=[i.buildExecuteMsg(g,this.tokenBridge,{deposit_tokens:{}},[{amount:n.toString(),denom:o}]),i.buildExecuteMsg(g,this.tokenBridge,p({native_token:{denom:o}}))];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Native Transfer"},"TokenBridge.transferNative")}else{const h=[i.buildExecuteMsg(g,o,{increase_allowance:{spender:this.tokenBridge,amount:n.toString(),expires:{never:{}}}}),i.buildExecuteMsg(g,this.tokenBridge,p({token:{contract_addr:o}}),[{amount:n.toString(),denom:o}])];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Transfer"},"TokenBridge.transfer")}}async*redeem(e,t,r=!0){const n=s.b64.encode(s.serialize(t)),a=new s.CosmwasmAddress(e).toString(),u=this.translator&&new s.CosmwasmAddress(this.translator).toUniversalAddress().equals(t.payload.to.address)?i.buildExecuteMsg(a,this.translator,{complete_transfer_and_convert:{vaa:n}}):i.buildExecuteMsg(a,this.tokenBridge,{submit_vaa:{data:n}});yield this.createUnsignedTx({msgs:[u],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Complete Transfer"},"TokenBridge.redeem")}async parseTransactionDetails(e){throw new Error("Not implemented")}async getWrappedNative(){return s.toNative(this.chain,c.CosmwasmPlatform.getNativeDenom(this.network,this.chain))}createUnsignedTx(e,t,r=!1){return new i.CosmwasmUnsignedTransaction(e,this.network,this.chain,t,r)}}s.registerProtocol(s._platform$3,"TokenBridge",l);exports.CosmwasmTokenBridge=l;
1
+ "use strict";var T=Object.defineProperty;var C=(m,e,t)=>e in m?T(m,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):m[e]=t;var d=(m,e,t)=>C(m,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-S2WRTxH-.js");const c=require("./cosmwasm-DpoXBVof.js"),i=require("./unsignedTransaction-YyhZZvTR.js"),s=require("./index-DH03XiQv.js");class l{constructor(e,t,r,n){d(this,"network");d(this,"chain");d(this,"rpc");d(this,"contracts");d(this,"tokenBridge");d(this,"translator");this.network=e,this.chain=t,this.rpc=r,this.contracts=n;const a=this.contracts.tokenBridge;if(!a)throw new Error(`Wormhole Token Bridge contract for domain ${t} not found`);if(this.tokenBridge=a,this.translator=this.contracts.translator,this.translator!==void 0&&this.translator==="")throw new Error("Translator address may be undefined but not empty string")}static async fromRpc(e,t){const[r,n]=await c.CosmwasmPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error(`Network mismatch: ${a.network} != ${r}`);return new l(r,n,e,t[n].contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{}return!1}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(e.chain===this.chain)throw new Error(`Expected foreign chain, got ${e.chain}`);if(s.isNative(e.address))throw new Error("Native asset cannot be a wrapped asset");const t=s.b64.encode(e.address.toUniversalAddress().toUint8Array()),{address:r}=await this.rpc.queryContractSmart(this.tokenBridge,{wrapped_registry:{chain:s.toChainId(e.chain),address:t}});return s.toNative(this.chain,r)}async getOriginalAsset(e){let t=new s.CosmwasmAddress(e);t.denomType==="factory"&&(t=c.Gateway.factoryToCw20(t));const r=await this.rpc.queryContractSmart(t.toString(),{wrapped_asset_info:{}}),n=s.toChain(r.asset_chain),a=s.b64.decode(r.asset_address);return{chain:n,address:new s.UniversalAddress(new Uint8Array(a))}}async getTokenUniversalAddress(e){return new s.CosmwasmAddress(e).toUniversalAddress()}async getTokenNativeAddress(e,t){return new s.CosmwasmAddress(t).toNative()}async isTransferCompleted(e){const t=s.b64.encode(s.serialize(e));return(await this.rpc.queryContractSmart(this.tokenBridge,{is_vaa_redeemed:{vaa:t}})).is_redeemed}async*createAttestation(e,t){if(!t)throw new Error("Payer required to create attestation");const r=new s.CosmwasmAddress(e).toString(),n=new s.CosmwasmAddress(t).toString(),a=0,w=s.isNative(e)?{native_token:{denom:c.CosmwasmPlatform.getNativeDenom(this.network,this.chain)}}:{token:{contract_addr:r}};yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(n,this.tokenBridge,{create_asset_meta:{asset_info:w,nonce:a}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Create Attestation"},"TokenBridge.createAttestation")}async*submitAttestation(e,t){if(!t)throw new Error("Payer required to submit attestation");const r=new s.CosmwasmAddress(t).toString();yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(r,this.tokenBridge,{submit_vaa:{data:s.serialize(e)}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Submit Attestation"},"TokenBridge.submitAttestation")}async*transfer(e,t,r,n,a){const w=Math.round(Math.random()*1e5),u="0",k=s.toChainId(t.chain),A=s.b64.encode(t.address.toUniversalAddress().toUint8Array()),v=c.CosmwasmPlatform.getNativeDenom(this.network,this.chain),f=s.isNative(r);let o=f?v:r.toString();o.startsWith("factory")&&(o=c.Gateway.factoryToCw20(new s.CosmwasmAddress(o)).toString());const g=new s.CosmwasmAddress(e).toString(),p=h=>{const y={asset:{amount:n.toString(),info:h},recipient_chain:k,recipient:A,fee:u,nonce:w};return a?{initiate_transfer_with_payload:{...y,payload:s.b64.encode(a)}}:{initiate_transfer:y}};if(f){const h=[i.buildExecuteMsg(g,this.tokenBridge,{deposit_tokens:{}},[{amount:n.toString(),denom:o}]),i.buildExecuteMsg(g,this.tokenBridge,p({native_token:{denom:o}}))];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Native Transfer"},"TokenBridge.transferNative")}else{const h=[i.buildExecuteMsg(g,o,{increase_allowance:{spender:this.tokenBridge,amount:n.toString(),expires:{never:{}}}}),i.buildExecuteMsg(g,this.tokenBridge,p({token:{contract_addr:o}}),[{amount:n.toString(),denom:o}])];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Transfer"},"TokenBridge.transfer")}}async*redeem(e,t,r=!0){const n=s.b64.encode(s.serialize(t)),a=new s.CosmwasmAddress(e).toString(),u=this.translator&&new s.CosmwasmAddress(this.translator).toUniversalAddress().equals(t.payload.to.address)?i.buildExecuteMsg(a,this.translator,{complete_transfer_and_convert:{vaa:n}}):i.buildExecuteMsg(a,this.tokenBridge,{submit_vaa:{data:n}});yield this.createUnsignedTx({msgs:[u],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Complete Transfer"},"TokenBridge.redeem")}async parseTransactionDetails(e){throw new Error("Not implemented")}async getWrappedNative(){return s.toNative(this.chain,c.CosmwasmPlatform.getNativeDenom(this.network,this.chain))}createUnsignedTx(e,t,r=!1){return new i.CosmwasmUnsignedTransaction(e,this.network,this.chain,t,r)}}s.registerProtocol(s._platform$3,"TokenBridge",l);exports.CosmwasmTokenBridge=l;