@kimafinance/kima-transaction-widget 1.3.9 → 1.3.11
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 +40 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -38
- 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.js
CHANGED
|
@@ -2823,7 +2823,7 @@ function useEvmAllowance() {
|
|
|
2823
2823
|
});
|
|
2824
2824
|
return await walletClient.signMessage({
|
|
2825
2825
|
account: walletAddress,
|
|
2826
|
-
message: `I approve
|
|
2826
|
+
message: `I approve the transfer of ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}.`
|
|
2827
2827
|
});
|
|
2828
2828
|
} catch (error) {
|
|
2829
2829
|
console.error("useEvmAllowance: Error on signing message:", error);
|
|
@@ -3148,7 +3148,7 @@ function useSolanaAllowance() {
|
|
|
3148
3148
|
return;
|
|
3149
3149
|
}
|
|
3150
3150
|
try {
|
|
3151
|
-
const message = `I approve
|
|
3151
|
+
const message = `I approve the transfer of ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}.`;
|
|
3152
3152
|
const encodedMessage = new TextEncoder().encode(message);
|
|
3153
3153
|
const signature = await signMessage(encodedMessage);
|
|
3154
3154
|
return `0x${Buffer.from(signature).toString("hex")}`;
|
|
@@ -3736,7 +3736,7 @@ function useTronAllowance() {
|
|
|
3736
3736
|
return;
|
|
3737
3737
|
}
|
|
3738
3738
|
try {
|
|
3739
|
-
const message = `I approve
|
|
3739
|
+
const message = `I approve the transfer of ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}.`;
|
|
3740
3740
|
const signedMessage = await signMessage(message);
|
|
3741
3741
|
return signedMessage;
|
|
3742
3742
|
} catch (error2) {
|
|
@@ -3954,7 +3954,7 @@ import React113, { useEffect as useEffect20 } from "react";
|
|
|
3954
3954
|
|
|
3955
3955
|
// src/components/KimaWidgetWrapper.tsx
|
|
3956
3956
|
import React112, { useEffect as useEffect19 } from "react";
|
|
3957
|
-
import { useDispatch as useDispatch26, useSelector as
|
|
3957
|
+
import { useDispatch as useDispatch26, useSelector as useSelector38 } from "react-redux";
|
|
3958
3958
|
|
|
3959
3959
|
// src/components/TransactionWidget.tsx
|
|
3960
3960
|
import React101, { useEffect as useEffect13, useMemo as useMemo13, useState as useState10 } from "react";
|
|
@@ -5270,7 +5270,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
5270
5270
|
|
|
5271
5271
|
// src/components/TransferWidget.tsx
|
|
5272
5272
|
import React111, { useEffect as useEffect18, useState as useState14, useRef as useRef7 } from "react";
|
|
5273
|
-
import { useDispatch as useDispatch25, useSelector as
|
|
5273
|
+
import { useDispatch as useDispatch25, useSelector as useSelector37 } from "react-redux";
|
|
5274
5274
|
|
|
5275
5275
|
// src/components/reusable/SingleForm.tsx
|
|
5276
5276
|
import React103, { useEffect as useEffect15, useMemo as useMemo15, useState as useState12 } from "react";
|
|
@@ -6032,7 +6032,6 @@ var useValidateTransaction_default = useValidateTransaction;
|
|
|
6032
6032
|
// src/hooks/useSubmitTransaction.tsx
|
|
6033
6033
|
import { useState as useState13 } from "react";
|
|
6034
6034
|
import { useDispatch as useDispatch24 } from "react-redux";
|
|
6035
|
-
import { useSelector as useSelector37 } from "react-redux";
|
|
6036
6035
|
var useSubmitTransaction = ({
|
|
6037
6036
|
amount,
|
|
6038
6037
|
totalFee,
|
|
@@ -6047,8 +6046,7 @@ var useSubmitTransaction = ({
|
|
|
6047
6046
|
}) => {
|
|
6048
6047
|
const dispatch = useDispatch24();
|
|
6049
6048
|
const [isSubmitting, setSubmitting] = useState13(false);
|
|
6050
|
-
const
|
|
6051
|
-
const submitTransaction = async () => {
|
|
6049
|
+
const submitTransaction = async (signature) => {
|
|
6052
6050
|
try {
|
|
6053
6051
|
setSubmitting(true);
|
|
6054
6052
|
const params = JSON.stringify({
|
|
@@ -6066,7 +6064,7 @@ var useSubmitTransaction = ({
|
|
|
6066
6064
|
htlcExpirationTimestamp: "0",
|
|
6067
6065
|
htlcVersion: "",
|
|
6068
6066
|
senderPubKey: "",
|
|
6069
|
-
options: signature
|
|
6067
|
+
options: JSON.stringify({ signature })
|
|
6070
6068
|
});
|
|
6071
6069
|
const transactionResult = await fetchWrapper.post(
|
|
6072
6070
|
`${backendUrl}/submit`,
|
|
@@ -6192,36 +6190,36 @@ var TransferWidget = ({
|
|
|
6192
6190
|
}) => {
|
|
6193
6191
|
const dispatch = useDispatch25();
|
|
6194
6192
|
const mainRef = useRef7(null);
|
|
6193
|
+
const [signature, setSignature2] = useState14("");
|
|
6195
6194
|
const [formStep, setFormStep] = useState14(0);
|
|
6196
6195
|
const [warningModalOpen, setWarningModalOpen] = useState14(null);
|
|
6197
|
-
const dAppOption =
|
|
6198
|
-
const mode =
|
|
6199
|
-
const transactionOption =
|
|
6200
|
-
const backendUrl =
|
|
6201
|
-
const sourceAddress =
|
|
6202
|
-
const targetAddress =
|
|
6203
|
-
const sourceChain =
|
|
6204
|
-
const targetChain =
|
|
6205
|
-
const sourceCurrency =
|
|
6206
|
-
const targetCurrency =
|
|
6207
|
-
const amount =
|
|
6196
|
+
const dAppOption = useSelector37(selectDappOption);
|
|
6197
|
+
const mode = useSelector37(selectMode);
|
|
6198
|
+
const transactionOption = useSelector37(selectTransactionOption);
|
|
6199
|
+
const backendUrl = useSelector37(selectBackendUrl);
|
|
6200
|
+
const sourceAddress = useSelector37(selectSourceAddress);
|
|
6201
|
+
const targetAddress = useSelector37(selectTargetAddress);
|
|
6202
|
+
const sourceChain = useSelector37(selectSourceChain);
|
|
6203
|
+
const targetChain = useSelector37(selectTargetChain);
|
|
6204
|
+
const sourceCurrency = useSelector37(selectSourceCurrency);
|
|
6205
|
+
const targetCurrency = useSelector37(selectTargetCurrency);
|
|
6206
|
+
const amount = useSelector37(selectAmount);
|
|
6208
6207
|
const {
|
|
6209
6208
|
totalFeeUsd,
|
|
6210
6209
|
totalFee,
|
|
6211
6210
|
targetNetworkFee,
|
|
6212
6211
|
submitAmount,
|
|
6213
6212
|
decimals: feeDecimals
|
|
6214
|
-
} =
|
|
6215
|
-
const compliantOption =
|
|
6216
|
-
const networkOptions3 =
|
|
6217
|
-
const feeDeduct =
|
|
6213
|
+
} = useSelector37(selectServiceFee);
|
|
6214
|
+
const compliantOption = useSelector37(selectCompliantOption);
|
|
6215
|
+
const networkOptions3 = useSelector37(selectNetworkOption);
|
|
6216
|
+
const feeDeduct = useSelector37(selectFeeDeduct);
|
|
6218
6217
|
const { keplrHandler, closeHandler } = useKimaContext();
|
|
6219
6218
|
const [isCancellingApprove, setCancellingApprove] = useState14(false);
|
|
6220
6219
|
const [isApproving, setApproving] = useState14(false);
|
|
6221
6220
|
const [isSigning, setSigning] = useState14(false);
|
|
6222
|
-
const pendingTxs =
|
|
6223
|
-
const networks =
|
|
6224
|
-
const signature = useSelector38(selectSignature);
|
|
6221
|
+
const pendingTxs = useSelector37(selectPendingTxs);
|
|
6222
|
+
const networks = useSelector37(selectNetworks);
|
|
6225
6223
|
const { width: windowWidth } = useWidth_default();
|
|
6226
6224
|
const { disconnectWallet } = useDisconnectWallet4();
|
|
6227
6225
|
const { balance } = useBalance2();
|
|
@@ -6277,29 +6275,29 @@ var TransferWidget = ({
|
|
|
6277
6275
|
return toast5.error(validationMessage, { icon: /* @__PURE__ */ React111.createElement(Error_default, null) });
|
|
6278
6276
|
}
|
|
6279
6277
|
if (error === "ApprovalNeeded" /* ApprovalNeeded */) {
|
|
6280
|
-
const
|
|
6278
|
+
const sig2 = await signMessage?.({
|
|
6281
6279
|
targetAddress,
|
|
6282
|
-
targetChain: targetChain.
|
|
6280
|
+
targetChain: targetChain.shortName,
|
|
6283
6281
|
originSymbol: sourceCurrency,
|
|
6284
|
-
originChain: sourceChain.
|
|
6282
|
+
originChain: sourceChain.shortName
|
|
6285
6283
|
});
|
|
6286
|
-
|
|
6284
|
+
setSignature2(sig2);
|
|
6287
6285
|
return approve();
|
|
6288
6286
|
}
|
|
6289
6287
|
if (dAppOption === "LPDrain" /* LPDrain */ || dAppOption === "LPAdd" /* LPAdd */) {
|
|
6290
6288
|
keplrHandler && keplrHandler(sourceAddress);
|
|
6291
6289
|
return;
|
|
6292
6290
|
}
|
|
6293
|
-
|
|
6294
|
-
|
|
6291
|
+
let sig = signature;
|
|
6292
|
+
if (!sig) {
|
|
6293
|
+
sig = await signMessage?.({
|
|
6295
6294
|
targetAddress,
|
|
6296
|
-
targetChain: targetChain.
|
|
6295
|
+
targetChain: targetChain.shortName,
|
|
6297
6296
|
originSymbol: sourceCurrency,
|
|
6298
|
-
originChain: sourceChain.
|
|
6297
|
+
originChain: sourceChain.shortName
|
|
6299
6298
|
});
|
|
6300
|
-
setSignature(signature2);
|
|
6301
6299
|
}
|
|
6302
|
-
const { success, message: submitMessage } = await submitTransaction();
|
|
6300
|
+
const { success, message: submitMessage } = await submitTransaction(sig);
|
|
6303
6301
|
if (!success) return toast5.error(submitMessage, { icon: /* @__PURE__ */ React111.createElement(Error_default, null) });
|
|
6304
6302
|
};
|
|
6305
6303
|
const onNext = () => {
|
|
@@ -6525,7 +6523,7 @@ var KimaWidgetWrapper = ({
|
|
|
6525
6523
|
excludedTargetNetworks = []
|
|
6526
6524
|
}) => {
|
|
6527
6525
|
const { kimaBackendUrl } = useKimaContext();
|
|
6528
|
-
const submitted =
|
|
6526
|
+
const submitted = useSelector38(selectSubmitted);
|
|
6529
6527
|
const dispatch = useDispatch26();
|
|
6530
6528
|
const { setThemeMode, setThemeVariables } = useAppKitTheme();
|
|
6531
6529
|
const { data: chainData } = useChainData(kimaBackendUrl);
|