@ape.swap/bonds-sdk 3.0.87 → 3.0.88
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 +5 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -73496,10 +73496,11 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
73496
73496
|
var _a, _b;
|
|
73497
73497
|
//Hooks
|
|
73498
73498
|
const { writeContractAsync } = useWriteContract();
|
|
73499
|
-
const { address: account } = useAccount();
|
|
73499
|
+
const { address: account, chainId } = useAccount();
|
|
73500
73500
|
const SDKConfig = useSDKConfig();
|
|
73501
73501
|
const { addToastError } = usePopups();
|
|
73502
73502
|
const { refetch } = usePreTGEUserBonds();
|
|
73503
|
+
const { switchChain } = useSwitchChain();
|
|
73503
73504
|
//State
|
|
73504
73505
|
const [loading, setLoading] = useState(false);
|
|
73505
73506
|
const [hash, setHash] = useState('');
|
|
@@ -73515,7 +73516,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
73515
73516
|
const handleRedeem = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73516
73517
|
setLoading(true);
|
|
73517
73518
|
writeContractAsync({
|
|
73518
|
-
address: userBond.contractAddress,
|
|
73519
|
+
address: userBond.contractAddress[userBond.chainId],
|
|
73519
73520
|
abi: launchBondsABI_V2_2_0,
|
|
73520
73521
|
functionName: 'redeem',
|
|
73521
73522
|
chain: userBond.chainId,
|
|
@@ -73545,7 +73546,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
73545
73546
|
if (!((_a = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _a === void 0 ? void 0 : _a.id))
|
|
73546
73547
|
return;
|
|
73547
73548
|
writeContractAsync({
|
|
73548
|
-
address: userBond.contractAddress,
|
|
73549
|
+
address: userBond.contractAddress[userBond.chainId],
|
|
73549
73550
|
abi: launchBondsABI_V2_2_0,
|
|
73550
73551
|
functionName: 'claim',
|
|
73551
73552
|
args: [(_b = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _b === void 0 ? void 0 : _b.id],
|
|
@@ -73577,7 +73578,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
73577
73578
|
}
|
|
73578
73579
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
73579
73580
|
}, [hash, isSuccess, isLoadingOnChain]);
|
|
73580
|
-
return (jsx$2(Button, { disabled: !saleFinalized || loading || isLoadingOnChain, load: loading || isLoadingOnChain, fullWidth: true, sx: {
|
|
73581
|
+
return chainId !== userBond.chainId && saleFinalized ? (jsxs(Button, { onClick: () => switchChain({ chainId: userBond === null || userBond === void 0 ? void 0 : userBond.chainId }), sx: { fontSize: '14px', height: '30px' }, fullWidth: true, children: ["Switch to ", NETWORK_LABEL[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]] })) : (jsx$2(Button, { disabled: !saleFinalized || loading || isLoadingOnChain, load: loading || isLoadingOnChain, fullWidth: true, sx: {
|
|
73581
73582
|
fontSize: '14px',
|
|
73582
73583
|
height: '30px',
|
|
73583
73584
|
background: !saleFinalized && 'var(--theme-ui-colors-white4) !important',
|