@kimafinance/kima-transaction-widget 1.2.31-beta.1 → 1.2.32-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 CHANGED
@@ -1204,7 +1204,9 @@ var _optionSlice$actions = optionSlice.actions,
1204
1204
  setSignature = _optionSlice$actions.setSignature,
1205
1205
  setUuid = _optionSlice$actions.setUuid,
1206
1206
  setKYCStatus = _optionSlice$actions.setKYCStatus,
1207
- setExpireTime = _optionSlice$actions.setExpireTime;
1207
+ setExpireTime = _optionSlice$actions.setExpireTime,
1208
+ setPendingTxData = _optionSlice$actions.setPendingTxData,
1209
+ setPendingTxs = _optionSlice$actions.setPendingTxs;
1208
1210
  var optionReducer = optionSlice.reducer;
1209
1211
 
1210
1212
  var configureStore = toolkitRaw.configureStore;
@@ -8662,6 +8664,47 @@ var TransferWidget = function TransferWidget(_ref) {
8662
8664
  React.useEffect(function () {
8663
8665
  dispatch(setTheme(theme));
8664
8666
  }, [theme]);
8667
+ React.useEffect(function () {
8668
+ if (!nodeProviderQuery || sourceChain !== exports.SupportNetworks.BTC || !walletAddress) return;
8669
+ var updatePendingTxs = function updatePendingTxs() {
8670
+ try {
8671
+ return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/transaction/get_htlc_transaction/" + walletAddress)).then(function (result) {
8672
+ var data = result === null || result === void 0 ? void 0 : result.htlcLockingTransaction;
8673
+ var txData = [];
8674
+ if (data.length > 0) {
8675
+ for (var _iterator5 = _createForOfIteratorHelperLoose(data), _step5; !(_step5 = _iterator5()).done;) {
8676
+ var tx = _step5.value;
8677
+ var status = '';
8678
+ if (tx.status !== 'Completed') {
8679
+ status = 'Confirming';
8680
+ } else if (tx.pull_status === 'htlc_pull_available') {
8681
+ status = 'Pending';
8682
+ } else if (tx.pull_status === 'htlc_pull_in_progress') {
8683
+ status = 'In Progress';
8684
+ } else if (tx.pull_status === 'htlc_pull_succeed') {
8685
+ status = 'Completed';
8686
+ } else if (tx.pull_status === 'htlc_pull_failed') {
8687
+ status = 'Failed';
8688
+ }
8689
+ txData.push({
8690
+ hash: tx.txHash,
8691
+ amount: tx.amount,
8692
+ expireTime: tx.htlcTimestamp,
8693
+ status: status
8694
+ });
8695
+ }
8696
+ dispatch(setPendingTxData(txData));
8697
+ dispatch(setPendingTxs(txData.filter(function (tx) {
8698
+ return tx.status === 'Pending' || tx.status === 'Confirming';
8699
+ }).length));
8700
+ }
8701
+ });
8702
+ } catch (e) {
8703
+ return Promise.reject(e);
8704
+ }
8705
+ };
8706
+ updatePendingTxs();
8707
+ }, [sourceChain, nodeProviderQuery, walletAddress]);
8665
8708
  return React__default.createElement("div", {
8666
8709
  className: "kima-card " + theme.colorMode + " font-" + theme.fontSize,
8667
8710
  style: {