@goodaofi/bonds-sdk 3.0.138 → 3.0.139
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/main.js
CHANGED
|
@@ -95159,7 +95159,7 @@ const transformPrivatePartnerData = (rawData, isFake) => {
|
|
|
95159
95159
|
};
|
|
95160
95160
|
|
|
95161
95161
|
const stepDelay = 1000;
|
|
95162
|
-
const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, inputToken, inputValue, buyTxHash, rateChanged, }) => {
|
|
95162
|
+
const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, inputToken, inputValue, buyTxHash, rateChanged, onTransactionSuccess, }) => {
|
|
95163
95163
|
var _a;
|
|
95164
95164
|
// Hooks
|
|
95165
95165
|
const { chain } = useAccount();
|
|
@@ -95246,6 +95246,7 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
95246
95246
|
useEffect(() => {
|
|
95247
95247
|
if (buyTxHash && txReceipt) {
|
|
95248
95248
|
if (isSuccess) {
|
|
95249
|
+
onTransactionSuccess === null || onTransactionSuccess === void 0 ? void 0 : onTransactionSuccess();
|
|
95249
95250
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
95250
95251
|
}
|
|
95251
95252
|
}
|
|
@@ -95276,9 +95277,10 @@ const GooPrivatePartners = () => {
|
|
|
95276
95277
|
const { address: account } = useAccount();
|
|
95277
95278
|
const currentChainId = useChainId();
|
|
95278
95279
|
const { writeContractAsync } = useWriteContract();
|
|
95279
|
-
const { addToastError
|
|
95280
|
+
const { addToastError } = usePopups();
|
|
95280
95281
|
const { data: privatePartnerInfo, isLoading, error, refetch } = usePrivatePartnerInfo();
|
|
95281
95282
|
const { switchChain } = useSwitchChain();
|
|
95283
|
+
const queryClient = useQueryClient();
|
|
95282
95284
|
const chainId = (privatePartnerInfo === null || privatePartnerInfo === void 0 ? void 0 : privatePartnerInfo.chainId) || currentChainId;
|
|
95283
95285
|
const depositToken = privatePartnerInfo === null || privatePartnerInfo === void 0 ? void 0 : privatePartnerInfo.contract.principalToken;
|
|
95284
95286
|
const depositContract = privatePartnerInfo === null || privatePartnerInfo === void 0 ? void 0 : privatePartnerInfo.contract.address;
|
|
@@ -95355,9 +95357,7 @@ const GooPrivatePartners = () => {
|
|
|
95355
95357
|
});
|
|
95356
95358
|
if (hash) {
|
|
95357
95359
|
setBuyTxHash(hash);
|
|
95358
|
-
addToastSuccess('Deposit successful!');
|
|
95359
95360
|
setInputValue('0');
|
|
95360
|
-
refetch();
|
|
95361
95361
|
}
|
|
95362
95362
|
}
|
|
95363
95363
|
catch (error) {
|
|
@@ -95368,7 +95368,16 @@ const GooPrivatePartners = () => {
|
|
|
95368
95368
|
setLoadingTx(false);
|
|
95369
95369
|
}
|
|
95370
95370
|
});
|
|
95371
|
-
const
|
|
95371
|
+
const handleTransactionSuccess = () => {
|
|
95372
|
+
// Refetch data after successful transaction
|
|
95373
|
+
refetch();
|
|
95374
|
+
// Invalidate token balance query to update the balance
|
|
95375
|
+
const balanceQueryKey = `${QUERY_KEYS.USER_TOKENS_BALANCES}-${depositToken === null || depositToken === void 0 ? void 0 : depositToken.address[chainId]}-${account}`;
|
|
95376
|
+
queryClient.invalidateQueries({ queryKey: [balanceQueryKey] });
|
|
95377
|
+
// Reset transaction hash
|
|
95378
|
+
setBuyTxHash('');
|
|
95379
|
+
};
|
|
95380
|
+
const [openTxModal] = useModal(jsx$2(TransactionModal, { txChain: chainId, approvalState: approvalState, approveCallback: handleApprove, loadingTx: loadingTx, txCallback: handleDeposit, inputToken: depositToken, inputValue: inputValue, buyTxHash: buyTxHash, rateChanged: false, onDismiss: () => { }, onTransactionSuccess: handleTransactionSuccess }), false, true, 'transactionModal');
|
|
95372
95381
|
const exceedsBalance = new BigNumber$1(tokenBalance).lt(inputValue);
|
|
95373
95382
|
const isValidAmount = inputValue && parseFloat(inputValue) > 0;
|
|
95374
95383
|
return (jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', alignItems: 'center' }, children: jsxs(Flex, { sx: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ApprovalState } from '../../state/allowance/useAllowance';
|
|
3
3
|
import { Token } from '@ape.swap/apeswap-lists';
|
|
4
|
-
declare const TransactionModal: ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, inputToken, inputValue, buyTxHash, rateChanged, }: {
|
|
4
|
+
declare const TransactionModal: ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, inputToken, inputValue, buyTxHash, rateChanged, onTransactionSuccess, }: {
|
|
5
5
|
onDismiss?: () => void;
|
|
6
6
|
txChain?: number;
|
|
7
7
|
approvalState?: ApprovalState;
|
|
@@ -12,5 +12,6 @@ declare const TransactionModal: ({ onDismiss, txChain, approvalState, approveCal
|
|
|
12
12
|
inputValue: string;
|
|
13
13
|
buyTxHash?: string;
|
|
14
14
|
rateChanged: boolean;
|
|
15
|
+
onTransactionSuccess?: () => void;
|
|
15
16
|
}) => React.JSX.Element;
|
|
16
17
|
export default TransactionModal;
|