@kimafinance/kima-transaction-widget 1.3.9 → 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 +33 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -31
- 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.cjs
CHANGED
|
@@ -3910,7 +3910,7 @@ var import_react136 = __toESM(require("react"), 1);
|
|
|
3910
3910
|
|
|
3911
3911
|
// src/components/KimaWidgetWrapper.tsx
|
|
3912
3912
|
var import_react134 = __toESM(require("react"), 1);
|
|
3913
|
-
var
|
|
3913
|
+
var import_react_redux52 = require("react-redux");
|
|
3914
3914
|
|
|
3915
3915
|
// src/components/TransactionWidget.tsx
|
|
3916
3916
|
var import_react121 = __toESM(require("react"), 1);
|
|
@@ -5226,7 +5226,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
5226
5226
|
|
|
5227
5227
|
// src/components/TransferWidget.tsx
|
|
5228
5228
|
var import_react133 = __toESM(require("react"), 1);
|
|
5229
|
-
var
|
|
5229
|
+
var import_react_redux51 = require("react-redux");
|
|
5230
5230
|
|
|
5231
5231
|
// src/components/reusable/SingleForm.tsx
|
|
5232
5232
|
var import_react123 = __toESM(require("react"), 1);
|
|
@@ -5988,7 +5988,6 @@ var useValidateTransaction_default = useValidateTransaction;
|
|
|
5988
5988
|
// src/hooks/useSubmitTransaction.tsx
|
|
5989
5989
|
var import_react131 = require("react");
|
|
5990
5990
|
var import_react_redux50 = require("react-redux");
|
|
5991
|
-
var import_react_redux51 = require("react-redux");
|
|
5992
5991
|
var useSubmitTransaction = ({
|
|
5993
5992
|
amount,
|
|
5994
5993
|
totalFee,
|
|
@@ -6003,8 +6002,7 @@ var useSubmitTransaction = ({
|
|
|
6003
6002
|
}) => {
|
|
6004
6003
|
const dispatch = (0, import_react_redux50.useDispatch)();
|
|
6005
6004
|
const [isSubmitting, setSubmitting] = (0, import_react131.useState)(false);
|
|
6006
|
-
const
|
|
6007
|
-
const submitTransaction = async () => {
|
|
6005
|
+
const submitTransaction = async (signature) => {
|
|
6008
6006
|
try {
|
|
6009
6007
|
setSubmitting(true);
|
|
6010
6008
|
const params = JSON.stringify({
|
|
@@ -6022,7 +6020,7 @@ var useSubmitTransaction = ({
|
|
|
6022
6020
|
htlcExpirationTimestamp: "0",
|
|
6023
6021
|
htlcVersion: "",
|
|
6024
6022
|
senderPubKey: "",
|
|
6025
|
-
options: signature
|
|
6023
|
+
options: JSON.stringify({ signature })
|
|
6026
6024
|
});
|
|
6027
6025
|
const transactionResult = await fetchWrapper.post(
|
|
6028
6026
|
`${backendUrl}/submit`,
|
|
@@ -6146,38 +6144,38 @@ var TransferWidget = ({
|
|
|
6146
6144
|
titleOption,
|
|
6147
6145
|
paymentTitleOption
|
|
6148
6146
|
}) => {
|
|
6149
|
-
const dispatch = (0,
|
|
6147
|
+
const dispatch = (0, import_react_redux51.useDispatch)();
|
|
6150
6148
|
const mainRef = (0, import_react133.useRef)(null);
|
|
6149
|
+
const [signature, setSignature2] = (0, import_react133.useState)("");
|
|
6151
6150
|
const [formStep, setFormStep] = (0, import_react133.useState)(0);
|
|
6152
6151
|
const [warningModalOpen, setWarningModalOpen] = (0, import_react133.useState)(null);
|
|
6153
|
-
const dAppOption = (0,
|
|
6154
|
-
const mode = (0,
|
|
6155
|
-
const transactionOption = (0,
|
|
6156
|
-
const backendUrl = (0,
|
|
6157
|
-
const sourceAddress = (0,
|
|
6158
|
-
const targetAddress = (0,
|
|
6159
|
-
const sourceChain = (0,
|
|
6160
|
-
const targetChain = (0,
|
|
6161
|
-
const sourceCurrency = (0,
|
|
6162
|
-
const targetCurrency = (0,
|
|
6163
|
-
const amount = (0,
|
|
6152
|
+
const dAppOption = (0, import_react_redux51.useSelector)(selectDappOption);
|
|
6153
|
+
const mode = (0, import_react_redux51.useSelector)(selectMode);
|
|
6154
|
+
const transactionOption = (0, import_react_redux51.useSelector)(selectTransactionOption);
|
|
6155
|
+
const backendUrl = (0, import_react_redux51.useSelector)(selectBackendUrl);
|
|
6156
|
+
const sourceAddress = (0, import_react_redux51.useSelector)(selectSourceAddress);
|
|
6157
|
+
const targetAddress = (0, import_react_redux51.useSelector)(selectTargetAddress);
|
|
6158
|
+
const sourceChain = (0, import_react_redux51.useSelector)(selectSourceChain);
|
|
6159
|
+
const targetChain = (0, import_react_redux51.useSelector)(selectTargetChain);
|
|
6160
|
+
const sourceCurrency = (0, import_react_redux51.useSelector)(selectSourceCurrency);
|
|
6161
|
+
const targetCurrency = (0, import_react_redux51.useSelector)(selectTargetCurrency);
|
|
6162
|
+
const amount = (0, import_react_redux51.useSelector)(selectAmount);
|
|
6164
6163
|
const {
|
|
6165
6164
|
totalFeeUsd,
|
|
6166
6165
|
totalFee,
|
|
6167
6166
|
targetNetworkFee,
|
|
6168
6167
|
submitAmount,
|
|
6169
6168
|
decimals: feeDecimals
|
|
6170
|
-
} = (0,
|
|
6171
|
-
const compliantOption = (0,
|
|
6172
|
-
const networkOptions3 = (0,
|
|
6173
|
-
const feeDeduct = (0,
|
|
6169
|
+
} = (0, import_react_redux51.useSelector)(selectServiceFee);
|
|
6170
|
+
const compliantOption = (0, import_react_redux51.useSelector)(selectCompliantOption);
|
|
6171
|
+
const networkOptions3 = (0, import_react_redux51.useSelector)(selectNetworkOption);
|
|
6172
|
+
const feeDeduct = (0, import_react_redux51.useSelector)(selectFeeDeduct);
|
|
6174
6173
|
const { keplrHandler, closeHandler } = useKimaContext();
|
|
6175
6174
|
const [isCancellingApprove, setCancellingApprove] = (0, import_react133.useState)(false);
|
|
6176
6175
|
const [isApproving, setApproving] = (0, import_react133.useState)(false);
|
|
6177
6176
|
const [isSigning, setSigning] = (0, import_react133.useState)(false);
|
|
6178
|
-
const pendingTxs = (0,
|
|
6179
|
-
const networks = (0,
|
|
6180
|
-
const signature = (0, import_react_redux52.useSelector)(selectSignature);
|
|
6177
|
+
const pendingTxs = (0, import_react_redux51.useSelector)(selectPendingTxs);
|
|
6178
|
+
const networks = (0, import_react_redux51.useSelector)(selectNetworks);
|
|
6181
6179
|
const { width: windowWidth } = useWidth_default();
|
|
6182
6180
|
const { disconnectWallet } = useDisconnectWallet4();
|
|
6183
6181
|
const { balance } = useBalance2();
|
|
@@ -6233,29 +6231,29 @@ var TransferWidget = ({
|
|
|
6233
6231
|
return import_react_hot_toast5.toast.error(validationMessage, { icon: /* @__PURE__ */ import_react133.default.createElement(Error_default, null) });
|
|
6234
6232
|
}
|
|
6235
6233
|
if (error === "ApprovalNeeded" /* ApprovalNeeded */) {
|
|
6236
|
-
const
|
|
6234
|
+
const sig2 = await signMessage?.({
|
|
6237
6235
|
targetAddress,
|
|
6238
6236
|
targetChain: targetChain.name,
|
|
6239
6237
|
originSymbol: sourceCurrency,
|
|
6240
6238
|
originChain: sourceChain.name
|
|
6241
6239
|
});
|
|
6242
|
-
|
|
6240
|
+
setSignature2(sig2);
|
|
6243
6241
|
return approve();
|
|
6244
6242
|
}
|
|
6245
6243
|
if (dAppOption === "LPDrain" /* LPDrain */ || dAppOption === "LPAdd" /* LPAdd */) {
|
|
6246
6244
|
keplrHandler && keplrHandler(sourceAddress);
|
|
6247
6245
|
return;
|
|
6248
6246
|
}
|
|
6249
|
-
|
|
6250
|
-
|
|
6247
|
+
let sig = signature;
|
|
6248
|
+
if (!sig) {
|
|
6249
|
+
sig = await signMessage?.({
|
|
6251
6250
|
targetAddress,
|
|
6252
6251
|
targetChain: targetChain.name,
|
|
6253
6252
|
originSymbol: sourceCurrency,
|
|
6254
6253
|
originChain: sourceChain.name
|
|
6255
6254
|
});
|
|
6256
|
-
setSignature(signature2);
|
|
6257
6255
|
}
|
|
6258
|
-
const { success, message: submitMessage } = await submitTransaction();
|
|
6256
|
+
const { success, message: submitMessage } = await submitTransaction(sig);
|
|
6259
6257
|
if (!success) return import_react_hot_toast5.toast.error(submitMessage, { icon: /* @__PURE__ */ import_react133.default.createElement(Error_default, null) });
|
|
6260
6258
|
};
|
|
6261
6259
|
const onNext = () => {
|
|
@@ -6481,8 +6479,8 @@ var KimaWidgetWrapper = ({
|
|
|
6481
6479
|
excludedTargetNetworks = []
|
|
6482
6480
|
}) => {
|
|
6483
6481
|
const { kimaBackendUrl } = useKimaContext();
|
|
6484
|
-
const submitted = (0,
|
|
6485
|
-
const dispatch = (0,
|
|
6482
|
+
const submitted = (0, import_react_redux52.useSelector)(selectSubmitted);
|
|
6483
|
+
const dispatch = (0, import_react_redux52.useDispatch)();
|
|
6486
6484
|
const { setThemeMode, setThemeVariables } = (0, import_react135.useAppKitTheme)();
|
|
6487
6485
|
const { data: chainData } = useChainData(kimaBackendUrl);
|
|
6488
6486
|
const { data: envOptions } = useGetEnvOptions({ kimaBackendUrl });
|
|
@@ -6548,7 +6546,7 @@ var KimaWidgetWrapper = ({
|
|
|
6548
6546
|
var KimaWidgetWrapper_default = KimaWidgetWrapper;
|
|
6549
6547
|
|
|
6550
6548
|
// src/components/KimaTransactionWidget.tsx
|
|
6551
|
-
var
|
|
6549
|
+
var import_react_redux53 = require("react-redux");
|
|
6552
6550
|
var KimaTransactionWidget = ({
|
|
6553
6551
|
mode,
|
|
6554
6552
|
txId,
|
|
@@ -6562,7 +6560,7 @@ var KimaTransactionWidget = ({
|
|
|
6562
6560
|
excludedSourceNetworks = [],
|
|
6563
6561
|
excludedTargetNetworks = []
|
|
6564
6562
|
}) => {
|
|
6565
|
-
const dispatch = (0,
|
|
6563
|
+
const dispatch = (0, import_react_redux53.useDispatch)();
|
|
6566
6564
|
const { kimaBackendUrl } = useKimaContext();
|
|
6567
6565
|
const { isLoading: isLoadingEnvs } = useGetEnvOptions({
|
|
6568
6566
|
kimaBackendUrl
|