@multiversx/sdk-dapp-liquidity 2.0.0 → 2.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/helpers/assertRateConfirmationMatchesIntent.d.ts +8 -0
  2. package/helpers/assertRateConfirmationMatchesIntent.js +24 -0
  3. package/helpers/assertRateConfirmationMatchesIntent.mjs +23 -0
  4. package/helpers/index.d.ts +2 -0
  5. package/helpers/index.js +4 -0
  6. package/helpers/index.mjs +4 -0
  7. package/helpers/safeImageUrl.d.ts +1 -0
  8. package/helpers/safeImageUrl.js +24 -0
  9. package/helpers/safeImageUrl.mjs +23 -0
  10. package/helpers/serializeTransaction.js +1 -1
  11. package/helpers/serializeTransaction.mjs +1 -1
  12. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.d.ts +1 -0
  13. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +64 -0
  14. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +62 -0
  15. package/helpers/tests/safeImageUrl.spec.d.ts +1 -0
  16. package/helpers/tests/safeImageUrl.spec.js +49 -0
  17. package/helpers/tests/safeImageUrl.spec.mjs +47 -0
  18. package/helpers/tests/serializeTransaction.spec.d.ts +1 -0
  19. package/helpers/tests/serializeTransaction.spec.js +37 -0
  20. package/helpers/tests/serializeTransaction.spec.mjs +35 -0
  21. package/index.js +7 -3
  22. package/index.mjs +10 -6
  23. package/package.json +13 -8
  24. package/react.esm-7GsOwMPq.js +11815 -0
  25. package/react.esm-CU-Iqz8D.mjs +11796 -0
  26. package/reactjs/adapters/SuiAdapter.d.ts +14 -0
  27. package/reactjs/adapters/SuiAdapter.js +31 -2
  28. package/reactjs/adapters/SuiAdapter.mjs +31 -2
  29. package/reactjs/components/BridgeForm/Deposit.js +9 -7
  30. package/reactjs/components/BridgeForm/Deposit.mjs +8 -6
  31. package/reactjs/components/BridgeForm/Transfer.js +8 -6
  32. package/reactjs/components/BridgeForm/Transfer.mjs +7 -5
  33. package/reactjs/components/BridgeHistory/BridgeHistory.js +20 -6
  34. package/reactjs/components/BridgeHistory/BridgeHistory.mjs +20 -6
  35. package/reactjs/components/Connect/BridgeConnectButton.js +2 -1
  36. package/reactjs/components/Connect/BridgeConnectButton.mjs +2 -1
  37. package/reactjs/components/CopyButton/CopyButton.mjs +2 -2
  38. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +5 -1
  39. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +6 -2
  40. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +5 -1
  41. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +6 -2
  42. package/reactjs/components/TokenSelector/components/TokenIcon.js +2 -1
  43. package/reactjs/components/TokenSelector/components/TokenIcon.mjs +2 -1
  44. package/reactjs/context/Web3AppProvider.js +4 -2
  45. package/reactjs/context/Web3AppProvider.mjs +6 -4
  46. package/reactjs/hooks/tests/useGenericSignMessage.spec.d.ts +1 -0
  47. package/reactjs/hooks/tests/useGenericSignMessage.spec.js +69 -0
  48. package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +67 -0
  49. package/reactjs/hooks/tests/useSignTransaction.spec.d.ts +1 -0
  50. package/reactjs/hooks/tests/useSignTransaction.spec.js +196 -0
  51. package/reactjs/hooks/tests/useSignTransaction.spec.mjs +194 -0
  52. package/reactjs/hooks/useBridgeFormik.js +5 -0
  53. package/reactjs/hooks/useBridgeFormik.mjs +5 -0
  54. package/reactjs/hooks/useFetchTokens.js +4 -2
  55. package/reactjs/hooks/useFetchTokens.mjs +4 -2
  56. package/reactjs/hooks/useGenericSignMessage.js +23 -3
  57. package/reactjs/hooks/useGenericSignMessage.mjs +23 -3
  58. package/reactjs/hooks/useSignTransaction.js +27 -1
  59. package/reactjs/hooks/useSignTransaction.mjs +28 -2
  60. package/reactjs/index.js +3 -3
  61. package/reactjs/index.mjs +6 -6
  62. package/reactjs/init/init.d.ts +1 -0
  63. package/reactjs/init/init.js +11 -3
  64. package/reactjs/init/init.mjs +11 -3
  65. package/reactjs/queries/index.js +3 -3
  66. package/reactjs/queries/index.mjs +7 -7
  67. package/reactjs/queries/useCheckAccount.query.js +1 -1
  68. package/reactjs/queries/useCheckAccount.query.mjs +1 -1
  69. package/reactjs/queries/useGetAllTokens.query.js +1 -1
  70. package/reactjs/queries/useGetAllTokens.query.mjs +1 -1
  71. package/reactjs/queries/useGetChains.query.js +1 -1
  72. package/reactjs/queries/useGetChains.query.mjs +1 -1
  73. package/reactjs/queries/useGetHistory.query.d.ts +1 -1
  74. package/reactjs/queries/useGetHistory.query.js +10 -9
  75. package/reactjs/queries/useGetHistory.query.mjs +12 -11
  76. package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +1 -1
  77. package/reactjs/queries/useGetMvxTokensBalances.query.js +9 -14
  78. package/reactjs/queries/useGetMvxTokensBalances.query.mjs +12 -17
  79. package/reactjs/queries/useGetNonMvxTokensBalances.query.d.ts +1 -1
  80. package/reactjs/queries/useGetNonMvxTokensBalances.query.js +8 -8
  81. package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +11 -11
  82. package/types/errors.d.ts +3 -0
  83. package/types/errors.js +10 -0
  84. package/types/errors.mjs +9 -0
  85. package/reactjs/hooks/useSignTransaction.d.ts +0 -511
