@kimafinance/kima-transaction-widget 1.2.23-beta.1 → 1.2.24-beta.1
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 +93 -3
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +81 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/store/optionSlice.d.ts +468 -1
- package/dist/store/selectors.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -936,6 +936,8 @@ var createSlice = toolkitRaw.createSlice;
|
|
|
936
936
|
var initialState = {
|
|
937
937
|
theme: {},
|
|
938
938
|
tokenOptions: {},
|
|
939
|
+
pendingTxs: 0,
|
|
940
|
+
pendingTxData: [],
|
|
939
941
|
kimaExplorerUrl: 'explorer.kima.finance',
|
|
940
942
|
mode: exports.ModeOptions.bridge,
|
|
941
943
|
sourceChain: '',
|
|
@@ -1014,6 +1016,12 @@ var optionSlice = createSlice({
|
|
|
1014
1016
|
state.targetNetworkFetching = false;
|
|
1015
1017
|
state.signature = '';
|
|
1016
1018
|
},
|
|
1019
|
+
setPendingTxs: function setPendingTxs(state, action) {
|
|
1020
|
+
state.pendingTxs = action.payload;
|
|
1021
|
+
},
|
|
1022
|
+
setPendingTxData: function setPendingTxData(state, action) {
|
|
1023
|
+
state.pendingTxData = action.payload;
|
|
1024
|
+
},
|
|
1017
1025
|
setTokenOptions: function setTokenOptions(state, action) {
|
|
1018
1026
|
state.tokenOptions = action.payload;
|
|
1019
1027
|
},
|
|
@@ -1196,7 +1204,9 @@ var _optionSlice$actions = optionSlice.actions,
|
|
|
1196
1204
|
setSignature = _optionSlice$actions.setSignature,
|
|
1197
1205
|
setUuid = _optionSlice$actions.setUuid,
|
|
1198
1206
|
setKYCStatus = _optionSlice$actions.setKYCStatus,
|
|
1199
|
-
setExpireTime = _optionSlice$actions.setExpireTime
|
|
1207
|
+
setExpireTime = _optionSlice$actions.setExpireTime,
|
|
1208
|
+
setPendingTxData = _optionSlice$actions.setPendingTxData,
|
|
1209
|
+
setPendingTxs = _optionSlice$actions.setPendingTxs;
|
|
1200
1210
|
var optionReducer = optionSlice.reducer;
|
|
1201
1211
|
|
|
1202
1212
|
var configureStore = toolkitRaw.configureStore;
|
|
@@ -1589,6 +1599,12 @@ var selectKycStatus = function selectKycStatus(state) {
|
|
|
1589
1599
|
var selectExpireTime = function selectExpireTime(state) {
|
|
1590
1600
|
return state.option.expireTime;
|
|
1591
1601
|
};
|
|
1602
|
+
var selectPendingTxs = function selectPendingTxs(state) {
|
|
1603
|
+
return state.option.pendingTxs;
|
|
1604
|
+
};
|
|
1605
|
+
var selectPendingTxData = function selectPendingTxData(state) {
|
|
1606
|
+
return state.option.pendingTxData;
|
|
1607
|
+
};
|
|
1592
1608
|
|
|
1593
1609
|
var Loading180Ring = function Loading180Ring(_ref) {
|
|
1594
1610
|
var _ref$width = _ref.width,
|
|
@@ -3368,6 +3384,24 @@ var BankInput = function BankInput() {
|
|
|
3368
3384
|
})));
|
|
3369
3385
|
};
|
|
3370
3386
|
|
|
3387
|
+
var TxButton = function TxButton(_ref) {
|
|
3388
|
+
var theme = _ref.theme,
|
|
3389
|
+
txCount = _ref.txCount;
|
|
3390
|
+
var dispatch = reactRedux.useDispatch();
|
|
3391
|
+
var handleClick = function handleClick() {
|
|
3392
|
+
dispatch(setPendingTxPopup(true));
|
|
3393
|
+
};
|
|
3394
|
+
return React__default.createElement("button", {
|
|
3395
|
+
className: "secondary-button tx-button " + theme.colorMode,
|
|
3396
|
+
onClick: handleClick,
|
|
3397
|
+
"data-tooltip-id": 'popup-tooltip'
|
|
3398
|
+
}, txCount, React__default.createElement(Loading180Ring, {
|
|
3399
|
+
height: 16,
|
|
3400
|
+
width: 16,
|
|
3401
|
+
fill: theme.colorMode === 'light' ? 'black' : 'white'
|
|
3402
|
+
}));
|
|
3403
|
+
};
|
|
3404
|
+
|
|
3371
3405
|
var HelpPopup = function HelpPopup() {
|
|
3372
3406
|
var dispatch = reactRedux.useDispatch();
|
|
3373
3407
|
var theme = reactRedux.useSelector(selectTheme);
|
|
@@ -8298,7 +8332,8 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
8298
8332
|
var _useIsWalletReady = useIsWalletReady(),
|
|
8299
8333
|
isReady = _useIsWalletReady.isReady,
|
|
8300
8334
|
walletAddress = _useIsWalletReady.walletAddress;
|
|
8301
|
-
var pendingTxData =
|
|
8335
|
+
var pendingTxData = reactRedux.useSelector(selectPendingTxData);
|
|
8336
|
+
var pendingTxs = reactRedux.useSelector(selectPendingTxs);
|
|
8302
8337
|
var _useAllowance = useAllowance({
|
|
8303
8338
|
setApproving: setApproving
|
|
8304
8339
|
}),
|
|
@@ -8768,6 +8803,58 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
8768
8803
|
React.useEffect(function () {
|
|
8769
8804
|
dispatch(setTheme(theme));
|
|
8770
8805
|
}, [theme]);
|
|
8806
|
+
var updatePendingTxs = function updatePendingTxs() {
|
|
8807
|
+
try {
|
|
8808
|
+
var _temp9 = _catch(function () {
|
|
8809
|
+
return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/transaction/get_htlc_transaction/" + walletAddress)).then(function (result) {
|
|
8810
|
+
var data = result === null || result === void 0 ? void 0 : result.htlcLockingTransaction;
|
|
8811
|
+
var txData = [];
|
|
8812
|
+
if (data.length > 0) {
|
|
8813
|
+
for (var _iterator5 = _createForOfIteratorHelperLoose(data), _step5; !(_step5 = _iterator5()).done;) {
|
|
8814
|
+
var tx = _step5.value;
|
|
8815
|
+
var status = '';
|
|
8816
|
+
if (tx.status !== 'Completed') {
|
|
8817
|
+
status = 'Confirming';
|
|
8818
|
+
} else if (tx.pull_status === 'htlc_pull_available') {
|
|
8819
|
+
status = 'Pending';
|
|
8820
|
+
} else if (tx.pull_status === 'htlc_pull_in_progress') {
|
|
8821
|
+
status = 'In Progress';
|
|
8822
|
+
} else if (tx.pull_status === 'htlc_pull_succeed') {
|
|
8823
|
+
status = 'Completed';
|
|
8824
|
+
} else if (tx.pull_status === 'htlc_pull_failed') {
|
|
8825
|
+
status = 'Failed';
|
|
8826
|
+
}
|
|
8827
|
+
txData.push({
|
|
8828
|
+
hash: tx.txHash,
|
|
8829
|
+
amount: tx.amount,
|
|
8830
|
+
expireTime: tx.htlcTimestamp,
|
|
8831
|
+
status: status
|
|
8832
|
+
});
|
|
8833
|
+
}
|
|
8834
|
+
dispatch(setPendingTxData([].concat(txData)));
|
|
8835
|
+
dispatch(setPendingTxs(txData.filter(function (tx) {
|
|
8836
|
+
return tx.status === 'Pending' || tx.status === 'Confirming';
|
|
8837
|
+
}).length));
|
|
8838
|
+
}
|
|
8839
|
+
});
|
|
8840
|
+
}, function (e) {
|
|
8841
|
+
console.log(e);
|
|
8842
|
+
});
|
|
8843
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
|
8844
|
+
} catch (e) {
|
|
8845
|
+
return Promise.reject(e);
|
|
8846
|
+
}
|
|
8847
|
+
};
|
|
8848
|
+
React.useEffect(function () {
|
|
8849
|
+
if (!nodeProviderQuery || sourceChain !== exports.SupportNetworks.BTC || !walletAddress) return;
|
|
8850
|
+
updatePendingTxs();
|
|
8851
|
+
var timerId = setInterval(function () {
|
|
8852
|
+
updatePendingTxs();
|
|
8853
|
+
}, 10000);
|
|
8854
|
+
return function () {
|
|
8855
|
+
clearInterval(timerId);
|
|
8856
|
+
};
|
|
8857
|
+
}, [sourceChain, nodeProviderQuery, walletAddress]);
|
|
8771
8858
|
return React__default.createElement("div", {
|
|
8772
8859
|
className: "kima-card " + theme.colorMode + " font-" + theme.fontSize,
|
|
8773
8860
|
style: {
|
|
@@ -8782,7 +8869,10 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
8782
8869
|
className: 'title'
|
|
8783
8870
|
}, React__default.createElement("h3", null, isWizard && wizardStep === 3 || !isWizard && formStep > 0 ? titleOption !== null && titleOption !== void 0 && titleOption.confirmTitle ? titleOption === null || titleOption === void 0 ? void 0 : titleOption.confirmTitle : 'Transfer Details' : titleOption !== null && titleOption !== void 0 && titleOption.initialTitle ? titleOption === null || titleOption === void 0 ? void 0 : titleOption.initialTitle : 'New Transfer')), React__default.createElement("div", {
|
|
8784
8871
|
className: 'control-buttons'
|
|
8785
|
-
},
|
|
8872
|
+
}, pendingTxs > 0 ? React__default.createElement(TxButton, {
|
|
8873
|
+
theme: theme,
|
|
8874
|
+
txCount: pendingTxs
|
|
8875
|
+
}) : null, React__default.createElement(ExternalLink, {
|
|
8786
8876
|
to: helpURL ? helpURL : 'https://docs.kima.finance/demo'
|
|
8787
8877
|
}, React__default.createElement("div", {
|
|
8788
8878
|
className: 'menu-button'
|