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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/assets/{ccip-DG5PxfxZ.js → ccip-ugcVXZ-r.js} +1 -1
  2. package/dist/assets/{evm-CpEqLT_y.js → evm-DQC4xykE.js} +4 -4
  3. package/dist/assets/{index-CsGdgxew.js → index-B1SC-u2d.js} +1 -1
  4. package/dist/assets/{index-CDRpv8fM.js → index-ClGMzASA.js} +1 -1
  5. package/dist/assets/{index-tcDQieq-.js → index-JHRLBcVB.js} +2 -2
  6. package/dist/assets/{index.es-uOIRXoHK.js → index.es-WG_H7rYm.js} +2 -2
  7. package/dist/main.js +40 -43
  8. package/dist/src/icons/Tokens/CELO.d.ts.map +1 -1
  9. package/lib/{algorand-DZQLtCs3.js → algorand-Bfhml9ow.js} +1 -1
  10. package/lib/{algorand-Dm6TKWo1.mjs → algorand-Cjxu_rGT.mjs} +3 -3
  11. package/lib/{aptos-BgGyOa6d.js → aptos-8LK4z3vn.js} +1 -1
  12. package/lib/{aptos-C2XVzOAY.mjs → aptos-CCPjhoiH.mjs} +1 -1
  13. package/lib/{aptos-CuJuzlQ4.mjs → aptos-DoD0ybSM.mjs} +3 -3
  14. package/lib/{aptos-Oi2w7M7g.js → aptos-kknI1DBa.js} +2 -2
  15. package/lib/{ccip-DpMplNou.js → ccip-DFb-9M3G.js} +1 -1
  16. package/lib/{ccip-dAqJN7S0.mjs → ccip-DPB6Aeux.mjs} +1 -1
  17. package/lib/{cosmos-90bGYuhD.js → cosmos-Bpf_4aPg.js} +1 -1
  18. package/lib/{cosmos-zIwOBV8H.mjs → cosmos-D8oxyfb-.mjs} +5 -5
  19. package/lib/{cosmwasm-CrtL_ala.js → cosmwasm-B_Hk0_zg.js} +2 -2
  20. package/lib/{cosmwasm-B90CBMmk.mjs → cosmwasm-C0n2vNoS.mjs} +6 -6
  21. package/lib/{events-CkXgb0qh.mjs → events-IweKXbqK.mjs} +1 -1
  22. package/lib/{events-COwefqOt.js → events-wwBkyeeC.js} +1 -1
  23. package/lib/{evm-BdVnM5pA.js → evm-2R09kBJC.js} +1 -1
  24. package/lib/{evm-ETVyy1bF.mjs → evm-Bd2pCSsJ.mjs} +7 -7
  25. package/lib/{evm-DOnB2oR6.mjs → evm-aPO4WIdi.mjs} +5 -5
  26. package/lib/{evm-BN522EMV.js → evm-fe0Am1O3.js} +4 -4
  27. package/lib/{index-Oa-p0V5E.mjs → index--4VtoDDS.mjs} +4 -4
  28. package/lib/{index-B5_WNdeb.js → index-0GB3Vnvc.js} +1 -1
  29. package/lib/{index-CotIM_QM.js → index-47xrPd7t.js} +1 -1
  30. package/lib/{index-CAO9VKRh.mjs → index-56vFoolS.mjs} +1 -1
  31. package/lib/{index-CjaaWCsQ.js → index-B-m4JhhB.js} +4 -7
  32. package/lib/{index-CUNm43cC.mjs → index-B18omPyI.mjs} +3 -3
  33. package/lib/{index-D_IvJasJ.mjs → index-BA62NbuM.mjs} +2 -2
  34. package/lib/{index-B03mlZnU.js → index-BB5T29FD.js} +1 -1
  35. package/lib/{index-DG4r6BgI.js → index-BDrktTYO.js} +1 -1
  36. package/lib/{index-_6ORrwJQ.js → index-BKRL-VZ-.js} +1 -1
  37. package/lib/{index-BK5v6OjI.mjs → index-BNvCSTJM.mjs} +2 -2
  38. package/lib/{index-Dx54Fq-M.js → index-BWC_CLDn.js} +1 -1
  39. package/lib/{index-Dv2SHpnV.mjs → index-Bf66m4uH.mjs} +2 -2
  40. package/lib/{index-SHXZG1qD.js → index-Bm4h_tq9.js} +1 -1
  41. package/lib/{index-CKK14LS0.js → index-Bw_OvbxM.js} +1 -1
  42. package/lib/{index-B_6I_1KE.mjs → index-C4F1e3oi.mjs} +6 -6
  43. package/lib/{index-uEx_Ty6H.mjs → index-C7YoUen_.mjs} +2 -2
  44. package/lib/{index-S-6g7te9.mjs → index-C9ML4MIb.mjs} +2 -2
  45. package/lib/{index-DUnWVA2t.js → index-CCHGtHEs.js} +1 -1
  46. package/lib/{index-DgwozKZn.js → index-CDtHBUln.js} +1 -1
  47. package/lib/{index-CszotuUi.mjs → index-CFvHFN54.mjs} +3 -3
  48. package/lib/{index-2r-kWsjk.mjs → index-CHzy6dYb.mjs} +1 -1
  49. package/lib/{index-CfsjU0i8.mjs → index-CJXTHi_P.mjs} +2 -2
  50. package/lib/{index-BiEcDoCp.mjs → index-CLOOv5Du.mjs} +3 -3
  51. package/lib/{index-GIMIwhEX.js → index-CLbtY-pt.js} +1 -1
  52. package/lib/{index-CngGxdSU.mjs → index-CLwX1P1j.mjs} +3 -3
  53. package/lib/{index-RBlsEf3k.js → index-CTVkfVib.js} +1 -1
  54. package/lib/{index-CKEOPl_r.js → index-CgK6uLkd.js} +1 -1
  55. package/lib/{index-DxTkOnq6.js → index-Cz-8L-Qb.js} +1 -1
  56. package/lib/{index-t3NbnUgt.mjs → index-D7M_-bS5.mjs} +2 -2
  57. package/lib/{index-B3rePQFd.mjs → index-DFhYR6id.mjs} +1 -1
  58. package/lib/{index-Cx4LuiA1.mjs → index-DLDcbGAp.mjs} +2 -2
  59. package/lib/{index-kIexF0uT.js → index-DNvjoXDi.js} +1 -1
  60. package/lib/{index-CTVxLNgQ.mjs → index-DOb7A68c.mjs} +4 -4
  61. package/lib/{index-COovR23o.mjs → index-DQ8BRVa9.mjs} +2 -2
  62. package/lib/{index-q0kjBXQA.js → index-DdPHRkXV.js} +1 -1
  63. package/lib/{index-Dnfo149P.js → index-Dh_38iiq.js} +1 -1
  64. package/lib/{index-Be9Bg4au.js → index-DpzW5j0n.js} +1 -1
  65. package/lib/{index-CcPZaBV3.js → index-Du-JoS7B.js} +1 -1
  66. package/lib/{index-C4PiSpuF.js → index-Mmq175PJ.js} +1 -1
  67. package/lib/{index-DXkh0tUi.js → index-NyUOs86a.js} +1 -1
  68. package/lib/{index-DCFAlA0r.mjs → index-PezPPmQR.mjs} +32 -57
  69. package/lib/{index-BUJ1M7Ob.mjs → index-TvJJirn8.mjs} +2 -2
  70. package/lib/{index-B8U_Gr4R.mjs → index-eOaDp35h.mjs} +1 -1
  71. package/lib/{index-qCDztmW8.mjs → index-hgDL5OvS.mjs} +1 -1
  72. package/lib/{index-CVFSCRrp.js → index-xf8W0MMN.js} +1 -1
  73. package/lib/{index.es-DXLvY_D0.js → index.es-QOrf6vQ0.js} +2 -2
  74. package/lib/{index.es-DV0FLIto.mjs → index.es-rchXXbeY.mjs} +5 -5
  75. package/lib/index.js +1 -1
  76. package/lib/index.mjs +1 -1
  77. package/lib/{keccak-BIz1wVpA.js → keccak-BdDlOEQS.js} +1 -1
  78. package/lib/{keccak-BUByz5uF.mjs → keccak-DKGShrRL.mjs} +1 -1
  79. package/lib/{libsodium-wrappers-fP6c9wsa.js → libsodium-wrappers-BadAASPQ.js} +1 -1
  80. package/lib/{libsodium-wrappers-Cor7IUex.mjs → libsodium-wrappers-C2r7sgV4.mjs} +1 -1
  81. package/lib/{pako.esm-ZR78Kcp_.mjs → pako.esm-BUTjWIY2.mjs} +2 -2
  82. package/lib/{pako.esm-CYeKGWZL.js → pako.esm-DAaoySH_.js} +1 -1
  83. package/lib/{pbkdf2-CtnM_vol.js → pbkdf2-DDUd1MIo.js} +1 -1
  84. package/lib/{pbkdf2-BXETruEi.mjs → pbkdf2-DpLdYPlz.mjs} +1 -1
  85. package/lib/{sei-83rTGsK7.mjs → sei-BJXcObS8.mjs} +3 -3
  86. package/lib/{sei-BVrV8RIX.js → sei-C-M5R_lN.js} +1 -1
  87. package/lib/{signer-nBgWI7Cp.mjs → signer-D72l6J0o.mjs} +1 -1
  88. package/lib/{signer-DrIAzvo5.js → signer-nQpU_826.js} +1 -1
  89. package/lib/{solana-CDYc5Kkf.mjs → solana-B7ycHhCW.mjs} +5 -5
  90. package/lib/{solana-DfDEsqum.mjs → solana-Cwzan1t4.mjs} +4 -4
  91. package/lib/{solana-BHhb_iN6.js → solana-D6OY2B-1.js} +1 -1
  92. package/lib/solana-DEJ3zHI-.js +1 -0
  93. package/lib/{solanaEmbed.esm-THCQirO0.mjs → solanaEmbed.esm-D9U4HFlG.mjs} +3 -3
  94. package/lib/{solanaEmbed.esm-NdMQEmdv.js → solanaEmbed.esm-DPWnM67X.js} +1 -1
  95. package/lib/src/icons/Tokens/CELO.d.ts.map +1 -1
  96. package/lib/{sui-yf1o5y4o.js → sui-826u9KP_.js} +2 -2
  97. package/lib/{sui-BCKOTjLA.mjs → sui-CV8X52Ot.mjs} +4 -4
  98. package/lib/{sui-2OJrRkLv.js → sui-DUASPIkT.js} +1 -1
  99. package/lib/{sui-DZw78j9M.mjs → sui-sBQX8Jtb.mjs} +1 -1
  100. package/lib/{unsignedTransaction-BOL13zs_.js → unsignedTransaction-BXkK1pqs.js} +1 -1
  101. package/lib/{unsignedTransaction-CWcOEDGs.mjs → unsignedTransaction-DkG4Acpk.mjs} +2 -2
  102. package/package.json +1 -1
  103. package/lib/solana-BgoFdxcd.js +0 -1
