@kimafinance/kima-transaction-widget 1.3.8 → 1.3.9
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 +49 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -39
- 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,9 +2823,7 @@ function useEvmAllowance() {
|
|
|
2823
2823
|
});
|
|
2824
2824
|
return await walletClient.signMessage({
|
|
2825
2825
|
account: walletAddress,
|
|
2826
|
-
message: `
|
|
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 = `
|
|
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 = `
|
|
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) {
|
|
@@ -3960,7 +3954,7 @@ import React113, { useEffect as useEffect20 } from "react";
|
|
|
3960
3954
|
|
|
3961
3955
|
// src/components/KimaWidgetWrapper.tsx
|
|
3962
3956
|
import React112, { useEffect as useEffect19 } from "react";
|
|
3963
|
-
import { useDispatch as useDispatch26, useSelector as
|
|
3957
|
+
import { useDispatch as useDispatch26, useSelector as useSelector39 } from "react-redux";
|
|
3964
3958
|
|
|
3965
3959
|
// src/components/TransactionWidget.tsx
|
|
3966
3960
|
import React101, { useEffect as useEffect13, useMemo as useMemo13, useState as useState10 } from "react";
|
|
@@ -5276,7 +5270,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
5276
5270
|
|
|
5277
5271
|
// src/components/TransferWidget.tsx
|
|
5278
5272
|
import React111, { useEffect as useEffect18, useState as useState14, useRef as useRef7 } from "react";
|
|
5279
|
-
import { useDispatch as useDispatch25, useSelector as
|
|
5273
|
+
import { useDispatch as useDispatch25, useSelector as useSelector38 } from "react-redux";
|
|
5280
5274
|
|
|
5281
5275
|
// src/components/reusable/SingleForm.tsx
|
|
5282
5276
|
import React103, { useEffect as useEffect15, useMemo as useMemo15, useState as useState12 } from "react";
|
|
@@ -6038,6 +6032,7 @@ var useValidateTransaction_default = useValidateTransaction;
|
|
|
6038
6032
|
// src/hooks/useSubmitTransaction.tsx
|
|
6039
6033
|
import { useState as useState13 } from "react";
|
|
6040
6034
|
import { useDispatch as useDispatch24 } from "react-redux";
|
|
6035
|
+
import { useSelector as useSelector37 } from "react-redux";
|
|
6041
6036
|
var useSubmitTransaction = ({
|
|
6042
6037
|
amount,
|
|
6043
6038
|
totalFee,
|
|
@@ -6052,7 +6047,8 @@ var useSubmitTransaction = ({
|
|
|
6052
6047
|
}) => {
|
|
6053
6048
|
const dispatch = useDispatch24();
|
|
6054
6049
|
const [isSubmitting, setSubmitting] = useState13(false);
|
|
6055
|
-
const
|
|
6050
|
+
const signature = useSelector37(selectSignature);
|
|
6051
|
+
const submitTransaction = async () => {
|
|
6056
6052
|
try {
|
|
6057
6053
|
setSubmitting(true);
|
|
6058
6054
|
const params = JSON.stringify({
|
|
@@ -6198,33 +6194,34 @@ var TransferWidget = ({
|
|
|
6198
6194
|
const mainRef = useRef7(null);
|
|
6199
6195
|
const [formStep, setFormStep] = useState14(0);
|
|
6200
6196
|
const [warningModalOpen, setWarningModalOpen] = useState14(null);
|
|
6201
|
-
const dAppOption =
|
|
6202
|
-
const mode =
|
|
6203
|
-
const transactionOption =
|
|
6204
|
-
const backendUrl =
|
|
6205
|
-
const sourceAddress =
|
|
6206
|
-
const targetAddress =
|
|
6207
|
-
const sourceChain =
|
|
6208
|
-
const targetChain =
|
|
6209
|
-
const sourceCurrency =
|
|
6210
|
-
const targetCurrency =
|
|
6211
|
-
const amount =
|
|
6197
|
+
const dAppOption = useSelector38(selectDappOption);
|
|
6198
|
+
const mode = useSelector38(selectMode);
|
|
6199
|
+
const transactionOption = useSelector38(selectTransactionOption);
|
|
6200
|
+
const backendUrl = useSelector38(selectBackendUrl);
|
|
6201
|
+
const sourceAddress = useSelector38(selectSourceAddress);
|
|
6202
|
+
const targetAddress = useSelector38(selectTargetAddress);
|
|
6203
|
+
const sourceChain = useSelector38(selectSourceChain);
|
|
6204
|
+
const targetChain = useSelector38(selectTargetChain);
|
|
6205
|
+
const sourceCurrency = useSelector38(selectSourceCurrency);
|
|
6206
|
+
const targetCurrency = useSelector38(selectTargetCurrency);
|
|
6207
|
+
const amount = useSelector38(selectAmount);
|
|
6212
6208
|
const {
|
|
6213
6209
|
totalFeeUsd,
|
|
6214
6210
|
totalFee,
|
|
6215
6211
|
targetNetworkFee,
|
|
6216
6212
|
submitAmount,
|
|
6217
6213
|
decimals: feeDecimals
|
|
6218
|
-
} =
|
|
6219
|
-
const compliantOption =
|
|
6220
|
-
const networkOptions3 =
|
|
6221
|
-
const feeDeduct =
|
|
6214
|
+
} = useSelector38(selectServiceFee);
|
|
6215
|
+
const compliantOption = useSelector38(selectCompliantOption);
|
|
6216
|
+
const networkOptions3 = useSelector38(selectNetworkOption);
|
|
6217
|
+
const feeDeduct = useSelector38(selectFeeDeduct);
|
|
6222
6218
|
const { keplrHandler, closeHandler } = useKimaContext();
|
|
6223
6219
|
const [isCancellingApprove, setCancellingApprove] = useState14(false);
|
|
6224
6220
|
const [isApproving, setApproving] = useState14(false);
|
|
6225
6221
|
const [isSigning, setSigning] = useState14(false);
|
|
6226
|
-
const pendingTxs =
|
|
6227
|
-
const networks =
|
|
6222
|
+
const pendingTxs = useSelector38(selectPendingTxs);
|
|
6223
|
+
const networks = useSelector38(selectNetworks);
|
|
6224
|
+
const signature = useSelector38(selectSignature);
|
|
6228
6225
|
const { width: windowWidth } = useWidth_default();
|
|
6229
6226
|
const { disconnectWallet } = useDisconnectWallet4();
|
|
6230
6227
|
const { balance } = useBalance2();
|
|
@@ -6280,20 +6277,29 @@ var TransferWidget = ({
|
|
|
6280
6277
|
return toast5.error(validationMessage, { icon: /* @__PURE__ */ React111.createElement(Error_default, null) });
|
|
6281
6278
|
}
|
|
6282
6279
|
if (error === "ApprovalNeeded" /* ApprovalNeeded */) {
|
|
6280
|
+
const signature2 = await signMessage?.({
|
|
6281
|
+
targetAddress,
|
|
6282
|
+
targetChain: targetChain.name,
|
|
6283
|
+
originSymbol: sourceCurrency,
|
|
6284
|
+
originChain: sourceChain.name
|
|
6285
|
+
});
|
|
6286
|
+
setSignature(signature2);
|
|
6283
6287
|
return approve();
|
|
6284
6288
|
}
|
|
6285
6289
|
if (dAppOption === "LPDrain" /* LPDrain */ || dAppOption === "LPAdd" /* LPAdd */) {
|
|
6286
6290
|
keplrHandler && keplrHandler(sourceAddress);
|
|
6287
6291
|
return;
|
|
6288
6292
|
}
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6293
|
+
if (!signature?.length) {
|
|
6294
|
+
const signature2 = await signMessage?.({
|
|
6295
|
+
targetAddress,
|
|
6296
|
+
targetChain: targetChain.name,
|
|
6297
|
+
originSymbol: sourceCurrency,
|
|
6298
|
+
originChain: sourceChain.name
|
|
6299
|
+
});
|
|
6300
|
+
setSignature(signature2);
|
|
6301
|
+
}
|
|
6302
|
+
const { success, message: submitMessage } = await submitTransaction();
|
|
6297
6303
|
if (!success) return toast5.error(submitMessage, { icon: /* @__PURE__ */ React111.createElement(Error_default, null) });
|
|
6298
6304
|
};
|
|
6299
6305
|
const onNext = () => {
|
|
@@ -6519,7 +6525,7 @@ var KimaWidgetWrapper = ({
|
|
|
6519
6525
|
excludedTargetNetworks = []
|
|
6520
6526
|
}) => {
|
|
6521
6527
|
const { kimaBackendUrl } = useKimaContext();
|
|
6522
|
-
const submitted =
|
|
6528
|
+
const submitted = useSelector39(selectSubmitted);
|
|
6523
6529
|
const dispatch = useDispatch26();
|
|
6524
6530
|
const { setThemeMode, setThemeVariables } = useAppKitTheme();
|
|
6525
6531
|
const { data: chainData } = useChainData(kimaBackendUrl);
|
|
@@ -6595,7 +6601,7 @@ var KimaTransactionWidget = ({
|
|
|
6595
6601
|
titleOption,
|
|
6596
6602
|
paymentTitleOption,
|
|
6597
6603
|
helpURL = "",
|
|
6598
|
-
compliantOption =
|
|
6604
|
+
compliantOption = false,
|
|
6599
6605
|
transactionOption,
|
|
6600
6606
|
excludedSourceNetworks = [],
|
|
6601
6607
|
excludedTargetNetworks = []
|