@kimafinance/kima-transaction-widget 1.3.8 → 1.3.10

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
@@ -2799,9 +2799,7 @@ function useEvmAllowance() {
2799
2799
  });
2800
2800
  return await walletClient.signMessage({
2801
2801
  account: walletAddress,
2802
- message: `Target Address: ${data.targetAddress}
2803
- Target Chain: ${data.targetChain}
2804
- Target Symbol: ${data.targetSymbol}`
2802
+ message: `I approve moving ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}`
2805
2803
  });
2806
2804
  } catch (error) {
2807
2805
  console.error("useEvmAllowance: Error on signing message:", error);
@@ -3112,9 +3110,7 @@ function useSolanaAllowance() {
3112
3110
  return;
3113
3111
  }
3114
3112
  try {
3115
- const message = `Target Address: ${data.targetAddress}
3116
- Target Chain: ${data.targetChain}
3117
- Target Symbol: ${data.targetSymbol}`;
3113
+ const message = `I approve moving ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}`;
3118
3114
  const encodedMessage = new TextEncoder().encode(message);
3119
3115
  const signature = await signMessage(encodedMessage);
3120
3116
  return `0x${Buffer.from(signature).toString("hex")}`;
@@ -3696,9 +3692,7 @@ function useTronAllowance() {
3696
3692
  return;
3697
3693
  }
3698
3694
  try {
3699
- const message = `Target Address: ${data.targetAddress}
3700
- Target Chain: ${data.targetChain}
3701
- Target Symbol: ${data.targetSymbol}`;
3695
+ const message = `I approve moving ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}`;
3702
3696
  const signedMessage = await signMessage(message);
3703
3697
  return signedMessage;
3704
3698
  } catch (error2) {
@@ -6026,7 +6020,7 @@ var useSubmitTransaction = ({
6026
6020
  htlcExpirationTimestamp: "0",
6027
6021
  htlcVersion: "",
6028
6022
  senderPubKey: "",
6029
- options: signature
6023
+ options: JSON.stringify({ signature })
6030
6024
  });
6031
6025
  const transactionResult = await fetchWrapper.post(
6032
6026
  `${backendUrl}/submit`,
@@ -6152,6 +6146,7 @@ var TransferWidget = ({
6152
6146
  }) => {
6153
6147
  const dispatch = (0, import_react_redux51.useDispatch)();
6154
6148
  const mainRef = (0, import_react133.useRef)(null);
6149
+ const [signature, setSignature2] = (0, import_react133.useState)("");
6155
6150
  const [formStep, setFormStep] = (0, import_react133.useState)(0);
6156
6151
  const [warningModalOpen, setWarningModalOpen] = (0, import_react133.useState)(null);
6157
6152
  const dAppOption = (0, import_react_redux51.useSelector)(selectDappOption);
@@ -6236,20 +6231,29 @@ var TransferWidget = ({
6236
6231
  return import_react_hot_toast5.toast.error(validationMessage, { icon: /* @__PURE__ */ import_react133.default.createElement(Error_default, null) });
6237
6232
  }
6238
6233
  if (error === "ApprovalNeeded" /* ApprovalNeeded */) {
6234
+ const sig2 = await signMessage?.({
6235
+ targetAddress,
6236
+ targetChain: targetChain.name,
6237
+ originSymbol: sourceCurrency,
6238
+ originChain: sourceChain.name
6239
+ });
6240
+ setSignature2(sig2);
6239
6241
  return approve();
6240
6242
  }
6241
6243
  if (dAppOption === "LPDrain" /* LPDrain */ || dAppOption === "LPAdd" /* LPAdd */) {
6242
6244
  keplrHandler && keplrHandler(sourceAddress);
6243
6245
  return;
6244
6246
  }
6245
- const signature = await signMessage?.({
6246
- targetAddress,
6247
- targetChain: targetChain.shortName,
6248
- targetSymbol: targetCurrency
6249
- });
6250
- const { success, message: submitMessage } = await submitTransaction(
6251
- JSON.stringify({ signature })
6252
- );
6247
+ let sig = signature;
6248
+ if (!sig) {
6249
+ sig = await signMessage?.({
6250
+ targetAddress,
6251
+ targetChain: targetChain.name,
6252
+ originSymbol: sourceCurrency,
6253
+ originChain: sourceChain.name
6254
+ });
6255
+ }
6256
+ const { success, message: submitMessage } = await submitTransaction(sig);
6253
6257
  if (!success) return import_react_hot_toast5.toast.error(submitMessage, { icon: /* @__PURE__ */ import_react133.default.createElement(Error_default, null) });
6254
6258
  };
6255
6259
  const onNext = () => {
@@ -6551,7 +6555,7 @@ var KimaTransactionWidget = ({
6551
6555
  titleOption,
6552
6556
  paymentTitleOption,
6553
6557
  helpURL = "",
6554
- compliantOption = true,
6558
+ compliantOption = false,
6555
6559
  transactionOption,
6556
6560
  excludedSourceNetworks = [],
6557
6561
  excludedTargetNetworks = []