@kimafinance/kima-transaction-widget 1.1.1 → 1.1.2
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 +7 -20
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +8 -19
- package/dist/index.modern.js.map +1 -1
- package/dist/store/optionSlice.d.ts +1 -3
- package/dist/store/selectors.d.ts +2 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -680,7 +680,6 @@ var initialState = {
|
|
|
680
680
|
isSubmitting: false,
|
|
681
681
|
isConfirming: false,
|
|
682
682
|
feeDeduct: false,
|
|
683
|
-
splAllowance: 0,
|
|
684
683
|
errorHandler: function errorHandler() {
|
|
685
684
|
return void 0;
|
|
686
685
|
},
|
|
@@ -748,9 +747,6 @@ var optionSlice = toolkit.createSlice({
|
|
|
748
747
|
setSubmitting: function setSubmitting(state, action) {
|
|
749
748
|
state.isSubmitting = action.payload;
|
|
750
749
|
},
|
|
751
|
-
setSplAllowance: function setSplAllowance(state, action) {
|
|
752
|
-
state.splAllowance = action.payload;
|
|
753
|
-
},
|
|
754
750
|
setErrorHandler: function setErrorHandler(state, action) {
|
|
755
751
|
state.errorHandler = action.payload;
|
|
756
752
|
},
|
|
@@ -802,7 +798,6 @@ var _optionSlice$actions = optionSlice.actions,
|
|
|
802
798
|
setApproving = _optionSlice$actions.setApproving,
|
|
803
799
|
setSubmitting = _optionSlice$actions.setSubmitting,
|
|
804
800
|
setConfirming = _optionSlice$actions.setConfirming,
|
|
805
|
-
setSplAllowance = _optionSlice$actions.setSplAllowance,
|
|
806
801
|
setErrorHandler = _optionSlice$actions.setErrorHandler,
|
|
807
802
|
setCloseHandler = _optionSlice$actions.setCloseHandler,
|
|
808
803
|
setSuccessHandler = _optionSlice$actions.setSuccessHandler,
|
|
@@ -864,9 +859,6 @@ var selectApproving = function selectApproving(state) {
|
|
|
864
859
|
var selectSubmitting = function selectSubmitting(state) {
|
|
865
860
|
return state.option.isSubmitting;
|
|
866
861
|
};
|
|
867
|
-
var selectSplAllowance = function selectSplAllowance(state) {
|
|
868
|
-
return state.option.splAllowance;
|
|
869
|
-
};
|
|
870
862
|
var selectErrorHandler = function selectErrorHandler(state) {
|
|
871
863
|
return state.option.errorHandler;
|
|
872
864
|
};
|
|
@@ -6552,7 +6544,7 @@ var TokenAmount = /*#__PURE__*/function (_BN) {
|
|
|
6552
6544
|
|
|
6553
6545
|
function useAllowance() {
|
|
6554
6546
|
var dispatch = reactRedux.useDispatch();
|
|
6555
|
-
var _useState = React.useState(
|
|
6547
|
+
var _useState = React.useState(0),
|
|
6556
6548
|
allowance = _useState[0],
|
|
6557
6549
|
setAllowance = _useState[1];
|
|
6558
6550
|
var _useState2 = React.useState(null),
|
|
@@ -6573,8 +6565,6 @@ function useAllowance() {
|
|
|
6573
6565
|
}, [selectedNetwork, evmChainId]);
|
|
6574
6566
|
var amount = reactRedux.useSelector(selectAmount);
|
|
6575
6567
|
var serviceFee = reactRedux.useSelector(selectServiceFee);
|
|
6576
|
-
var isApproving = reactRedux.useSelector(selectApproving);
|
|
6577
|
-
var splAllowance = reactRedux.useSelector(selectSplAllowance);
|
|
6578
6568
|
var nodeProviderQuery = reactRedux.useSelector(selectNodeProviderQuery);
|
|
6579
6569
|
var _useConnection = walletAdapterReact.useConnection(),
|
|
6580
6570
|
connection = _useConnection.connection;
|
|
@@ -6589,12 +6579,8 @@ function useAllowance() {
|
|
|
6589
6579
|
targetAddress = _useState3[0],
|
|
6590
6580
|
setTargetAddress = _useState3[1];
|
|
6591
6581
|
var isApproved = React.useMemo(function () {
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
}
|
|
6595
|
-
if (allowance && amount && allowance.gte(units.parseUnits((amount + serviceFee).toString(), decimals))) return true;
|
|
6596
|
-
return false;
|
|
6597
|
-
}, [decimals, sourceChain, allowance, amount, splAllowance, serviceFee]);
|
|
6582
|
+
return allowance >= amount + serviceFee;
|
|
6583
|
+
}, [allowance, amount, serviceFee]);
|
|
6598
6584
|
var updatePoolAddress = function updatePoolAddress() {
|
|
6599
6585
|
try {
|
|
6600
6586
|
return Promise.resolve(_catch(function () {
|
|
@@ -6632,7 +6618,7 @@ function useAllowance() {
|
|
|
6632
6618
|
return Promise.resolve(erc20Contract.decimals()).then(function (decimals) {
|
|
6633
6619
|
return Promise.resolve(erc20Contract.allowance(signerAddress, targetAddress)).then(function (userAllowance) {
|
|
6634
6620
|
setDecimals(+decimals);
|
|
6635
|
-
setAllowance(userAllowance);
|
|
6621
|
+
setAllowance(+units.formatUnits(userAllowance, decimals));
|
|
6636
6622
|
});
|
|
6637
6623
|
});
|
|
6638
6624
|
}
|
|
@@ -6659,7 +6645,7 @@ function useAllowance() {
|
|
|
6659
6645
|
Promise.reject(e);
|
|
6660
6646
|
}
|
|
6661
6647
|
})();
|
|
6662
|
-
}, [signerAddress, tokenAddress, targetAddress,
|
|
6648
|
+
}, [signerAddress, tokenAddress, targetAddress, sourceChain, publicKey]);
|
|
6663
6649
|
var approve = React.useCallback(function () {
|
|
6664
6650
|
try {
|
|
6665
6651
|
var _temp8 = function _temp8(_result4) {
|
|
@@ -6677,7 +6663,7 @@ function useAllowance() {
|
|
|
6677
6663
|
transaction.recentBlockhash = _blockHash$blockhash;
|
|
6678
6664
|
return Promise.resolve(signTransaction(transaction)).then(function (signed) {
|
|
6679
6665
|
return Promise.resolve(connection.sendRawTransaction(signed.serialize())).then(function () {
|
|
6680
|
-
|
|
6666
|
+
setAllowance(amount + serviceFee);
|
|
6681
6667
|
dispatch(setApproving(false));
|
|
6682
6668
|
});
|
|
6683
6669
|
});
|
|
@@ -6706,6 +6692,7 @@ function useAllowance() {
|
|
|
6706
6692
|
return Promise.resolve(erc20Contract.approve(targetAddress, units.parseUnits((amount + serviceFee).toString(), decimals))).then(function (approve) {
|
|
6707
6693
|
return Promise.resolve(approve.wait()).then(function () {
|
|
6708
6694
|
dispatch(setApproving(false));
|
|
6695
|
+
setAllowance(amount + serviceFee);
|
|
6709
6696
|
});
|
|
6710
6697
|
});
|
|
6711
6698
|
}, function (error) {
|