@@ -7,6 +7,11 @@ export type SuiAdapterOptions = {
7
7
  * AppKit sometimes passes an empty `networks` array into `construct`; this keeps WC valid.
8
8
  */
9
9
  explicitCaipChains?: string[];
10
+ /**
11
+ * When set, `connect()` will throw if the WalletConnect session advertises a different address.
12
+ * If not set, any address is accepted (backward-compatible).
13
+ */
14
+ expectedSuiAddress?: string;
10
15
  };
11
16
  export declare class SuiAdapter extends AdapterBlueprint {
12
17
  /**
@@ -16,6 +21,7 @@ export declare class SuiAdapter extends AdapterBlueprint {
16
21
  */
17
22
  private sharedWcProvider?;
18
23
  private readonly explicitCaipChainsFromInit;
24
+ private readonly expectedSuiAddress?;
19
25
  constructor(opts?: SuiAdapterOptions);
20
26
  /**
21
27
  * AppKit passes `networks` here from `createAppKit({ networks })` filtered by namespace.
@@ -47,6 +53,14 @@ export declare class SuiAdapter extends AdapterBlueprint {
47
53
  syncConnection(params: AdapterBlueprint.SyncConnectionParams): Promise<AdapterBlueprint.ConnectResult>;
48
54
  syncConnections({ connectToFirstConnector, caipNetwork }: AdapterBlueprint.SyncConnectionsParams): Promise<void>;
49
55
  getWalletConnectProvider(params: AdapterBlueprint.GetWalletConnectProviderParams): AdapterBlueprint.GetWalletConnectProviderResult;
56
+ /**
57
+ * Resolves the CAIP-2 chain scope string for WalletConnect requests.
58
+ * Resolution order:
59
+ * 1. `caipNetworkId` argument (if it starts with `'sui:'`)
60
+ * 2. First `'sui:'`-prefixed entry in `explicitCaipChainsFromInit`
61
+ * 3. `'sui:mainnet'` as a safe last resort
62
+ */
63
+ private getChainScope;
50
64
  signMessage(params: AdapterBlueprint.SignMessageParams): Promise<AdapterBlueprint.SignMessageResult>;
51
65
  sendTransaction(params: AdapterBlueprint.SendTransactionParams): Promise<AdapterBlueprint.SendTransactionResult>;
52
66
  estimateGas(): Promise<AdapterBlueprint.EstimateGasTransactionResult>;
@@ -20,12 +20,14 @@ class SuiAdapter extends appkitControllers.AdapterBlueprint {
20
20
  */
21
21
  __publicField(this, "sharedWcProvider");
22
22
  __publicField(this, "explicitCaipChainsFromInit");
23
+ __publicField(this, "expectedSuiAddress");
23
24
  /**
24
25
  * AppKit passes `networks` here from `createAppKit({ networks })` filtered by namespace.
25
26
  * `ChainController.getRequestedCaipNetworks('sui')` is often still empty → we must keep this.
26
27
  */
27
28
  __publicField(this, "suiNetworksFromConfig", []);
28
29
  this.explicitCaipChainsFromInit = (opts == null ? void 0 : opts.explicitCaipChains) ?? [];
30
+ this.expectedSuiAddress = opts == null ? void 0 : opts.expectedSuiAddress;
29
31
  }
30
32
  construct(params) {
31
33
  super.construct(params);
@@ -180,6 +182,11 @@ class SuiAdapter extends appkitControllers.AdapterBlueprint {
180
182
  if (!address) {
181
183
  throw new Error("No Sui account found after WalletConnect session");
182
184
  }
185
+ if (this.expectedSuiAddress && address !== this.expectedSuiAddress) {
186
+ throw new Error(
187
+ `Sui account mismatch: expected ${this.expectedSuiAddress}, got ${address}`
188
+ );
189
+ }
183
190
  const caipNetwork = (_c = this.getCaipNetworks()) == null ? void 0 : _c.find(
184
191
  (n) => n.id === params.chainId
185
192
  );
@@ -300,25 +307,47 @@ class SuiAdapter extends appkitControllers.AdapterBlueprint {
300
307
  getWalletConnectProvider(params) {
301
308
  return params.provider;
302
309
  }
310
+ /**
311
+ * Resolves the CAIP-2 chain scope string for WalletConnect requests.
312
+ * Resolution order:
313
+ * 1. `caipNetworkId` argument (if it starts with `'sui:'`)
314
+ * 2. First `'sui:'`-prefixed entry in `explicitCaipChainsFromInit`
315
+ * 3. `'sui:mainnet'` as a safe last resort
316
+ */
317
+ getChainScope(caipNetworkId) {
318
+ if (caipNetworkId == null ? void 0 : caipNetworkId.startsWith("sui:")) {
319
+ return caipNetworkId;
320
+ }
321
+ const fromInit = this.explicitCaipChainsFromInit.find(
322
+ (c) => c.startsWith("sui:")
323
+ );
324
+ if (fromInit) {
325
+ return fromInit;
326
+ }
327
+ return "sui:mainnet";
328
+ }
303
329
  async signMessage(params) {
304
330
  const wc = this.getWcProvider();
331
+ const chainScope = this.getChainScope();
305
332
  const result = await wc.request(
306
333
  {
307
334
  method: "sui_signPersonalMessage",
308
335
  params: { message: params.message, address: params.address }
309
336
  },
310
- "sui:mainnet"
337
+ chainScope
311
338
  );
312
339
  return { signature: result.signature };
313
340
  }
314
341
  async sendTransaction(params) {
342
+ var _a;
315
343
  const wc = this.getWcProvider();
344
+ const chainScope = this.getChainScope((_a = params.caipNetwork) == null ? void 0 : _a.caipNetworkId);
316
345
  const result = await wc.request(
317
346
  {
318
347
  method: "sui_signAndExecuteTransaction",
319
348
  params: { transaction: params.data, address: params.to }
320
349
  },
321
- "sui:mainnet"
350
+ chainScope
322
351
  );
323
352
  return { hash: result.digest };
324
353
  }
@@ -17,12 +17,14 @@ class SuiAdapter extends AdapterBlueprint {
17
17
  */
18
18
  __publicField(this, "sharedWcProvider");
19
19
  __publicField(this, "explicitCaipChainsFromInit");
20
+ __publicField(this, "expectedSuiAddress");
20
21
  /**
21
22
  * AppKit passes `networks` here from `createAppKit({ networks })` filtered by namespace.
22
23
  * `ChainController.getRequestedCaipNetworks('sui')` is often still empty → we must keep this.
23
24
  */
24
25
  __publicField(this, "suiNetworksFromConfig", []);
25
26
  this.explicitCaipChainsFromInit = (opts == null ? void 0 : opts.explicitCaipChains) ?? [];
27
+ this.expectedSuiAddress = opts == null ? void 0 : opts.expectedSuiAddress;
26
28
  }
27
29
  construct(params) {
28
30
  super.construct(params);
@@ -177,6 +179,11 @@ class SuiAdapter extends AdapterBlueprint {
177
179
  if (!address) {
178
180
  throw new Error("No Sui account found after WalletConnect session");
179
181
  }
182
+ if (this.expectedSuiAddress && address !== this.expectedSuiAddress) {
183
+ throw new Error(
184
+ `Sui account mismatch: expected ${this.expectedSuiAddress}, got ${address}`
185
+ );
186
+ }
180
187
  const caipNetwork = (_c = this.getCaipNetworks()) == null ? void 0 : _c.find(
181
188
  (n) => n.id === params.chainId
182
189
  );
@@ -297,25 +304,47 @@ class SuiAdapter extends AdapterBlueprint {
297
304
  getWalletConnectProvider(params) {
298
305
  return params.provider;
299
306
  }
307
+ /**
308
+ * Resolves the CAIP-2 chain scope string for WalletConnect requests.
309
+ * Resolution order:
310
+ * 1. `caipNetworkId` argument (if it starts with `'sui:'`)
311
+ * 2. First `'sui:'`-prefixed entry in `explicitCaipChainsFromInit`
312
+ * 3. `'sui:mainnet'` as a safe last resort
313
+ */
314
+ getChainScope(caipNetworkId) {
315
+ if (caipNetworkId == null ? void 0 : caipNetworkId.startsWith("sui:")) {
316
+ return caipNetworkId;
317
+ }
318
+ const fromInit = this.explicitCaipChainsFromInit.find(
319
+ (c) => c.startsWith("sui:")
320
+ );
321
+ if (fromInit) {
322
+ return fromInit;
323
+ }
324
+ return "sui:mainnet";
325
+ }
300
326
  async signMessage(params) {
301
327
  const wc = this.getWcProvider();
328
+ const chainScope = this.getChainScope();
302
329
  const result = await wc.request(
303
330
  {
304
331
  method: "sui_signPersonalMessage",
305
332
  params: { message: params.message, address: params.address }
306
333
  },
307
- "sui:mainnet"
334
+ chainScope
308
335
  );
309
336
  return { signature: result.signature };
310
337
  }
311
338
  async sendTransaction(params) {
339
+ var _a;
312
340
  const wc = this.getWcProvider();
341
+ const chainScope = this.getChainScope((_a = params.caipNetwork) == null ? void 0 : _a.caipNetworkId);
313
342
  const result = await wc.request(
314
343
  {
315
344
  method: "sui_signAndExecuteTransaction",
316
345
  params: { transaction: params.data, address: params.to }
317
346
  },
318
- "sui:mainnet"
347
+ chainScope
319
348
  );
320
349
  return { hash: result.digest };
321
350
  }
@@ -14,6 +14,8 @@ const reactjs_components_BridgeForm_hooks_useBridgeTokenSelection = require("./h
14
14
  const reactjs_components_BridgeForm_utils_bridgeFormHelpers = require("./utils/bridgeFormHelpers.js");
15
15
  const constants_index = require("../../../constants/index.js");
16
16
  const helpers_getApiURL = require("../../../helpers/getApiURL.js");
17
+ require("../../constants/index.js");
18
+ const helpers_safeImageUrl = require("../../../helpers/safeImageUrl.js");
17
19
  const types_chainType = require("../../../types/chainType.js");
18
20
  const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
19
21
  const reactjs_helpers_resolveBridgeApiChainId = require("../../helpers/resolveBridgeApiChainId.js");
@@ -38,7 +40,6 @@ require("@headlessui/react");
38
40
  require("react-dom");
39
41
  require("react-popper");
40
42
  require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");
41
- require("../../constants/index.js");
42
43
  const reactjs_components_BridgeHistory_BridgeHistory = require("../BridgeHistory/BridgeHistory.js");
43
44
  const reactjs_components_Connect_BridgeConnectButton = require("../Connect/BridgeConnectButton.js");
44
45
  require("wagmi");
@@ -77,6 +78,7 @@ const Deposit = ({
77
78
  const [siginingTransactionsCount, setSigningTransactionsCount] = React.useState(0);
78
79
  const account = reactjs_hooks_useAccount.useAccount();
79
80
  const { switchNetwork } = react.useAppKitNetwork();
81
+ const invalidateHistoryQuery = reactjs_queries_useGetHistory_query.useInvalidateHistoryQuery();
80
82
  const {
81
83
  config,
82
84
  options,
@@ -221,8 +223,8 @@ const Deposit = ({
221
223
  async (txHashes) => {
222
224
  handleOnChangeFirstAmount("");
223
225
  handleOnChangeSecondAmount("");
224
- reactjs_queries_useGetHistory_query.invalidateHistoryQuery();
225
- reactjs_queries_useGetHistory_query.invalidateHistoryQuery();
226
+ invalidateHistoryQuery();
227
+ invalidateHistoryQuery();
226
228
  onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction(txHashes);
227
229
  },
228
230
  [
@@ -556,7 +558,7 @@ const Deposit = ({
556
558
  reactjs_components_Connect_MvxAccountDisplay.MvxAccountDisplay,
557
559
  {
558
560
  accountAddress: mvxAddress,
559
- chainIcon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
561
+ chainIcon: helpers_safeImageUrl.safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
560
562
  username,
561
563
  accountExplorerUrl: `${options.mvxExplorerAddress}/accounts/${mvxAddress}`,
562
564
  showTag: true,
@@ -602,7 +604,7 @@ const Deposit = ({
602
604
  reactjs_components_Connect_MvxConnectButton.MvxConnectButton,
603
605
  {
604
606
  mvxAccountAddress: mvxAddress,
605
- icon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
607
+ icon: helpers_safeImageUrl.safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
606
608
  onClick: onMvxConnect
607
609
  }
608
610
  ),
@@ -627,7 +629,7 @@ const Deposit = ({
627
629
  /* @__PURE__ */ jsxRuntime.jsx(
628
630
  "img",
629
631
  {
630
- src: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
632
+ src: helpers_safeImageUrl.safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
631
633
  alt: "",
632
634
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
633
635
  }
@@ -648,7 +650,7 @@ const Deposit = ({
648
650
  /* @__PURE__ */ jsxRuntime.jsx(
649
651
  "img",
650
652
  {
651
- src: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
653
+ src: helpers_safeImageUrl.safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
652
654
  alt: "",
653
655
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
654
656
  }
@@ -11,6 +11,8 @@ import { useBridgeTokenSelection } from "./hooks/useBridgeTokenSelection.mjs";
11
11
  import { resolveSigningChainType } from "./utils/bridgeFormHelpers.mjs";
12
12
  import { MVX_CHAIN_IDS } from "../../../constants/index.mjs";
13
13
  import { getApiURL } from "../../../helpers/getApiURL.mjs";
14
+ import "../../constants/index.mjs";
15
+ import { safeImageUrl } from "../../../helpers/safeImageUrl.mjs";
14
16
  import { ChainType } from "../../../types/chainType.mjs";
15
17
  import { useWeb3App } from "../../context/useWeb3App.mjs";
16
18
  import { sameBridgeApiChainId, toBridgeApiChainId } from "../../helpers/resolveBridgeApiChainId.mjs";
@@ -21,7 +23,7 @@ import { useFetchBridgeData } from "../../hooks/useFetchBridgeData.mjs";
21
23
  import { useGetChainId } from "../../hooks/useGetChainId.mjs";
22
24
  import { useSendTransactions } from "../../hooks/useSendTransactions.mjs";
23
25
  import { useSignTransaction } from "../../hooks/useSignTransaction.mjs";
24
- import { invalidateHistoryQuery } from "../../queries/useGetHistory.query.mjs";
26
+ import { useInvalidateHistoryQuery } from "../../queries/useGetHistory.query.mjs";
25
27
  import { useGetRateMutation } from "../../queries/useGetRate.mutation.mjs";
26
28
  import { mxClsx } from "../../utils/mxClsx.mjs";
27
29
  import { AmountCard } from "../AmountCard/AmountCard.mjs";
@@ -35,7 +37,6 @@ import "@headlessui/react";
35
37
  import "react-dom";
36
38
  import "react-popper";
37
39
  import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
38
- import "../../constants/index.mjs";
39
40
  import { BridgeHistory } from "../BridgeHistory/BridgeHistory.mjs";
40
41
  import { BridgeConnectButton } from "../Connect/BridgeConnectButton.mjs";
41
42
  import "wagmi";
@@ -74,6 +75,7 @@ const Deposit = ({
74
75
  const [siginingTransactionsCount, setSigningTransactionsCount] = useState(0);
75
76
  const account = useAccount();
76
77
  const { switchNetwork } = useAppKitNetwork();
78
+ const invalidateHistoryQuery = useInvalidateHistoryQuery();
77
79
  const {
78
80
  config,
79
81
  options,
@@ -553,7 +555,7 @@ const Deposit = ({
553
555
  MvxAccountDisplay,
554
556
  {
555
557
  accountAddress: mvxAddress,
556
- chainIcon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
558
+ chainIcon: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
557
559
  username,
558
560
  accountExplorerUrl: `${options.mvxExplorerAddress}/accounts/${mvxAddress}`,
559
561
  showTag: true,
@@ -599,7 +601,7 @@ const Deposit = ({
599
601
  MvxConnectButton,
600
602
  {
601
603
  mvxAccountAddress: mvxAddress,
602
- icon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
604
+ icon: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
603
605
  onClick: onMvxConnect
604
606
  }
605
607
  ),
@@ -624,7 +626,7 @@ const Deposit = ({
624
626
  /* @__PURE__ */ jsx(
625
627
  "img",
626
628
  {
627
- src: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
629
+ src: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
628
630
  alt: "",
629
631
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
630
632
  }
@@ -645,7 +647,7 @@ const Deposit = ({
645
647
  /* @__PURE__ */ jsx(
646
648
  "img",
647
649
  {
648
- src: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
650
+ src: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
649
651
  alt: "",
650
652
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
651
653
  }
@@ -10,6 +10,8 @@ const reactToastify = require("react-toastify");
10
10
  const reactjs_components_BridgeForm_hooks_useBridgeTokenSelection = require("./hooks/useBridgeTokenSelection.js");
11
11
  const constants_index = require("../../../constants/index.js");
12
12
  const helpers_getApiURL = require("../../../helpers/getApiURL.js");
13
+ require("../../constants/index.js");
14
+ const helpers_safeImageUrl = require("../../../helpers/safeImageUrl.js");
13
15
  const types_providerType = require("../../../types/providerType.js");
14
16
  const reactjs_context_useWeb3App = require("../../context/useWeb3App.js");
15
17
  const reactjs_helpers_resolveBridgeApiChainId = require("../../helpers/resolveBridgeApiChainId.js");
@@ -23,7 +25,6 @@ const reactjs_hooks_useFetchBridgeData = require("../../hooks/useFetchBridgeData
23
25
  const reactjs_hooks_useBridgeApiChainId = require("../../hooks/useBridgeApiChainId.js");
24
26
  require("@tanstack/react-query");
25
27
  const reactjs_hooks_useGetChainId = require("../../hooks/useGetChainId.js");
26
- require("../../constants/index.js");
27
28
  const reactjs_hooks_useSendTransactions = require("../../hooks/useSendTransactions.js");
28
29
  require("@reown/appkit-adapter-solana/react");
29
30
  require("@solana/web3.js");
@@ -80,6 +81,7 @@ const Transfer = ({
80
81
  const [latestTransactions, setLatestTransactions] = React.useState([]);
81
82
  const account = reactjs_hooks_useAccount.useAccount();
82
83
  const { switchNetwork } = react.useAppKitNetwork();
84
+ const invalidateHistoryQuery = reactjs_queries_useGetHistory_query.useInvalidateHistoryQuery();
83
85
  const {
84
86
  options,
85
87
  supportedChains: sdkChains,
@@ -232,8 +234,8 @@ const Transfer = ({
232
234
  async (txHashes) => {
233
235
  handleOnChangeFirstAmount("");
234
236
  handleOnChangeSecondAmount("");
235
- reactjs_queries_useGetHistory_query.invalidateHistoryQuery();
236
- reactjs_queries_useGetHistory_query.invalidateHistoryQuery();
237
+ invalidateHistoryQuery();
238
+ invalidateHistoryQuery();
237
239
  onSuccessfullySentTransaction == null ? void 0 : onSuccessfullySentTransaction(txHashes);
238
240
  },
239
241
  [
@@ -406,7 +408,7 @@ const Transfer = ({
406
408
  reactjs_components_Connect_MvxAccountDisplay.MvxAccountDisplay,
407
409
  {
408
410
  accountAddress: mvxAddress,
409
- chainIcon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
411
+ chainIcon: helpers_safeImageUrl.safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
410
412
  username,
411
413
  accountExplorerUrl: `${options.mvxExplorerAddress}/accounts/${mvxAddress}`,
412
414
  showTag: true,
@@ -507,7 +509,7 @@ const Transfer = ({
507
509
  reactjs_components_Connect_MvxConnectButton.MvxConnectButton,
508
510
  {
509
511
  mvxAccountAddress: mvxAddress,
510
- icon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
512
+ icon: helpers_safeImageUrl.safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
511
513
  onClick: onMvxConnect
512
514
  }
513
515
  ),
@@ -533,7 +535,7 @@ const Transfer = ({
533
535
  /* @__PURE__ */ jsxRuntime.jsx(
534
536
  "img",
535
537
  {
536
- src: (secondTokenChain == null ? void 0 : secondTokenChain.pngUrl) ?? "",
538
+ src: helpers_safeImageUrl.safeImageUrl(secondTokenChain == null ? void 0 : secondTokenChain.pngUrl),
537
539
  alt: "",
538
540
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
539
541
  }
@@ -7,6 +7,8 @@ import { toast } from "react-toastify";
7
7
  import { useBridgeTokenSelection } from "./hooks/useBridgeTokenSelection.mjs";
8
8
  import { MVX_CHAIN_IDS } from "../../../constants/index.mjs";
9
9
  import { getApiURL } from "../../../helpers/getApiURL.mjs";
10
+ import "../../constants/index.mjs";
11
+ import { safeImageUrl } from "../../../helpers/safeImageUrl.mjs";
10
12
  import { ProviderType } from "../../../types/providerType.mjs";
11
13
  import { useWeb3App } from "../../context/useWeb3App.mjs";
12
14
  import { sameBridgeApiChainId, toBridgeApiChainId } from "../../helpers/resolveBridgeApiChainId.mjs";
@@ -20,13 +22,12 @@ import { useFetchBridgeData } from "../../hooks/useFetchBridgeData.mjs";
20
22
  import { useBridgeApiChainId } from "../../hooks/useBridgeApiChainId.mjs";
21
23
  import "@tanstack/react-query";
22
24
  import { useGetChainId } from "../../hooks/useGetChainId.mjs";
23
- import "../../constants/index.mjs";
24
25
  import { useSendTransactions } from "../../hooks/useSendTransactions.mjs";
25
26
  import "@reown/appkit-adapter-solana/react";
26
27
  import "@solana/web3.js";
27
28
  import "wagmi";
28
29
  import "@reown/appkit-controllers";
29
- import { invalidateHistoryQuery } from "../../queries/useGetHistory.query.mjs";
30
+ import { useInvalidateHistoryQuery } from "../../queries/useGetHistory.query.mjs";
30
31
  import { useGetRateMutation } from "../../queries/useGetRate.mutation.mjs";
31
32
  import { mxClsx } from "../../utils/mxClsx.mjs";
32
33
  import { AmountCard } from "../AmountCard/AmountCard.mjs";
@@ -77,6 +78,7 @@ const Transfer = ({
77
78
  const [latestTransactions, setLatestTransactions] = useState([]);
78
79
  const account = useAccount();
79
80
  const { switchNetwork } = useAppKitNetwork();
81
+ const invalidateHistoryQuery = useInvalidateHistoryQuery();
80
82
  const {
81
83
  options,
82
84
  supportedChains: sdkChains,
@@ -403,7 +405,7 @@ const Transfer = ({
403
405
  MvxAccountDisplay,
404
406
  {
405
407
  accountAddress: mvxAddress,
406
- chainIcon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
408
+ chainIcon: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
407
409
  username,
408
410
  accountExplorerUrl: `${options.mvxExplorerAddress}/accounts/${mvxAddress}`,
409
411
  showTag: true,
@@ -504,7 +506,7 @@ const Transfer = ({
504
506
  MvxConnectButton,
505
507
  {
506
508
  mvxAccountAddress: mvxAddress,
507
- icon: (mvxChain == null ? void 0 : mvxChain.pngUrl) ?? "",
509
+ icon: safeImageUrl(mvxChain == null ? void 0 : mvxChain.pngUrl),
508
510
  onClick: onMvxConnect
509
511
  }
510
512
  ),
@@ -530,7 +532,7 @@ const Transfer = ({
530
532
  /* @__PURE__ */ jsx(
531
533
  "img",
532
534
  {
533
- src: (secondTokenChain == null ? void 0 : secondTokenChain.pngUrl) ?? "",
535
+ src: safeImageUrl(secondTokenChain == null ? void 0 : secondTokenChain.pngUrl),
534
536
  alt: "",
535
537
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
536
538
  }
@@ -27,6 +27,7 @@ require("@reown/appkit-adapter-solana/react");
27
27
  require("@solana/web3.js");
28
28
  require("wagmi");
29
29
  require("@reown/appkit-controllers");
30
+ const helpers_safeImageUrl = require("../../../helpers/safeImageUrl.js");
30
31
  const reactjs_queries_useGetHistory_query = require("../../queries/useGetHistory.query.js");
31
32
  const reactjs_utils_formatAmount = require("../../utils/formatAmount.js");
32
33
  const reactjs_utils_mxClsx = require("../../utils/mxClsx.js");
@@ -242,7 +243,9 @@ const BridgeHistory = ({
242
243
  /* @__PURE__ */ jsxRuntime.jsx(
243
244
  "img",
244
245
  {
245
- src: (_c = tokensMap[transaction.tokenDestination]) == null ? void 0 : _c.pngUrl,
246
+ src: helpers_safeImageUrl.safeImageUrl(
247
+ (_c = tokensMap[transaction.tokenDestination]) == null ? void 0 : _c.pngUrl
248
+ ),
246
249
  alt: "",
247
250
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
248
251
  }
@@ -259,7 +262,9 @@ const BridgeHistory = ({
259
262
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full liq-h-8 liq-w-8 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-h-6 liq-w-6 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
260
263
  "img",
261
264
  {
262
- src: (_f = tokensMap[transaction.tokenSource]) == null ? void 0 : _f.pngUrl,
265
+ src: helpers_safeImageUrl.safeImageUrl(
266
+ (_f = tokensMap[transaction.tokenSource]) == null ? void 0 : _f.pngUrl
267
+ ),
263
268
  alt: "",
264
269
  className: "liq-asset-icon liq-sm liq-p-0"
265
270
  }
@@ -267,7 +272,9 @@ const BridgeHistory = ({
267
272
  /* @__PURE__ */ jsxRuntime.jsx(
268
273
  "img",
269
274
  {
270
- src: (_g = chainsMap[transaction.fromChainId]) == null ? void 0 : _g.pngUrl,
275
+ src: helpers_safeImageUrl.safeImageUrl(
276
+ (_g = chainsMap[transaction.fromChainId]) == null ? void 0 : _g.pngUrl
277
+ ),
271
278
  alt: "",
272
279
  className: "liq-absolute liq-left-3 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-5 liq-h-5 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg"
273
280
  }
@@ -298,7 +305,9 @@ const BridgeHistory = ({
298
305
  /* @__PURE__ */ jsxRuntime.jsx(
299
306
  "img",
300
307
  {
301
- src: (_j = tokensMap[transaction.tokenSource]) == null ? void 0 : _j.pngUrl,
308
+ src: helpers_safeImageUrl.safeImageUrl(
309
+ (_j = tokensMap[transaction.tokenSource]) == null ? void 0 : _j.pngUrl
310
+ ),
302
311
  alt: "",
303
312
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
304
313
  }
@@ -315,7 +324,9 @@ const BridgeHistory = ({
315
324
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full liq-h-8 liq-w-8 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-h-6 liq-w-6 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
316
325
  "img",
317
326
  {
318
- src: (_m = tokensMap[transaction.tokenDestination]) == null ? void 0 : _m.pngUrl,
327
+ src: helpers_safeImageUrl.safeImageUrl(
328
+ (_m = tokensMap[transaction.tokenDestination]) == null ? void 0 : _m.pngUrl
329
+ ),
319
330
  alt: "",
320
331
  className: "liq-asset-icon liq-sm liq-p-0"
321
332
  }
@@ -323,7 +334,9 @@ const BridgeHistory = ({
323
334
  /* @__PURE__ */ jsxRuntime.jsx(
324
335
  "img",
325
336
  {
326
- src: (_n = chainsMap[transaction.toChainId]) == null ? void 0 : _n.pngUrl,
337
+ src: helpers_safeImageUrl.safeImageUrl(
338
+ (_n = chainsMap[transaction.toChainId]) == null ? void 0 : _n.pngUrl
339
+ ),
327
340
  alt: "",
328
341
  className: "liq-absolute liq-left-3 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-5 liq-h-5 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg"
329
342
  }
@@ -338,6 +351,7 @@ const BridgeHistory = ({
338
351
  {
339
352
  href: `${options.bridgeURL}/status/${transaction.txHash}`,
340
353
  target: "_blank",
354
+ rel: "noopener noreferrer",
341
355
  className: "liq-flex",
342
356
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsxRuntime.jsx(
343
357
  reactjs_components_base_MxTooltip_MxTooltip.MxTooltip,
@@ -24,6 +24,7 @@ import "@reown/appkit-adapter-solana/react";
24
24
  import "@solana/web3.js";
25
25
  import "wagmi";
26
26
  import "@reown/appkit-controllers";
27
+ import { safeImageUrl } from "../../../helpers/safeImageUrl.mjs";
27
28
  import { useGetHistoryQuery } from "../../queries/useGetHistory.query.mjs";
28
29
  import { formatAmount } from "../../utils/formatAmount.mjs";
29
30
  import { mxClsx } from "../../utils/mxClsx.mjs";
@@ -239,7 +240,9 @@ const BridgeHistory = ({
239
240
  /* @__PURE__ */ jsx(
240
241
  "img",
241
242
  {
242
- src: (_c = tokensMap[transaction.tokenDestination]) == null ? void 0 : _c.pngUrl,
243
+ src: safeImageUrl(
244
+ (_c = tokensMap[transaction.tokenDestination]) == null ? void 0 : _c.pngUrl
245
+ ),
243
246
  alt: "",
244
247
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
245
248
  }
@@ -256,7 +259,9 @@ const BridgeHistory = ({
256
259
  /* @__PURE__ */ jsx("div", { className: "liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full liq-h-8 liq-w-8 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsx("div", { className: "liq-h-6 liq-w-6 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsx(
257
260
  "img",
258
261
  {
259
- src: (_f = tokensMap[transaction.tokenSource]) == null ? void 0 : _f.pngUrl,
262
+ src: safeImageUrl(
263
+ (_f = tokensMap[transaction.tokenSource]) == null ? void 0 : _f.pngUrl
264
+ ),
260
265
  alt: "",
261
266
  className: "liq-asset-icon liq-sm liq-p-0"
262
267
  }
@@ -264,7 +269,9 @@ const BridgeHistory = ({
264
269
  /* @__PURE__ */ jsx(
265
270
  "img",
266
271
  {
267
- src: (_g = chainsMap[transaction.fromChainId]) == null ? void 0 : _g.pngUrl,
272
+ src: safeImageUrl(
273
+ (_g = chainsMap[transaction.fromChainId]) == null ? void 0 : _g.pngUrl
274
+ ),
268
275
  alt: "",
269
276
  className: "liq-absolute liq-left-3 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-5 liq-h-5 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg"
270
277
  }
@@ -295,7 +302,9 @@ const BridgeHistory = ({
295
302
  /* @__PURE__ */ jsx(
296
303
  "img",
297
304
  {
298
- src: (_j = tokensMap[transaction.tokenSource]) == null ? void 0 : _j.pngUrl,
305
+ src: safeImageUrl(
306
+ (_j = tokensMap[transaction.tokenSource]) == null ? void 0 : _j.pngUrl
307
+ ),
299
308
  alt: "",
300
309
  className: "liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
301
310
  }
@@ -312,7 +321,9 @@ const BridgeHistory = ({
312
321
  /* @__PURE__ */ jsx("div", { className: "liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full liq-h-8 liq-w-8 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsx("div", { className: "liq-h-6 liq-w-6 liq-flex liq-items-center liq-justify-center", children: /* @__PURE__ */ jsx(
313
322
  "img",
314
323
  {
315
- src: (_m = tokensMap[transaction.tokenDestination]) == null ? void 0 : _m.pngUrl,
324
+ src: safeImageUrl(
325
+ (_m = tokensMap[transaction.tokenDestination]) == null ? void 0 : _m.pngUrl
326
+ ),
316
327
  alt: "",
317
328
  className: "liq-asset-icon liq-sm liq-p-0"
318
329
  }
@@ -320,7 +331,9 @@ const BridgeHistory = ({
320
331
  /* @__PURE__ */ jsx(
321
332
  "img",
322
333
  {
323
- src: (_n = chainsMap[transaction.toChainId]) == null ? void 0 : _n.pngUrl,
334
+ src: safeImageUrl(
335
+ (_n = chainsMap[transaction.toChainId]) == null ? void 0 : _n.pngUrl
336
+ ),
324
337
  alt: "",
325
338
  className: "liq-absolute liq-left-3 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-5 liq-h-5 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg"
326
339
  }
@@ -335,6 +348,7 @@ const BridgeHistory = ({
335
348
  {
336
349
  href: `${options.bridgeURL}/status/${transaction.txHash}`,
337
350
  target: "_blank",
351
+ rel: "noopener noreferrer",
338
352
  className: "liq-flex",
339
353
  children: /* @__PURE__ */ jsx("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ jsx(
340
354
  MxTooltip,
@@ -4,6 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("react/jsx-runtime");
5
5
  const reactjs_components_Connect_CustomConnectButton = require("./CustomConnectButton.js");
6
6
  const helpers_getDisplayName = require("../../../helpers/getDisplayName.js");
7
+ const helpers_safeImageUrl = require("../../../helpers/safeImageUrl.js");
7
8
  const reactjs_hooks_useAccount = require("../../hooks/useAccount.js");
8
9
  const BridgeConnectButton = ({
9
10
  activeChain,
@@ -22,7 +23,7 @@ const BridgeConnectButton = ({
22
23
  activeChain && /* @__PURE__ */ jsxRuntime.jsx(
23
24
  "img",
24
25
  {
25
- src: activeChain.pngUrl,
26
+ src: helpers_safeImageUrl.safeImageUrl(activeChain.pngUrl),
26
27
  alt: "",
27
28
  className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
28
29
  }
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { CustomConnectButton } from "./CustomConnectButton.mjs";
3
3
  import { getDisplayName } from "../../../helpers/getDisplayName.mjs";
4
+ import { safeImageUrl } from "../../../helpers/safeImageUrl.mjs";
4
5
  import { useAccount } from "../../hooks/useAccount.mjs";
5
6
  const BridgeConnectButton = ({
6
7
  activeChain,
@@ -19,7 +20,7 @@ const BridgeConnectButton = ({
19
20
  activeChain && /* @__PURE__ */ jsx(
20
21
  "img",
21
22
  {
22
- src: activeChain.pngUrl,
23
+ src: safeImageUrl(activeChain.pngUrl),
23
24
  alt: "",
24
25
  className: "liq-z-10 liq-flex liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"
25
26
  }