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