@kimafinance/kima-transaction-widget 1.5.19 → 1.5.21

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.
package/dist/index.cjs CHANGED
@@ -3042,6 +3042,9 @@ var isAddressCompatible = (address, shortName) => {
3042
3042
  return false;
3043
3043
  };
3044
3044
 
3045
+ // src/shared/lib/fees.ts
3046
+ var getFeeSideValues = (feeDeduct, transactionValues) => feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
3047
+
3045
3048
  // src/features/allowances/evm/useApproveErc20.ts
3046
3049
  var import_viem2 = require("viem");
3047
3050
 
@@ -3068,7 +3071,7 @@ var useApproveErc20 = () => {
3068
3071
  const tokenOptions = (0, import_react_redux.useSelector)(selectTokenOptions);
3069
3072
  const { transactionValues } = (0, import_react_redux.useSelector)(selectServiceFee);
3070
3073
  const feeDeduct = (0, import_react_redux.useSelector)(selectFeeDeduct);
3071
- const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
3074
+ const txValues = getFeeSideValues(feeDeduct, transactionValues);
3072
3075
  const allowanceNeeded = BigInt(txValues.allowanceAmount.value);
3073
3076
  const { pools } = useGetPools_default(
3074
3077
  (0, import_react_redux.useSelector)(selectBackendUrl),
@@ -3237,7 +3240,7 @@ var useEvmSignMessage = () => {
3237
3240
  const { address: appkitAddress } = (0, import_react7.useAppKitAccount)() || {};
3238
3241
  const { walletProvider: appkitProvider } = (0, import_react7.useAppKitProvider)("eip155");
3239
3242
  const userAddress = useEvmAddress(mode);
3240
- const { message } = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
3243
+ const { message } = getFeeSideValues(feeDeduct, transactionValues);
3241
3244
  const signMessage = (0, import_react6.useCallback)(async () => {
3242
3245
  try {
3243
3246
  const eip1193 = appkitProvider?.provider ?? globalThis.ethereum;
@@ -3275,7 +3278,7 @@ var useAllowance = () => {
3275
3278
  const { signMessage } = useEvmSignMessage();
3276
3279
  const { transactionValues } = (0, import_react_redux4.useSelector)(selectServiceFee);
3277
3280
  const feeDeduct = (0, import_react_redux4.useSelector)(selectFeeDeduct);
3278
- const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
3281
+ const txValues = getFeeSideValues(feeDeduct, transactionValues);
3279
3282
  const allowanceNeeded = (0, import_react8.useMemo)(
3280
3283
  () => BigInt(txValues.allowanceAmount.value),
3281
3284
  [txValues.allowanceAmount.value]
@@ -4127,7 +4130,7 @@ var useApproveSPL = () => {
4127
4130
  const tokenOptions = (0, import_react_redux13.useSelector)(selectTokenOptions);
4128
4131
  const { transactionValues } = (0, import_react_redux13.useSelector)(selectServiceFee);
4129
4132
  const feeDeduct = (0, import_react_redux13.useSelector)(selectFeeDeduct);
4130
- const { allowanceAmount } = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
4133
+ const { allowanceAmount } = getFeeSideValues(feeDeduct, transactionValues);
4131
4134
  const allowanceNumber = BigInt(allowanceAmount.value);
4132
4135
  const ownerPk = mode === "light" /* light */ ? new import_web37.PublicKey(lightDemoAccounts.SOL) : publicKey ? new import_web37.PublicKey(publicKey) : void 0;
4133
4136
  const { pools } = useGetPools_default(backendUrl, networkOption);
@@ -4217,7 +4220,7 @@ var useSolSignMessage = () => {
4217
4220
  const { signMessage } = useSolProvider();
4218
4221
  const { transactionValues } = (0, import_react_redux14.useSelector)(selectServiceFee);
4219
4222
  const feeDeduct = (0, import_react_redux14.useSelector)(selectFeeDeduct);
4220
- const { message } = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
4223
+ const { message } = getFeeSideValues(feeDeduct, transactionValues);
4221
4224
  const sign = (0, import_react23.useCallback)(async () => {
4222
4225
  if (!signMessage) {
4223
4226
  logger_default.warn("useSolSignMessage: signMessage not available");
@@ -4244,7 +4247,7 @@ var useAllowance2 = () => {
4244
4247
  const { transactionValues } = (0, import_react_redux15.useSelector)(selectServiceFee);
4245
4248
  const feeDeduct = (0, import_react_redux15.useSelector)(selectFeeDeduct);
4246
4249
  const needed = BigInt(
4247
- (feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin).allowanceAmount.value
4250
+ getFeeSideValues(feeDeduct, transactionValues).allowanceAmount.value
4248
4251
  );
4249
4252
  const current = read?.allowance ?? 0n;
4250
4253
  const isApproved = current >= needed;
@@ -4922,7 +4925,7 @@ var useApproveTrc20 = () => {
4922
4925
  const tokenOptions = (0, import_react_redux21.useSelector)(selectTokenOptions);
4923
4926
  const { transactionValues } = (0, import_react_redux21.useSelector)(selectServiceFee);
4924
4927
  const feeDeduct = (0, import_react_redux21.useSelector)(selectFeeDeduct);
4925
- const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
4928
+ const txValues = getFeeSideValues(feeDeduct, transactionValues);
4926
4929
  const allowanceNeeded = BigInt(txValues.allowanceAmount.value);
4927
4930
  const { tronWeb, signTransaction } = useTronProvider();
4928
4931
  const address = useTronAddress(mode);
@@ -5077,7 +5080,7 @@ var useAllowance3 = () => {
5077
5080
  const { sign } = useTronSignMessage();
5078
5081
  const { transactionValues } = (0, import_react_redux23.useSelector)(selectServiceFee);
5079
5082
  const feeDeduct = (0, import_react_redux23.useSelector)(selectFeeDeduct);
5080
- const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
5083
+ const txValues = getFeeSideValues(feeDeduct, transactionValues);
5081
5084
  const allowanceNeeded = (0, import_react31.useMemo)(
5082
5085
  () => BigInt(txValues.allowanceAmount.value),
5083
5086
  [txValues.allowanceAmount.value]
@@ -5482,7 +5485,7 @@ var KimaProvider = ({
5482
5485
  var KimaProvider_default = KimaProvider;
5483
5486
 
5484
5487
  // src/widgets/common/KimaTransactionWidget.tsx
5485
- var import_react67 = require("react");
5488
+ var import_react69 = require("react");
5486
5489
  var import_react_redux58 = require("react-redux");
5487
5490
 
5488
5491
  // src/assets/loading/180-ring.tsx
@@ -5771,6 +5774,15 @@ var isSamePeggedToken = (originChain, originSymbol, targetChain, targetSymbol) =
5771
5774
  if (!src.peggedTo || !dst.peggedTo) return false;
5772
5775
  return src.peggedTo === dst.peggedTo;
5773
5776
  };
5777
+ var uiTokenSymbol = (symbol) => {
5778
+ if (!symbol) return symbol ?? "";
5779
+ const s = symbol.toString().trim();
5780
+ const up = s.toUpperCase();
5781
+ if (up === "WETH") return "ETH";
5782
+ if (up === "WSOL") return "SOL";
5783
+ if (up === "WBTC") return "BTC";
5784
+ return s;
5785
+ };
5774
5786
 
5775
5787
  // src/components/reusable/WalletButton.tsx
5776
5788
  var import_wallet_adapter_react5 = require("@solana/wallet-adapter-react");
@@ -6066,7 +6078,7 @@ var WalletButton = ({
6066
6078
  isConnected && mode !== "light" /* light */ && !placeholder && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: balance !== void 0 && decimals !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("p", { className: "balance-info", children: [
6067
6079
  formatUSD(bigIntToNumber({ value: balance, decimals })),
6068
6080
  " ",
6069
- selectedCoin,
6081
+ uiTokenSymbol(selectedCoin),
6070
6082
  " available"
6071
6083
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "loading", "aria-label": "balance-loading" }) })
6072
6084
  ]
@@ -6163,6 +6175,7 @@ var COIN_LIST2 = {
6163
6175
  USD: USD_default,
6164
6176
  USDT: USDT_default,
6165
6177
  USD1: USD1_default,
6178
+ BTC: BTC_default,
6166
6179
  WBTC: BTC_default,
6167
6180
  WETH: Ethereum_default,
6168
6181
  WSOL: Solana_default,
@@ -6185,7 +6198,6 @@ function TokenIcon({
6185
6198
 
6186
6199
  // src/components/reusable/CoinDropdown.tsx
6187
6200
  var import_jsx_runtime65 = require("react/jsx-runtime");
6188
- var displaySymbol = (sym) => sym === "WETH" ? "ETH" : sym === "WSOL" ? "SOL" : sym ?? "";
6189
6201
  var CoinDropdown = ({
6190
6202
  isSourceChain = true
6191
6203
  }) => {
@@ -6254,7 +6266,7 @@ var CoinDropdown = ({
6254
6266
  children: [
6255
6267
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "coin-wrapper", children: tokenSymbol ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
6256
6268
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(TokenIcon, { symbol: tokenSymbol, width: 24, height: 24 }),
6257
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "coin", children: displaySymbol(tokenSymbol) })
6269
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "coin", children: uiTokenSymbol(tokenSymbol) })
6258
6270
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "coin placeholder", children: "Select token" }) }),
6259
6271
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
6260
6272
  "div",
@@ -6270,7 +6282,7 @@ var CoinDropdown = ({
6270
6282
  },
6271
6283
  children: [
6272
6284
  /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(TokenIcon, { symbol: token.symbol, width: 24, height: 24 }),
6273
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { children: displaySymbol(token.symbol) })
6285
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { children: uiTokenSymbol(token.symbol) })
6274
6286
  ]
6275
6287
  },
6276
6288
  token.symbol
@@ -6332,6 +6344,8 @@ var FeeDeductionRadioButtons = ({ disabled }) => {
6332
6344
  const targetCurrency = (0, import_react_redux31.useSelector)(selectTargetCurrency);
6333
6345
  const theme = (0, import_react_redux31.useSelector)(selectTheme);
6334
6346
  const isSubmitted = (0, import_react_redux31.useSelector)(selectSubmitted);
6347
+ const uiSourceCurrency = uiTokenSymbol(sourceCurrency);
6348
+ const uiTargetCurrency = uiTokenSymbol(targetCurrency);
6335
6349
  const handleChange = (value) => {
6336
6350
  dispatch(setFeeDeduct(value));
6337
6351
  };
@@ -6349,9 +6363,9 @@ var FeeDeductionRadioButtons = ({ disabled }) => {
6349
6363
  ),
6350
6364
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: `radio-label ${theme.colorMode}`, children: `Pay $${formatterFloat.format(
6351
6365
  Number(amount)
6352
- )} ${sourceCurrency} ${["BANK", "CC"].includes(sourceNetwork.shortName) ? "with" : "in"} ${sourceNetwork.name} to receive $${formatterFloat.format(
6366
+ )} ${uiSourceCurrency} ${["BANK", "CC"].includes(sourceNetwork.shortName) ? "with" : "in"} ${sourceNetwork.name} to receive $${formatterFloat.format(
6353
6367
  Number(amount) - totalFee
6354
- )} ${targetCurrency} ${["BANK", "CC"].includes(targetNetwork.shortName) ? "with" : "in"} ${targetNetwork.name}` })
6368
+ )} ${uiTargetCurrency} ${["BANK", "CC"].includes(targetNetwork.shortName) ? "with" : "in"} ${targetNetwork.name}` })
6355
6369
  ] }),
6356
6370
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("label", { className: `fee-option ${disabled ? "disabled" : ""}`, children: [
6357
6371
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
@@ -6366,9 +6380,9 @@ var FeeDeductionRadioButtons = ({ disabled }) => {
6366
6380
  ),
6367
6381
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: `radio-label ${theme.colorMode}`, children: `Pay $${formatterFloat.format(
6368
6382
  Number(amount) + totalFee
6369
- )} ${sourceCurrency} ${["BANK", "CC"].includes(sourceNetwork.shortName) ? "with" : "in"} ${sourceNetwork.name} to receive $${formatterFloat.format(
6383
+ )} ${uiSourceCurrency} ${["BANK", "CC"].includes(sourceNetwork.shortName) ? "with" : "in"} ${sourceNetwork.name} to receive $${formatterFloat.format(
6370
6384
  Number(amount)
6371
- )} ${targetCurrency} ${["BANK", "CC"].includes(targetNetwork.shortName) ? "with" : "in"} ${targetNetwork.name}` })
6385
+ )} ${uiTargetCurrency} ${["BANK", "CC"].includes(targetNetwork.shortName) ? "with" : "in"} ${targetNetwork.name}` })
6372
6386
  ] })
6373
6387
  ] }) });
6374
6388
  };
@@ -6425,6 +6439,14 @@ var ConfirmDetails = ({
6425
6439
  );
6426
6440
  const sourceCurrency = (0, import_react_redux32.useSelector)(selectSourceCurrency);
6427
6441
  const targetCurrency = (0, import_react_redux32.useSelector)(selectTargetCurrency);
6442
+ const uiSourceCurrency = (0, import_react47.useMemo)(
6443
+ () => uiTokenSymbol(sourceCurrency),
6444
+ [sourceCurrency]
6445
+ );
6446
+ const uiTargetCurrency = (0, import_react47.useMemo)(
6447
+ () => uiTokenSymbol(targetCurrency),
6448
+ [targetCurrency]
6449
+ );
6428
6450
  const { width, updateWidth } = useWidth_default();
6429
6451
  const isSwap = (0, import_react47.useMemo)(
6430
6452
  () => !isSamePeggedToken(
@@ -6490,8 +6512,8 @@ var ConfirmDetails = ({
6490
6512
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { children: [
6491
6513
  "Step ",
6492
6514
  isApproved ? "2" : "1",
6493
- "\xA0of 2\xA0\xA0\xA0",
6494
- isApproved ? "Submit transaction" : originNetwork.shortName === "FIAT" /* FIAT */ ? "Bank Details" : "Approval"
6515
+ "\xA0of 2:\xA0\xA0\xA0",
6516
+ isApproved ? isSwap ? "Submit Swap Transaction" : "Submit Transfer Transaction" : originNetwork.shortName === "FIAT" /* FIAT */ ? "Bank Details" : "Approval"
6495
6517
  ] }),
6496
6518
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "detail-item", children: [
6497
6519
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "label", children: [
@@ -6513,7 +6535,7 @@ var ConfirmDetails = ({
6513
6535
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "coin-details", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { children: [
6514
6536
  formatBigInt(amountToTransferBig),
6515
6537
  " ",
6516
- sourceCurrency
6538
+ uiSourceCurrency
6517
6539
  ] }) })
6518
6540
  ] }),
6519
6541
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "amount-details", children: [
@@ -6538,7 +6560,7 @@ var ConfirmDetails = ({
6538
6560
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "service-fee", children: [
6539
6561
  formatBigInt(totalFee),
6540
6562
  " ",
6541
- sourceCurrency
6563
+ uiSourceCurrency
6542
6564
  ] })
6543
6565
  ]
6544
6566
  }
@@ -6550,7 +6572,7 @@ var ConfirmDetails = ({
6550
6572
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "service-fee", children: [
6551
6573
  formatBigInt(combinedSwapFees),
6552
6574
  " ",
6553
- sourceCurrency
6575
+ uiSourceCurrency
6554
6576
  ] })
6555
6577
  ] }),
6556
6578
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "amount-details", children: [
@@ -6558,7 +6580,7 @@ var ConfirmDetails = ({
6558
6580
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "service-fee", children: [
6559
6581
  formatBigInt(kimaFee),
6560
6582
  " ",
6561
- sourceCurrency
6583
+ uiSourceCurrency
6562
6584
  ] })
6563
6585
  ] })
6564
6586
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
@@ -6567,7 +6589,7 @@ var ConfirmDetails = ({
6567
6589
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "service-fee", children: [
6568
6590
  formatBigInt(sourceFee),
6569
6591
  " ",
6570
- sourceCurrency
6592
+ uiSourceCurrency
6571
6593
  ] })
6572
6594
  ] }),
6573
6595
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "amount-details", children: [
@@ -6579,7 +6601,7 @@ var ConfirmDetails = ({
6579
6601
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "service-fee", children: [
6580
6602
  formatBigInt(targetFee),
6581
6603
  " ",
6582
- targetCurrency
6604
+ uiTargetCurrency
6583
6605
  ] })
6584
6606
  ] }),
6585
6607
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "amount-details", children: [
@@ -6587,7 +6609,7 @@ var ConfirmDetails = ({
6587
6609
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "service-fee", children: [
6588
6610
  formatBigInt(kimaFee),
6589
6611
  " ",
6590
- sourceCurrency
6612
+ uiSourceCurrency
6591
6613
  ] })
6592
6614
  ] })
6593
6615
  ] }) }),