@@ -90092,7 +90092,7 @@ const { chains: chains$3 } = CONFIG.MAINNET, MAINNET_CHAINS = {
90092
90092
  }
90093
90093
  return T;
90094
90094
  }
90095
- }, capitalize$1 = (T) => T[0].toUpperCase() + T.slice(1), __vite_import_meta_env__$2 = { 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 }, {
90095
+ }, capitalize$1 = (T) => T[0].toUpperCase() + T.slice(1), __vite_import_meta_env__$2 = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "8e3c7cbc2b66ed9711b2c04d5a46e029163fdc45", REACT_APP_CONNECT_VERSION: "1.1.2-beta.2-development", SSR: !1 }, {
90096
90096
  REACT_APP_ETHEREUM_RPC,
90097
90097
  REACT_APP_SOLANA_RPC,
90098
90098
  REACT_APP_POLYGON_RPC,
@@ -91801,7 +91801,7 @@ const { chains: chains$3 } = CONFIG.MAINNET, MAINNET_CHAINS = {
91801
91801
  icon: Icon.MANTLE,
91802
91802
  maxBlockSearch: 2e3
91803
91803
  }
91804
- }, __vite_import_meta_env__$1 = { 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 }, {
91804
+ }, __vite_import_meta_env__$1 = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "8e3c7cbc2b66ed9711b2c04d5a46e029163fdc45", REACT_APP_CONNECT_VERSION: "1.1.2-beta.2-development", SSR: !1 }, {
91805
91805
  REACT_APP_SEPOLIA_RPC,
91806
91806
  REACT_APP_BSC_TESTNET_RPC,
91807
91807
  REACT_APP_FUJI_RPC,
@@ -92445,7 +92445,7 @@ const { chains: chains$3 } = CONFIG.MAINNET, MAINNET_CHAINS = {
92445
92445
  icon: Icon.OSMO,
92446
92446
  maxBlockSearch: 0
92447
92447
  }
92448
- }, __vite_import_meta_env__ = { 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 }, {
92448
+ }, __vite_import_meta_env__ = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "8e3c7cbc2b66ed9711b2c04d5a46e029163fdc45", REACT_APP_CONNECT_VERSION: "1.1.2-beta.2-development", SSR: !1 }, {
92449
92449
  REACT_APP_ETHEREUM_DEVNET_RPC,
92450
92450
  REACT_APP_OSMOSIS_DEVNET_RPC,
92451
92451
  REACT_APP_WORMCHAIN_DEVNET_RPC,
@@ -92509,7 +92509,7 @@ const { chains: chains$3 } = CONFIG.MAINNET, MAINNET_CHAINS = {
92509
92509
  index: 0,
92510
92510
  keys: ["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
92511
92511
  }
92512
- }, WORMSCAN = "https://wormholescan.io/#/", CONNECT_VERSION = "1.1.2-beta.1-development", CONNECT_GIT_HASH = "a40a8d0e151502ca2bd050b2db7ef84c4a08170b", CHAIN_ORDER = [
92512
+ }, WORMSCAN = "https://wormholescan.io/#/", CONNECT_VERSION = "1.1.2-beta.2-development", CONNECT_GIT_HASH = "8e3c7cbc2b66ed9711b2c04d5a46e029163fdc45", CHAIN_ORDER = [
92513
92513
  "Ethereum",
92514
92514
  "Solana",
92515
92515
  "Arbitrum",
@@ -98113,7 +98113,7 @@ class SDKConverter {
98113
98113
  );
98114
98114
  }
98115
98115
  }
98116
- const evm = async () => (await import("./evm-DOnB2oR6.mjs")).default, solana$1 = async () => (await import("./solana-CDYc5Kkf.mjs")).default, aptos$1 = async () => (await import("./aptos-CuJuzlQ4.mjs").then((T) => T.a)).default, sui = async () => (await import("./sui-BCKOTjLA.mjs").then((T) => T.s)).default, cosmwasm = async () => (await import("./cosmwasm-B90CBMmk.mjs").then((T) => T.Q)).default, algorand = async () => (await import("./algorand-Dm6TKWo1.mjs").then((T) => T.a)).default;
98116
+ const evm = async () => (await import("./evm-aPO4WIdi.mjs")).default, solana$1 = async () => (await import("./solana-B7ycHhCW.mjs")).default, aptos$1 = async () => (await import("./aptos-DoD0ybSM.mjs").then((T) => T.a)).default, sui = async () => (await import("./sui-CV8X52Ot.mjs").then((T) => T.s)).default, cosmwasm = async () => (await import("./cosmwasm-C0n2vNoS.mjs").then((T) => T.Q)).default, algorand = async () => (await import("./algorand-Cjxu_rGT.mjs").then((T) => T.a)).default;
98117
98117
  var eventemitter3 = { exports: {} };
