@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.js CHANGED
@@ -2823,9 +2823,7 @@ function useEvmAllowance() {
2823
2823
  });
2824
2824
  return await walletClient.signMessage({
2825
2825
  account: walletAddress,
2826
- message: `Target Address: ${data.targetAddress}
2827
- Target Chain: ${data.targetChain}
2828
- Target Symbol: ${data.targetSymbol}`
2826
+ message: `I approve moving ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}`
2829
2827
  });
2830
2828
  } catch (error) {
2831
2829
  console.error("useEvmAllowance: Error on signing message:", error);
@@ -3150,9 +3148,7 @@ function useSolanaAllowance() {
3150
3148
  return;
3151
3149
  }
3152
3150
  try {
3153
- const message = `Target Address: ${data.targetAddress}
3154
- Target Chain: ${data.targetChain}
3155
- Target Symbol: ${data.targetSymbol}`;
3151
+ const message = `I approve moving ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}`;
3156
3152
  const encodedMessage = new TextEncoder().encode(message);
3157
3153
  const signature = await signMessage(encodedMessage);
3158
3154
  return `0x${Buffer.from(signature).toString("hex")}`;
@@ -3740,9 +3736,7 @@ function useTronAllowance() {
3740
3736
  return;
3741
3737
  }
3742
3738
  try {
3743
- const message = `Target Address: ${data.targetAddress}
3744
- Target Chain: ${data.targetChain}
3745
- Target Symbol: ${data.targetSymbol}`;
3739
+ const message = `I approve moving ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}`;
3746
3740
  const signedMessage = await signMessage(message);
3747
3741
  return signedMessage;
3748
3742
  } catch (error2) {
@@ -6070,7 +6064,7 @@ var useSubmitTransaction = ({
6070
6064
  htlcExpirationTimestamp: "0",
6071
6065
  htlcVersion: "",
6072
6066
  senderPubKey: "",
6073
- options: signature
6067
+ options: JSON.stringify({ signature })
6074
6068
  });
6075
6069
  const transactionResult = await fetchWrapper.post(
6076
6070
  `${backendUrl}/submit`,
@@ -6196,6 +6190,7 @@ var TransferWidget = ({
6196
6190
  }) => {
6197
6191
  const dispatch = useDispatch25();
6198
6192
  const mainRef = useRef7(null);
6193
+ const [signature, setSignature2] = useState14("");
6199
6194
  const [formStep, setFormStep] = useState14(0);
6200
6195
  const [warningModalOpen, setWarningModalOpen] = useState14(null);
6201
6196
  const dAppOption = useSelector37(selectDappOption);
@@ -6280,20 +6275,29 @@ var TransferWidget = ({
6280
6275
  return toast5.error(validationMessage, { icon: /* @__PURE__ */ React111.createElement(Error_default, null) });
6281
6276
  }
6282
6277
  if (error === "ApprovalNeeded" /* ApprovalNeeded */) {
6278
+ const sig2 = await signMessage?.({
6279
+ targetAddress,
6280
+ targetChain: targetChain.name,
6281
+ originSymbol: sourceCurrency,
6282
+ originChain: sourceChain.name
6283
+ });
6284
+ setSignature2(sig2);
6283
6285
  return approve();
6284
6286
  }
6285
6287
  if (dAppOption === "LPDrain" /* LPDrain */ || dAppOption === "LPAdd" /* LPAdd */) {
6286
6288
  keplrHandler && keplrHandler(sourceAddress);
6287
6289
  return;
6288
6290
  }
6289
- const signature = await signMessage?.({
6290
- targetAddress,
6291
- targetChain: targetChain.shortName,
6292
- targetSymbol: targetCurrency
6293
- });
6294
- const { success, message: submitMessage } = await submitTransaction(
6295
- JSON.stringify({ signature })
6296
- );
6291
+ let sig = signature;
6292
+ if (!sig) {
6293
+ sig = await signMessage?.({
6294
+ targetAddress,
6295
+ targetChain: targetChain.name,
6296
+ originSymbol: sourceCurrency,
6297
+ originChain: sourceChain.name
6298
+ });
6299
+ }
6300
+ const { success, message: submitMessage } = await submitTransaction(sig);
6297
6301
  if (!success) return toast5.error(submitMessage, { icon: /* @__PURE__ */ React111.createElement(Error_default, null) });
6298
6302
  };
6299
6303
  const onNext = () => {
@@ -6595,7 +6599,7 @@ var KimaTransactionWidget = ({
6595
6599
  titleOption,
6596
6600
  paymentTitleOption,
6597
6601
  helpURL = "",
6598
- compliantOption = true,
6602
+ compliantOption = false,
6599
6603
  transactionOption,
6600
6604
  excludedSourceNetworks = [],
6601
6605
  excludedTargetNetworks = []