@kimafinance/kima-transaction-widget 1.5.11 → 1.5.13

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
@@ -2268,7 +2268,9 @@ var isValidExternalProvider = (externalProvider) => {
2268
2268
 
2269
2269
  // src/shared/logger.ts
2270
2270
  var import_loglevel = __toESM(require("loglevel"), 1);
2271
- var DEFAULT_LOG_LEVEL = process?.env.LOG_LEVEL || process?.env.NEXT_PUBLIC_LOG_LEVEL || process?.env.VITE_LOG_LEVEL || "error";
2271
+ var import_meta = {};
2272
+ var safeEnv = typeof process !== "undefined" && process.env || (import_meta.env ?? {}) || {};
2273
+ var DEFAULT_LOG_LEVEL = safeEnv.LOG_LEVEL || safeEnv.NEXT_PUBLIC_LOG_LEVEL || safeEnv.VITE_LOG_LEVEL || "error";
2272
2274
  if (import_loglevel.default.getLevel() !== DEFAULT_LOG_LEVEL) {
2273
2275
  console.info("Setting log level from ENV to:", DEFAULT_LOG_LEVEL);
2274
2276
  import_loglevel.default.setLevel(DEFAULT_LOG_LEVEL);
@@ -6197,6 +6199,7 @@ var ConfirmDetails = ({
6197
6199
  ),
6198
6200
  [originNetwork, sourceCurrency, targetNetwork, targetCurrency]
6199
6201
  );
6202
+ const chargeFeeAtOrigin = !isSwap && feeDeduct;
6200
6203
  const baseSubmit = (0, import_react47.useMemo)(
6201
6204
  () => transactionValues.feeFromOrigin.submitAmount,
6202
6205
  [transactionValues.feeFromOrigin.submitAmount]
@@ -6209,16 +6212,18 @@ var ConfirmDetails = ({
6209
6212
  [totalFee, baseSubmit.decimals]
6210
6213
  );
6211
6214
  const amountToTransferBig = (0, import_react47.useMemo)(() => {
6212
- const val = feeDeduct ? baseSubmit.value : baseSubmit.value + totalFeeInSubmitDec.value;
6215
+ if (isSwap)
6216
+ return { value: baseSubmit.value, decimals: baseSubmit.decimals };
6217
+ const val = chargeFeeAtOrigin ? baseSubmit.value : baseSubmit.value + totalFeeInSubmitDec.value;
6213
6218
  return { value: val, decimals: baseSubmit.decimals };
6214
- }, [feeDeduct, baseSubmit, totalFeeInSubmitDec]);
6219
+ }, [isSwap, chargeFeeAtOrigin, baseSubmit, totalFeeInSubmitDec]);
6215
6220
  const targetTransferBig = (0, import_react47.useMemo)(() => {
6216
6221
  if (isSwap) {
6217
6222
  if (swapInfo?.amountOutBigInt) return swapInfo.amountOutBigInt;
6218
6223
  return transactionValues.feeFromOrigin.submitAmount;
6219
6224
  }
6220
6225
  const minus = baseSubmit.value - totalFeeInSubmitDec.value;
6221
- const val = feeDeduct ? minus > 0n ? minus : 0n : baseSubmit.value;
6226
+ const val = chargeFeeAtOrigin ? minus > 0n ? minus : 0n : baseSubmit.value;
6222
6227
  return { value: val, decimals: baseSubmit.decimals };
6223
6228
  }, [
6224
6229
  isSwap,
@@ -6227,7 +6232,7 @@ var ConfirmDetails = ({
6227
6232
  baseSubmit.value,
6228
6233
  baseSubmit.decimals,
6229
6234
  totalFeeInSubmitDec.value,
6230
- feeDeduct
6235
+ chargeFeeAtOrigin
6231
6236
  ]);
6232
6237
  const combinedSwapFees = (0, import_react47.useMemo)(
6233
6238
  () => sumBigAmts([sourceFee, targetFee, swapFee ?? { value: 0n, decimals: 0 }]),