@kimafinance/kima-transaction-widget 1.5.6 → 1.5.7

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
@@ -7636,9 +7636,18 @@ var useSubmitTransaction = (isSubmitting, setIsSubmitting) => {
7636
7636
  };
7637
7637
  const endpoint = doSwap ? "/submit/swap" : "/submit/transfer";
7638
7638
  if (doSwap) {
7639
+ setIsSubmitting(true);
7640
+ const baseOptions2 = {
7641
+ signature: transactionValues.originChain === "CC" ? "" : signature,
7642
+ feeId,
7643
+ chargeFeeAtTarget: feeDeduct,
7644
+ ...feeOptions
7645
+ };
7646
+ const endpoint2 = "/submit/swap";
7639
7647
  const amountIn = txValues.submitAmount.value.toString();
7640
- const decimals = txValues.submitAmount.decimals;
7648
+ const amountInDecimals = txValues.submitAmount.decimals;
7641
7649
  const amountOut = (swapInfo?.amountOutBigInt?.value ?? txValues.submitAmount.value).toString();
7650
+ const amountOutDecimals = swapInfo?.amountOutBigInt?.decimals ?? amountInDecimals;
7642
7651
  const params2 = JSON.stringify({
7643
7652
  originAddress: transactionValues.originChain === "CC" ? transactionValues.targetAddress : transactionValues.originAddress,
7644
7653
  originChain: transactionValues.originChain,
@@ -7648,22 +7657,25 @@ var useSubmitTransaction = (isSubmitting, setIsSubmitting) => {
7648
7657
  targetSymbol: transactionValues.targetSymbol,
7649
7658
  amountIn,
7650
7659
  amountOut,
7660
+ // send BOTH decimals explicitly
7661
+ amountInDecimals,
7662
+ amountOutDecimals,
7663
+ // keep 'decimals' for backwards compat (origin/input decimals)
7664
+ decimals: amountInDecimals,
7665
+ // fee in the same decimals as amountIn
7651
7666
  fee: bigIntChangeDecimals({
7652
7667
  ...totalFee,
7653
- newDecimals: decimals
7668
+ newDecimals: amountInDecimals
7654
7669
  }).value.toString(),
7655
- decimals,
7656
- dex: baseOptions?.dex ?? "auto",
7657
- slippage: baseOptions?.slippage ?? "0.005",
7658
- options: JSON.stringify({
7659
- ...baseOptions
7660
- }),
7670
+ dex: baseOptions2?.dex ?? "auto",
7671
+ slippage: baseOptions2?.slippage ?? "0.005",
7672
+ options: JSON.stringify({ ...baseOptions2 }),
7661
7673
  fiatTransactionIdSeed: ccTransactionIdSeed,
7662
7674
  mode
7663
7675
  });
7664
7676
  logger_default.debug("submitTransaction (SWAP): params:", params2);
7665
7677
  const response2 = await fetchWrapper.post(
7666
- `${backendUrl}${endpoint}`,
7678
+ `${backendUrl}${endpoint2}`,
7667
7679
  params2
7668
7680
  );
7669
7681
  if (response2?.code !== 0) {