98118
98118
  (function(T) {
98119
98119
  var e = Object.prototype.hasOwnProperty, C = "~";
@@ -98456,14 +98456,14 @@ const walletConnection = {
98456
98456
  if (C.getNetworkInfo().chainId !== T) {
98457
98457
  if ($.context === Context.ETH)
98458
98458
  try {
98459
- const { switchChain: J } = await import("./evm-ETVyy1bF.mjs").then((ee) => ee.j);
98459
+ const { switchChain: J } = await import("./evm-Bd2pCSsJ.mjs").then((ee) => ee.j);
98460
98460
  await J(C, T);
98461
98461
  } catch (J) {
98462
98462
  if (J instanceof NotSupported) return;
98463
98463
  throw J;
98464
98464
  }
98465
98465
  if ($.context === Context.COSMOS) {
98466
- const { switchChain: J } = await import("./cosmos-zIwOBV8H.mjs");
98466
+ const { switchChain: J } = await import("./cosmos-D8oxyfb-.mjs");
98467
98467
  await J(C, T);
98468
98468
  }
98469
98469
  return C.getAddress();
@@ -98476,7 +98476,7 @@ const walletConnection = {
98476
98476
  if (!J)
98477
98477
  throw new Error("wallet is undefined");
98478
98478
  if (V.context === Context.ETH) {
98479
- const { signAndSendTransaction: ee } = await import("./evm-ETVyy1bF.mjs").then((ne) => ne.j);
98479
+ const { signAndSendTransaction: ee } = await import("./evm-Bd2pCSsJ.mjs").then((ne) => ne.j);
98480
98480
  return await ee(
98481
98481
  e,
98482
98482
  J,
@@ -98484,20 +98484,20 @@ const walletConnection = {
98484
98484
  $
98485
98485
  );
98486
98486
  } else if (V.context === Context.SOLANA) {
98487
- const { signAndSendTransaction: ee } = await import("./solana-DfDEsqum.mjs");
98487
+ const { signAndSendTransaction: ee } = await import("./solana-Cwzan1t4.mjs");
98488
98488
  return await ee(
98489
98489
  e,
98490
98490
  J,
98491
98491
  $
98492
98492
  );
98493
98493
  } else if (V.context === Context.SUI) {
98494
- const { signAndSendTransaction: ee } = await import("./sui-DZw78j9M.mjs");
98494
+ const { signAndSendTransaction: ee } = await import("./sui-sBQX8Jtb.mjs");
98495
98495
  return (await ee(
98496
98496
  e,
98497
98497
  J
98498
98498
  )).id;
98499
98499
  } else if (V.context === Context.APTOS) {
98500
- const { signAndSendTransaction: ee } = await import("./aptos-C2XVzOAY.mjs");
98500
+ const { signAndSendTransaction: ee } = await import("./aptos-CCPjhoiH.mjs");
98501
98501
  return (await ee(
98502
98502
  e,
98503
98503
  J
@@ -98519,39 +98519,39 @@ const walletConnection = {
98519
98519
  if (T === void 0)
98520
98520
  return [];
98521
98521
  if (T.context === Context.ETH) {
98522
- const { wallets: e } = await import("./evm-ETVyy1bF.mjs").then((C) => C.j);
98522
+ const { wallets: e } = await import("./evm-Bd2pCSsJ.mjs").then((C) => C.j);
98523
98523
  return Object.values(mapWallets(e, Context.ETH));
98524
98524
  } else if (T.context === Context.SOLANA) {
98525
- const { fetchOptions: e } = await import("./solana-DfDEsqum.mjs"), C = e();
98525
+ const { fetchOptions: e } = await import("./solana-Cwzan1t4.mjs"), C = e();
98526
98526
  return Object.values(mapWallets(C, Context.SOLANA));
98527
98527
  } else if (T.context === Context.SUI) {
98528
- const C = await (await import("./sui-DZw78j9M.mjs")).fetchOptions();
98528
+ const C = await (await import("./sui-sBQX8Jtb.mjs")).fetchOptions();
98529
98529
  return Object.values(mapWallets(C, Context.SUI));
98530
98530
  } else if (T.context === Context.APTOS) {
98531
- const C = (await import("./aptos-C2XVzOAY.mjs")).fetchOptions();
98531
+ const C = (await import("./aptos-CCPjhoiH.mjs")).fetchOptions();
98532
98532
  return Object.values(mapWallets(C, Context.APTOS));
98533
98533
  } else if (T.context === Context.SEI) {
98534
- const C = await (await import("./sei-83rTGsK7.mjs")).fetchOptions();
98534
+ const C = await (await import("./sei-BJXcObS8.mjs")).fetchOptions();
98535
98535
  return Object.values(mapWallets(C, Context.SEI));
98536
98536
  } else if (T.context === Context.COSMOS)
98537
98537
  if (T.key === "Evmos") {
98538
98538
  const {
98539
98539
  wallets: { cosmosEvm: e }
98540
- } = await import("./cosmos-zIwOBV8H.mjs");
98540
+ } = await import("./cosmos-D8oxyfb-.mjs");
98541
98541
  return Object.values(
98542
98542
  mapWallets(e, Context.COSMOS, ["OKX Wallet"])
98543
98543
  );
98544
98544
  } else if (T.key === "Injective") {
98545
98545
  const {
98546
98546
  wallets: { cosmosEvm: e }
98547
- } = await import("./cosmos-zIwOBV8H.mjs");
98547
+ } = await import("./cosmos-D8oxyfb-.mjs");
98548
98548
  return Object.values(
98549
98549
  mapWallets(e, Context.COSMOS, ["OKX Wallet"])
98550
98550
  );
98551
98551
  } else {
98552
98552
  const {
98553
98553
  wallets: { cosmos: e }
98554
- } = await import("./cosmos-zIwOBV8H.mjs");
98554
+ } = await import("./cosmos-D8oxyfb-.mjs");
98555
98555
  return Object.values(mapWallets(e, Context.COSMOS));
98556
98556
  }
98557
98557
  return [];
@@ -111096,7 +111096,7 @@ function scale(T, e, C) {
111096
111096
  registerProtocol(_platform$1, "Ntt", EvmNtt);
111097
111097
  class SolanaChain extends ChainContext {
111098
111098
  async getTokenAccount(e, C) {
111099
- const { getAssociatedTokenAddress: $ } = await import("./index-CAO9VKRh.mjs"), V = new SolanaAddress(C).unwrap(), J = new SolanaAddress(e).unwrap(), ee = await $(V, J);
111099
+ const { getAssociatedTokenAddress: $ } = await import("./index-56vFoolS.mjs"), V = new SolanaAddress(C).unwrap(), J = new SolanaAddress(e).unwrap(), ee = await $(V, J);
111100
111100
  return {
111101
111101
  chain: this.chain,
111102
111102
  address: new SolanaAddress(ee.toString())
@@ -146455,51 +146455,26 @@ function BNB() {
146455
146455
  );
146456
146456
  }
146457
146457
  function CELO() {
146458
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
146458
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
146459
146459
  "svg",
146460
146460
  {
146461
- style: { maxHeight: "100%", maxWidth: "100%" },
146462
146461
  version: "1.1",
146463
- id: "Celo_Rings",
146462
+ id: "Symbol",
146464
146463
  xmlns: "http://www.w3.org/2000/svg",
146465
146464
  xmlnsXlink: "http://www.w3.org/1999/xlink",
146466
146465
  x: "0px",
146467
146466
  y: "0px",
146468
- width: "950",
146469
- height: "950",
146470
- viewBox: "0 0 950 950",
146467
+ viewBox: "0 0 384 383",
146468
+ style: { width: "100%", height: "100%" },
146471
146469
  xmlSpace: "preserve",
146472
- children: [
146473
- /* @__PURE__ */ jsxRuntimeExports.jsx("title", { children: "Artboard 1" }),
146474
- /* @__PURE__ */ jsxRuntimeExports.jsx(
146475
- "path",
146476
- {
146477
- id: "Bottom_Ring",
146478
- fill: "#FBCC5C",
146479
- d: `M375,850c151.9,0,275-123.1,275-275S526.9,300,375,300S100,423.1,100,575S223.1,850,375,850z
146480
- M375,950C167.9,950,0,782.1,0,575s167.9-375,375-375s375,167.9,375,375S582.1,950,375,950z`
146481
- }
146482
- ),
146483
- /* @__PURE__ */ jsxRuntimeExports.jsx(
146484
- "path",
146485
- {
146486
- id: "Top_Ring",
146487
- fill: "#35D07F",
146488
- d: `M575,650c151.9,0,275-123.1,275-275S726.9,100,575,100S300,223.1,300,375S423.1,650,575,650z
146489
- M575,750c-207.1,0-375-167.9-375-375S367.9,0,575,0s375,167.9,375,375S782.1,750,575,750z`
146490
- }
146491
- ),
146492
- /* @__PURE__ */ jsxRuntimeExports.jsx(
146493
- "path",
146494
- {
146495
- id: "Rings_Overlap",
146496
- fill: "#5EA33B",
146497
- d: `M587.4,750c26-31.5,44.6-68.4,54.5-108.1c39.6-9.9,76.5-28.5,108.1-54.5
146498
- c-1.4,45.9-11.3,91.1-29.2,133.5C678.5,738.7,633.3,748.6,587.4,750z M308.1,308.1c-39.6,9.9-76.5,28.5-108.1,54.5
146499
- c1.4-45.9,11.3-91.1,29.2-133.4c42.3-17.8,87.6-27.7,133.4-29.2C336.6,231.5,318,268.4,308.1,308.1z`
146500
- }
146501
- )
146502
- ]
146470
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
146471
+ "path",
146472
+ {
146473
+ fill: "#FFF572",
146474
+ d: `M383.5,0H0.5v383h383V249.3h-63.6C298,298.1,248.7,332,192.3,332c-77.8,0-140.8-63.6-140.8-140.8
146475
+ C51.4,114,114.5,51,192.3,51c57.5,0,106.8,35,128.7,84.9h62.5V0z`
146476
+ }
146477
+ )
146503
146478
  }
146504
146479
  );
146505
146480
  }
@@ -1,8 +1,8 @@
1
1
  var J = Object.defineProperty;
2
2
  var K = (n, f, e) => f in n ? J(n, f, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[f] = e;
3
3
  var d = (n, f, e) => K(n, typeof f != "symbol" ? f + "" : f, e);
4
- import { ar as y, bV as f0, bW as z, bX as p, bY as e0, bZ as a0, b_ as t0, b$ as _, c0 as b0, c1 as n0, c2 as d0, aj as L, c3 as O, E as v, a as C, c4 as D, u as U, bN as u, c5 as H, bQ as c0, c6 as N, bS as q, bT as j, a8 as s0, c7 as i0, c8 as I, bI as S, aA as $, bU as V, _ as Q } from "./index-DCFAlA0r.mjs";
5
- import "./index-qCDztmW8.mjs";
4
+ import { ar as y, bV as f0, bW as z, bX as p, bY as e0, bZ as a0, b_ as t0, b$ as _, c0 as b0, c1 as n0, c2 as d0, aj as L, c3 as O, E as v, a as C, c4 as D, u as U, bN as u, c5 as H, bQ as c0, c6 as N, bS as q, bT as j, a8 as s0, c7 as i0, c8 as I, bI as S, aA as $, bU as V, _ as Q } from "./index-PezPPmQR.mjs";
5
+ import "./index-hgDL5OvS.mjs";
6
6
  const r0 = new RegExp("^bytes([0-9]+)$"), p0 = new RegExp("^(u?int)([0-9]*)$"), y0 = new RegExp("^(.*)\\[([0-9]*)\\]$");
7
7
  function X(n, f, e) {
8
8
  switch (n) {
@@ -1,4 +1,4 @@
1
- import { dC as Tt, $ as Mt, a1 as xt } from "./index-DCFAlA0r.mjs";
1
+ import { dC as Tt, $ as Mt, a1 as xt } from "./index-PezPPmQR.mjs";
2
2
  var Lt = {}, Me = {}, B = {}, _t = {};
3
3
  (function(e) {
4
4
  Object.defineProperty(e, "__esModule", { value: !0 });
@@ -1,7 +1,7 @@
1
1
  var $ = Object.defineProperty;
2
2
  var V = (i, e, b) => e in i ? $(i, e, { enumerable: !0, configurable: !0, writable: !0, value: b }) : i[e] = b;
3
3
  var d = (i, e, b) => V(i, typeof e != "symbol" ? e + "" : e, b);
4
- import { aj as E, E as o, c9 as x, a8 as l, bO as z, ca as j, a as c, p as k, cb as L, cc as Z, bP as g, cd as W, ce as T, bN as s, cf as _, bS as P, bT as N, c8 as F, bI as q, aA as D, bU as H, _ as O } from "./index-DCFAlA0r.mjs";
4
+ import { aj as E, E as o, c9 as x, a8 as l, bO as z, ca as j, a as c, p as k, cb as L, cc as Z, bP as g, cd as W, ce as T, bN as s, cf as _, bS as P, bT as N, c8 as F, bI as q, aA as D, bU as H, _ as O } from "./index-PezPPmQR.mjs";
5
5
  class B {
6
6
  constructor(e, b, a, t) {
7
7
  d(this, "network");
@@ -1 +1 @@
1
- "use strict";var A=Object.defineProperty;var y=(o,e,t)=>e in o?A(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var i=(o,e,t)=>y(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CjaaWCsQ.js"),g=require("./aptos-Oi2w7M7g.js");class f{constructor(e,t,r,n,a=!1){i(this,"transaction");i(this,"network");i(this,"chain");i(this,"description");i(this,"parallelizable");this.transaction=e,this.network=t,this.chain=r,this.description=n,this.parallelizable=a}}const w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],k=o=>s.serializeLayout(w,o);class d{constructor(e,t,r,n){i(this,"network");i(this,"chain");i(this,"connection");i(this,"contracts");i(this,"chainId");i(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=r,this.contracts=n,this.chainId=s.toChainId(t);const a=n.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[r,n]=await g.AptosPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error("Network mismatch "+a.network+" !== "+r);return new d(r,n,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(s.APTOS_SEPARATOR);let r;if(r=(await this.connection.getAccountResource(t[0],`${this.tokenBridgeAddress}::state::OriginInfo`)).data,!r)throw s.ErrNotWrapped;const n=s.toChain(parseInt(r.token_chain.number)),a=new s.UniversalAddress(r.token_address.external_address);return{chain:n,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const r=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!r)throw new Error("Invalid asset address.");return new s.AptosAddress(r)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource(s.coalesceModuleAddress(t),`${this.tokenBridgeAddress}::state::OriginInfo`),s.toNative(this.chain,t)}async isTransferCompleted(e){const r=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data.consumed_vaas.elems.handle;try{return await this.connection.getTableItem(r,{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const r={chain:this.chain,address:new s.AptosAddress(e)},n=await this.getAssetFullyQualifiedType(r);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,type_arguments:[n],arguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,type_arguments:[],arguments:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const r=await this.getAssetFullyQualifiedType(e.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,type_arguments:[r],arguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,r,n,a){const p=0n,c=0n,h=s.isNative(r)?s.APTOS_COIN:r.toString(),l=t.address.toUniversalAddress().toUint8Array(),u=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,type_arguments:[h],arguments:[n,u,l,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,type_arguments:[h],arguments:[n,u,l,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,r=!0){const n=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,type_arguments:[n],arguments:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data,{handle:r}=t.native_infos,n=await this.connection.getTableItem(r,{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}});return n?[n.account_address,String.fromCharCode(...s.hex.decode(n.module_name)),String.fromCharCode(...s.hex.decode(n.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,r){if(s.isNative(r.address))throw new Error("Invalid token address");const n=k({chain:r.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:r.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(n),!0)}createUnsignedTx(e,t,r=!1){return new f(e,this.network,this.chain,t,r)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
1
+ "use strict";var A=Object.defineProperty;var y=(o,e,t)=>e in o?A(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var i=(o,e,t)=>y(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-B-m4JhhB.js"),g=require("./aptos-kknI1DBa.js");class f{constructor(e,t,r,n,a=!1){i(this,"transaction");i(this,"network");i(this,"chain");i(this,"description");i(this,"parallelizable");this.transaction=e,this.network=t,this.chain=r,this.description=n,this.parallelizable=a}}const w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],k=o=>s.serializeLayout(w,o);class d{constructor(e,t,r,n){i(this,"network");i(this,"chain");i(this,"connection");i(this,"contracts");i(this,"chainId");i(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=r,this.contracts=n,this.chainId=s.toChainId(t);const a=n.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[r,n]=await g.AptosPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error("Network mismatch "+a.network+" !== "+r);return new d(r,n,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(s.APTOS_SEPARATOR);let r;if(r=(await this.connection.getAccountResource(t[0],`${this.tokenBridgeAddress}::state::OriginInfo`)).data,!r)throw s.ErrNotWrapped;const n=s.toChain(parseInt(r.token_chain.number)),a=new s.UniversalAddress(r.token_address.external_address);return{chain:n,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const r=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!r)throw new Error("Invalid asset address.");return new s.AptosAddress(r)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource(s.coalesceModuleAddress(t),`${this.tokenBridgeAddress}::state::OriginInfo`),s.toNative(this.chain,t)}async isTransferCompleted(e){const r=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data.consumed_vaas.elems.handle;try{return await this.connection.getTableItem(r,{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const r={chain:this.chain,address:new s.AptosAddress(e)},n=await this.getAssetFullyQualifiedType(r);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,type_arguments:[n],arguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,type_arguments:[],arguments:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const r=await this.getAssetFullyQualifiedType(e.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,type_arguments:[r],arguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,r,n,a){const p=0n,c=0n,h=s.isNative(r)?s.APTOS_COIN:r.toString(),l=t.address.toUniversalAddress().toUint8Array(),u=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,type_arguments:[h],arguments:[n,u,l,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,type_arguments:[h],arguments:[n,u,l,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,r=!0){const n=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,type_arguments:[n],arguments:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=(await this.connection.getAccountResource(this.tokenBridgeAddress,`${this.tokenBridgeAddress}::state::State`)).data,{handle:r}=t.native_infos,n=await this.connection.getTableItem(r,{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}});return n?[n.account_address,String.fromCharCode(...s.hex.decode(n.module_name)),String.fromCharCode(...s.hex.decode(n.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,r){if(s.isNative(r.address))throw new Error("Invalid token address");const n=k({chain:r.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:r.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(n),!0)}createUnsignedTx(e,t,r=!1){return new f(e,this.network,this.chain,t,r)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("./events-COwefqOt.js"),J=require("./index-CjaaWCsQ.js"),T=require("./index-CcPZaBV3.js"),I=require("./index-RBlsEf3k.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function or(o){let t;return typeof window<"u"&&typeof window[o]<"u"&&(t=window[o]),t}ne.getFromWindow=or;function $r(o){const t=or(o);if(!t)throw new Error(`${o} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function ew(){return $r("document")}ne.getDocumentOrThrow=ew;function tw(){return or("document")}ne.getDocument=tw;function rw(){return $r("navigator")}ne.getNavigatorOrThrow=rw;function iw(){return or("navigator")}ne.getNavigator=iw;function sw(){return $r("location")}ne.getLocationOrThrow=sw;function nw(){return or("location")}ne.getLocation=nw;function ow(){return $r("crypto")}ne.getCryptoOrThrow=ow;function aw(){return or("crypto")}ne.getCrypto=aw;function cw(){return $r("localStorage")}ne.getLocalStorageOrThrow=cw;function uw(){return or("localStorage")}ne.getLocalStorage=uw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const pu=ne;function hw(){let o,t;try{o=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=o.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const D=O[q],B=D.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let G=t.protocol+"//"+t.host;if(F.indexOf("/")===0)G+=F;else{const de=t.pathname.split("/");de.pop();const Z=de.join("/");G+=Z+"/"+F}N.push(G)}else if(F.indexOf("//")===0){const G=t.protocol+F;N.push(G)}else N.push(F)}}return N}function s(...O){const N=o.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const D=N[q],B=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?O.includes(F):!1);if(B.length&&B){const F=D.getAttribute("content");if(F)return F}}return""}function a(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=o.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=a(),g=u(),w=t.origin,b=r();return{description:g,url:w,icons:b,name:l}}bo.getWindowMetadata=hw;function lw(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}const pw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function dw(o,t){const{message:r,code:s}=pw[o];return{message:r,code:s}}function co(o,t){return!!Array.isArray(o)}var Ar={};/*! *****************************************************************************
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("./events-wwBkyeeC.js"),J=require("./index-B-m4JhhB.js"),T=require("./index-Du-JoS7B.js"),I=require("./index-CTVkfVib.js");var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0;function or(o){let t;return typeof window<"u"&&typeof window[o]<"u"&&(t=window[o]),t}ne.getFromWindow=or;function $r(o){const t=or(o);if(!t)throw new Error(`${o} is not defined in Window`);return t}ne.getFromWindowOrThrow=$r;function ew(){return $r("document")}ne.getDocumentOrThrow=ew;function tw(){return or("document")}ne.getDocument=tw;function rw(){return $r("navigator")}ne.getNavigatorOrThrow=rw;function iw(){return or("navigator")}ne.getNavigator=iw;function sw(){return $r("location")}ne.getLocationOrThrow=sw;function nw(){return or("location")}ne.getLocation=nw;function ow(){return $r("crypto")}ne.getCryptoOrThrow=ow;function aw(){return or("crypto")}ne.getCrypto=aw;function cw(){return $r("localStorage")}ne.getLocalStorageOrThrow=cw;function uw(){return or("localStorage")}ne.getLocalStorage=uw;var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.getWindowMetadata=void 0;const pu=ne;function hw(){let o,t;try{o=pu.getDocumentOrThrow(),t=pu.getLocationOrThrow()}catch{return null}function r(){const O=o.getElementsByTagName("link"),N=[];for(let q=0;q<O.length;q++){const D=O[q],B=D.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let G=t.protocol+"//"+t.host;if(F.indexOf("/")===0)G+=F;else{const de=t.pathname.split("/");de.pop();const Z=de.join("/");G+=Z+"/"+F}N.push(G)}else if(F.indexOf("//")===0){const G=t.protocol+F;N.push(G)}else N.push(F)}}return N}function s(...O){const N=o.getElementsByTagName("meta");for(let q=0;q<N.length;q++){const D=N[q],B=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?O.includes(F):!1);if(B.length&&B){const F=D.getAttribute("content");if(F)return F}}return""}function a(){let O=s("name","og:site_name","og:title","twitter:title");return O||(O=o.title),O}function u(){return s("description","og:description","twitter:description","keywords")}const l=a(),g=u(),w=t.origin,b=r();return{description:g,url:w,icons:b,name:l}}bo.getWindowMetadata=hw;function lw(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}const pw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function dw(o,t){const{message:r,code:s}=pw[o];return{message:r,code:s}}function co(o,t){return!!Array.isArray(o)}var Ar={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -43,4 +43,4 @@ __p += '`),Y&&(R+=`' +
43
43
  function print() { __p += __j.call(arguments, '') }
44
44
  `:`;
45
45
  `)+R+`return __p
46
- }`;var V=uu(function(){return ee(d,j+"return "+R).apply(r,f)});if(V.source=R,Un(V))throw V;return V}function am(e){return te(e).toLowerCase()}function cm(e){return te(e).toUpperCase()}function um(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Ve(i)))return e;var c=at(e),h=at(i),d=wa(c,h),f=_a(c,h)+1;return kt(c,d,f).join("")}function hm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Ve(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Ve(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function pm(e,i){var n=sl,c=nl;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?H(i.length):n,c="omission"in i?Ve(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var f=at(e);d=f.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=f?kt(f,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(f&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Ve(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function dm(e){return e=te(e),e&&Il.test(e)?e.replace(qo,kp):e}var fm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?jp(e)?Vp(e):Rp(e):e.match(i)||[]}var uu=K(function(e,i){try{return ze(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),gm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function ym(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],K(function(c){for(var h=-1;++h<i;){var d=e[h];if(ze(d[0],this,c))return ze(d[1],this,c)}})}function vm(e){return kd(et(e,O))}function Hn(e){return function(){return e}}function mm(e,i){return e==null||e!==e?i:e}var wm=pc(),_m=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function bm(e){return Va(et(e,O))}function Em(e,i){return Ba(e,et(i,O))}var Im=K(function(e,i){return function(n){return Yr(n,e,i)}}),Pm=K(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,f=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,f&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Sm(){return Ie._===this&&(Ie._=Qp),this}function Kn(){}function Om(e){return e=H(e),K(function(i){return Ka(i,e)})}var Rm=In(ue),Nm=In(da),Cm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):nf(e)}function $m(e){return function(i){return e==null?r:Xt(e,i)}}var Am=fc(),Tm=fc(!0);function Wn(){return[]}function Jn(){return!1}function xm(){return{}}function Dm(){return""}function Fm(){return!0}function jm(e,i){if(e=H(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function qm(e){return z(e)?ue(e,yt):Be(e)?[e]:Fe($c(te(e)))}function Um(e){var i=++Jp;return te(e)+i}var Mm=Zi(function(e,i){return e+i},0),Lm=Pn("ceil"),km=Zi(function(e,i){return e/i},1),zm=Pn("floor");function Hm(e){return e&&e.length?Bi(e,Ue,un):r}function Vm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Bm(e){return ya(e,Ue)}function Km(e,i){return ya(e,U(i,2))}function Wm(e){return e&&e.length?Bi(e,Ue,dn):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Gm=Zi(function(e,i){return e*i},1),Qm=Pn("round"),Ym=Zi(function(e,i){return e-i},0);function Zm(e){return e&&e.length?Qs(e,Ue):0}function Xm(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=by,p.ary=kc,p.assign=cv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=uv,p.at=hv,p.before=zc,p.bind=jn,p.bindAll=gm,p.bindKey=Hc,p.castArray=xy,p.chain=Uc,p.chunk=zf,p.compact=Hf,p.concat=Vf,p.cond=ym,p.conforms=vm,p.constant=Hn,p.countBy=Zg,p.create=lv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=pv,p.defaultsDeep=dv,p.defer=Ey,p.delay=Iy,p.difference=Bf,p.differenceBy=Kf,p.differenceWith=Wf,p.drop=Jf,p.dropRight=Gf,p.dropRightWhile=Qf,p.dropWhile=Yf,p.fill=Zf,p.filter=ey,p.flatMap=iy,p.flatMapDeep=sy,p.flatMapDepth=ny,p.flatten=Dc,p.flattenDeep=Xf,p.flattenDepth=eg,p.flip=Py,p.flow=wm,p.flowRight=_m,p.fromPairs=tg,p.functions=_v,p.functionsIn=bv,p.groupBy=oy,p.initial=ig,p.intersection=sg,p.intersectionBy=ng,p.intersectionWith=og,p.invert=Iv,p.invertBy=Pv,p.invokeMap=cy,p.iteratee=Vn,p.keyBy=uy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=Ov,p.mapValues=Rv,p.matches=bm,p.matchesProperty=Em,p.memoize=as,p.merge=Nv,p.mergeWith=ru,p.method=Im,p.methodOf=Pm,p.mixin=Bn,p.negate=cs,p.nthArg=Om,p.omit=Cv,p.omitBy=$v,p.once=Sy,p.orderBy=hy,p.over=Rm,p.overArgs=Oy,p.overEvery=Nm,p.overSome=Cm,p.partial=qn,p.partialRight=Wc,p.partition=ly,p.pick=Av,p.pickBy=iu,p.property=hu,p.propertyOf=$m,p.pull=hg,p.pullAll=jc,p.pullAllBy=lg,p.pullAllWith=pg,p.pullAt=dg,p.range=Am,p.rangeRight=Tm,p.rearg=Ry,p.reject=fy,p.remove=fg,p.rest=Ny,p.reverse=Dn,p.sampleSize=yy,p.set=xv,p.setWith=Dv,p.shuffle=vy,p.slice=gg,p.sortBy=_y,p.sortedUniq=Eg,p.sortedUniqBy=Ig,p.split=im,p.spread=Cy,p.tail=Pg,p.take=Sg,p.takeRight=Og,p.takeRightWhile=Rg,p.takeWhile=Ng,p.tap=Hg,p.throttle=$y,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=qm,p.toPlainObject=eu,p.transform=Fv,p.unary=Ay,p.union=Cg,p.unionBy=$g,p.unionWith=Ag,p.uniq=Tg,p.uniqBy=xg,p.uniqWith=Dg,p.unset=jv,p.unzip=Fn,p.unzipWith=qc,p.update=qv,p.updateWith=Uv,p.values=Sr,p.valuesIn=Mv,p.without=Fg,p.words=cu,p.wrap=Ty,p.xor=jg,p.xorBy=qg,p.xorWith=Ug,p.zip=Mg,p.zipObject=Lg,p.zipObjectDeep=kg,p.zipWith=zg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Mm,p.attempt=uu,p.camelCase=Hv,p.capitalize=ou,p.ceil=Lm,p.clamp=Lv,p.clone=Dy,p.cloneDeep=jy,p.cloneDeepWith=qy,p.cloneWith=Fy,p.conformsTo=Uy,p.deburr=au,p.defaultTo=mm,p.divide=km,p.endsWith=Vv,p.eq=ut,p.escape=Bv,p.escapeRegExp=Kv,p.every=Xg,p.find=ty,p.findIndex=Tc,p.findKey=fv,p.findLast=ry,p.findLastIndex=xc,p.findLastKey=gv,p.floor=zm,p.forEach=Mc,p.forEachRight=Lc,p.forIn=yv,p.forInRight=vv,p.forOwn=mv,p.forOwnRight=wv,p.get=Ln,p.gt=My,p.gte=Ly,p.has=Ev,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ay,p.indexOf=rg,p.inRange=kv,p.invoke=Sv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=ky,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=zy,p.isBuffer=zt,p.isDate=Hy,p.isElement=Vy,p.isEmpty=By,p.isEqual=Ky,p.isEqualWith=Wy,p.isError=Un,p.isFinite=Jy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Gy,p.isMatchWith=Qy,p.isNaN=Yy,p.isNative=Zy,p.isNil=ev,p.isNull=Xy,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=tv,p.isSet=Yc,p.isString=hs,p.isSymbol=Be,p.isTypedArray=Pr,p.isUndefined=rv,p.isWeakMap=iv,p.isWeakSet=sv,p.join=ag,p.kebabCase=Wv,p.last=rt,p.lastIndexOf=cg,p.lowerCase=Jv,p.lowerFirst=Gv,p.lt=nv,p.lte=ov,p.max=Hm,p.maxBy=Vm,p.mean=Bm,p.meanBy=Km,p.min=Wm,p.minBy=Jm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=xm,p.stubString=Dm,p.stubTrue=Fm,p.multiply=Gm,p.nth=ug,p.noConflict=Sm,p.noop=Kn,p.now=os,p.pad=Qv,p.padEnd=Yv,p.padStart=Zv,p.parseInt=Xv,p.random=zv,p.reduce=py,p.reduceRight=dy,p.repeat=em,p.replace=tm,p.result=Tv,p.round=Qm,p.runInContext=v,p.sample=gy,p.size=my,p.snakeCase=rm,p.some=wy,p.sortedIndex=yg,p.sortedIndexBy=vg,p.sortedIndexOf=mg,p.sortedLastIndex=wg,p.sortedLastIndexBy=_g,p.sortedLastIndexOf=bg,p.startCase=sm,p.startsWith=nm,p.subtract=Ym,p.sum=Zm,p.sumBy=Xm,p.template=om,p.times=jm,p.toFinite=Ot,p.toInteger=H,p.toLength=Xc,p.toLower=am,p.toNumber=it,p.toSafeInteger=av,p.toString=te,p.toUpper=cm,p.trim=um,p.trimEnd=hm,p.trimStart=lm,p.truncate=pm,p.unescape=dm,p.uniqueId=Um,p.upperCase=fm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(H(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==ul;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=K(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=H(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=H(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var f=this.__wrapped__,y=c?[1]:arguments,m=f instanceof Q,P=y[0],S=m||z(f),R=function(W){var Y=h.apply(p,Ft([W],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,V=m&&!j;if(!d&&S){f=V?f:new Q(this);var L=e.apply(f,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&V?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(f){return i.apply(z(f)?f:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=pd,Q.prototype.reverse=dd,Q.prototype.value=fd,p.prototype.at=Vg,p.prototype.chain=Bg,p.prototype.commit=Kg,p.prototype.next=Wg,p.prototype.plant=Gg,p.prototype.reverse=Qg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Yg,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Jg),p},yr=Bp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var YE=Object.defineProperty,ZE=Object.defineProperties,XE=Object.getOwnPropertyDescriptors,ph=Object.getOwnPropertySymbols,eI=Object.prototype.hasOwnProperty,tI=Object.prototype.propertyIsEnumerable,dh=(o,t,r)=>t in o?YE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,fs=(o,t)=>{for(var r in t||(t={}))eI.call(t,r)&&dh(o,r,t[r]);if(ph)for(var r of ph(t))tI.call(t,r)&&dh(o,r,t[r]);return o},rI=(o,t)=>ZE(o,XE(t));function Bt(o,t,r){var s;const a=R0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${QE}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function ur(o){return o.includes(":")?o.split(":")[1]:o}function el(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function iI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function sI(o={},t={}){const r=fh(o),s=fh(t);return _o.exports.merge(r,s)}function fh(o){var t,r,s,a;const u={};if(!Cr(o))return u;for(const[l,g]of Object.entries(o)){const w=No(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=li(l);u[N]=rI(fs(fs({},u[N]),g),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(a=u[N])==null?void 0:a.rpcMap)})}return u}function nI(o){return o.includes(":")?o.split(":")[2]:o}function oI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],g=No(r)?[r]:s.chains?s.chains:el(s.accounts);t[r]={chains:g,methods:a,events:u,accounts:l}}return t}function so(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const tl={},he=o=>tl[o],no=(o,t)=>{tl[o]=t};class aI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class cI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(ur(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class uI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class hI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class lI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=ur(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class pI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class dI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var gI=Object.defineProperty,yI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,yh=(o,t,r)=>t in o?gI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,gs=(o,t)=>{for(var r in t||(t={}))mI.call(t,r)&&yh(o,r,t[r]);if(gh)for(var r of gh(t))wI.call(t,r)&&yh(o,r,t[r]);return o},oo=(o,t)=>yI(o,vI(t));class xo{constructor(t){this.events=new Ge.es,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.qt(I.k({level:(t==null?void 0:t.logger)||hh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=oI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Zh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await jE.init({logger:this.providerOpts.logger||hh,relayUrl:this.providerOpts.relayUrl||WE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=iI(r,this.session),a=el(s),u=sI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new cI({namespace:l});break;case"solana":this.rpcProviders[r]=new uI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new hI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new aI({namespace:l});break;case"cip34":this.rpcProviders[r]=new lI({namespace:l});break;case"elrond":this.rpcProviders[r]=new pI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new dI({namespace:l});break;case"near":this.rpcProviders[r]=new fI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&nr(a)&&this.events.emit("accountsChanged",a.map(nI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=li(a),g=so(a)!==so(u)?`${l}:${so(u)}`:a;this.onChainChanged(g)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${lh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${lh}/${t}`)}}const _I=xo,bI="wc",EI="ethereum_provider",II=`${bI}@2:${EI}:`,PI="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],rl=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],il=["chainChanged","accountsChanged","message","disconnect","connect"];var SI=Object.defineProperty,OI=Object.defineProperties,RI=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,mh=(o,t,r)=>t in o?SI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,di=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&mh(o,r,t[r]);if(vh)for(var r of vh(t))CI.call(t,r)&&mh(o,r,t[r]);return o},wh=(o,t)=>OI(o,RI(t));function Es(o){return Number(o[0].split(":")[1])}function ao(o){return`0x${o.toString(16)}`}function $I(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:g}=o;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:g[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!a&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:rl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:il))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new Ge.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=II,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=$I(this.rpc);try{const a=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(wh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!a)return;const u=lw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",wh(di({},dw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=a.length?(t==null?void 0:t.methods)||_s:[],w=a.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await _I.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-B03mlZnU.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${PI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const AI=Os;exports.EthereumProvider=AI;exports.OPTIONAL_EVENTS=il;exports.OPTIONAL_METHODS=rl;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
46
+ }`;var V=uu(function(){return ee(d,j+"return "+R).apply(r,f)});if(V.source=R,Un(V))throw V;return V}function am(e){return te(e).toLowerCase()}function cm(e){return te(e).toUpperCase()}function um(e,i,n){if(e=te(e),e&&(n||i===r))return ma(e);if(!e||!(i=Ve(i)))return e;var c=at(e),h=at(i),d=wa(c,h),f=_a(c,h)+1;return kt(c,d,f).join("")}function hm(e,i,n){if(e=te(e),e&&(n||i===r))return e.slice(0,Ea(e)+1);if(!e||!(i=Ve(i)))return e;var c=at(e),h=_a(c,at(i))+1;return kt(c,0,h).join("")}function lm(e,i,n){if(e=te(e),e&&(n||i===r))return e.replace(qs,"");if(!e||!(i=Ve(i)))return e;var c=at(e),h=wa(c,at(i));return kt(c,h).join("")}function pm(e,i){var n=sl,c=nl;if(le(i)){var h="separator"in i?i.separator:h;n="length"in i?H(i.length):n,c="omission"in i?Ve(i.omission):c}e=te(e);var d=e.length;if(fr(e)){var f=at(e);d=f.length}if(n>=d)return e;var y=n-gr(c);if(y<1)return c;var m=f?kt(f,0,y).join(""):e.slice(0,y);if(h===r)return m+c;if(f&&(y+=m.length-y),Mn(h)){if(e.slice(y).search(h)){var P,S=m;for(h.global||(h=en(h.source,te(Lo.exec(h))+"g")),h.lastIndex=0;P=h.exec(S);)var R=P.index;m=m.slice(0,R===r?y:R)}}else if(e.indexOf(Ve(h),y)!=y){var A=m.lastIndexOf(h);A>-1&&(m=m.slice(0,A))}return m+c}function dm(e){return e=te(e),e&&Il.test(e)?e.replace(qo,kp):e}var fm=Er(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),zn=hc("toUpperCase");function cu(e,i,n){return e=te(e),i=n?r:i,i===r?jp(e)?Vp(e):Rp(e):e.match(i)||[]}var uu=K(function(e,i){try{return ze(e,r,i)}catch(n){return Un(n)?n:new k(n)}}),gm=It(function(e,i){return Ye(i,function(n){n=yt(n),bt(e,n,jn(e[n],e))}),e});function ym(e){var i=e==null?0:e.length,n=U();return e=i?ue(e,function(c){if(typeof c[1]!="function")throw new Ze(l);return[n(c[0]),c[1]]}):[],K(function(c){for(var h=-1;++h<i;){var d=e[h];if(ze(d[0],this,c))return ze(d[1],this,c)}})}function vm(e){return kd(et(e,O))}function Hn(e){return function(){return e}}function mm(e,i){return e==null||e!==e?i:e}var wm=pc(),_m=pc(!0);function Ue(e){return e}function Vn(e){return za(typeof e=="function"?e:et(e,O))}function bm(e){return Va(et(e,O))}function Em(e,i){return Ba(e,et(i,O))}var Im=K(function(e,i){return function(n){return Yr(n,e,i)}}),Pm=K(function(e,i){return function(n){return Yr(e,n,i)}});function Bn(e,i,n){var c=be(i),h=Ki(i,c);n==null&&!(le(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Ki(i,be(i)));var d=!(le(n)&&"chain"in n)||!!n.chain,f=St(e);return Ye(h,function(y){var m=i[y];e[y]=m,f&&(e.prototype[y]=function(){var P=this.__chain__;if(d||P){var S=e(this.__wrapped__),R=S.__actions__=Fe(this.__actions__);return R.push({func:m,args:arguments,thisArg:e}),S.__chain__=P,S}return m.apply(e,Ft([this.value()],arguments))})}),e}function Sm(){return Ie._===this&&(Ie._=Qp),this}function Kn(){}function Om(e){return e=H(e),K(function(i){return Ka(i,e)})}var Rm=In(ue),Nm=In(da),Cm=In(Ws);function hu(e){return $n(e)?Js(yt(e)):nf(e)}function $m(e){return function(i){return e==null?r:Xt(e,i)}}var Am=fc(),Tm=fc(!0);function Wn(){return[]}function Jn(){return!1}function xm(){return{}}function Dm(){return""}function Fm(){return!0}function jm(e,i){if(e=H(e),e<1||e>xt)return[];var n=dt,c=Oe(e,dt);i=U(i),e-=dt;for(var h=Ys(c,i);++n<e;)i(n);return h}function qm(e){return z(e)?ue(e,yt):Be(e)?[e]:Fe($c(te(e)))}function Um(e){var i=++Jp;return te(e)+i}var Mm=Zi(function(e,i){return e+i},0),Lm=Pn("ceil"),km=Zi(function(e,i){return e/i},1),zm=Pn("floor");function Hm(e){return e&&e.length?Bi(e,Ue,un):r}function Vm(e,i){return e&&e.length?Bi(e,U(i,2),un):r}function Bm(e){return ya(e,Ue)}function Km(e,i){return ya(e,U(i,2))}function Wm(e){return e&&e.length?Bi(e,Ue,dn):r}function Jm(e,i){return e&&e.length?Bi(e,U(i,2),dn):r}var Gm=Zi(function(e,i){return e*i},1),Qm=Pn("round"),Ym=Zi(function(e,i){return e-i},0);function Zm(e){return e&&e.length?Qs(e,Ue):0}function Xm(e,i){return e&&e.length?Qs(e,U(i,2)):0}return p.after=by,p.ary=kc,p.assign=cv,p.assignIn=tu,p.assignInWith=ls,p.assignWith=uv,p.at=hv,p.before=zc,p.bind=jn,p.bindAll=gm,p.bindKey=Hc,p.castArray=xy,p.chain=Uc,p.chunk=zf,p.compact=Hf,p.concat=Vf,p.cond=ym,p.conforms=vm,p.constant=Hn,p.countBy=Zg,p.create=lv,p.curry=Vc,p.curryRight=Bc,p.debounce=Kc,p.defaults=pv,p.defaultsDeep=dv,p.defer=Ey,p.delay=Iy,p.difference=Bf,p.differenceBy=Kf,p.differenceWith=Wf,p.drop=Jf,p.dropRight=Gf,p.dropRightWhile=Qf,p.dropWhile=Yf,p.fill=Zf,p.filter=ey,p.flatMap=iy,p.flatMapDeep=sy,p.flatMapDepth=ny,p.flatten=Dc,p.flattenDeep=Xf,p.flattenDepth=eg,p.flip=Py,p.flow=wm,p.flowRight=_m,p.fromPairs=tg,p.functions=_v,p.functionsIn=bv,p.groupBy=oy,p.initial=ig,p.intersection=sg,p.intersectionBy=ng,p.intersectionWith=og,p.invert=Iv,p.invertBy=Pv,p.invokeMap=cy,p.iteratee=Vn,p.keyBy=uy,p.keys=be,p.keysIn=qe,p.map=ns,p.mapKeys=Ov,p.mapValues=Rv,p.matches=bm,p.matchesProperty=Em,p.memoize=as,p.merge=Nv,p.mergeWith=ru,p.method=Im,p.methodOf=Pm,p.mixin=Bn,p.negate=cs,p.nthArg=Om,p.omit=Cv,p.omitBy=$v,p.once=Sy,p.orderBy=hy,p.over=Rm,p.overArgs=Oy,p.overEvery=Nm,p.overSome=Cm,p.partial=qn,p.partialRight=Wc,p.partition=ly,p.pick=Av,p.pickBy=iu,p.property=hu,p.propertyOf=$m,p.pull=hg,p.pullAll=jc,p.pullAllBy=lg,p.pullAllWith=pg,p.pullAt=dg,p.range=Am,p.rangeRight=Tm,p.rearg=Ry,p.reject=fy,p.remove=fg,p.rest=Ny,p.reverse=Dn,p.sampleSize=yy,p.set=xv,p.setWith=Dv,p.shuffle=vy,p.slice=gg,p.sortBy=_y,p.sortedUniq=Eg,p.sortedUniqBy=Ig,p.split=im,p.spread=Cy,p.tail=Pg,p.take=Sg,p.takeRight=Og,p.takeRightWhile=Rg,p.takeWhile=Ng,p.tap=Hg,p.throttle=$y,p.thru=ss,p.toArray=Zc,p.toPairs=su,p.toPairsIn=nu,p.toPath=qm,p.toPlainObject=eu,p.transform=Fv,p.unary=Ay,p.union=Cg,p.unionBy=$g,p.unionWith=Ag,p.uniq=Tg,p.uniqBy=xg,p.uniqWith=Dg,p.unset=jv,p.unzip=Fn,p.unzipWith=qc,p.update=qv,p.updateWith=Uv,p.values=Sr,p.valuesIn=Mv,p.without=Fg,p.words=cu,p.wrap=Ty,p.xor=jg,p.xorBy=qg,p.xorWith=Ug,p.zip=Mg,p.zipObject=Lg,p.zipObjectDeep=kg,p.zipWith=zg,p.entries=su,p.entriesIn=nu,p.extend=tu,p.extendWith=ls,Bn(p,p),p.add=Mm,p.attempt=uu,p.camelCase=Hv,p.capitalize=ou,p.ceil=Lm,p.clamp=Lv,p.clone=Dy,p.cloneDeep=jy,p.cloneDeepWith=qy,p.cloneWith=Fy,p.conformsTo=Uy,p.deburr=au,p.defaultTo=mm,p.divide=km,p.endsWith=Vv,p.eq=ut,p.escape=Bv,p.escapeRegExp=Kv,p.every=Xg,p.find=ty,p.findIndex=Tc,p.findKey=fv,p.findLast=ry,p.findLastIndex=xc,p.findLastKey=gv,p.floor=zm,p.forEach=Mc,p.forEachRight=Lc,p.forIn=yv,p.forInRight=vv,p.forOwn=mv,p.forOwnRight=wv,p.get=Ln,p.gt=My,p.gte=Ly,p.has=Ev,p.hasIn=kn,p.head=Fc,p.identity=Ue,p.includes=ay,p.indexOf=rg,p.inRange=kv,p.invoke=Sv,p.isArguments=rr,p.isArray=z,p.isArrayBuffer=ky,p.isArrayLike=je,p.isArrayLikeObject=ge,p.isBoolean=zy,p.isBuffer=zt,p.isDate=Hy,p.isElement=Vy,p.isEmpty=By,p.isEqual=Ky,p.isEqualWith=Wy,p.isError=Un,p.isFinite=Jy,p.isFunction=St,p.isInteger=Jc,p.isLength=us,p.isMap=Gc,p.isMatch=Gy,p.isMatchWith=Qy,p.isNaN=Yy,p.isNative=Zy,p.isNil=ev,p.isNull=Xy,p.isNumber=Qc,p.isObject=le,p.isObjectLike=pe,p.isPlainObject=ii,p.isRegExp=Mn,p.isSafeInteger=tv,p.isSet=Yc,p.isString=hs,p.isSymbol=Be,p.isTypedArray=Pr,p.isUndefined=rv,p.isWeakMap=iv,p.isWeakSet=sv,p.join=ag,p.kebabCase=Wv,p.last=rt,p.lastIndexOf=cg,p.lowerCase=Jv,p.lowerFirst=Gv,p.lt=nv,p.lte=ov,p.max=Hm,p.maxBy=Vm,p.mean=Bm,p.meanBy=Km,p.min=Wm,p.minBy=Jm,p.stubArray=Wn,p.stubFalse=Jn,p.stubObject=xm,p.stubString=Dm,p.stubTrue=Fm,p.multiply=Gm,p.nth=ug,p.noConflict=Sm,p.noop=Kn,p.now=os,p.pad=Qv,p.padEnd=Yv,p.padStart=Zv,p.parseInt=Xv,p.random=zv,p.reduce=py,p.reduceRight=dy,p.repeat=em,p.replace=tm,p.result=Tv,p.round=Qm,p.runInContext=v,p.sample=gy,p.size=my,p.snakeCase=rm,p.some=wy,p.sortedIndex=yg,p.sortedIndexBy=vg,p.sortedIndexOf=mg,p.sortedLastIndex=wg,p.sortedLastIndexBy=_g,p.sortedLastIndexOf=bg,p.startCase=sm,p.startsWith=nm,p.subtract=Ym,p.sum=Zm,p.sumBy=Xm,p.template=om,p.times=jm,p.toFinite=Ot,p.toInteger=H,p.toLength=Xc,p.toLower=am,p.toNumber=it,p.toSafeInteger=av,p.toString=te,p.toUpper=cm,p.trim=um,p.trimEnd=hm,p.trimStart=lm,p.truncate=pm,p.unescape=dm,p.uniqueId=Um,p.upperCase=fm,p.upperFirst=zn,p.each=Mc,p.eachRight=Lc,p.first=Fc,Bn(p,function(){var e={};return ft(p,function(i,n){re.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,Ye(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),Ye(["drop","take"],function(e,i){Q.prototype[e]=function(n){n=n===r?1:_e(H(n),0);var c=this.__filtered__&&!i?new Q(this):this.clone();return c.__filtered__?c.__takeCount__=Oe(n,c.__takeCount__):c.__views__.push({size:Oe(n,dt),type:e+(c.__dir__<0?"Right":"")}),c},Q.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Ye(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==Do||n==ul;Q.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:U(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),Ye(["head","last"],function(e,i){var n="take"+(i?"Right":"");Q.prototype[e]=function(){return this[n](1).value()[0]}}),Ye(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");Q.prototype[e]=function(){return this.__filtered__?new Q(this):this[n](1)}}),Q.prototype.compact=function(){return this.filter(Ue)},Q.prototype.find=function(e){return this.filter(e).head()},Q.prototype.findLast=function(e){return this.reverse().find(e)},Q.prototype.invokeMap=K(function(e,i){return typeof e=="function"?new Q(this):this.map(function(n){return Yr(n,e,i)})}),Q.prototype.reject=function(e){return this.filter(cs(U(e)))},Q.prototype.slice=function(e,i){e=H(e);var n=this;return n.__filtered__&&(e>0||i<0)?new Q(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=H(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},Q.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Q.prototype.toArray=function(){return this.take(dt)},ft(Q.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var f=this.__wrapped__,y=c?[1]:arguments,m=f instanceof Q,P=y[0],S=m||z(f),R=function(W){var Y=h.apply(p,Ft([W],y));return c&&A?Y[0]:Y};S&&n&&typeof P=="function"&&P.length!=1&&(m=S=!1);var A=this.__chain__,j=!!this.__actions__.length,M=d&&!A,V=m&&!j;if(!d&&S){f=V?f:new Q(this);var L=e.apply(f,y);return L.__actions__.push({func:ss,args:[R],thisArg:r}),new Xe(L,A)}return M&&V?e.apply(this,y):(L=this.thru(R),M?c?L.value()[0]:L.value():L)})}),Ye(["pop","push","shift","sort","splice","unshift"],function(e){var i=$i[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(z(d)?d:[],h)}return this[n](function(f){return i.apply(z(f)?f:[],h)})}}),ft(Q.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";re.call(wr,c)||(wr[c]=[]),wr[c].push({name:i,func:n})}}),wr[Yi(r,G).name]=[{name:"wrapper",func:r}],Q.prototype.clone=pd,Q.prototype.reverse=dd,Q.prototype.value=fd,p.prototype.at=Vg,p.prototype.chain=Bg,p.prototype.commit=Kg,p.prototype.next=Wg,p.prototype.plant=Gg,p.prototype.reverse=Qg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Yg,p.prototype.first=p.prototype.head,Vr&&(p.prototype[Vr]=Jg),p},yr=Bp();Jt?((Jt.exports=yr)._=yr,Hs._=yr):Ie._=yr}).call(hi)})(_o,_o.exports);var YE=Object.defineProperty,ZE=Object.defineProperties,XE=Object.getOwnPropertyDescriptors,ph=Object.getOwnPropertySymbols,eI=Object.prototype.hasOwnProperty,tI=Object.prototype.propertyIsEnumerable,dh=(o,t,r)=>t in o?YE(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,fs=(o,t)=>{for(var r in t||(t={}))eI.call(t,r)&&dh(o,r,t[r]);if(ph)for(var r of ph(t))tI.call(t,r)&&dh(o,r,t[r]);return o},rI=(o,t)=>ZE(o,XE(t));function Bt(o,t,r){var s;const a=R0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${QE}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function ur(o){return o.includes(":")?o.split(":")[1]:o}function el(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function iI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function sI(o={},t={}){const r=fh(o),s=fh(t);return _o.exports.merge(r,s)}function fh(o){var t,r,s,a;const u={};if(!Cr(o))return u;for(const[l,g]of Object.entries(o)){const w=No(l)?[l]:g.chains,b=g.methods||[],C=g.events||[],O=g.rpcMap||{},N=li(l);u[N]=rI(fs(fs({},u[N]),g),{chains:Yn(w,(t=u[N])==null?void 0:t.chains),methods:Yn(b,(r=u[N])==null?void 0:r.methods),events:Yn(C,(s=u[N])==null?void 0:s.events),rpcMap:fs(fs({},O),(a=u[N])==null?void 0:a.rpcMap)})}return u}function nI(o){return o.includes(":")?o.split(":")[2]:o}function oI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],g=No(r)?[r]:s.chains?s.chains:el(s.accounts);t[r]={chains:g,methods:a,events:u,accounts:l}}return t}function so(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const tl={},he=o=>tl[o],no=(o,t)=>{tl[o]=t};class aI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class cI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Bt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(ur(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class uI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class hI{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class lI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=ur(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class pI{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class dI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=ur(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new $t(new Kt(s,he("disableProviderPing")))}}class fI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=he("events"),this.client=he("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Bt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(At.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Bt(t,this.namespace);return typeof s>"u"?void 0:new $t(new Kt(s,he("disableProviderPing")))}}var gI=Object.defineProperty,yI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,yh=(o,t,r)=>t in o?gI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,gs=(o,t)=>{for(var r in t||(t={}))mI.call(t,r)&&yh(o,r,t[r]);if(gh)for(var r of gh(t))wI.call(t,r)&&yh(o,r,t[r]);return o},oo=(o,t)=>yI(o,vI(t));class xo{constructor(t){this.events=new Ge.es,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.qt(I.k({level:(t==null?void 0:t.logger)||hh})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new xo(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:gs({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ve("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=oI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==Zh)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(nr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await jE.init({logger:this.providerOpts.logger||hh,relayUrl:this.providerOpts.relayUrl||WE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>li(r)))];no("client",this.client),no("events",this.events),no("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=iI(r,this.session),a=el(s),u=sI(this.namespaces,this.optionalNamespaces),l=oo(gs({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new cI({namespace:l});break;case"solana":this.rpcProviders[r]=new uI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new hI({namespace:l});break;case"polkadot":this.rpcProviders[r]=new aI({namespace:l});break;case"cip34":this.rpcProviders[r]=new lI({namespace:l});break;case"elrond":this.rpcProviders[r]=new pI({namespace:l});break;case"multiversx":this.rpcProviders[r]=new dI({namespace:l});break;case"near":this.rpcProviders[r]=new fI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&nr(a)&&this.events.emit("accountsChanged",a.map(nI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=li(a),g=so(a)!==so(u)?`${l}:${so(u)}`:a;this.onChainChanged(g)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=oo(gs({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",oo(gs({},ve("USER_DISCONNECTED")),{data:t.topic}))}),this.on(At.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>li(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=li(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${lh}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${lh}/${t}`)}}const _I=xo,bI="wc",EI="ethereum_provider",II=`${bI}@2:${EI}:`,PI="https://rpc.walletconnect.com/v1/",_s=["eth_sendTransaction","personal_sign"],rl=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],bs=["chainChanged","accountsChanged"],il=["chainChanged","accountsChanged","message","disconnect","connect"];var SI=Object.defineProperty,OI=Object.defineProperties,RI=Object.getOwnPropertyDescriptors,vh=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,mh=(o,t,r)=>t in o?SI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,di=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&mh(o,r,t[r]);if(vh)for(var r of vh(t))CI.call(t,r)&&mh(o,r,t[r]);return o},wh=(o,t)=>OI(o,RI(t));function Es(o){return Number(o[0].split(":")[1])}function ao(o){return`0x${o.toString(16)}`}function $I(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:g}=o;if(!co(t))throw new Error("Invalid chains");const w={chains:t,methods:s||_s,events:u||bs,rpcMap:di({},t.length?{[Es(t)]:g[Es(t)]}:{})},b=u==null?void 0:u.filter(q=>!bs.includes(q)),C=s==null?void 0:s.filter(q=>!_s.includes(q));if(!r&&!l&&!a&&!(b!=null&&b.length)&&!(C!=null&&C.length))return{required:t.length?w:void 0};const O=(b==null?void 0:b.length)&&(C==null?void 0:C.length)||!r,N={chains:[...new Set(O?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:rl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:il))],rpcMap:g};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class Os{constructor(){this.events=new Ge.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=II,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new Os;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=$I(this.rpc);try{const a=await new Promise(async(l,g)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),g(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(wh(di({namespaces:di({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(b=>{l(b)}).catch(b=>{g(new Error(b.message))})});if(!a)return;const u=lw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:ao(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",ao(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",wh(di({},dw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ao(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const g=a.length?(t==null?void 0:t.methods)||_s:[],w=a.length?(t==null?void 0:t.events)||bs:[],b=(t==null?void 0:t.optionalMethods)||[],C=(t==null?void 0:t.optionalEvents)||[],O=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(q=>this.formatChainId(q)),optionalChains:u.map(q=>this.formatChainId(q)),methods:g,events:w,optionalMethods:b,optionalEvents:C,rpcMap:O,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Es(this.rpc.chains):Es(this.rpc.optionalChains),this.signer=await _I.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-BB5T29FD.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(di({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&co(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&co(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${PI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const AI=Os;exports.EthereumProvider=AI;exports.OPTIONAL_EVENTS=il;exports.OPTIONAL_METHODS=rl;exports.REQUIRED_EVENTS=bs;exports.REQUIRED_METHODS=_s;exports.default=Os;
@@ -1,7 +1,7 @@
1
- import { e as bt, a as To } from "./events-CkXgb0qh.mjs";
2
- import { a1 as xo, aR as Iw, h as ee, ac as Pw, du as $u } from "./index-DCFAlA0r.mjs";
3
- import { c as F, s as Do, x as kh, r as zh, H as Sw, a as Hh, q as Ss } from "./index-B8U_Gr4R.mjs";
4
- import { I as lr, f as ft, t as nt, c as Cu, C as Ow, r as Rw, a as Dr, g as Vh, i as _t, b as $s, d as Nw, E as ke, y as Qe, q as Cs, k as As, h as $w, e as Au, j as Cw, s as Aw, l as Tw, m as Fo, n as Ts, o as qo, p as Wt, u as xw, v as Tu, w as Dw } from "./index-CngGxdSU.mjs";
1
+ import { e as bt, a as To } from "./events-IweKXbqK.mjs";
2
+ import { a1 as xo, aR as Iw, h as ee, ac as Pw, du as $u } from "./index-PezPPmQR.mjs";
3
+ import { c as F, s as Do, x as kh, r as zh, H as Sw, a as Hh, q as Ss } from "./index-eOaDp35h.mjs";
4
+ import { I as lr, f as ft, t as nt, c as Cu, C as Ow, r as Rw, a as Dr, g as Vh, i as _t, b as $s, d as Nw, E as ke, y as Qe, q as Cs, k as As, h as $w, e as Au, j as Cw, s as Aw, l as Tw, m as Fo, n as Ts, o as qo, p as Wt, u as xw, v as Tu, w as Dw } from "./index-CLwX1P1j.mjs";
5
5
  var se = {};
6
6
  Object.defineProperty(se, "__esModule", { value: !0 });
7
7
  se.getLocalStorage = se.getLocalStorageOrThrow = se.getCrypto = se.getCryptoOrThrow = se.getLocation = se.getLocationOrThrow = se.getNavigator = se.getNavigatorOrThrow = se.getDocument = se.getDocumentOrThrow = se.getFromWindowOrThrow = se.getFromWindow = void 0;
@@ -7730,7 +7730,7 @@ class Jo {
7730
7730
  if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? Ns(this.rpc.chains) : Ns(this.rpc.optionalChains), this.signer = await tP.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
7731
7731
  let r;
7732
7732
  try {
7733
- const { WalletConnectModal: s } = await import("./index-Dv2SHpnV.mjs").then((a) => a.i);
7733
+ const { WalletConnectModal: s } = await import("./index-Bf66m4uH.mjs").then((a) => a.i);
7734
7734
  r = s;
7735
7735
  } catch {
7736
7736
  throw new Error("To use QR modal, please install @walletconnect/modal package");
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-CjaaWCsQ.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticPorticoRoute=t.AutomaticPorticoRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.buildConfig=t.buildConfig;exports.default=t.WormholeConnect;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;exports.wormholeConnectHosted=t.wormholeConnectHosted;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-B-m4JhhB.js");exports.AutomaticCCTPRoute=t.AutomaticCCTPRoute;exports.AutomaticPorticoRoute=t.AutomaticPorticoRoute;exports.AutomaticTokenBridgeRoute=t.AutomaticTokenBridgeRoute;exports.CCTPRoute=t.CCTPRoute;exports.DEFAULT_ROUTES=t.DEFAULT_ROUTES;exports.MAINNET=t.MAINNET;exports.MayanRoute=t.MayanRoute;exports.MayanRouteMCTP=t.MayanRouteMCTP;exports.MayanRouteSWIFT=t.MayanRouteSWIFT;exports.MayanRouteWH=t.MayanRouteWH;exports.TESTNET=t.TESTNET;exports.TokenBridgeRoute=t.TokenBridgeRoute;exports.buildConfig=t.buildConfig;exports.default=t.WormholeConnect;exports.nttAutomaticRoute=t.nttAutomaticRoute;exports.nttManualRoute=t.nttManualRoute;exports.nttRoutes=t.nttRoutes;exports.wormholeConnectHosted=t.wormholeConnectHosted;
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { dQ as o, dS as d, dO as e, dR as s, dK as u, dH as R, dT as n, dV as T, dW as i, dU as M, dI as C, dP as c, dJ as m, dG as r, dM as A, dN as E, dL as P, dX as l } from "./index-DCFAlA0r.mjs";
1
+ import { dQ as o, dS as d, dO as e, dR as s, dK as u, dH as R, dT as n, dV as T, dW as i, dU as M, dI as C, dP as c, dJ as m, dG as r, dM as A, dN as E, dL as P, dX as l } from "./index-PezPPmQR.mjs";
2
2
  export {
3
3
  o as AutomaticCCTPRoute,
4
4
  d as AutomaticPorticoRoute,