@@ -6596,7 +6618,7 @@ var ConfirmDetails = ({
6596
6618
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "service-fee", children: [
6597
6619
  formatBigInt(targetTransferBig),
6598
6620
  " ",
6599
- targetCurrency
6621
+ uiTargetCurrency
6600
6622
  ] })
6601
6623
  ] })
6602
6624
  ] }) }),
@@ -6680,29 +6702,20 @@ var import_jsx_runtime70 = require("react/jsx-runtime");
6680
6702
  var import_react49 = require("react");
6681
6703
  var import_react_redux35 = require("react-redux");
6682
6704
  var import_jsx_runtime71 = require("react/jsx-runtime");
6683
- var stepInfo = [
6684
- {
6685
- title: "Initialize"
6686
- },
6687
- {
6688
- title: "Source Transfer"
6689
- },
6690
- {
6691
- title: "Validation"
6692
- },
6693
- {
6694
- title: "Target Transfer"
6695
- },
6696
- {
6697
- title: "Finalize"
6698
- }
6705
+ var DEFAULT_STEPS = [
6706
+ { title: "Initialize" },
6707
+ { title: "Source Transfer" },
6708
+ { title: "Validation" },
6709
+ { title: "Target Transfer" },
6710
+ { title: "Finalize" }
6699
6711
  ];
6700
- var StepBox = ({ step, errorStep, loadingStep, data }) => {
6712
+ var StepBox = ({ step, errorStep, loadingStep, data, steps }) => {
6701
6713
  const theme = (0, import_react_redux35.useSelector)(selectTheme);
6702
6714
  const explorerUrl = (0, import_react_redux35.useSelector)(selectKimaExplorer);
6703
6715
  const networkOption = (0, import_react_redux35.useSelector)(selectNetworkOption);
6704
6716
  const networks = (0, import_react_redux35.useSelector)(selectNetworks);
6705
6717
  const { width: windowWidth } = useWidth_default();
6718
+ const stepInfo = steps ?? DEFAULT_STEPS;
6706
6719
  const sourceChain = (0, import_react49.useMemo)(() => {
6707
6720
  const sourceKey = data?.sourceChain === "FIAT" ? "CC" : data?.sourceChain;
6708
6721
  return networks.find((network) => network.shortName === sourceKey);
@@ -6801,7 +6814,7 @@ var StepBox = ({ step, errorStep, loadingStep, data }) => {
6801
6814
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CopyButton_default, { text: data?.tssReleaseHash || "" })
6802
6815
  ] })
6803
6816
  ] }) : null
6804
- ] }, item.title)) }) });
6817
+ ] }, `${item.title}-${index}`)) }) });
6805
6818
  };
6806
6819
  var StepBox_default = StepBox;
6807
6820
 
@@ -6929,45 +6942,49 @@ var useDebugCode = (sequence = ["D", "E", "B", "U", "G"]) => {
6929
6942
  };
6930
6943
 
6931
6944
  // src/widgets/common/KimaWidgetWrapper.tsx
6932
- var import_react65 = require("@reown/appkit/react");
6933
- var import_react66 = require("react");
6945
+ var import_react67 = require("@reown/appkit/react");
6946
+ var import_react68 = require("react");
6934
6947
  var import_react_redux57 = require("react-redux");
6935
6948
 
6936
6949
  // src/widgets/transaction/components/TransactionWidget.tsx
6937
- var import_react53 = require("react");
6950
+ var import_react54 = require("react");
6938
6951
 
6939
6952
  // src/components/reusable/Progressbar.tsx
6953
+ var import_react51 = require("react");
6940
6954
  var import_react_redux37 = require("react-redux");
6941
6955
  var import_jsx_runtime73 = require("react/jsx-runtime");
6942
- var stepInfo2 = [
6943
- {
6944
- title: "Initialize"
6945
- },
6946
- {
6947
- title: "Source Transfer"
6948
- },
6949
- {
6950
- title: "Validation"
6951
- },
6952
- {
6953
- title: "Target Transfer"
6954
- },
6955
- {
6956
- title: "Finalize"
6957
- }
6956
+ var DEFAULT_STEPS2 = [
6957
+ { title: "Initialize" },
6958
+ { title: "Source Transfer" },
6959
+ { title: "Validation" },
6960
+ { title: "Target Transfer" },
6961
+ { title: "Finalize" }
6958
6962
  ];
6959
- var Progressbar = ({ step, errorStep, setFocus, loadingStep }) => {
6963
+ var Progressbar = ({
6964
+ step,
6965
+ errorStep,
6966
+ setFocus,
6967
+ loadingStep,
6968
+ steps
6969
+ }) => {
6960
6970
  const theme = (0, import_react_redux37.useSelector)(selectTheme);
6971
+ const stepInfo = steps ?? DEFAULT_STEPS2;
6972
+ const lastIndex = stepInfo.length - 1;
6973
+ const pct = (0, import_react51.useMemo)(() => {
6974
+ if (lastIndex <= 0) return 0;
6975
+ const clamped = Math.max(0, Math.min(step, lastIndex));
6976
+ return clamped * 100 / lastIndex;
6977
+ }, [step, lastIndex]);
6961
6978
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "kima-progressbar", children: [
6962
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `value step-${step * 100 / 4}` }),
6963
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "step-indicators", children: stepInfo2.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6979
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "value", style: { width: `${pct}%` } }),
6980
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "step-indicators", children: stepInfo.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6964
6981
  "div",
6965
6982
  {
6966
6983
  className: `step ${step === index && "active"}
6967
6984
  ${step >= index ? index === errorStep ? "error" : "completed" : ""}
6968
6985
  ${step < index && "locked"} ${theme.colorMode}`,
6969
6986
  onClick: () => {
6970
- if (index < 4) setFocus(index);
6987
+ if (index < lastIndex) setFocus(index);
6971
6988
  },
6972
6989
  children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "step-info", children: [
6973
6990
  step < index && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Lock_default, {}),
@@ -6975,7 +6992,7 @@ var Progressbar = ({ step, errorStep, setFocus, loadingStep }) => {
6975
6992
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { children: item.title })
6976
6993
  ] })
6977
6994
  },
6978
- item.title
6995
+ `${item.title}-${index}`
6979
6996
  )) })
6980
6997
  ] });
6981
6998
  };
@@ -6988,7 +7005,7 @@ var import_react_redux42 = require("react-redux");
6988
7005
  var import_react_hot_toast2 = require("react-hot-toast");
6989
7006
 
6990
7007
  // src/widgets/transaction/hooks/useTxData.ts
6991
- var import_react51 = require("react");
7008
+ var import_react52 = require("react");
6992
7009
  var import_react_query17 = require("@tanstack/react-query");
6993
7010
 
6994
7011
  // src/services/transactionApi.ts
