@kimafinance/kima-transaction-widget 1.5.13 → 1.5.15

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
@@ -5933,7 +5933,9 @@ var COIN_LIST2 = {
5933
5933
  USD: USD_default,
5934
5934
  USDT: USDT_default,
5935
5935
  USD1: USD1_default,
5936
- WBTC: BTC_default
5936
+ WBTC: BTC_default,
5937
+ WETH: Ethereum_default,
5938
+ WSOL: Solana_default
5937
5939
  };
5938
5940
  function TokenIcon({
5939
5941
  symbol,
@@ -7826,6 +7828,14 @@ var useValidateTransaction = (inputs) => {
7826
7828
  const { data: envOptions } = useGetEnvOptions({ kimaBackendUrl });
7827
7829
  const mode = (0, import_react_redux45.useSelector)(selectMode);
7828
7830
  const networkOption = (0, import_react_redux45.useSelector)(selectNetworkOption);
7831
+ const srcNet = (0, import_react_redux45.useSelector)(selectSourceChain);
7832
+ const tgtNet = (0, import_react_redux45.useSelector)(selectTargetChain);
7833
+ const srcCur = (0, import_react_redux45.useSelector)(selectSourceCurrency);
7834
+ const tgtCur = (0, import_react_redux45.useSelector)(selectTargetCurrency);
7835
+ const isSwap = (0, import_react54.useMemo)(
7836
+ () => !isSamePeggedToken(srcNet, srcCur, tgtNet, tgtCur),
7837
+ [srcNet, srcCur, tgtNet, tgtCur]
7838
+ );
7829
7839
  const maxValue = (0, import_react54.useMemo)(() => {
7830
7840
  logger_default.debug("useValidateTransaction: maxValue: ", inputs);
7831
7841
  if (!balance) return 0n;
@@ -7880,10 +7890,7 @@ var useValidateTransaction = (inputs) => {
7880
7890
  }
7881
7891
  const isFiatSrc = sourceChain === "BANK" || sourceChain === "CC";
7882
7892
  if (totalFee <= 0n && !isFiatSrc) {
7883
- return {
7884
- error: "ValidationError" /* Error */,
7885
- message: "Fee calculation error"
7886
- };
7893
+ return { error: "ValidationError" /* Error */, message: "Fee calculation error" };
7887
7894
  }
7888
7895
  if (compliantOption) {
7889
7896
  if (!sourceCompliant?.isCompliant && sourceChain !== "CC") {
@@ -7923,17 +7930,19 @@ var useValidateTransaction = (inputs) => {
7923
7930
  message: "Allowance is insufficient for the transaction"
7924
7931
  };
7925
7932
  }
7926
- const { isPoolAvailable, error } = checkPoolBalance({
7927
- pools,
7928
- targetChain,
7929
- targetCurrency,
7930
- amount: (0, import_viem7.formatUnits)(amount, decimals)
7931
- });
7932
- if (!isPoolAvailable) {
7933
- return {
7934
- error: "ValidationError" /* Error */,
7935
- message: error || "Pool balance check failed"
7936
- };
7933
+ if (!isSwap) {
7934
+ const { isPoolAvailable, error } = checkPoolBalance({
7935
+ pools,
7936
+ targetChain,
7937
+ targetCurrency,
7938
+ amount: (0, import_viem7.formatUnits)(amount, decimals)
7939
+ });
7940
+ if (!isPoolAvailable) {
7941
+ return {
7942
+ error: "ValidationError" /* Error */,
7943
+ message: error || "Pool balance check failed"
7944
+ };
7945
+ }
7937
7946
  }
7938
7947
  return { error: "None" /* None */, message: "Validation passed" };
7939
7948
  };
@@ -9551,8 +9560,8 @@ var TransferWidget = ({
9551
9560
  return;
9552
9561
  }
9553
9562
  try {
9554
- setIsSubmitting(true);
9555
9563
  if (dAppOption === "LPDrain" /* LPDrain */ || dAppOption === "LPAdd" /* LPAdd */) {
9564
+ setIsSubmitting(true);
9556
9565
  await keplrHandler?.(sourceAddress);
9557
9566
  return;
9558
9567
  }
@@ -9572,9 +9581,9 @@ var TransferWidget = ({
9572
9581
  return;
9573
9582
  }
9574
9583
  setSignature2(sig);
9575
- await submitTransaction(sig);
9576
9584
  return;
9577
9585
  }
9586
+ setIsSubmitting(true);
9578
9587
  await submitTransaction(signature);
9579
9588
  } catch (err) {
9580
9589
  logger_default.error("[TransferWidget] handleSubmit failed", err);
@@ -9641,10 +9650,13 @@ var TransferWidget = ({
9641
9650
  if (["BANK", "CC"].includes(sourceChain.shortName) && ccTransactionStatus === "idle") {
9642
9651
  return "Next";
9643
9652
  }
9653
+ if (mode !== "light" /* light */ && dAppOption === "none" /* None */ && !signature) {
9654
+ return isSigning ? "Signing..." : "Sign";
9655
+ }
9644
9656
  if (isApproved) {
9645
- return isSubmitting ? !signature && dAppOption === "none" /* None */ ? "Signing..." : "Submitting..." : "Submit";
9657
+ return isSubmitting ? "Submitting..." : "Submit";
9646
9658
  }
9647
- return isApproving ? !signature && dAppOption === "none" /* None */ ? "Signing..." : "Approving..." : !signature && dAppOption === "none" /* None */ ? "Sign" : "Approve";
9659
+ return isApproving ? "Approving..." : "Approve";
9648
9660
  }
9649
9661
  if (isLoadingFees) return "";
9650
9662
  return "Next";