@kimafinance/kima-transaction-widget 1.2.26-beta.1 → 1.2.27-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
@@ -8707,64 +8707,55 @@ var TransferWidget = function TransferWidget(_ref) {
8707
8707
  React.useEffect(function () {
8708
8708
  dispatch(setTheme(theme));
8709
8709
  }, [theme]);
8710
- var updatePendingTxs = React.useCallback(function () {
8711
- try {
8712
- if (!nodeProviderQuery || !walletAddress) return Promise.resolve();
8713
- var _temp9 = _catch(function () {
8714
- return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/transaction/get_htlc_transaction/" + walletAddress)).then(function (result) {
8715
- var data = result === null || result === void 0 ? void 0 : result.htlcLockingTransaction;
8716
- var txData = [];
8717
- if (data.length > 0) {
8718
- for (var _iterator5 = _createForOfIteratorHelperLoose(data), _step5; !(_step5 = _iterator5()).done;) {
8719
- var tx = _step5.value;
8720
- var status = '';
8721
- if (tx.status !== 'Completed') {
8722
- status = 'Confirming';
8723
- } else if (tx.pull_status === 'htlc_pull_available') {
8724
- status = 'Pending';
8725
- } else if (tx.pull_status === 'htlc_pull_in_progress') {
8726
- status = 'In Progress';
8727
- } else if (tx.pull_status === 'htlc_pull_succeed') {
8728
- status = 'Completed';
8729
- } else if (tx.pull_status === 'htlc_pull_failed') {
8730
- status = 'Failed';
8710
+ React.useEffect(function () {
8711
+ if (!nodeProviderQuery || !walletAddress || sourceChain !== exports.SupportNetworks.BTC) return;
8712
+ var updatePendingTxData = function updatePendingTxData() {
8713
+ try {
8714
+ var _temp9 = _catch(function () {
8715
+ return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/transaction/get_htlc_transaction/" + walletAddress)).then(function (result) {
8716
+ var data = result === null || result === void 0 ? void 0 : result.htlcLockingTransaction;
8717
+ var txData = [];
8718
+ if (data.length > 0) {
8719
+ for (var _iterator5 = _createForOfIteratorHelperLoose(data), _step5; !(_step5 = _iterator5()).done;) {
8720
+ var tx = _step5.value;
8721
+ var status = '';
8722
+ if (tx.status !== 'Completed') {
8723
+ status = 'Confirming';
8724
+ } else if (tx.pull_status === 'htlc_pull_available') {
8725
+ status = 'Pending';
8726
+ } else if (tx.pull_status === 'htlc_pull_in_progress') {
8727
+ status = 'In Progress';
8728
+ } else if (tx.pull_status === 'htlc_pull_succeed') {
8729
+ status = 'Completed';
8730
+ } else if (tx.pull_status === 'htlc_pull_failed') {
8731
+ status = 'Failed';
8732
+ }
8733
+ txData.push({
8734
+ hash: tx.txHash,
8735
+ amount: tx.amount,
8736
+ expireTime: tx.htlcTimestamp,
8737
+ status: status
8738
+ });
8731
8739
  }
8732
- txData.push({
8733
- hash: tx.txHash,
8734
- amount: tx.amount,
8735
- expireTime: tx.htlcTimestamp,
8736
- status: status
8737
- });
8740
+ dispatch(setPendingTxData(txData));
8741
+ dispatch(setPendingTxs(txData.filter(function (tx) {
8742
+ return tx.status === 'Pending' || tx.status === 'Confirming';
8743
+ }).length));
8744
+ console.log(txData.filter(function (tx) {
8745
+ return tx.status === 'Pending' || tx.status === 'Confirming';
8746
+ }).length, txData);
8738
8747
  }
8739
- dispatch(setPendingTxData([].concat(txData)));
8740
- dispatch(setPendingTxs(txData.filter(function (tx) {
8741
- return tx.status === 'Pending' || tx.status === 'Confirming';
8742
- }).length));
8743
- console.log(txData.filter(function (tx) {
8744
- return tx.status === 'Pending' || tx.status === 'Confirming';
8745
- }).length, txData);
8746
- }
8748
+ });
8749
+ }, function (e) {
8750
+ console.log(e);
8747
8751
  });
8748
- }, function (e) {
8749
- console.log(e);
8750
- });
8751
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
8752
- } catch (e) {
8753
- return Promise.reject(e);
8754
- }
8755
- }, [nodeProviderQuery, walletAddress]);
8756
- React.useEffect(function () {
8757
- if (sourceChain !== exports.SupportNetworks.BTC) return;
8758
- updatePendingTxs();
8759
- var timerId = setInterval(function () {
8760
- updatePendingTxs();
8761
- }, 10000);
8762
- console.log(timerId);
8763
- return function () {
8764
- console.log('clearInterval', timerId);
8765
- clearInterval(timerId);
8752
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
8753
+ } catch (e) {
8754
+ return Promise.reject(e);
8755
+ }
8766
8756
  };
8767
- }, [updatePendingTxs, sourceChain]);
8757
+ updatePendingTxData();
8758
+ }, [sourceChain, nodeProviderQuery, walletAddress]);
8768
8759
  return React__default.createElement("div", {
8769
8760
  className: "kima-card " + theme.colorMode + " font-" + theme.fontSize,
8770
8761
  style: {