@@ -7087,7 +7104,7 @@ var getTxData = async ({
7087
7104
  // src/widgets/transaction/hooks/useTxData.ts
7088
7105
  var POLLING_INTERVAL_MS = 1e3 * 10;
7089
7106
  var useTxData = (txId, dAppOption, backendUrl, isSwap) => {
7090
- const refPollForUpdates = (0, import_react51.useRef)(false);
7107
+ const refPollForUpdates = (0, import_react52.useRef)(false);
7091
7108
  const isLP = dAppOption === "LPAdd" /* LPAdd */ || dAppOption === "LPDrain" /* LPDrain */;
7092
7109
  const validTxId = typeof txId === "number" ? txId > 0 : txId.toString().length > 0;
7093
7110
  return (0, import_react_query17.useQuery)({
@@ -7128,7 +7145,7 @@ var TransactionStatusMessage = ({
7128
7145
  var TransactionStatusMessage_default = TransactionStatusMessage;
7129
7146
 
7130
7147
  // src/components/reusable/TransactionSearch.tsx
7131
- var import_react52 = require("react");
7148
+ var import_react53 = require("react");
7132
7149
  var import_react_redux38 = require("react-redux");
7133
7150
  var import_react_redux39 = require("react-redux");
7134
7151
  var import_react_hot_toast = __toESM(require("react-hot-toast"), 1);
@@ -7137,8 +7154,8 @@ var TransactionSearch = () => {
7137
7154
  const theme = (0, import_react_redux38.useSelector)(selectTheme);
7138
7155
  const backendUrl = (0, import_react_redux38.useSelector)(selectBackendUrl);
7139
7156
  const dispatch = (0, import_react_redux39.useDispatch)();
7140
- const [transactionId, setTransactionId] = (0, import_react52.useState)("");
7141
- const refPollForUpdates = (0, import_react52.useRef)(false);
7157
+ const [transactionId, setTransactionId] = (0, import_react53.useState)("");
7158
+ const refPollForUpdates = (0, import_react53.useRef)(false);
7142
7159
  const handleSearch = async () => {
7143
7160
  if (transactionId.length <= 0)
7144
7161
  return import_react_hot_toast.default.error("You must provide a valid transaction id", {
@@ -7186,14 +7203,57 @@ var TransactionSearch_default = TransactionSearch;
7186
7203
 
7187
7204
  // src/widgets/transaction/components/TransactionWidget.tsx
7188
7205
  var import_jsx_runtime76 = require("react/jsx-runtime");
7206
+ var TRANSFER_STEPS = [
7207
+ { title: "Initialize" },
7208
+ { title: "Source Transfer" },
7209
+ { title: "Validation" },
7210
+ { title: "Target Transfer" },
7211
+ { title: "Finalize" }
7212
+ ];
7213
+ var SWAP_STEPS = [
7214
+ { title: "Initialize" },
7215
+ { title: "Source Transfer" },
7216
+ { title: "Swap" },
7217
+ { title: "Target Transfer" },
7218
+ { title: "Finalize" }
7219
+ ];
7220
+ var normalizeStatus = (s) => (s ?? "").toString().trim().toUpperCase().replace(/[\s-]+/g, "_");
7221
+ var compact = (s) => s.replace(/_/g, "");
7222
+ var displaySymbol = (sym) => uiTokenSymbol(sym);
7223
+ var formatTruncMaxDecimals = (value, maxDecimals = 4, maxExtraDecimals = 12) => {
7224
+ const n = Number(value);
7225
+ if (!Number.isFinite(n)) return "";
7226
+ const abs = Math.abs(n);
7227
+ const baseFactor = 10 ** maxDecimals;
7228
+ const baseTrunc = Math.trunc(n * baseFactor) / baseFactor;
7229
+ if (abs === 0 || baseTrunc !== 0) {
7230
+ const fixed2 = baseTrunc.toFixed(maxDecimals);
7231
+ return fixed2.replace(/\.?0+$/, "");
7232
+ }
7233
+ let d = maxDecimals + 1;
7234
+ const maxD = maxDecimals + maxExtraDecimals;
7235
+ while (d <= maxD) {
7236
+ const factor = 10 ** d;
7237
+ const trunc = Math.trunc(n * factor) / factor;
7238
+ if (trunc !== 0) {
7239
+ const fixed2 = trunc.toFixed(d);
7240
+ return fixed2.replace(/\.?0+$/, "");
7241
+ }
7242
+ d += 1;
7243
+ }
7244
+ const capFactor = 10 ** maxD;
7245
+ const capTrunc = Math.trunc(n * capFactor) / capFactor;
7246
+ const fixed = capTrunc.toFixed(maxD);
7247
+ return fixed.replace(/\.?0+$/, "");
7248
+ };
7189
7249
  var TransactionWidget = ({ theme }) => {
7190
- const [step, setStep] = (0, import_react53.useState)(0);
7191
- const [focus, setFocus] = (0, import_react53.useState)(-1);
7192
- const [errorStep, setErrorStep] = (0, import_react53.useState)(-1);
7193
- const [errorMessage, setErrorMessage] = (0, import_react53.useState)("");
7194
- const [loadingStep, setLoadingStep] = (0, import_react53.useState)(-1);
7195
- const [minimized, setMinimized] = (0, import_react53.useState)(false);
7196
- const [isComplete, setIsComplete] = (0, import_react53.useState)(false);
7250
+ const [step, setStep] = (0, import_react54.useState)(0);
7251
+ const [focus, setFocus] = (0, import_react54.useState)(-1);
7252
+ const [errorStep, setErrorStep] = (0, import_react54.useState)(-1);
7253
+ const [errorMessage, setErrorMessage] = (0, import_react54.useState)("");
7254
+ const [loadingStep, setLoadingStep] = (0, import_react54.useState)(-1);
7255
+ const [minimized, setMinimized] = (0, import_react54.useState)(false);
7256
+ const [isComplete, setIsComplete] = (0, import_react54.useState)(false);
7197
7257
  const dispatch = (0, import_react_redux42.useDispatch)();
7198
7258
  const explorerUrl = (0, import_react_redux41.useSelector)(selectKimaExplorer);
7199
7259
  const mode = (0, import_react_redux41.useSelector)(selectMode);
@@ -7220,8 +7280,12 @@ var TransactionWidget = ({ theme }) => {
7220
7280
  );
7221
7281
  const isSwapBy3Letters = three(sourceSymbol) !== three(targetSymbol);
7222
7282
  const widgetIsSwap = mode === "status" /* status */ ? isSwapBy3Letters : isSwapByPegged;
7283
+ const steps = (0, import_react54.useMemo)(
7284
+ () => widgetIsSwap ? SWAP_STEPS : TRANSFER_STEPS,
7285
+ [widgetIsSwap]
7286
+ );
7223
7287
  const { width: windowWidth, updateWidth } = useWidth_default();
7224
- (0, import_react53.useEffect)(() => {
7288
+ (0, import_react54.useEffect)(() => {
7225
7289
  windowWidth === 0 && updateWidth(window.innerWidth);
7226
7290
  }, [windowWidth, updateWidth]);
7227
7291
  const safeTxId = typeof txId === "string" || typeof txId === "number" ? txId : -1;
@@ -7231,80 +7295,93 @@ var TransactionWidget = ({ theme }) => {
7231
7295
  backendUrl,
7232
7296
  widgetIsSwap
7233
7297
  );
7234
- const transactionSourceChain = (0, import_react53.useMemo)(
7298
+ const transactionSourceChain = (0, import_react54.useMemo)(
7235
7299
  () => networks.find(
7236
7300
  (network) => network.shortName === (mode === "status" /* status */ ? data?.sourceChain === "FIAT" ? "CC" : data?.sourceChain : sourceChain.shortName)
7237
7301
  ),
7238
7302
  [data, mode, sourceChain, networks]
7239
7303
  );
7240
- const transactionTargetChain = (0, import_react53.useMemo)(
7304
+ const transactionTargetChain = (0, import_react54.useMemo)(
7241
7305
  () => networks.find(
7242
7306
  (network) => network.shortName === (mode === "status" /* status */ ? data?.targetChain : targetChain.shortName)
7243
7307
  ),
7244
7308
  [data, mode, targetChain, networks]
7245
7309
  );
7246
- const isValidTxId = (0, import_react53.useMemo)(() => {
7310
+ const isValidTxId = (0, import_react54.useMemo)(() => {
7247
7311
  return !(safeTxId === -1 || typeof safeTxId === "string" && safeTxId.length === 0);
7248
7312
  }, [safeTxId]);
7249
- const isEmptyStatus = (0, import_react53.useMemo)(() => {
7313
+ const isEmptyStatus = (0, import_react54.useMemo)(() => {
7250
7314
  if (!data) return true;
7251
7315
  return data?.amount === "";
7252
7316
  }, [data]);
7253
7317
  const showFetchingTitle = isValidTxId && isEmptyStatus;
7254
- (0, import_react53.useEffect)(() => {
7318
+ (0, import_react54.useEffect)(() => {
7255
7319
  if (!data || data.status !== "Completed" /* COMPLETED */) return;
7256
7320
  successHandler && successHandler({
7257
7321
  txId: safeTxId
7258
7322
  });
7259
7323
  }, [data, successHandler, safeTxId]);
7260
- (0, import_react53.useEffect)(() => {
7324
+ (0, import_react54.useEffect)(() => {
7261
7325
  if (!data) return;
7262
7326
  if (data.status === "Completed" /* COMPLETED */) {
7263
7327
  setIsComplete(true);
7264
7328
  }
7265
7329
  }, [data]);
7266
- (0, import_react53.useEffect)(() => {
7330
+ (0, import_react54.useEffect)(() => {
7267
7331
  if (error)
7268
7332
  import_react_hot_toast2.toast.error(
7269
7333
  "The provided transaction id is not valid, please use a different one or contact support for further assistance",
7270
7334
  { icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Error_default, {}) }
7271
7335
  );
7272
7336
  }, [error]);
7273
- (0, import_react53.useEffect)(() => {
7274
- const norm = (s2) => (s2 ?? "").toString().trim().toUpperCase().replace(/[\s_]/g, "");
7275
- const s = norm(data?.status);
7276
- if (!data || !s) {
7337
+ (0, import_react54.useEffect)(() => {
7338
+ const raw = normalizeStatus(data?.status);
7339
+ const s = compact(raw);
7340
+ const is = (candidate) => {
7341
+ const cRaw = normalizeStatus(candidate);
7342
+ return raw === cRaw || s === compact(cRaw);
7343
+ };
7344
+ if (!data || !raw) {
7277
7345
  setStep(0);
7278
7346
  setLoadingStep(0);
7279
7347
  return;
7280
7348
  }
7281
- logger_default.debug("tx status (normalized):", s, data?.failReason, errorMessage);
7349
+ logger_default.debug("[TransactionWidget] status", { raw, widgetIsSwap, errorMessage });
7282
7350
  setErrorStep(-1);
7283
- if (s === "AVAILABLE" || s === "PULLED") {
7284
- setStep(1);
7285
- setLoadingStep(1);
7286
- return;
7287
- }
7288
- if (s === "CONFIRMED") {
7289
- setStep(2);
7290
- setLoadingStep(2);
7351
+ if (is("DECLINED_INVALID") || is("DECLINEDINVALID")) {
7352
+ setStep(0);
7353
+ setErrorStep(0);
7354
+ setLoadingStep(-1);
7355
+ import_react_hot_toast2.toast.error("Invalid signature!");
7291
7356
  return;
7292
7357
  }
7293
- if (s.startsWith("UNAVAILABLE")) {
7358
+ if (raw.startsWith("UNAVAILABLE")) {
7294
7359
  setStep(1);
7295
7360
  setErrorStep(1);
7296
7361
  setLoadingStep(-1);
7297
- logger_default.error("transaction failed:", data?.failReason);
7298
7362
  import_react_hot_toast2.toast.error("Unavailable", { icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Error_default, {}) });
7299
7363
  setErrorMessage("Unavailable");
7300
7364
  return;
7301
7365
  }
7302
- if (s === "PAID") {
7366
+ if (is("FAILED_TO_PULL") || is("FAILEDTOPULL")) {
7367
+ setStep(1);
7368
+ setErrorStep(1);
7369
+ setLoadingStep(-1);
7370
+ import_react_hot_toast2.toast.error("Failed to pull tokens from source!", { icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Error_default, {}) });
7371
+ setErrorMessage("Failed to pull tokens from source!");
7372
+ return;
7373
+ }
7374
+ if (is("FAILED_TO_PAY") || is("FAILEDTOPAY")) {
7303
7375
  setStep(3);
7304
- setLoadingStep(3);
7376
+ setErrorStep(3);
7377
+ setLoadingStep(-1);
7378
+ import_react_hot_toast2.toast.error("Failed to release tokens to target!", {
7379
+ icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Error_default, {})
7380
+ });
7381
+ setErrorMessage("Failed to release tokens to target!");
7305
7382
  return;
7306
7383
  }
7307
- if (s === "REFUNDSTART" || s === "REFUNDSTARTED") {
7384
+ if (is("REFUND_START") || is("REFUND_STARTED") || is("REFUNDSTART") || is("REFUNDSTARTED")) {
7308
7385
  setStep(3);
7309
7386
  setLoadingStep(3);
7310
7387
  import_react_hot_toast2.toast.error(
@@ -7316,7 +7393,7 @@ var TransactionWidget = ({ theme }) => {
7316
7393
  );
7317
7394
  return;
7318
7395
  }
7319
- if (s === "REFUNDFAILED") {
7396
+ if (is("REFUND_FAILED") || is("REFUNDFAILED")) {
7320
7397
  setStep(3);
7321
7398
  setErrorStep(3);
7322
7399
  setLoadingStep(-1);
@@ -7324,7 +7401,7 @@ var TransactionWidget = ({ theme }) => {
7324
7401
  setErrorMessage("Failed to refund tokens to source!");
7325
7402
  return;
7326
7403
  }
7327
- if (s === "REFUNDCOMPLETED") {
7404
+ if (is("REFUND_COMPLETED") || is("REFUNDCOMPLETED")) {
7328
7405
  setStep(4);
7329
7406
  setErrorStep(3);
7330
7407
  setLoadingStep(-1);
@@ -7332,48 +7409,60 @@ var TransactionWidget = ({ theme }) => {
7332
7409
  setErrorMessage("Refund completed!");
7333
7410
  return;
7334
7411
  }
7335
- if (s === "FAILEDTOPAY") {
7336
- setStep(3);
7337
- setErrorStep(3);
7338
- setLoadingStep(-1);
7339
- logger_default.error("transaction failed:", data?.failReason);
7340
- import_react_hot_toast2.toast.error("Failed to release tokens to target!", {
7341
- icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Error_default, {})
7342
- });
7343
- setErrorMessage("Failed to release tokens to target!");
7412
+ if (widgetIsSwap) {
7413
+ if (is("AVAILABLE") || is("PULLED") || is("PULL_CONFIRMED") || is("CONFIRMED")) {
7414
+ setStep(1);
7415
+ setLoadingStep(1);
7416
+ return;
7417
+ }
7418
+ if (is("SWAP_APPROVED") || is("SWAP_APPROVE_CONFIRMED") || is("SWAPPED") || is("SWAP_CONFIRMED")) {
7419
+ setStep(2);
7420
+ setLoadingStep(2);
7421
+ return;
7422
+ }
7423
+ if (is("PAID")) {
7424
+ setStep(3);
7425
+ setLoadingStep(3);
7426
+ return;
7427
+ }
7428
+ if (is("COMPLETED")) {
7429
+ setStep(4);
7430
+ setLoadingStep(-1);
7431
+ return;
7432
+ }
7433
+ setStep((prev) => Math.max(prev, 1));
7434
+ setLoadingStep((prev) => Math.max(prev, 1));
7344
7435
  return;
7345
7436
  }
7346
- if (s === "FAILEDTOPULL") {
7437
+ if (is("AVAILABLE") || is("PULLED")) {
7347
7438
  setStep(1);
7348
- setErrorStep(1);
7349
- setLoadingStep(-1);
7350
- logger_default.error("transaction failed:", data?.failReason);
7351
- import_react_hot_toast2.toast.error("Failed to pull tokens from source!", { icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Error_default, {}) });
7352
- setErrorMessage("Failed to pull tokens from source!");
7439
+ setLoadingStep(1);
7353
7440
  return;
7354
7441
  }
7355
- if (s === "COMPLETED") {
7356
- setStep(4);
7357
- setLoadingStep(-1);
7442
+ if (is("CONFIRMED")) {
7443
+ setStep(2);
7444
+ setLoadingStep(2);
7358
7445
  return;
7359
7446
  }
7360
- if (s === "DECLINEDINVALID") {
7361
- setStep(0);
7362
- setErrorStep(0);
7447
+ if (is("PAID")) {
7448
+ setStep(3);
7449
+ setLoadingStep(3);
7450
+ return;
7451
+ }
7452
+ if (is("COMPLETED")) {
7453
+ setStep(4);
7363
7454
  setLoadingStep(-1);
7364
- import_react_hot_toast2.toast.error("Invalid signature!");
7365
7455
  return;
7366
7456
  }
7367
- }, [data?.status]);
7368
- const fmt3 = (v) => formatterFloat.format(Number(Number(v ?? 0).toFixed(3)));
7369
- const verb = (0, import_react53.useMemo)(() => {
7457
+ }, [data?.status, widgetIsSwap, errorMessage]);
7458
+ const verb = (0, import_react54.useMemo)(() => {
7370
7459
  if (mode === "status" /* status */) {
7371
7460
  if (isEmptyStatus) return "Fetching transaction status ";
7372
7461
  return data?.status?.toUpperCase?.() === "Completed" /* COMPLETED */ ? widgetIsSwap ? "Swapped " : "Transferred " : widgetIsSwap ? "Swapping " : "Transfering ";
7373
7462
  }
7374
7463
  return data?.status?.toUpperCase?.() === "Completed" /* COMPLETED */ ? widgetIsSwap ? "Swapped " : "Transferred " : widgetIsSwap ? "Swapping " : "Transfering ";
7375
7464
  }, [mode, data?.status, isEmptyStatus, widgetIsSwap]);
7376
- const originChargeAmount = (0, import_react53.useMemo)(() => {
7465
+ const originChargeAmount = (0, import_react54.useMemo)(() => {
7377
7466
  const submit = txValues.submitAmount;
7378
7467
  const feeInSubmitDec = bigIntChangeDecimals({
7379
7468
  ...totalFee,
@@ -7382,37 +7471,39 @@ var TransactionWidget = ({ theme }) => {
7382
7471
  const val = feeDeduct ? submit.value : submit.value + feeInSubmitDec.value;
7383
7472
  return { value: val, decimals: submit.decimals };
7384
7473
  }, [txValues.submitAmount, totalFee, feeDeduct]);
7385
- const { leftAmt, rightAmt, leftSym, rightSym } = (0, import_react53.useMemo)(() => {
7474
+ const { leftAmt, rightAmt, leftSym, rightSym } = (0, import_react54.useMemo)(() => {
7386
7475
  if (mode === "status" /* status */) {
7387
7476
  if (widgetIsSwap) {
7388
7477
  const amountIn = data?.amountIn;
7389
7478
  const amountOut = data?.amount ?? "";
7479
+ const left2 = amountIn != null ? amountIn : amountOut !== "" ? amountOut : "";
7480
+ const right2 = amountOut !== "" ? amountOut : "";
7390
7481
  return {
7391
- leftAmt: amountIn != null ? fmt3(amountIn) : amountOut !== "" ? fmt3(amountOut) : "",
7392
- rightAmt: amountOut !== "" ? fmt3(amountOut) : "",
7393
- leftSym: data?.sourceSymbol ?? "",
7394
- rightSym: data?.targetSymbol ?? ""
7482
+ leftAmt: left2 !== "" ? formatTruncMaxDecimals(left2, 4) : "",
7483
+ rightAmt: right2 !== "" ? formatTruncMaxDecimals(right2, 4) : "",
7484
+ leftSym: displaySymbol(data?.sourceSymbol ?? ""),
7485
+ rightSym: displaySymbol(data?.targetSymbol ?? "")
7395
7486
  };
7396
7487
  }
7397
7488
  const amt = data?.amount ?? "";
7398
7489
  return {
7399
7490
  leftAmt: amt,
7400
7491
  rightAmt: amt,
7401
- leftSym: data?.sourceSymbol ?? "",
7402
- rightSym: data?.targetSymbol ?? ""
7492
+ leftSym: displaySymbol(data?.sourceSymbol ?? ""),
7493
+ rightSym: displaySymbol(data?.targetSymbol ?? "")
7403
7494
  };
7404
7495
  }
7405
7496
  const isFiatSrc = (transactionSourceChain?.shortName ?? "") === "CC" || (transactionSourceChain?.shortName ?? "") === "BANK";
7406
7497
  let left = Number(amount) !== 0 ? isFiatSrc ? bigIntToNumber(originChargeAmount).toFixed(2) : formatBigInt(txValues.allowanceAmount) : "";
7407
7498
  let right = Number(amount) !== 0 ? isFiatSrc ? bigIntToNumber(txValues.submitAmount).toFixed(2) : formatBigInt(txValues.submitAmount) : "";
7408
- let leftSymbol = sourceSymbol;
7409
- let rightSymbol = targetSymbol;
7499
+ let leftSymbol = displaySymbol(sourceSymbol);
7500
+ let rightSymbol = displaySymbol(targetSymbol);
7410
7501
  if (widgetIsSwap && data && data?.amount != null && data?.amount !== "") {
7411
- right = fmt3(data.amount);
7412
- rightSymbol = data?.targetSymbol ?? rightSymbol;
7502
+ right = formatTruncMaxDecimals(data.amount, 4);
7503
+ rightSymbol = displaySymbol(data?.targetSymbol ?? rightSymbol);
7413
7504
  if (data?.amountIn != null) {
7414
- left = fmt3(data.amountIn);
7415
- leftSymbol = data?.sourceSymbol ?? leftSymbol;
7505
+ left = formatTruncMaxDecimals(data.amountIn, 4);
7506
+ leftSymbol = displaySymbol(data?.sourceSymbol ?? leftSymbol);
7416
7507
  }
7417
7508
  }
7418
7509
  return {
@@ -7471,7 +7562,7 @@ var TransactionWidget = ({ theme }) => {
7471
7562
  dispatch(setTxId(-1));
7472
7563
  dispatch(setSubmitted(false));
7473
7564
  } catch (e) {
7474
- logger_default.error("[TransactionWidget] reset failed", e);
7565
+ logger_default.debug("[TransactionWidget] reset failed", e);
7475
7566
  import_react_hot_toast2.toast.error(
7476
7567
  "Unable to reset the transaction view. Please contact support for assistance.",
7477
7568
  { icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Error_default, {}) }
@@ -7480,6 +7571,10 @@ var TransactionWidget = ({ theme }) => {
7480
7571
  };
7481
7572
  const swapSrcAmt = data?.amountIn ?? amount;
7482
7573
  const swapDstAmt = data?.amount;
7574
+ const swapSrcAmtLabel = formatTruncMaxDecimals(swapSrcAmt, 4);
7575
+ const swapDstAmtLabel = formatTruncMaxDecimals(swapDstAmt, 4);
7576
+ const swapSrcSymLabel = displaySymbol(data?.sourceSymbol ?? sourceSymbol);
7577
+ const swapDstSymLabel = displaySymbol(data?.targetSymbol ?? targetSymbol);
7483
7578
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react_redux40.Provider, { store: store_default, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
7484
7579
  "div",
7485
7580
  {
@@ -7575,7 +7670,8 @@ var TransactionWidget = ({ theme }) => {
7575
7670
  focus,
7576
7671
  errorStep,
7577
7672
  setFocus,
7578
- loadingStep
7673
+ loadingStep,
7674
+ steps
7579
7675
  }
7580
7676
  ),
7581
7677
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
@@ -7584,7 +7680,8 @@ var TransactionWidget = ({ theme }) => {
7584
7680
  step,
7585
7681
  errorStep,
7586
7682
  loadingStep,
7587
- data
7683
+ data,
7684
+ steps
7588
7685
  }
7589
7686
  )
7590
7687
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "transaction-content transaction-complete", children: [
@@ -7597,18 +7694,19 @@ var TransactionWidget = ({ theme }) => {
7597
7694
  children: [
7598
7695
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("p", { children: widgetIsSwap ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7599
7696
  "You just swapped ",
7600
- fmt3(swapSrcAmt),
7697
+ swapSrcAmtLabel,
7698
+ " ",
7699
+ swapSrcSymLabel,
7601
7700
  " ",
7602
- data?.sourceSymbol,
7603
- " for ",
7604
- fmt3(swapDstAmt),
7701
+ "for ",
7702
+ swapDstAmtLabel,
7605
7703
  " ",
7606
- data?.targetSymbol
7704
+ swapDstSymLabel
7607
7705
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7608
7706
  "You just transferred ",
7609
7707
  data?.amount,
7610
7708
  " ",
7611
- data?.sourceSymbol
7709
+ displaySymbol(data?.sourceSymbol)
7612
7710
  ] }) }),
7613
7711
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "header-network-labels", children: [
7614
7712
  /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
@@ -8035,7 +8133,7 @@ var useSubmitTransaction = (isSubmitting, setIsSubmitting) => {
8035
8133
  var useSubmitTransaction_default = useSubmitTransaction;
8036
8134
 
8037
8135
  // src/widgets/transfer/hooks/useValidateTransaction.tsx
8038
- var import_react54 = require("react");
8136
+ var import_react55 = require("react");
8039
8137
  var import_viem7 = require("viem");
8040
8138
  var import_react_redux45 = require("react-redux");
8041
8139
  var useValidateTransaction = (inputs) => {
@@ -8066,11 +8164,11 @@ var useValidateTransaction = (inputs) => {
8066
8164
  const tgtNet = (0, import_react_redux45.useSelector)(selectTargetChain);
8067
8165
  const srcCur = (0, import_react_redux45.useSelector)(selectSourceCurrency);
8068
8166
  const tgtCur = (0, import_react_redux45.useSelector)(selectTargetCurrency);
8069
- const isSwap = (0, import_react54.useMemo)(
8167
+ const isSwap = (0, import_react55.useMemo)(
8070
8168
  () => !isSamePeggedToken(srcNet, srcCur, tgtNet, tgtCur),
8071
8169
  [srcNet, srcCur, tgtNet, tgtCur]
8072
8170
  );
8073
- const maxValue = (0, import_react54.useMemo)(() => {
8171
+ const maxValue = (0, import_react55.useMemo)(() => {
8074
8172
  logger_default.debug("useValidateTransaction: maxValue: ", inputs);
8075
8173
  if (!balance) return 0n;
8076
8174
  if (totalFee <= 0n) return balance;
@@ -8185,8 +8283,8 @@ var useValidateTransaction = (inputs) => {
8185
8283
  var useValidateTransaction_default = useValidateTransaction;
8186
8284
 
8187
8285
  // src/widgets/transfer/components/TransferWidget.tsx
8188
- var import_react64 = require("react");
8189
- var import_react_hot_toast4 = __toESM(require("react-hot-toast"), 1);
8286
+ var import_react66 = require("react");
8287
+ var import_react_hot_toast10 = __toESM(require("react-hot-toast"), 1);
8190
8288
  var import_react_redux56 = require("react-redux");
8191
8289
  var import_viem9 = require("viem");
8192
8290
 
@@ -8226,12 +8324,12 @@ var WarningModal_default = WarningModal;
8226
8324
 
8227
8325
  // src/components/reusable/SingleForm.tsx
8228
8326
  var import_viem8 = require("viem");
8229
- var import_react56 = require("react");
8327
+ var import_react57 = require("react");
8230
8328
  var import_react_hot_toast3 = require("react-hot-toast");
8231
8329
  var import_react_redux47 = require("react-redux");
8232
8330
 
8233
8331
  // src/components/primary/NetworkSelector.tsx
8234
- var import_react55 = __toESM(require("react"), 1);
8332
+ var import_react56 = __toESM(require("react"), 1);
8235
8333
  var import_react_redux46 = require("react-redux");
8236
8334
  var import_jsx_runtime78 = require("react/jsx-runtime");
8237
8335
  var NetworkSelector = ({
@@ -8239,8 +8337,8 @@ var NetworkSelector = ({
8239
8337
  initialSelection,
8240
8338
  setInitialSelection
8241
8339
  }) => {
8242
- const [collapsed, setCollapsed] = (0, import_react55.useState)(true);
8243
- const ref = (0, import_react55.useRef)(null);
8340
+ const [collapsed, setCollapsed] = (0, import_react56.useState)(true);
8341
+ const ref = (0, import_react56.useRef)(null);
8244
8342
  const dispatch = (0, import_react_redux46.useDispatch)();
8245
8343
  const theme = (0, import_react_redux46.useSelector)(selectTheme);
8246
8344
  const networkOptions = (0, import_react_redux46.useSelector)(selectNetworks);
@@ -8254,7 +8352,7 @@ var NetworkSelector = ({
8254
8352
  const currentTargetAddr = (0, import_react_redux46.useSelector)(selectTargetAddress);
8255
8353
  const { switchChainHandler } = useKimaContext();
8256
8354
  const isOriginSelector = type === "origin";
8257
- (0, import_react55.useEffect)(() => {
8355
+ (0, import_react56.useEffect)(() => {
8258
8356
  logger_default.info("[NetworkSelector] mount", {
8259
8357
  type,
8260
8358
  mode,
@@ -8263,7 +8361,7 @@ var NetworkSelector = ({
8263
8361
  targetShort: targetNetwork?.shortName
8264
8362
  });
8265
8363
  }, []);
8266
- const networks = (0, import_react55.useMemo)(() => {
8364
+ const networks = (0, import_react56.useMemo)(() => {
8267
8365
  const result = networkOptions.filter((network) => {
8268
8366
  if (dAppOption !== "none" /* None */ && network.shortName === "CC")
8269
8367
  return false;
@@ -8288,7 +8386,7 @@ var NetworkSelector = ({
8288
8386
  isOriginSelector
8289
8387
  ]);
8290
8388
  const shouldLockSourceNetwork = isOriginSelector && mode === "payment" /* payment */ && dAppOption !== "none" /* None */ && !!transactionOption?.targetChain;
8291
- const selectedNetwork = (0, import_react55.useMemo)(() => {
8389
+ const selectedNetwork = (0, import_react56.useMemo)(() => {
8292
8390
  if (shouldLockSourceNetwork) {
8293
8391
  const forced = networks.find(
8294
8392
  (n) => n.shortName === transactionOption.targetChain
@@ -8327,8 +8425,8 @@ var NetworkSelector = ({
8327
8425
  shouldLockSourceNetwork,
8328
8426
  transactionOption?.targetChain
8329
8427
  ]);
8330
- const lastForcedShort = (0, import_react55.useRef)();
8331
- (0, import_react55.useEffect)(() => {
8428
+ const lastForcedShort = (0, import_react56.useRef)();
8429
+ (0, import_react56.useEffect)(() => {
8332
8430
  if (!shouldLockSourceNetwork || !isOriginSelector || !transactionOption?.targetChain)
8333
8431
  return;
8334
8432
  const forcedNetwork = networks.find(
@@ -8443,7 +8541,7 @@ var NetworkSelector = ({
8443
8541
  }
8444
8542
  setCollapsed(true);
8445
8543
  };
8446
- (0, import_react55.useEffect)(() => {
8544
+ (0, import_react56.useEffect)(() => {
8447
8545
  const handleOutsideClick = (e) => {
8448
8546
  if (ref.current && !ref.current.contains(e.target)) {
8449
8547
  setCollapsed(true);
@@ -8452,7 +8550,7 @@ var NetworkSelector = ({
8452
8550
  document.addEventListener("mousedown", handleOutsideClick);
8453
8551
  return () => document.removeEventListener("mousedown", handleOutsideClick);
8454
8552
  }, []);
8455
- (0, import_react55.useEffect)(() => {
8553
+ (0, import_react56.useEffect)(() => {
8456
8554
  if (mode !== "light" /* light */) return;
8457
8555
  let srcDemo = "";
8458
8556
  if (isEVMChain(sourceNetwork.shortName)) srcDemo = lightDemoAccounts.EVM;
@@ -8524,7 +8622,7 @@ var NetworkSelector = ({
8524
8622
  }
8525
8623
  );
8526
8624
  };
8527
- var NetworkSelector_default = import_react55.default.memo(NetworkSelector);
8625
+ var NetworkSelector_default = import_react56.default.memo(NetworkSelector);
8528
8626
 
8529
8627
  // src/components/reusable/SingleForm.tsx
8530
8628
  var import_jsx_runtime79 = require("react/jsx-runtime");
@@ -8546,7 +8644,7 @@ var SingleForm = ({
8546
8644
  const targetNetwork = (0, import_react_redux47.useSelector)(selectTargetChain);
8547
8645
  const targetAddress = (0, import_react_redux47.useSelector)(selectTargetAddress);
8548
8646
  const { isReady } = useIsWalletReady_default();
8549
- const [amountValue, setAmountValue] = (0, import_react56.useState)("");
8647
+ const [amountValue, setAmountValue] = (0, import_react57.useState)("");
8550
8648
  const amount = (0, import_react_redux47.useSelector)(selectAmount);
8551
8649
  const sourceCurrency = (0, import_react_redux47.useSelector)(selectSourceCurrency);
8552
8650
  const targetCurrency = (0, import_react_redux47.useSelector)(selectTargetCurrency);
@@ -8554,11 +8652,11 @@ var SingleForm = ({
8554
8652
  const { balance, decimals } = useBalance_default();
8555
8653
  const { kimaBackendUrl } = useKimaContext();
8556
8654
  const { data: envOptions } = useGetEnvOptions({ kimaBackendUrl });
8557
- const errorMessage = (0, import_react56.useMemo)(
8655
+ const errorMessage = (0, import_react57.useMemo)(
8558
8656
  () => compliantOption && targetCompliant !== null && !targetCompliant?.isCompliant ? `Target address has ${targetCompliant.results?.[0].result.risk_score} risk` : "",
8559
8657
  [compliantOption, targetCompliant]
8560
8658
  );
8561
- const maxValue = (0, import_react56.useMemo)(() => {
8659
+ const maxValue = (0, import_react57.useMemo)(() => {
8562
8660
  if (mode === "light" /* light */) {
8563
8661
  const limit = envOptions?.transferLimitMaxUSDT ? parseFloat(envOptions.transferLimitMaxUSDT) : 1e3;
8564
8662
  return BigInt(limit);
@@ -8568,13 +8666,13 @@ var SingleForm = ({
8568
8666
  const intAmount = (0, import_viem8.parseUnits)(amount || "0", totalFee.decimals);
8569
8667
  return balance - intAmount;
8570
8668
  }, [mode, envOptions?.transferLimitMaxUSDT, balance, totalFee, amount]);
8571
- const feeCurrency = (0, import_react56.useMemo)(() => {
8669
+ const feeCurrency = (0, import_react57.useMemo)(() => {
8572
8670
  const srcToken = sourceNetwork.supportedTokens.find(
8573
8671
  (t) => t.symbol === sourceCurrency
8574
8672
  );
8575
8673
  return srcToken?.peggedTo ?? "USD";
8576
8674
  }, [sourceNetwork, sourceCurrency]);
8577
- const canQuoteFees = (0, import_react56.useMemo)(() => {
8675
+ const canQuoteFees = (0, import_react57.useMemo)(() => {
8578
8676
  const haveBasics = !!backendUrl && !!amount && !!sourceNetwork?.shortName && !!sourceCurrency && !!targetNetwork?.shortName && !!targetCurrency;
8579
8677
  if (!haveBasics) return false;
8580
8678
  const requiresSourceAddress = !["BANK", "CC"].includes(
@@ -8593,11 +8691,11 @@ var SingleForm = ({
8593
8691
  sourceAddress,
8594
8692
  targetAddress
8595
8693
  ]);
8596
- (0, import_react56.useEffect)(() => {
8694
+ (0, import_react57.useEffect)(() => {
8597
8695
  if (!errorMessage) return;
8598
8696
  import_react_hot_toast3.toast.error(errorMessage);
8599
8697
  }, [errorMessage]);
8600
- (0, import_react56.useEffect)(() => {
8698
+ (0, import_react57.useEffect)(() => {
8601
8699
  if (amountValue && amount !== "") return;
8602
8700
  setAmountValue(amount);
8603
8701
  }, [amount, amountValue]);
@@ -8636,7 +8734,7 @@ var SingleForm = ({
8636
8734
  );
8637
8735
  }
8638
8736
  };
8639
- const demoSourceAddress = (0, import_react56.useMemo)(() => {
8737
+ const demoSourceAddress = (0, import_react57.useMemo)(() => {
8640
8738
  if (mode !== "light" /* light */) return "";
8641
8739
  const short = sourceNetwork?.shortName;
8642
8740
  if (!short) return "";
@@ -8645,7 +8743,7 @@ var SingleForm = ({
8645
8743
  if (lightDemoNetworks.includes(short)) return lightDemoAccounts.EVM;
8646
8744
  return "";
8647
8745
  }, [mode, sourceNetwork?.shortName]);
8648
- const isConnectedSourceWrapper = (0, import_react56.useMemo)(() => {
8746
+ const isConnectedSourceWrapper = (0, import_react57.useMemo)(() => {
8649
8747
  if (mode === "light" /* light */) {
8650
8748
  const on2 = !!demoSourceAddress;
8651
8749
  logger_default.debug("[SingleForm] source wrapper connected (LIGHT)?", {
@@ -8678,7 +8776,7 @@ var SingleForm = ({
8678
8776
  demoSourceAddress,
8679
8777
  sourceNetwork?.shortName
8680
8778
  ]);
8681
- const isConnectedTargetWrapper = (0, import_react56.useMemo)(() => {
8779
+ const isConnectedTargetWrapper = (0, import_react57.useMemo)(() => {
8682
8780
  if (mode !== "light" /* light */) return false;
8683
8781
  const on = !!targetAddress;
8684
8782
  logger_default.debug("[SingleForm] target wrapper connected (LIGHT)?", {
@@ -8688,13 +8786,13 @@ var SingleForm = ({
8688
8786
  });
8689
8787
  return on;
8690
8788
  }, [mode, targetAddress, targetNetwork?.shortName]);
8691
- const isConnected = (0, import_react56.useMemo)(() => {
8789
+ const isConnected = (0, import_react57.useMemo)(() => {
8692
8790
  if (mode === "payment" /* payment */ && dAppOption !== "none" /* None */) {
8693
8791
  return isReady;
8694
8792
  }
8695
8793
  return isReady && !initialSelection.sourceSelection;
8696
8794
  }, [isReady, initialSelection, mode, dAppOption]);
8697
- (0, import_react56.useEffect)(() => {
8795
+ (0, import_react57.useEffect)(() => {
8698
8796
  logger_default.debug("[SingleForm] snapshot", {
8699
8797
  mode,
8700
8798
  srcShort: sourceNetwork?.shortName,
@@ -8842,7 +8940,7 @@ var SingleForm = ({
8842
8940
  var SingleForm_default = SingleForm;
8843
8941
 
8844
8942
  // src/components/reusable/FiatWidget.tsx
8845
- var import_react57 = require("react");
8943
+ var import_react58 = require("react");
8846
8944
  var import_react_redux48 = require("react-redux");
8847
8945
  var import_uuid = require("uuid");
8848
8946
 
@@ -8880,8 +8978,8 @@ var FiatWidget = ({ submitCallback }) => {
8880
8978
  const sourceCurrency = (0, import_react_redux48.useSelector)(selectSourceCurrency);
8881
8979
  const sourceChain = (0, import_react_redux48.useSelector)(selectSourceChain);
8882
8980
  const { transactionValues } = (0, import_react_redux48.useSelector)(selectServiceFee);
8883
- const ccTransactionIdSeedRef = (0, import_react57.useRef)((0, import_uuid.v4)());
8884
- const ccTransactionSubmittedRef = (0, import_react57.useRef)(false);
8981
+ const ccTransactionIdSeedRef = (0, import_react58.useRef)((0, import_uuid.v4)());
8982
+ const ccTransactionSubmittedRef = (0, import_react58.useRef)(false);
8885
8983
  const { data: envOptions, isLoading: isEnvLoading } = useGetEnvOptions({
8886
8984
  kimaBackendUrl: backendUrl
8887
8985
  });
@@ -8891,25 +8989,25 @@ var FiatWidget = ({ submitCallback }) => {
8891
8989
  isLoading: isTransactionIdLoading,
8892
8990
  error
8893
8991
  } = useCCTransactionId(backendUrl, ccTransactionIdSeedRef.current);
8894
- (0, import_react57.useEffect)(() => {
8992
+ (0, import_react58.useEffect)(() => {
8895
8993
  dispatch(setCCTransactionIdSeed(ccTransactionIdSeedRef.current));
8896
8994
  dispatch(setCCTransactionId(data?.transactionId));
8897
8995
  }, [dispatch, data, isTransactionIdLoading]);
8898
8996
  const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
8899
- const allowanceAmount = (0, import_react57.useMemo)(
8997
+ const allowanceAmount = (0, import_react58.useMemo)(
8900
8998
  () => formatBigInt(txValues.allowanceAmount),
8901
8999
  [txValues]
8902
9000
  );
8903
- const [isLoading, setIsLoading] = (0, import_react57.useState)(true);
8904
- const baseUrl = (0, import_react57.useMemo)(
9001
+ const [isLoading, setIsLoading] = (0, import_react58.useState)(true);
9002
+ const baseUrl = (0, import_react58.useMemo)(
8905
9003
  () => `https://widget2${networkOption === "testnet" /* testnet */ ? "-sandbox" : ""}.depa.wtf`,
8906
9004
  [networkOption]
8907
9005
  );
8908
- const scenario = (0, import_react57.useMemo)(
9006
+ const scenario = (0, import_react58.useMemo)(
8909
9007
  () => sourceChain.shortName === "CC" ? "direct_card_payment" : "direct_bank_payment",
8910
9008
  [sourceChain]
8911
9009
  );
8912
- (0, import_react57.useEffect)(() => {
9010
+ (0, import_react58.useEffect)(() => {
8913
9011
  const handleMessage = (event) => {
8914
9012
  if (event.origin !== baseUrl) {
8915
9013
  return;
@@ -8938,7 +9036,7 @@ var FiatWidget = ({ submitCallback }) => {
8938
9036
  window.addEventListener("message", handleMessage);
8939
9037
  return () => window.removeEventListener("message", handleMessage);
8940
9038
  }, []);
8941
- (0, import_react57.useEffect)(() => {
9039
+ (0, import_react58.useEffect)(() => {
8942
9040
  if (error) dispatch(setCCTransactionStatus("error-id"));
8943
9041
  }, [dispatch, error]);
8944
9042
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `cc-widget ${isLoading ? "loading" : ""}`, children: [
@@ -9038,23 +9136,79 @@ var useDisconnectWallet6 = () => {
9038
9136
  var useDisconnectWallet_default = useDisconnectWallet6;
9039
9137
 
9040
9138
  // src/widgets/transfer/components/solana/SolanaConnectModal.tsx
9041
- var import_react60 = __toESM(require("react"), 1);
9139
+ var import_react62 = __toESM(require("react"), 1);
9042
9140
  var import_react_redux52 = require("react-redux");
9043
9141
  var import_wallet_adapter_react8 = require("@solana/wallet-adapter-react");
9142
+ var import_react_hot_toast6 = __toESM(require("react-hot-toast"), 1);
9143
+
9144
+ // src/shared/lib/wallet.ts
9145
+ var isUserRejected = (err) => {
9146
+ if (!err) return false;
9147
+ if (err._kimaUserRejected) return true;
9148
+ if (err.code === 4001) return true;
9149
+ const msg = String(err?.message ?? err);
9150
+ return /UserRejected|denied|canceled|cancelled/i.test(msg);
9151
+ };
9044
9152
 
9045
9153
  // src/widgets/transfer/components/solana/SolanaWalletSelect.tsx
9046
- var import_react58 = require("react");
9154
+ var import_react60 = require("react");
9047
9155
  var import_react_redux49 = require("react-redux");
9048
9156
  var import_wallet_adapter_react6 = require("@solana/wallet-adapter-react");
9049
9157
  var import_wallet_adapter_base = require("@solana/wallet-adapter-base");
9158
+
9159
+ // src/shared/lib/hooks/useHorizontalDragScroll.ts
9160
+ var import_react59 = require("react");
9161
+ var useHorizontalDragScroll = (ref) => {
9162
+ (0, import_react59.useEffect)(() => {
9163
+ const el = ref.current;
9164
+ if (!el) return;
9165
+ let isDown = false;
9166
+ let startX = 0;
9167
+ let scrollLeft = 0;
9168
+ const onMouseDown = (e) => {
9169
+ isDown = true;
9170
+ el.classList.add("active");
9171
+ startX = e.pageX - el.offsetLeft;
9172
+ scrollLeft = el.scrollLeft;
9173
+ };
9174
+ const onMouseLeave = () => {
9175
+ isDown = false;
9176
+ el.classList.remove("active");
9177
+ };
9178
+ const onMouseUp = () => {
9179
+ isDown = false;
9180
+ el.classList.remove("active");
9181
+ };
9182
+ const onMouseMove = (e) => {
9183
+ if (!isDown) return;
9184
+ e.preventDefault();
9185
+ const x = e.pageX - el.offsetLeft;
9186
+ const walk = (x - startX) * 1;
9187
+ el.scrollLeft = scrollLeft - walk;
9188
+ };
9189
+ el.addEventListener("mousedown", onMouseDown);
9190
+ el.addEventListener("mouseleave", onMouseLeave);
9191
+ el.addEventListener("mouseup", onMouseUp);
9192
+ el.addEventListener("mousemove", onMouseMove);
9193
+ return () => {
9194
+ el.removeEventListener("mousedown", onMouseDown);
9195
+ el.removeEventListener("mouseleave", onMouseLeave);
9196
+ el.removeEventListener("mouseup", onMouseUp);
9197
+ el.removeEventListener("mousemove", onMouseMove);
9198
+ };
9199
+ }, [ref]);
9200
+ };
9201
+
9202
+ // src/widgets/transfer/components/solana/SolanaWalletSelect.tsx
9203
+ var import_react_hot_toast4 = __toESM(require("react-hot-toast"), 1);
9050
9204
  var import_jsx_runtime81 = require("react/jsx-runtime");
9051
9205
  var SolanaWalletSelect = () => {
9052
9206
  const theme = (0, import_react_redux49.useSelector)(selectTheme);
9053
9207
  const sourceChain = (0, import_react_redux49.useSelector)(selectSourceChain);
9054
9208
  const dispatch = (0, import_react_redux49.useDispatch)();
9055
- const sliderRef = (0, import_react58.useRef)();
9209
+ const sliderRef = (0, import_react60.useRef)(null);
9056
9210
  const { wallet, wallets, select, connect, connected } = (0, import_wallet_adapter_react6.useWallet)();
9057
- const [detected, undetected] = (0, import_react58.useMemo)(() => {
9211
+ const [detected, undetected] = (0, import_react60.useMemo)(() => {
9058
9212
  const detected2 = [];
9059
9213
  const undetected2 = [];
9060
9214
  for (const wallet2 of wallets) {
@@ -9066,39 +9220,14 @@ var SolanaWalletSelect = () => {
9066
9220
  }
9067
9221
  return [detected2, undetected2];
9068
9222
  }, [wallets]);
9069
- (0, import_react58.useEffect)(() => {
9070
- let isDown = false;
9071
- let startX;
9072
- let scrollLeft;
9073
- sliderRef.current?.addEventListener("mousedown", (e) => {
9074
- isDown = true;
9075
- sliderRef.current?.classList.add("active");
9076
- startX = e.pageX - sliderRef.current?.offsetLeft;
9077
- scrollLeft = sliderRef.current?.scrollLeft;
9078
- });
9079
- sliderRef.current?.addEventListener("mouseleave", () => {
9080
- isDown = false;
9081
- sliderRef.current.classList.remove("active");
9082
- });
9083
- sliderRef.current?.addEventListener("mouseup", () => {
9084
- isDown = false;
9085
- sliderRef.current.classList.remove("active");
9086
- });
9087
- sliderRef.current?.addEventListener("mousemove", (e) => {
9088
- if (!isDown) return;
9089
- e.preventDefault();
9090
- const x = e.pageX - sliderRef.current.offsetLeft;
9091
- const walk = (x - startX) * 1;
9092
- sliderRef.current.scrollLeft = scrollLeft - walk;
9093
- });
9094
- }, []);
9095
- const handleWalletClick = (0, import_react58.useCallback)(
9223
+ useHorizontalDragScroll(sliderRef);
9224
+ const handleWalletClick = (0, import_react60.useCallback)(
9096
9225
  (walletName) => {
9097
9226
  select(walletName);
9098
9227
  },
9099
9228
  [select]
9100
9229
  );
9101
- (0, import_react58.useEffect)(() => {
9230
+ (0, import_react60.useEffect)(() => {
9102
9231
  if (!wallet) return;
9103
9232
  if (sourceChain.shortName !== "SOL") {
9104
9233
  return;
@@ -9108,7 +9237,14 @@ var SolanaWalletSelect = () => {
9108
9237
  "SolanaWalletSelect: Wallet exists but not connected, connecting wallet:",
9109
9238
  wallet
9110
9239
  );
9111
- connect().catch((err) => logger_default.error("Solana connect error:", err));
9240
+ connect().catch((err) => {
9241
+ if (isUserRejected(err)) {
9242
+ (0, import_react_hot_toast4.default)("Wallet connection was cancelled.");
9243
+ } else {
9244
+ import_react_hot_toast4.default.error("Failed to connect wallet.");
9245
+ }
9246
+ logger_default.error("Solana connect error:", err);
9247
+ });
9112
9248
  }
9113
9249
  dispatch(setSolanaConnectModal(false));
9114
9250
  }, [wallet, sourceChain]);
@@ -9145,10 +9281,20 @@ var SolanaWalletSelect = () => {
9145
9281
  var SolanaWalletSelect_default = SolanaWalletSelect;
9146
9282
 
9147
9283
  // src/widgets/transfer/components/solana/AccountDetailsModal.tsx
9148
- var import_react59 = require("react");
9284
+ var import_react61 = require("react");
9149
9285
  var import_react_redux51 = require("react-redux");
9150
9286
  var import_wallet_adapter_react7 = require("@solana/wallet-adapter-react");
9151
9287
 
9288
+ // src/shared/lib/explorers.ts
9289
+ var getSolanaAccountExplorerUrl = (address, networkOption) => {
9290
+ const cluster = networkOption === "mainnet" /* mainnet */ ? "mainnet" : "devnet";
9291
+ return `https://solscan.io/account/${address}?cluster=${cluster}`;
9292
+ };
9293
+ var getTronAccountExplorerUrl = (address, networkOption) => {
9294
+ const sub = networkOption === "testnet" /* testnet */ ? "nile." : "";
9295
+ return `https://${sub}tronscan.io/#/address/${address}`;
9296
+ };
9297
+
9152
9298
  // src/widgets/transfer/components/WalletModalShell.tsx
9153
9299
  var import_react_redux50 = require("react-redux");
9154
9300
  var import_jsx_runtime82 = require("react/jsx-runtime");
@@ -9181,8 +9327,55 @@ var WalletModalShell = ({
9181
9327
  };
9182
9328
  var WalletModalShell_default = WalletModalShell;
9183
9329
 
9184
- // src/widgets/transfer/components/solana/AccountDetailsModal.tsx
9330
+ // src/widgets/transfer/components/AccountDetailsModalBase.tsx
9185
9331
  var import_jsx_runtime83 = require("react/jsx-runtime");
9332
+ var AccountDetailsModalBase = ({
9333
+ isOpen,
9334
+ onClose,
9335
+ themeMode,
9336
+ address,
9337
+ balance,
9338
+ symbol,
9339
+ explorerUrl,
9340
+ onDisconnect,
9341
+ disableDisconnect = false,
9342
+ closeButtonClassName = "cross-icon-button"
9343
+ }) => {
9344
+ const isLight = themeMode ? themeMode === "light" : true;
9345
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
9346
+ WalletModalShell_default,
9347
+ {
9348
+ isOpen: !!isOpen,
9349
+ title: "Account Details",
9350
+ onClose,
9351
+ rightHeader: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("button", { className: closeButtonClassName, onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Cross_default, { fill: isLight ? "black" : "white" }) }),
9352
+ children: [
9353
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "summary", children: [
9354
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "address", children: [
9355
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("h2", { children: address ? getShortenedAddress(address) : "\u2014" }),
9356
+ address && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(CopyButton_default, { text: address })
9357
+ ] }),
9358
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("h3", { children: [
9359
+ formatterFloat.format(Number(balance || 0)),
9360
+ " ",
9361
+ symbol
9362
+ ] })
9363
+ ] }),
9364
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SecondaryButton_default, { className: "block-explorer", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ExternalLink_default, { className: "link", to: explorerUrl, children: [
9365
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Explorer_default, { fill: "#778DA3" }),
9366
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { children: "Block explorer" }),
9367
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ExternalUrl_default, { fill: "#778DA3" })
9368
+ ] }) }),
9369
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PrimaryButton_default, { clickHandler: onDisconnect, disabled: disableDisconnect, children: "Disconnect" })
9370
+ ]
9371
+ }
9372
+ );
9373
+ };
9374
+ var AccountDetailsModalBase_default = AccountDetailsModalBase;
9375
+
9376
+ // src/widgets/transfer/components/solana/AccountDetailsModal.tsx
9377
+ var import_react_hot_toast5 = __toESM(require("react-hot-toast"), 1);
9378
+ var import_jsx_runtime84 = require("react/jsx-runtime");
9186
9379
  var AccountDetailsModal = () => {
9187
9380
  const dispatch = (0, import_react_redux51.useDispatch)();
9188
9381
  const theme = (0, import_react_redux51.useSelector)(selectTheme);
@@ -9195,10 +9388,10 @@ var AccountDetailsModal = () => {
9195
9388
  const { balance: solBalance } = useSolNativeBalance();
9196
9389
  const isSol = sourceChain.shortName === "SOL" /* SOLANA */;
9197
9390
  if (!isSol) return null;
9198
- const explorerUrl = (0, import_react59.useMemo)(() => {
9199
- const cluster = networkOption === "mainnet" ? "mainnet" : "devnet";
9200
- return `https://solscan.io/account/${sourceAddress}?cluster=${cluster}`;
9201
- }, [sourceAddress, networkOption]);
9391
+ const explorerUrl = (0, import_react61.useMemo)(
9392
+ () => getSolanaAccountExplorerUrl(sourceAddress, networkOption),
9393
+ [sourceAddress, networkOption]
9394
+ );
9202
9395
  const close = () => dispatch(setAccountDetailsModal(false));
9203
9396
  const handleDisconnect = async () => {
9204
9397
  if (mode === "light" /* light */) {
@@ -9208,50 +9401,36 @@ var AccountDetailsModal = () => {
9208
9401
  }
9209
9402
  try {
9210
9403
  await solanaWalletDisconnect();
9404
+ (0, import_react_hot_toast5.default)("Wallet disconnected.");
9211
9405
  } catch (e) {
9406
+ if (isUserRejected(e)) {
9407
+ (0, import_react_hot_toast5.default)("Wallet disconnect was cancelled.");
9408
+ } else {
9409
+ import_react_hot_toast5.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Error_default, {}) });
9410
+ }
9212
9411
  } finally {
9213
9412
  close();
9214
9413
  }
9215
9414
  };
9216
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
9217
- WalletModalShell_default,
9415
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
9416
+ AccountDetailsModalBase_default,
9218
9417
  {
9219
9418
  isOpen: !!isOpen,
9220
- title: "Account Details",
9221
9419
  onClose: close,
9222
- rightHeader: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("button", { className: "cross-icon-button", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Cross_default, { fill: theme.colorMode === "light" ? "black" : "white" }) }),
9223
- children: [
9224
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "summary", children: [
9225
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "address", children: [
9226
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("h2", { children: sourceAddress ? getShortenedAddress(sourceAddress) : "\u2014" }),
9227
- sourceAddress && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(CopyButton_default, { text: sourceAddress })
9228
- ] }),
9229
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("h3", { children: [
9230
- formatterFloat.format(Number(solBalance || 0)),
9231
- " SOL"
9232
- ] })
9233
- ] }),
9234
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SecondaryButton_default, { className: "block-explorer", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ExternalLink_default, { className: "link", to: explorerUrl, children: [
9235
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Explorer_default, { fill: "#778DA3" }),
9236
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { children: "Block explorer" }),
9237
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ExternalUrl_default, { fill: "#778DA3" })
9238
- ] }) }),
9239
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
9240
- PrimaryButton_default,
9241
- {
9242
- clickHandler: handleDisconnect,
9243
- disabled: mode === "light" /* light */,
9244
- children: "Disconnect"
9245
- }
9246
- )
9247
- ]
9420
+ themeMode: theme.colorMode,
9421
+ address: sourceAddress,
9422
+ balance: solBalance,
9423
+ symbol: "SOL",
9424
+ explorerUrl,
9425
+ onDisconnect: handleDisconnect,
9426
+ disableDisconnect: mode === "light" /* light */
9248
9427
  }
9249
9428
  );
9250
9429
  };
9251
9430
  var AccountDetailsModal_default = AccountDetailsModal;
9252
9431
 
9253
9432
  // src/widgets/transfer/components/solana/SolanaConnectModal.tsx
9254
- var import_jsx_runtime84 = require("react/jsx-runtime");
9433
+ var import_jsx_runtime85 = require("react/jsx-runtime");
9255
9434
  var SolanaWalletConnectModal = () => {
9256
9435
  const dispatch = (0, import_react_redux52.useDispatch)();
9257
9436
  const theme = (0, import_react_redux52.useSelector)(selectTheme);
@@ -9260,17 +9439,17 @@ var SolanaWalletConnectModal = () => {
9260
9439
  const sourceChain = (0, import_react_redux52.useSelector)(selectSourceChain);
9261
9440
  const { connect, connecting, connected, publicKey } = (0, import_wallet_adapter_react8.useWallet)();
9262
9441
  const isSol = sourceChain.shortName === "SOL" /* SOLANA */;
9263
- const close = (0, import_react60.useCallback)(() => {
9442
+ const close = (0, import_react62.useCallback)(() => {
9264
9443
  dispatch(setSolanaConnectModal(false));
9265
9444
  }, [dispatch]);
9266
- import_react60.default.useEffect(() => {
9445
+ import_react62.default.useEffect(() => {
9267
9446
  logger_default.debug("[SolanaConnectModal] wallet-adapter state", {
9268
9447
  connecting,
9269
9448
  connected,
9270
9449
  publicKey: publicKey?.toBase58?.()
9271
9450
  });
9272
9451
  }, [connecting, connected, publicKey]);
9273
- const onConnect = (0, import_react60.useCallback)(async () => {
9452
+ const onConnect = (0, import_react62.useCallback)(async () => {
9274
9453
  if (!isSol) return;
9275
9454
  if (mode === "light" /* light */) {
9276
9455
  logger_default.debug("[SolanaConnectModal] LIGHT mode \u2192 skip connect, open details");
@@ -9282,24 +9461,30 @@ var SolanaWalletConnectModal = () => {
9282
9461
  await connect();
9283
9462
  dispatch(setSolanaConnectModal(false));
9284
9463
  dispatch(setAccountDetailsModal(true));
9464
+ (0, import_react_hot_toast6.default)("Wallet connected.");
9285
9465
  } catch (e) {
9466
+ if (isUserRejected(e)) {
9467
+ (0, import_react_hot_toast6.default)("Wallet connection was cancelled.");
9468
+ } else {
9469
+ import_react_hot_toast6.default.error("Failed to connect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Error_default, {}) });
9470
+ }
9286
9471
  logger_default.error("[SolanaConnectModal] connect error", e);
9287
9472
  }
9288
9473
  }, [isSol, mode, connect, dispatch]);
9289
- const demoMsg = (0, import_react60.useMemo)(
9474
+ const demoMsg = (0, import_react62.useMemo)(
9290
9475
  () => mode === "light" /* light */ ? `Light mode uses a demo Solana address (${lightDemoAccounts.SOL}).` : "",
9291
9476
  [mode]
9292
9477
  );
9293
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
9294
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(AccountDetailsModal_default, {}),
9295
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
9478
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
9479
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(AccountDetailsModal_default, {}),
9480
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
9296
9481
  WalletModalShell_default,
9297
9482
  {
9298
9483
  isOpen: !!isOpen,
9299
9484
  title: "Connect Wallet",
9300
9485
  onClose: close,
9301
9486
  className: "wallet-connect",
9302
- rightHeader: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { className: "cross-icon-button", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
9487
+ rightHeader: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { className: "cross-icon-button", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9303
9488
  Cross_default,
9304
9489
  {
9305
9490
  width: 30,
@@ -9308,10 +9493,10 @@ var SolanaWalletConnectModal = () => {
9308
9493
  }
9309
9494
  ) }),
9310
9495
  children: [
9311
- demoMsg && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "muted", children: demoMsg }),
9312
- mode !== "light" /* light */ ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
9313
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SolanaWalletSelect_default, {}),
9314
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
9496
+ demoMsg && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "muted", children: demoMsg }),
9497
+ mode !== "light" /* light */ ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
9498
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(SolanaWalletSelect_default, {}),
9499
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9315
9500
  "button",
9316
9501
  {
9317
9502
  className: "primary",
@@ -9320,8 +9505,8 @@ var SolanaWalletConnectModal = () => {
9320
9505
  children: connecting ? "Connecting\u2026" : connected ? "Connected" : "Connect"
9321
9506
  }
9322
9507
  ) })
9323
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: { display: "flex", gap: 8 }, children: [
9324
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
9508
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { style: { display: "flex", gap: 8 }, children: [
9509
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9325
9510
  "button",
9326
9511
  {
9327
9512
  className: "secondary",
@@ -9329,7 +9514,7 @@ var SolanaWalletConnectModal = () => {
9329
9514
  children: "View Account"
9330
9515
  }
9331
9516
  ),
9332
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { className: "primary", onClick: close, children: "Close" })
9517
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { className: "primary", onClick: close, children: "Close" })
9333
9518
  ] })
9334
9519
  ]
9335
9520
  }
@@ -9339,15 +9524,17 @@ var SolanaWalletConnectModal = () => {
9339
9524
  var SolanaConnectModal_default = SolanaWalletConnectModal;
9340
9525
 
9341
9526
  // src/widgets/transfer/components/tron/TronWalletConnectModal.tsx
9342
- var import_react63 = require("react");
9527
+ var import_react65 = require("react");
9343
9528
  var import_react_redux55 = require("react-redux");
9344
9529
  var import_tronwallet_adapter_react_hooks8 = require("@tronweb3/tronwallet-adapter-react-hooks");
9530
+ var import_react_hot_toast9 = __toESM(require("react-hot-toast"), 1);
9345
9531
 
9346
9532
  // src/widgets/transfer/components/tron/AccountDetailsModal.tsx
9347
- var import_react61 = require("react");
9533
+ var import_react63 = require("react");
9348
9534
  var import_react_redux53 = require("react-redux");
9349
9535
  var import_tronwallet_adapter_react_hooks6 = require("@tronweb3/tronwallet-adapter-react-hooks");
9350
- var import_jsx_runtime85 = require("react/jsx-runtime");
9536
+ var import_react_hot_toast7 = __toESM(require("react-hot-toast"), 1);
9537
+ var import_jsx_runtime86 = require("react/jsx-runtime");
9351
9538
  var AccountDetailsModal2 = () => {
9352
9539
  const dispatch = (0, import_react_redux53.useDispatch)();
9353
9540
  const theme = (0, import_react_redux53.useSelector)(selectTheme);
@@ -9360,10 +9547,10 @@ var AccountDetailsModal2 = () => {
9360
9547
  const { balance: tronBalance } = useTronNativeBalance();
9361
9548
  const isTrx = sourceChain.shortName === "TRX" /* TRON */;
9362
9549
  if (!isTrx) return null;
9363
- const explorerUrl = (0, import_react61.useMemo)(() => {
9364
- const sub = networkOption === "testnet" ? "nile." : "";
9365
- return `https://${sub}tronscan.io/#/address/${sourceAddress}`;
9366
- }, [sourceAddress, networkOption]);
9550
+ const explorerUrl = (0, import_react63.useMemo)(
9551
+ () => getTronAccountExplorerUrl(sourceAddress, networkOption),
9552
+ [sourceAddress, networkOption]
9553
+ );
9367
9554
  const close = () => dispatch(setAccountDetailsModal(false));
9368
9555
  const handleDisconnect = async () => {
9369
9556
  if (mode === "light" /* light */) {
@@ -9373,57 +9560,44 @@ var AccountDetailsModal2 = () => {
9373
9560
  }
9374
9561
  try {
9375
9562
  await tronWalletDisconnect();
9563
+ (0, import_react_hot_toast7.default)("Wallet disconnected.");
9376
9564
  } catch (e) {
9565
+ if (isUserRejected(e)) {
9566
+ (0, import_react_hot_toast7.default)("Wallet disconnect was cancelled.");
9567
+ } else {
9568
+ import_react_hot_toast7.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Error_default, {}) });
9569
+ }
9377
9570
  } finally {
9378
9571
  close();
9379
9572
  }
9380
9573
  };
9381
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
9382
- WalletModalShell_default,
9574
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9575
+ AccountDetailsModalBase_default,
9383
9576
  {
9384
9577
  isOpen: !!isOpen,
9385
- title: "Account Details",
9386
9578
  onClose: close,
9387
- rightHeader: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { className: "cross-icon-button", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Cross_default, { fill: theme.colorMode === "light" ? "black" : "white" }) }),
9388
- children: [
9389
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "summary", children: [
9390
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "address", children: [
9391
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("h2", { children: sourceAddress ? getShortenedAddress(sourceAddress) : "\u2014" }),
9392
- sourceAddress && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CopyButton_default, { text: sourceAddress })
9393
- ] }),
9394
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("h3", { children: [
9395
- formatterFloat.format(Number(tronBalance || 0)),
9396
- " TRX"
9397
- ] })
9398
- ] }),
9399
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(SecondaryButton_default, { className: "block-explorer", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(ExternalLink_default, { className: "link", to: explorerUrl, children: [
9400
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Explorer_default, { fill: "#778DA3" }),
9401
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { children: "Block explorer" }),
9402
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ExternalUrl_default, { fill: "#778DA3" })
9403
- ] }) }),
9404
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9405
- PrimaryButton_default,
9406
- {
9407
- clickHandler: handleDisconnect,
9408
- disabled: mode === "light" /* light */,
9409
- children: "Disconnect"
9410
- }
9411
- )
9412
- ]
9579
+ themeMode: theme.colorMode,
9580
+ address: sourceAddress,
9581
+ balance: tronBalance,
9582
+ symbol: "TRX",
9583
+ explorerUrl,
9584
+ onDisconnect: handleDisconnect,
9585
+ disableDisconnect: mode === "light" /* light */
9413
9586
  }
9414
9587
  );
9415
9588
  };
9416
9589
  var AccountDetailsModal_default2 = AccountDetailsModal2;
9417
9590
 
9418
9591
  // src/widgets/transfer/components/tron/TronWalletSelect.tsx
9419
- var import_react62 = require("react");
9592
+ var import_react64 = require("react");
9420
9593
  var import_react_redux54 = require("react-redux");
9421
9594
  var import_tronwallet_adapter_react_hooks7 = require("@tronweb3/tronwallet-adapter-react-hooks");
9422
9595
  var import_tronwallet_abstract_adapter = require("@tronweb3/tronwallet-abstract-adapter");
9423
- var import_jsx_runtime86 = require("react/jsx-runtime");
9596
+ var import_react_hot_toast8 = __toESM(require("react-hot-toast"), 1);
9597
+ var import_jsx_runtime87 = require("react/jsx-runtime");
9424
9598
  var TronWalletSelect = () => {
9425
9599
  const theme = (0, import_react_redux54.useSelector)(selectTheme);
9426
- const sliderRef = (0, import_react62.useRef)();
9600
+ const sliderRef = (0, import_react64.useRef)(null);
9427
9601
  const dispatch = (0, import_react_redux54.useDispatch)();
9428
9602
  const {
9429
9603
  wallets,
@@ -9432,7 +9606,7 @@ var TronWalletSelect = () => {
9432
9606
  connect,
9433
9607
  connected
9434
9608
  } = (0, import_tronwallet_adapter_react_hooks7.useWallet)();
9435
- const [detected, undetected] = (0, import_react62.useMemo)(() => {
9609
+ const [detected, undetected] = (0, import_react64.useMemo)(() => {
9436
9610
  const detected2 = [];
9437
9611
  const undetected2 = [];
9438
9612
  for (const wallet of wallets) {
@@ -9444,59 +9618,46 @@ var TronWalletSelect = () => {
9444
9618
  }
9445
9619
  return [detected2, undetected2];
9446
9620
  }, [wallets]);
9447
- (0, import_react62.useEffect)(() => {
9448
- let isDown = false;
9449
- let startX;
9450
- let scrollLeft;
9451
- sliderRef.current?.addEventListener("mousedown", (e) => {
9452
- isDown = true;
9453
- sliderRef.current?.classList.add("active");
9454
- startX = e.pageX - sliderRef.current?.offsetLeft;
9455
- scrollLeft = sliderRef.current?.scrollLeft;
9456
- });
9457
- sliderRef.current?.addEventListener("mouseleave", () => {
9458
- isDown = false;
9459
- sliderRef.current.classList.remove("active");
9460
- });
9461
- sliderRef.current?.addEventListener("mouseup", () => {
9462
- isDown = false;
9463
- sliderRef.current.classList.remove("active");
9464
- });
9465
- sliderRef.current?.addEventListener("mousemove", (e) => {
9466
- if (!isDown) return;
9467
- e.preventDefault();
9468
- const x = e.pageX - sliderRef.current.offsetLeft;
9469
- const walk = (x - startX) * 1;
9470
- sliderRef.current.scrollLeft = scrollLeft - walk;
9471
- });
9472
- }, []);
9473
- (0, import_react62.useEffect)(() => {
9621
+ useHorizontalDragScroll(sliderRef);
9622
+ (0, import_react64.useEffect)(() => {
9474
9623
  connected && dispatch(setTronConnectModal(false));
9475
9624
  }, [connected]);
9476
9625
  const connectWallet = async (walletName) => {
9477
- currentWallet?.adapter.name === walletName ? await connect() : select(walletName);
9626
+ try {
9627
+ if (currentWallet?.adapter.name === walletName) {
9628
+ await connect();
9629
+ } else {
9630
+ select(walletName);
9631
+ }
9632
+ } catch (err) {
9633
+ if (isUserRejected(err)) {
9634
+ (0, import_react_hot_toast8.default)("Wallet connection was cancelled.");
9635
+ } else {
9636
+ import_react_hot_toast8.default.error("Failed to connect wallet.");
9637
+ }
9638
+ }
9478
9639
  };
9479
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `wallet-select`, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "slide-area hide-scrollbar", ref: sliderRef, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "wallet-container", children: [
9480
- detected.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9640
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `wallet-select`, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "slide-area hide-scrollbar", ref: sliderRef, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "wallet-container", children: [
9641
+ detected.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9481
9642
  "div",
9482
9643
  {
9483
9644
  className: `card-item ${theme.colorMode}`,
9484
9645
  onClick: () => connectWallet(wallet.adapter.name),
9485
- children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "wallet-item", children: [
9486
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("img", { src: wallet.adapter.icon, alt: wallet.adapter.name }),
9487
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { children: wallet.adapter.name })
9646
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "wallet-item", children: [
9647
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: wallet.adapter.icon, alt: wallet.adapter.name }),
9648
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: wallet.adapter.name })
9488
9649
  ] })
9489
9650
  },
9490
9651
  `${wallet.adapter.name}-${index}`
9491
9652
  )),
9492
- undetected.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9653
+ undetected.map((wallet, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9493
9654
  ExternalLink_default,
9494
9655
  {
9495
9656
  to: wallet.adapter.url,
9496
9657
  className: `card-item ${theme.colorMode}`,
9497
- children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "wallet-item", children: [
9498
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("img", { src: wallet.adapter.icon, alt: wallet.adapter.name }),
9499
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("span", { children: [
9658
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "wallet-item", children: [
9659
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: wallet.adapter.icon, alt: wallet.adapter.name }),
9660
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { children: [
9500
9661
  "Install ",
9501
9662
  wallet.adapter.name
9502
9663
  ] })
@@ -9509,7 +9670,7 @@ var TronWalletSelect = () => {
9509
9670
  var TronWalletSelect_default = TronWalletSelect;
9510
9671
 
9511
9672
  // src/widgets/transfer/components/tron/TronWalletConnectModal.tsx
9512
- var import_jsx_runtime87 = require("react/jsx-runtime");
9673
+ var import_jsx_runtime88 = require("react/jsx-runtime");
9513
9674
  var TronWalletConnectModal = () => {
9514
9675
  const dispatch = (0, import_react_redux55.useDispatch)();
9515
9676
  const theme = (0, import_react_redux55.useSelector)(selectTheme);
@@ -9518,10 +9679,10 @@ var TronWalletConnectModal = () => {
9518
9679
  const sourceChain = (0, import_react_redux55.useSelector)(selectSourceChain);
9519
9680
  const { connect, connected, connecting } = (0, import_tronwallet_adapter_react_hooks8.useWallet)();
9520
9681
  const isTrx = sourceChain.shortName === "TRX" /* TRON */;
9521
- const close = (0, import_react63.useCallback)(() => {
9682
+ const close = (0, import_react65.useCallback)(() => {
9522
9683
  dispatch(setTronConnectModal(false));
9523
9684
  }, [dispatch]);
9524
- const onConnect = (0, import_react63.useCallback)(async () => {
9685
+ const onConnect = (0, import_react65.useCallback)(async () => {
9525
9686
  if (!isTrx) return;
9526
9687
  if (mode === "light" /* light */) {
9527
9688
  logger_default.debug("[TronConnectModal] LIGHT mode \u2192 skip connect, open details");
@@ -9533,29 +9694,35 @@ var TronWalletConnectModal = () => {
9533
9694
  await connect();
9534
9695
  dispatch(setTronConnectModal(false));
9535
9696
  dispatch(setAccountDetailsModal(true));
9697
+ (0, import_react_hot_toast9.default)("Wallet connected.");
9536
9698
  } catch (e) {
9699
+ if (isUserRejected(e)) {
9700
+ (0, import_react_hot_toast9.default)("Wallet connection was cancelled.");
9701
+ } else {
9702
+ import_react_hot_toast9.default.error("Failed to connect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) });
9703
+ }
9537
9704
  logger_default.error("[TronConnectModal] connect error", e);
9538
9705
  }
9539
9706
  }, [isTrx, mode, connect, dispatch]);
9540
- const demoMsg = (0, import_react63.useMemo)(
9707
+ const demoMsg = (0, import_react65.useMemo)(
9541
9708
  () => mode === "light" /* light */ ? `Light mode uses a demo Tron address (${lightDemoAccounts.TRX}).` : "",
9542
9709
  [mode]
9543
9710
  );
9544
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
9545
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(AccountDetailsModal_default2, {}),
9546
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
9711
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
9712
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(AccountDetailsModal_default2, {}),
9713
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
9547
9714
  WalletModalShell_default,
9548
9715
  {
9549
9716
  isOpen: !!isOpen,
9550
9717
  title: "Connect Wallet",
9551
9718
  onClose: close,
9552
9719
  className: "wallet-connect",
9553
- rightHeader: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("button", { className: "icon-button", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Cross_default, { fill: theme.colorMode === "light" ? "black" : "white" }) }),
9720
+ rightHeader: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("button", { className: "icon-button", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Cross_default, { fill: theme.colorMode === "light" ? "black" : "white" }) }),
9554
9721
  children: [
9555
- demoMsg && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "muted", children: demoMsg }),
9556
- mode !== "light" /* light */ ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
9557
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TronWalletSelect_default, {}),
9558
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9722
+ demoMsg && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "muted", children: demoMsg }),
9723
+ mode !== "light" /* light */ ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
9724
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(TronWalletSelect_default, {}),
9725
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9559
9726
  "button",
9560
9727
  {
9561
9728
  className: "primary",
@@ -9564,8 +9731,8 @@ var TronWalletConnectModal = () => {
9564
9731
  children: connecting ? "Connecting\u2026" : connected ? "Connected" : "Connect"
9565
9732
  }
9566
9733
  ) })
9567
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { style: { display: "flex", gap: 8 }, children: [
9568
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9734
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { style: { display: "flex", gap: 8 }, children: [
9735
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9569
9736
  "button",
9570
9737
  {
9571
9738
  className: "secondary",
@@ -9573,7 +9740,7 @@ var TronWalletConnectModal = () => {
9573
9740
  children: "View Account"
9574
9741
  }
9575
9742
  ),
9576
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("button", { className: "primary", onClick: close, children: "Close" })
9743
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("button", { className: "primary", onClick: close, children: "Close" })
9577
9744
  ] })
9578
9745
  ]
9579
9746
  }
@@ -9583,7 +9750,7 @@ var TronWalletConnectModal = () => {
9583
9750
  var TronWalletConnectModal_default = TronWalletConnectModal;
9584
9751
 
9585
9752
  // src/widgets/transfer/components/TransferWidget.tsx
9586
- var import_jsx_runtime88 = require("react/jsx-runtime");
9753
+ var import_jsx_runtime89 = require("react/jsx-runtime");
9587
9754
  var TransferWidget = ({
9588
9755
  theme,
9589
9756
  helpURL,
@@ -9592,16 +9759,16 @@ var TransferWidget = ({
9592
9759
  }) => {
9593
9760
  logger_default.debug("[TransferWidget] mount");
9594
9761
  const dispatch = (0, import_react_redux56.useDispatch)();
9595
- const mainRef = (0, import_react64.useRef)(null);
9596
- const [signature, setSignature2] = (0, import_react64.useState)("");
9597
- const [isSubmitting, setIsSubmitting] = (0, import_react64.useState)(false);
9598
- const [formStep, setFormStep] = (0, import_react64.useState)(0);
9599
- const [warningModalOpen, setWarningModalOpen] = (0, import_react64.useState)(null);
9600
- const [resetModalOpen, setResetModalOpen] = (0, import_react64.useState)(false);
9601
- const [isCancellingApprove, setCancellingApprove] = (0, import_react64.useState)(false);
9602
- const [isApproving, setApproving] = (0, import_react64.useState)(false);
9603
- const [isSigning, setSigning] = (0, import_react64.useState)(false);
9604
- const [feeOptionDisabled, setFeeOptionDisabled] = (0, import_react64.useState)(false);
9762
+ const mainRef = (0, import_react66.useRef)(null);
9763
+ const [signature, setSignature2] = (0, import_react66.useState)("");
9764
+ const [isSubmitting, setIsSubmitting] = (0, import_react66.useState)(false);
9765
+ const [formStep, setFormStep] = (0, import_react66.useState)(0);
9766
+ const [warningModalOpen, setWarningModalOpen] = (0, import_react66.useState)(null);
9767
+ const [resetModalOpen, setResetModalOpen] = (0, import_react66.useState)(false);
9768
+ const [isCancellingApprove, setCancellingApprove] = (0, import_react66.useState)(false);
9769
+ const [isApproving, setApproving] = (0, import_react66.useState)(false);
9770
+ const [isSigning, setSigning] = (0, import_react66.useState)(false);
9771
+ const [feeOptionDisabled, setFeeOptionDisabled] = (0, import_react66.useState)(false);
9605
9772
  const networkOption = (0, import_react_redux56.useSelector)(selectNetworkOption);
9606
9773
  const dAppOption = (0, import_react_redux56.useSelector)(selectDappOption);
9607
9774
  const mode = (0, import_react_redux56.useSelector)(selectMode);
@@ -9649,7 +9816,16 @@ var TransferWidget = ({
9649
9816
  targetSymbol: targetCurrency,
9650
9817
  backendUrl
9651
9818
  });
9652
- (0, import_react64.useEffect)(() => {
9819
+ const isSwap = (0, import_react66.useMemo)(
9820
+ () => !isSamePeggedToken(
9821
+ sourceChain,
9822
+ sourceCurrency,
9823
+ targetChain,
9824
+ targetCurrency
9825
+ ),
9826
+ [sourceChain, sourceCurrency, targetChain, targetCurrency]
9827
+ );
9828
+ (0, import_react66.useEffect)(() => {
9653
9829
  setSignature2("");
9654
9830
  setFeeOptionDisabled(false);
9655
9831
  setApproving(false);
@@ -9660,7 +9836,7 @@ var TransferWidget = ({
9660
9836
  targetChain.shortName,
9661
9837
  targetCurrency
9662
9838
  ]);
9663
- (0, import_react64.useEffect)(() => {
9839
+ (0, import_react66.useEffect)(() => {
9664
9840
  try {
9665
9841
  if (fees) dispatch(setServiceFee(fees));
9666
9842
  if (transactionOption?.sourceChain) {
@@ -9674,13 +9850,13 @@ var TransferWidget = ({
9674
9850
  "[TransferWidget] failed to apply fees/update initial selection",
9675
9851
  e
9676
9852
  );
9677
- import_react_hot_toast4.default.error(
9853
+ import_react_hot_toast10.default.error(
9678
9854
  "An unexpected error occurred while preparing the transfer. Please contact support for assistance.",
9679
- { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) }
9855
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9680
9856
  );
9681
9857
  }
9682
9858
  }, [fees, mode, transactionOption, dispatch]);
9683
- const isBackButtonEnabled = (0, import_react64.useMemo)(() => {
9859
+ const isBackButtonEnabled = (0, import_react66.useMemo)(() => {
9684
9860
  if (formStep !== 0) {
9685
9861
  if (["BANK", "CC"].includes(sourceChain.shortName)) {
9686
9862
  return ccTransactionStatus === "idle" || ccTransactionStatus === "failed";
@@ -9689,14 +9865,14 @@ var TransferWidget = ({
9689
9865
  }
9690
9866
  return false;
9691
9867
  }, [ccTransactionStatus, sourceChain, formStep]);
9692
- const isSubmitButtonEnabled = (0, import_react64.useMemo)(() => {
9868
+ const isSubmitButtonEnabled = (0, import_react66.useMemo)(() => {
9693
9869
  if (submitted) return false;
9694
9870
  if (["BANK", "CC"].includes(sourceChain.shortName)) {
9695
9871
  return ccTransactionStatus === "idle";
9696
9872
  }
9697
9873
  return true;
9698
9874
  }, [sourceChain, ccTransactionStatus, submitted]);
9699
- const [initialSelection, setInitialSelection] = (0, import_react64.useState)({
9875
+ const [initialSelection, setInitialSelection] = (0, import_react66.useState)({
9700
9876
  sourceSelection: true,
9701
9877
  targetSelection: true
9702
9878
  });
@@ -9727,22 +9903,61 @@ var TransferWidget = ({
9727
9903
  isSubmitting,
9728
9904
  setIsSubmitting
9729
9905
  );
9730
- const submit = (0, import_react64.useCallback)(async () => {
9906
+ const submit = (0, import_react66.useCallback)(async () => {
9731
9907
  try {
9732
9908
  await submitTransaction(signature);
9733
9909
  } catch (err) {
9734
9910
  logger_default.error("[TransferWidget] submit failed", err);
9735
- import_react_hot_toast4.default.error(
9911
+ import_react_hot_toast10.default.error(
9736
9912
  "Failed to submit your transaction. Please contact support for assistance.",
9737
- { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) }
9913
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9738
9914
  );
9739
9915
  dispatch(setCCTransactionStatus("error-generic"));
9740
9916
  }
9741
9917
  }, [signature, submitTransaction, dispatch]);
9918
+ const requestSignature = (0, import_react66.useCallback)(async () => {
9919
+ let sig;
9920
+ setSigning(true);
9921
+ setFeeOptionDisabled(true);
9922
+ try {
9923
+ sig = await signMessage?.({
9924
+ targetAddress,
9925
+ targetChain: targetChain.shortName,
9926
+ originSymbol: sourceCurrency,
9927
+ originChain: sourceChain.shortName
9928
+ });
9929
+ if (!sig) {
9930
+ (0, import_react_hot_toast10.default)("Signature request was cancelled.", { icon: "\u2139\uFE0F" });
9931
+ return void 0;
9932
+ }
9933
+ setSignature2(sig);
9934
+ return sig;
9935
+ } catch (err) {
9936
+ if (isUserRejected(err)) {
9937
+ (0, import_react_hot_toast10.default)("Signature request was cancelled.", { icon: "\u2139\uFE0F" });
9938
+ } else {
9939
+ logger_default.error("[TransferWidget] signing failed", err);
9940
+ import_react_hot_toast10.default.error(
9941
+ "Failed to sign the message. Please contact support for assistance.",
9942
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9943
+ );
9944
+ }
9945
+ return void 0;
9946
+ } finally {
9947
+ setSigning(false);
9948
+ if (!sig) setFeeOptionDisabled(false);
9949
+ }
9950
+ }, [
9951
+ signMessage,
9952
+ targetAddress,
9953
+ targetChain.shortName,
9954
+ sourceCurrency,
9955
+ sourceChain.shortName
9956
+ ]);
9742
9957
  const handleSubmit = async () => {
9743
9958
  const { error, message: validationMessage } = validate(true);
9744
9959
  if (error === "ValidationError" /* Error */) {
9745
- import_react_hot_toast4.default.error(validationMessage, { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) });
9960
+ import_react_hot_toast10.default.error(validationMessage, { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) });
9746
9961
  return;
9747
9962
  }
9748
9963
  if (["BANK", "CC"].includes(sourceChain.shortName)) {
@@ -9752,44 +9967,34 @@ var TransferWidget = ({
9752
9967
  if (error === "ApprovalNeeded" /* ApprovalNeeded */ && mode !== "light" /* light */ && dAppOption === "none" /* None */) {
9753
9968
  try {
9754
9969
  if (!signature) {
9755
- setSigning(true);
9756
- setFeeOptionDisabled(true);
9757
- const sig = await signMessage?.({
9758
- targetAddress,
9759
- targetChain: targetChain.shortName,
9760
- originSymbol: sourceCurrency,
9761
- originChain: sourceChain.shortName
9762
- });
9763
- setSigning(false);
9970
+ const sig = await requestSignature();
9764
9971
  if (!sig) {
9765
- (0, import_react_hot_toast4.default)("Signature request was cancelled.", { icon: "\u2139\uFE0F" });
9766
9972
  return;
9767
9973
  }
9768
- setSignature2(sig);
9769
9974
  return;
9770
9975
  }
9771
9976
  setApproving(true);
9772
9977
  await approve();
9773
- setApproving(false);
9774
9978
  } catch (err) {
9775
- setApproving(false);
9776
- if (err?.code === 4001) {
9777
- (0, import_react_hot_toast4.default)("Approval request was cancelled.", { icon: "\u2139\uFE0F" });
9979
+ if (isUserRejected(err)) {
9980
+ (0, import_react_hot_toast10.default)("Approval request was cancelled.", { icon: "\u2139\uFE0F" });
9778
9981
  return;
9779
9982
  }
9780
9983
  const msg = String(err?.message ?? err);
9781
9984
  if (msg.includes("ChainMismatch")) {
9782
- import_react_hot_toast4.default.error(
9985
+ import_react_hot_toast10.default.error(
9783
9986
  `Your wallet is on the wrong network. Please switch to ${sourceChain.name} and try again.`,
9784
- { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) }
9987
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9785
9988
  );
9786
9989
  return;
9787
9990
  }
9788
9991
  logger_default.error("[TransferWidget] approval failed", err);
9789
- import_react_hot_toast4.default.error(
9992
+ import_react_hot_toast10.default.error(
9790
9993
  "Failed to approve the token allowance. Please contact support for assistance.",
9791
- { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) }
9994
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9792
9995
  );
9996
+ } finally {
9997
+ setApproving(false);
9793
9998
  }
9794
9999
  return;
9795
10000
  }
@@ -9800,30 +10005,20 @@ var TransferWidget = ({
9800
10005
  return;
9801
10006
  }
9802
10007
  if (!signature && mode !== "light" /* light */ && dAppOption === "none" /* None */) {
9803
- setSigning(true);
9804
- setFeeOptionDisabled(true);
9805
- const sig = await signMessage?.({
9806
- targetAddress,
9807
- targetChain: targetChain.shortName,
9808
- originSymbol: sourceCurrency,
9809
- originChain: sourceChain.shortName
9810
- });
9811
- setSigning(false);
10008
+ const sig = await requestSignature();
9812
10009
  if (!sig) {
9813
- (0, import_react_hot_toast4.default)("Signature request was cancelled.", { icon: "\u2139\uFE0F" });
9814
10010
  setIsSubmitting(false);
9815
10011
  return;
9816
10012
  }
9817
- setSignature2(sig);
9818
10013
  return;
9819
10014
  }
9820
10015
  setIsSubmitting(true);
9821
10016
  await submitTransaction(signature);
9822
10017
  } catch (err) {
9823
10018
  logger_default.error("[TransferWidget] handleSubmit failed", err);
9824
- import_react_hot_toast4.default.error(
10019
+ import_react_hot_toast10.default.error(
9825
10020
  "An unexpected error occurred while submitting. Please contact support for assistance.",
9826
- { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) }
10021
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9827
10022
  );
9828
10023
  setIsSubmitting(false);
9829
10024
  }
@@ -9843,7 +10038,7 @@ var TransferWidget = ({
9843
10038
  void handleSubmit();
9844
10039
  return;
9845
10040
  }
9846
- import_react_hot_toast4.default.error(validationMessage, { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) });
10041
+ import_react_hot_toast10.default.error(validationMessage, { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) });
9847
10042
  mainRef.current?.click();
9848
10043
  };
9849
10044
  const onBack = () => {
@@ -9863,15 +10058,15 @@ var TransferWidget = ({
9863
10058
  try {
9864
10059
  setCancellingApprove(true);
9865
10060
  await approve(true);
9866
- (0, import_react_hot_toast4.default)("Approval successfully cancelled.", { icon: "\u2139\uFE0F" });
10061
+ (0, import_react_hot_toast10.default)("Approval successfully cancelled.", { icon: "\u2139\uFE0F" });
9867
10062
  } catch (err) {
9868
- if (err?.code === 4001) {
9869
- (0, import_react_hot_toast4.default)("Cancel-approval request was cancelled.", { icon: "\u2139\uFE0F" });
10063
+ if (isUserRejected(err)) {
10064
+ (0, import_react_hot_toast10.default)("Cancel-approval request was cancelled.", { icon: "\u2139\uFE0F" });
9870
10065
  } else {
9871
10066
  logger_default.error("[TransferWidget] cancel approve failed", err);
9872
- import_react_hot_toast4.default.error(
10067
+ import_react_hot_toast10.default.error(
9873
10068
  "Unable to cancel the approval. Please contact support for assistance.",
9874
- { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) }
10069
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9875
10070
  );
9876
10071
  }
9877
10072
  } finally {
@@ -9917,13 +10112,13 @@ var TransferWidget = ({
9917
10112
  await disconnectWallet();
9918
10113
  } catch (e) {
9919
10114
  logger_default.error("[TransferWidget] reset failed", e);
9920
- import_react_hot_toast4.default.error(
10115
+ import_react_hot_toast10.default.error(
9921
10116
  "Unable to reset the form. Please contact support for assistance.",
9922
- { icon: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Error_default, {}) }
10117
+ { icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Error_default, {}) }
9923
10118
  );
9924
10119
  }
9925
10120
  };
9926
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
10121
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
9927
10122
  "div",
9928
10123
  {
9929
10124
  className: `kima-card ${theme.colorMode}`,
@@ -9931,7 +10126,7 @@ var TransferWidget = ({
9931
10126
  background: theme.colorMode === "light" /* light */ ? theme.backgroundColorLight : theme.backgroundColorDark
9932
10127
  },
9933
10128
  children: [
9934
- resetModalOpen && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10129
+ resetModalOpen && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9935
10130
  WarningModal_default,
9936
10131
  {
9937
10132
  message: "Are you sure you want to reset the widget?",
@@ -9943,7 +10138,7 @@ var TransferWidget = ({
9943
10138
  onCancel: () => setResetModalOpen(false)
9944
10139
  }
9945
10140
  ),
9946
- warningModalOpen && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10141
+ warningModalOpen && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9947
10142
  WarningModal_default,
9948
10143
  {
9949
10144
  message: warningModalOpen.message,
@@ -9957,21 +10152,21 @@ var TransferWidget = ({
9957
10152
  }
9958
10153
  }
9959
10154
  ),
9960
- mode === "payment" /* payment */ && !transactionOption && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h2", { className: "invalid-option-banner", children: "We're unable to process your payment. Please ensure the necessary transaction details are provided. Contact support if the issue persists." }),
9961
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "transfer-card", children: [
9962
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "kima-card-header", children: [
9963
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "topbar", children: [
9964
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "title", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h3", { style: { marginRight: "5px" }, children: formStep === 0 ? titleOption?.initialTitle ?? (mode === "payment" /* payment */ ? "New Purchase" : "New Transfer") : titleOption?.confirmTitle ?? (mode === "payment" /* payment */ ? "Confirm Purchase" : "Transfer Details") }) }),
9965
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "control-buttons", children: [
9966
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10155
+ mode === "payment" /* payment */ && !transactionOption && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h2", { className: "invalid-option-banner", children: "We're unable to process your payment. Please ensure the necessary transaction details are provided. Contact support if the issue persists." }),
10156
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "transfer-card", children: [
10157
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "kima-card-header", children: [
10158
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "topbar", children: [
10159
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "title", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h3", { style: { marginRight: "5px" }, children: formStep === 0 ? titleOption?.initialTitle ?? (mode === "payment" /* payment */ ? "New Purchase" : "New Transfer") : titleOption?.confirmTitle ?? (mode === "payment" /* payment */ ? "Confirm Purchase" : isSwap ? "Swap Details" : "Transfer Details") }) }),
10160
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "control-buttons", children: [
10161
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9967
10162
  ExternalLink_default,
9968
10163
  {
9969
10164
  to: helpURL ? helpURL : networkOption === "testnet" /* testnet */ ? "https://docs.kima.network/kima-network/try-kima-with-the-demo-app" : "https://support.kima.network",
9970
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "menu-button", children: "I need help" })
10165
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "menu-button", children: "I need help" })
9971
10166
  }
9972
10167
  ),
9973
- ["BANK", "CC"].includes(sourceChain.shortName) && formStep > 0 && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(ExternalLink_default, { to: "https://docs.kima.network/kima-network/supported-fiat#unsupported-countries-credit-cards", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "menu-button", children: "Unsupported Countries" }) }),
9974
- formStep === 0 && mode !== "payment" /* payment */ && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10168
+ ["BANK", "CC"].includes(sourceChain.shortName) && formStep > 0 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ExternalLink_default, { to: "https://docs.kima.network/kima-network/supported-fiat#unsupported-countries-credit-cards", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "menu-button", children: "Unsupported Countries" }) }),
10169
+ formStep === 0 && mode !== "payment" /* payment */ && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9975
10170
  "button",
9976
10171
  {
9977
10172
  className: "reset-button",
@@ -9980,7 +10175,7 @@ var TransferWidget = ({
9980
10175
  children: "Reset"
9981
10176
  }
9982
10177
  ),
9983
- closeHandler && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10178
+ closeHandler && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9984
10179
  "button",
9985
10180
  {
9986
10181
  className: "cross-icon-button",
@@ -9988,14 +10183,14 @@ var TransferWidget = ({
9988
10183
  resetForm();
9989
10184
  closeHandler(0);
9990
10185
  },
9991
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Cross_default, {})
10186
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Cross_default, {})
9992
10187
  }
9993
10188
  )
9994
10189
  ] })
9995
10190
  ] }),
9996
- mode === "payment" /* payment */ && paymentTitleOption?.title && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h4", { className: "subtitle", children: paymentTitleOption.title })
10191
+ mode === "payment" /* payment */ && paymentTitleOption?.title && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h4", { className: "subtitle", children: paymentTitleOption.title })
9997
10192
  ] }),
9998
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "kima-card-content", ref: mainRef, children: formStep === 0 ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10193
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "kima-card-content", ref: mainRef, children: formStep === 0 ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9999
10194
  SingleForm_default,
10000
10195
  {
10001
10196
  ...{
@@ -10008,7 +10203,7 @@ var TransferWidget = ({
10008
10203
  setInitialSelection
10009
10204
  }
10010
10205
  }
10011
- ) : ccTransactionStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(FiatWidget_default, { submitCallback: submit }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10206
+ ) : ccTransactionStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FiatWidget_default, { submitCallback: submit }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10012
10207
  ConfirmDetails_default,
10013
10208
  {
10014
10209
  ...{
@@ -10017,12 +10212,12 @@ var TransferWidget = ({
10017
10212
  }
10018
10213
  }
10019
10214
  ) }),
10020
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10215
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10021
10216
  "div",
10022
10217
  {
10023
10218
  className: `kima-card-footer ${mode === "bridge" /* bridge */ && formStep !== 0 && "confirm"}`,
10024
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "button-group", children: [
10025
- isBackButtonEnabled && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10219
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "button-group", children: [
10220
+ isBackButtonEnabled && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10026
10221
  SecondaryButton_default,
10027
10222
  {
10028
10223
  clickHandler: onBack,
@@ -10032,7 +10227,7 @@ var TransferWidget = ({
10032
10227
  }
10033
10228
  ),
10034
10229
  !!allowance && allowance > 0n && formStep !== 0 && !["BANK", "CC"].includes(sourceChain.shortName) && // EVM path
10035
- mode !== "light" /* light */ && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10230
+ mode !== "light" /* light */ && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10036
10231
  SecondaryButton_default,
10037
10232
  {
10038
10233
  clickHandler: onCancelApprove,
@@ -10042,7 +10237,7 @@ var TransferWidget = ({
10042
10237
  children: isCancellingApprove ? "Cancelling Approval" : "Cancel Approve"
10043
10238
  }
10044
10239
  ),
10045
- isSubmitButtonEnabled && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10240
+ isSubmitButtonEnabled && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10046
10241
  PrimaryButton_default,
10047
10242
  {
10048
10243
  clickHandler: onNext,
@@ -10054,10 +10249,10 @@ var TransferWidget = ({
10054
10249
  ] })
10055
10250
  }
10056
10251
  ),
10057
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(SolanaConnectModal_default, {}),
10058
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(TronWalletConnectModal_default, {}),
10059
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10060
- import_react_hot_toast4.Toaster,
10252
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SolanaConnectModal_default, {}),
10253
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TronWalletConnectModal_default, {}),
10254
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10255
+ import_react_hot_toast10.Toaster,
10061
10256
  {
10062
10257
  position: "top-right",
10063
10258
  reverseOrder: false,
@@ -10080,9 +10275,9 @@ var TransferWidget = ({
10080
10275
  }
10081
10276
  }
10082
10277
  ),
10083
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "floating-footer", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `items ${theme.colorMode}`, children: [
10084
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { children: "Powered by" }),
10085
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(KimaNetwork_default, {})
10278
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "floating-footer", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `items ${theme.colorMode}`, children: [
10279
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { children: "Powered by" }),
10280
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(KimaNetwork_default, {})
10086
10281
  ] }) })
10087
10282
  ] })
10088
10283
  ]
@@ -10091,7 +10286,7 @@ var TransferWidget = ({
10091
10286
  };
10092
10287
 
10093
10288
  // src/widgets/common/KimaWidgetWrapper.tsx
10094
- var import_jsx_runtime89 = require("react/jsx-runtime");
10289
+ var import_jsx_runtime90 = require("react/jsx-runtime");
10095
10290
  var KimaWidgetWrapper = ({
10096
10291
  mode,
10097
10292
  txId,
@@ -10108,7 +10303,7 @@ var KimaWidgetWrapper = ({
10108
10303
  useDebugCode();
10109
10304
  const { kimaBackendUrl } = useKimaContext();
10110
10305
  const dispatch = (0, import_react_redux57.useDispatch)();
10111
- const { setThemeMode, setThemeVariables } = (0, import_react65.useAppKitTheme)();
10306
+ const { setThemeMode, setThemeVariables } = (0, import_react67.useAppKitTheme)();
10112
10307
  const submitted = (0, import_react_redux57.useSelector)(selectSubmitted);
10113
10308
  const sourceChain = (0, import_react_redux57.useSelector)(selectSourceChain);
10114
10309
  const ccTransactionStatus = (0, import_react_redux57.useSelector)(selectCCTransactionStatus);
@@ -10116,8 +10311,8 @@ var KimaWidgetWrapper = ({
10116
10311
  const networkOption = envOptions?.env;
10117
10312
  const kimaExplorer = envOptions?.kimaExplorer || "https://explorer.sardis.kima.network";
10118
10313
  const { currentPlugin } = useGetCurrentPlugin_default();
10119
- const prevColorMode = (0, import_react66.useRef)(void 0);
10120
- (0, import_react66.useEffect)(() => {
10314
+ const prevColorMode = (0, import_react68.useRef)(void 0);
10315
+ (0, import_react68.useEffect)(() => {
10121
10316
  if (prevColorMode.current !== theme?.colorMode) {
10122
10317
  dispatch(setTheme(theme));
10123
10318
  setThemeMode(
@@ -10130,7 +10325,7 @@ var KimaWidgetWrapper = ({
10130
10325
  prevColorMode.current = theme?.colorMode;
10131
10326
  }
10132
10327
  }, [theme?.colorMode, dispatch, setThemeMode, setThemeVariables, theme]);
10133
- const prevConfigRef = (0, import_react66.useRef)({
10328
+ const prevConfigRef = (0, import_react68.useRef)({
10134
10329
  compliantOption: void 0,
10135
10330
  backendUrl: void 0,
10136
10331
  mode: void 0,
@@ -10138,7 +10333,7 @@ var KimaWidgetWrapper = ({
10138
10333
  networkOption: void 0,
10139
10334
  kimaExplorer: void 0
10140
10335
  });
10141
- (0, import_react66.useEffect)(() => {
10336
+ (0, import_react68.useEffect)(() => {
10142
10337
  if (prevConfigRef.current.compliantOption !== compliantOption) {
10143
10338
  dispatch(setCompliantOption(compliantOption));
10144
10339
  prevConfigRef.current.compliantOption = compliantOption;
@@ -10172,8 +10367,8 @@ var KimaWidgetWrapper = ({
10172
10367
  kimaExplorer,
10173
10368
  dispatch
10174
10369
  ]);
10175
- const prevTxOptJson = (0, import_react66.useRef)(null);
10176
- (0, import_react66.useEffect)(() => {
10370
+ const prevTxOptJson = (0, import_react68.useRef)(null);
10371
+ (0, import_react68.useEffect)(() => {
10177
10372
  const nextJson = transactionOption ? JSON.stringify(transactionOption) : null;
10178
10373
  if (nextJson === prevTxOptJson.current) return;
10179
10374
  if (transactionOption) {
@@ -10202,9 +10397,9 @@ var KimaWidgetWrapper = ({
10202
10397
  }
10203
10398
  prevTxOptJson.current = nextJson;
10204
10399
  }, [transactionOption, chainData, dispatch]);
10205
- const prevModeRef = (0, import_react66.useRef)(void 0);
10206
- const prevTxIdRef = (0, import_react66.useRef)(void 0);
10207
- (0, import_react66.useEffect)(() => {
10400
+ const prevModeRef = (0, import_react68.useRef)(void 0);
10401
+ const prevTxIdRef = (0, import_react68.useRef)(void 0);
10402
+ (0, import_react68.useEffect)(() => {
10208
10403
  const modeChanged = prevModeRef.current !== mode;
10209
10404
  const txChanged = prevTxIdRef.current !== txId;
10210
10405
  if (mode === "payment" /* payment */ && !transactionOption) {
@@ -10235,8 +10430,8 @@ var KimaWidgetWrapper = ({
10235
10430
  prevTxIdRef.current = txId;
10236
10431
  }
10237
10432
  }, [mode, txId, transactionOption, dispatch]);
10238
- const didIndex = (0, import_react66.useRef)(false);
10239
- (0, import_react66.useEffect)(() => {
10433
+ const didIndex = (0, import_react68.useRef)(false);
10434
+ (0, import_react68.useEffect)(() => {
10240
10435
  if (!chainData?.length || didIndex.current) return;
10241
10436
  logger_default.debug(
10242
10437
  "[KimaWidgetWrapper] indexing plugins for chains:",
@@ -10245,7 +10440,7 @@ var KimaWidgetWrapper = ({
10245
10440
  indexPluginsByChain(chainData);
10246
10441
  didIndex.current = true;
10247
10442
  }, [chainData]);
10248
- (0, import_react66.useEffect)(() => {
10443
+ (0, import_react68.useEffect)(() => {
10249
10444
  logger_default.debug("[KimaWidgetWrapper] render", {
10250
10445
  mode,
10251
10446
  dAppOption,
@@ -10255,16 +10450,16 @@ var KimaWidgetWrapper = ({
10255
10450
  sourceChain: sourceChain?.shortName
10256
10451
  });
10257
10452
  });
10258
- const pluginKey = (0, import_react66.useMemo)(() => {
10453
+ const pluginKey = (0, import_react68.useMemo)(() => {
10259
10454
  if (!currentPlugin?.id) return null;
10260
10455
  return `transfer-${currentPlugin.id}-${sourceChain?.shortName ?? "unknown"}`;
10261
10456
  }, [currentPlugin?.id, sourceChain?.shortName]);
10262
- const content = (0, import_react66.useMemo)(() => {
10457
+ const content = (0, import_react68.useMemo)(() => {
10263
10458
  if (mode === "status" /* status */) {
10264
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TransactionWidget, { theme });
10459
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TransactionWidget, { theme });
10265
10460
  }
10266
10461
  if (!currentPlugin && !sourceChain?.shortName) {
10267
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10462
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10268
10463
  TransferWidget,
10269
10464
  {
10270
10465
  theme,
@@ -10276,15 +10471,15 @@ var KimaWidgetWrapper = ({
10276
10471
  );
10277
10472
  }
10278
10473
  if (!currentPlugin) {
10279
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SkeletonLoader_default, { theme });
10474
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SkeletonLoader_default, { theme });
10280
10475
  }
10281
10476
  if (sourceChain.shortName === "CC") {
10282
10477
  if (submitted) {
10283
10478
  logger_default.debug("[KimaWidgetWrapper] CC mode -> TransactionWidget");
10284
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TransactionWidget, { theme });
10479
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TransactionWidget, { theme });
10285
10480
  }
10286
10481
  if (ccTransactionStatus === "error-id") {
10287
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10482
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10288
10483
  ErrorWidget_default,
10289
10484
  {
10290
10485
  theme,
@@ -10299,7 +10494,7 @@ var KimaWidgetWrapper = ({
10299
10494
  );
10300
10495
  }
10301
10496
  if (ccTransactionStatus === "error-generic") {
10302
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10497
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10303
10498
  ErrorWidget_default,
10304
10499
  {
10305
10500
  theme,
@@ -10313,7 +10508,7 @@ var KimaWidgetWrapper = ({
10313
10508
  }
10314
10509
  );
10315
10510
  }
10316
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10511
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10317
10512
  TransferWidget,
10318
10513
  {
10319
10514
  theme,
@@ -10328,7 +10523,7 @@ var KimaWidgetWrapper = ({
10328
10523
  "[KimaWidgetWrapper] rendering TransferWidget with plugin",
10329
10524
  currentPlugin?.id
10330
10525
  );
10331
- return submitted ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TransactionWidget, { theme }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
10526
+ return submitted ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TransactionWidget, { theme }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10332
10527
  TransferWidget,
10333
10528
  {
10334
10529
  theme,
@@ -10357,7 +10552,7 @@ var KimaWidgetWrapper = ({
10357
10552
  var KimaWidgetWrapper_default = KimaWidgetWrapper;
10358
10553
 
10359
10554
  // src/widgets/common/KimaTransactionWidget.tsx
10360
- var import_jsx_runtime90 = require("react/jsx-runtime");
10555
+ var import_jsx_runtime91 = require("react/jsx-runtime");
10361
10556
  var KimaTransactionWidget = ({
10362
10557
  mode,
10363
10558
  txId,
@@ -10371,7 +10566,7 @@ var KimaTransactionWidget = ({
10371
10566
  }) => {
10372
10567
  const dispatch = (0, import_react_redux58.useDispatch)();
10373
10568
  const { kimaBackendUrl } = useKimaContext();
10374
- const [hydrated, setHydrated] = (0, import_react67.useState)(false);
10569
+ const [hydrated, setHydrated] = (0, import_react69.useState)(false);
10375
10570
  const {
10376
10571
  data: envOptions,
10377
10572
  error: envOptionsError,
@@ -10382,20 +10577,20 @@ var KimaTransactionWidget = ({
10382
10577
  error: chainDataError,
10383
10578
  isLoading: isLoadingChainData
10384
10579
  } = useChainData(kimaBackendUrl);
10385
- (0, import_react67.useEffect)(() => {
10580
+ (0, import_react69.useEffect)(() => {
10386
10581
  if (typeof window !== "undefined") setHydrated(true);
10387
10582
  }, []);
10388
- (0, import_react67.useEffect)(() => {
10583
+ (0, import_react69.useEffect)(() => {
10389
10584
  if (theme?.colorMode) {
10390
10585
  dispatch(setTheme(theme));
10391
10586
  }
10392
10587
  }, [theme?.colorMode, dispatch, theme]);
10393
10588
  if (!hydrated || !theme?.colorMode)
10394
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ring_default, { width: 20, height: 20, fill: "#86b8ce" });
10589
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ring_default, { width: 20, height: 20, fill: "#86b8ce" });
10395
10590
  if (isLoadingEnvs || isLoadingChainData)
10396
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SkeletonLoader_default, { theme });
10591
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SkeletonLoader_default, { theme });
10397
10592
  if (envOptionsError || !envOptions)
10398
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10593
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
10399
10594
  ErrorWidget_default,
10400
10595
  {
10401
10596
  theme,
@@ -10404,7 +10599,7 @@ var KimaTransactionWidget = ({
10404
10599
  }
10405
10600
  );
10406
10601
  if (chainDataError || !chainData)
10407
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10602
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
10408
10603
  ErrorWidget_default,
10409
10604
  {
10410
10605
  theme,
@@ -10412,7 +10607,7 @@ var KimaTransactionWidget = ({
10412
10607
  message: "There was an error loading the chain data from the backend. Please check that the backend is running properly and the widget points to the corresponding url." /* ChainLoadingError */
10413
10608
  }
10414
10609
  );
10415
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
10610
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
10416
10611
  KimaWidgetWrapper_default,
10417
10612
  {
10418
10613
  ...{