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