@goodaofi/bonds-sdk 3.0.130 → 3.0.132
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { forwardRef, useContext, useState, useLayoutEffect, useEffect, useCallback, useMemo, createContext as createContext$1, useRef, useId, useInsertionEffect as useInsertionEffect$1, Children, isValidElement, Fragment as Fragment$1, createElement, Component } from 'react';
|
|
3
3
|
import { useAccount, useWaitForTransactionReceipt, useChainId, useSwitchChain, useWriteContract, useSendTransaction } from 'wagmi';
|
|
4
|
-
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
4
|
+
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import Swiper$1 from 'swiper';
|
|
7
7
|
import { ConnectButton as ConnectButton$1 } from '@rainbow-me/rainbowkit';
|
|
@@ -58242,6 +58242,7 @@ const QUERY_KEYS = {
|
|
|
58242
58242
|
USER_INFO: 'Goomoney-SDK-userInfo',
|
|
58243
58243
|
USER_GOO_DATA: 'Goomoney-SDK-userGooData',
|
|
58244
58244
|
GOO_ELIGIBILITY: 'Goomoney-SDK-gooEligibility',
|
|
58245
|
+
CBBTC_BALANCE: 'Goomoney-SDK-cbBTCBalance',
|
|
58245
58246
|
// used values on SDK
|
|
58246
58247
|
BOND_API_STATS: 'Goomoney-SDK-bondApiStats',
|
|
58247
58248
|
SDK_CONFIG: 'Goomoney-SDK-sdkConfig',
|
|
@@ -94551,83 +94552,6 @@ const BondRowsByChain = ({ contractsByChain }) => {
|
|
|
94551
94552
|
}) }));
|
|
94552
94553
|
};
|
|
94553
94554
|
|
|
94554
|
-
const Confetti = ({ trigger }) => {
|
|
94555
|
-
const canvasRef = useRef(null);
|
|
94556
|
-
const confettiTriggeredRef = useRef(false);
|
|
94557
|
-
useEffect(() => {
|
|
94558
|
-
if (trigger && !confettiTriggeredRef.current) {
|
|
94559
|
-
confettiTriggeredRef.current = true;
|
|
94560
|
-
triggerConfetti();
|
|
94561
|
-
}
|
|
94562
|
-
}, [trigger]);
|
|
94563
|
-
const triggerConfetti = () => {
|
|
94564
|
-
const canvas = canvasRef.current;
|
|
94565
|
-
if (!canvas)
|
|
94566
|
-
return;
|
|
94567
|
-
const ctx = canvas.getContext('2d');
|
|
94568
|
-
if (!ctx)
|
|
94569
|
-
return;
|
|
94570
|
-
canvas.width = window.innerWidth;
|
|
94571
|
-
canvas.height = window.innerHeight;
|
|
94572
|
-
const particles = [];
|
|
94573
|
-
const colors = ['#312E7A', '#5C4FAE', '#AD6568', '#AD6E66', '#FFD700', '#FF6B6B', '#4ECDC4'];
|
|
94574
|
-
// Create particles
|
|
94575
|
-
for (let i = 0; i < 150; i++) {
|
|
94576
|
-
particles.push({
|
|
94577
|
-
x: Math.random() * canvas.width,
|
|
94578
|
-
y: -10,
|
|
94579
|
-
vx: (Math.random() - 0.5) * 8,
|
|
94580
|
-
vy: Math.random() * 3 + 2,
|
|
94581
|
-
color: colors[Math.floor(Math.random() * colors.length)],
|
|
94582
|
-
size: Math.random() * 8 + 4,
|
|
94583
|
-
rotation: Math.random() * 360,
|
|
94584
|
-
rotationSpeed: (Math.random() - 0.5) * 10,
|
|
94585
|
-
});
|
|
94586
|
-
}
|
|
94587
|
-
let animationId;
|
|
94588
|
-
const animate = () => {
|
|
94589
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
94590
|
-
particles.forEach((particle, index) => {
|
|
94591
|
-
particle.x += particle.vx;
|
|
94592
|
-
particle.y += particle.vy;
|
|
94593
|
-
particle.vy += 0.15; // gravity
|
|
94594
|
-
particle.rotation += particle.rotationSpeed;
|
|
94595
|
-
ctx.save();
|
|
94596
|
-
ctx.translate(particle.x, particle.y);
|
|
94597
|
-
ctx.rotate((particle.rotation * Math.PI) / 180);
|
|
94598
|
-
ctx.fillStyle = particle.color;
|
|
94599
|
-
ctx.fillRect(-particle.size / 2, -particle.size / 2, particle.size, particle.size);
|
|
94600
|
-
ctx.restore();
|
|
94601
|
-
// Remove particles that are off screen
|
|
94602
|
-
if (particle.y > canvas.height) {
|
|
94603
|
-
particles.splice(index, 1);
|
|
94604
|
-
}
|
|
94605
|
-
});
|
|
94606
|
-
if (particles.length > 0) {
|
|
94607
|
-
animationId = requestAnimationFrame(animate);
|
|
94608
|
-
}
|
|
94609
|
-
else {
|
|
94610
|
-
// Clean up canvas after animation
|
|
94611
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
94612
|
-
}
|
|
94613
|
-
};
|
|
94614
|
-
animate();
|
|
94615
|
-
return () => {
|
|
94616
|
-
if (animationId)
|
|
94617
|
-
cancelAnimationFrame(animationId);
|
|
94618
|
-
};
|
|
94619
|
-
};
|
|
94620
|
-
return (jsx$2("canvas", { ref: canvasRef, style: {
|
|
94621
|
-
position: 'fixed',
|
|
94622
|
-
top: 0,
|
|
94623
|
-
left: 0,
|
|
94624
|
-
width: '100%',
|
|
94625
|
-
height: '100%',
|
|
94626
|
-
pointerEvents: 'none',
|
|
94627
|
-
zIndex: 9999,
|
|
94628
|
-
} }));
|
|
94629
|
-
};
|
|
94630
|
-
|
|
94631
94555
|
const ProgressBar = ({ saleInfo }) => {
|
|
94632
94556
|
var _a, _b, _c, _d;
|
|
94633
94557
|
const nextStageNumber = (_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _a === void 0 ? void 0 : _a.stageNumber;
|
|
@@ -94678,7 +94602,7 @@ const ProgressBar = ({ saleInfo }) => {
|
|
|
94678
94602
|
})
|
|
94679
94603
|
: 'N/A';
|
|
94680
94604
|
}, [saleInfo]);
|
|
94681
|
-
return (jsxs(Fragment$1, { children: [
|
|
94605
|
+
return (jsxs(Fragment$1, { children: [jsxs(Flex$1, { sx: { alignItems: 'end', justifyContent: 'space-between', flexDirection: 'row', mt: '1rem' }, children: [jsxs(Flex$1, { sx: { flexDirection: 'column', width: '200px', alignItems: 'start' }, children: [jsx$2(Text, { sx: {
|
|
94682
94606
|
fontSize: '14px',
|
|
94683
94607
|
fontWeight: '700',
|
|
94684
94608
|
color: 'var(--theme-ui-colors-textDisabledButton)',
|
|
@@ -95024,9 +94948,120 @@ const checkEligibility = (address) => __awaiter$9(void 0, void 0, void 0, functi
|
|
|
95024
94948
|
return null;
|
|
95025
94949
|
}
|
|
95026
94950
|
});
|
|
94951
|
+
const addToWhitelist = (address) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
94952
|
+
try {
|
|
94953
|
+
// First, get the current tier 2 collection to get its ID and existing wallets
|
|
94954
|
+
const response = yield axios.get('https://strapi-api.ape.bond/goomoney-whitelist');
|
|
94955
|
+
const tier2Collection = response.data.find((item) => item.tier === 2);
|
|
94956
|
+
if (!tier2Collection) {
|
|
94957
|
+
console.error('Tier 2 collection not found');
|
|
94958
|
+
return false;
|
|
94959
|
+
}
|
|
94960
|
+
// Check if wallet is already in the list
|
|
94961
|
+
if (tier2Collection.wallets.some((w) => w.toLowerCase() === address.toLowerCase())) {
|
|
94962
|
+
return true;
|
|
94963
|
+
}
|
|
94964
|
+
// Add the new wallet to the existing wallets array
|
|
94965
|
+
const updatedWallets = [...tier2Collection.wallets, address];
|
|
94966
|
+
// PUT request to update the tier 2 collection with the new wallets array
|
|
94967
|
+
yield axios.put(`https://strapi-api.ape.bond/goomoney-whitelist/${tier2Collection.id}`, {
|
|
94968
|
+
wallets: updatedWallets,
|
|
94969
|
+
});
|
|
94970
|
+
return true;
|
|
94971
|
+
}
|
|
94972
|
+
catch (error) {
|
|
94973
|
+
console.error('Failed to add to whitelist:', error);
|
|
94974
|
+
return false;
|
|
94975
|
+
}
|
|
94976
|
+
});
|
|
94977
|
+
// Helper function to get chain name
|
|
94978
|
+
const getChainName = (chainId) => {
|
|
94979
|
+
const chainNames = {
|
|
94980
|
+
[types.ChainId.BASE]: 'Base',
|
|
94981
|
+
[types.ChainId.ARBITRUM]: 'Arbitrum',
|
|
94982
|
+
[types.ChainId.BSC]: 'BSC',
|
|
94983
|
+
[types.ChainId.MAINNET]: 'Ethereum',
|
|
94984
|
+
};
|
|
94985
|
+
return chainNames[chainId] || `Chain ${chainId}`;
|
|
94986
|
+
};
|
|
95027
94987
|
function useGooEligibility() {
|
|
94988
|
+
var _a;
|
|
95028
94989
|
const { address } = useAccount();
|
|
95029
|
-
|
|
94990
|
+
const queryClient = useQueryClient();
|
|
94991
|
+
const [cbBTCBalanceChecked, setCbBTCBalanceChecked] = useState(false);
|
|
94992
|
+
const SDKConfig = useSDKConfig();
|
|
94993
|
+
const isFake = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.isFakeBTC) !== null && _a !== void 0 ? _a : false;
|
|
94994
|
+
// Get BTC tokens for all chains
|
|
94995
|
+
const btcTokensSource = isFake ? FAKE_BTC_TOKENS : BTC_TOKENS;
|
|
94996
|
+
const chainsToCheck = [types.ChainId.BASE, types.ChainId.ARBITRUM, types.ChainId.BSC, types.ChainId.MAINNET];
|
|
94997
|
+
// Fetch balances for all chains - call hooks at top level
|
|
94998
|
+
const baseToken = btcTokensSource[types.ChainId.BASE];
|
|
94999
|
+
const arbitrumToken = btcTokensSource[types.ChainId.ARBITRUM];
|
|
95000
|
+
const bscToken = btcTokensSource[types.ChainId.BSC];
|
|
95001
|
+
const mainnetToken = btcTokensSource[types.ChainId.MAINNET];
|
|
95002
|
+
const baseBalanceQuery = useUserTokensBalance(baseToken ? [baseToken] : [], types.ChainId.BASE);
|
|
95003
|
+
const arbitrumBalanceQuery = useUserTokensBalance(arbitrumToken ? [arbitrumToken] : [], types.ChainId.ARBITRUM);
|
|
95004
|
+
const bscBalanceQuery = useUserTokensBalance(bscToken ? [bscToken] : [], types.ChainId.BSC);
|
|
95005
|
+
const mainnetBalanceQuery = useUserTokensBalance(mainnetToken ? [mainnetToken] : [], types.ChainId.MAINNET);
|
|
95006
|
+
// Collect balance queries and data
|
|
95007
|
+
const balanceQueries = [baseBalanceQuery, arbitrumBalanceQuery, bscBalanceQuery, mainnetBalanceQuery];
|
|
95008
|
+
const balancesData = balanceQueries.map((q) => q.data);
|
|
95009
|
+
const refetchAllBalances = () => __awaiter$9(this, void 0, void 0, function* () {
|
|
95010
|
+
yield Promise.all(balanceQueries.map((q) => q.refetch()));
|
|
95011
|
+
});
|
|
95012
|
+
// Check BTC balance across all chains
|
|
95013
|
+
const cbBTCBalanceInfo = useQuery({
|
|
95014
|
+
queryKey: [QUERY_KEYS.CBBTC_BALANCE, address, balancesData, cbBTCBalanceChecked],
|
|
95015
|
+
queryFn: () => {
|
|
95016
|
+
// Check if we have any balance data
|
|
95017
|
+
const hasData = balancesData.some((data) => data && data.length > 0);
|
|
95018
|
+
if (!hasData) {
|
|
95019
|
+
return null;
|
|
95020
|
+
}
|
|
95021
|
+
// Collect all BTC balances from all chains
|
|
95022
|
+
const allBalances = chainsToCheck.map((chainId, index) => {
|
|
95023
|
+
const chainBalances = balancesData[index];
|
|
95024
|
+
const token = btcTokensSource[chainId];
|
|
95025
|
+
const tokenAddress = token === null || token === void 0 ? void 0 : token.address[chainId];
|
|
95026
|
+
if (!chainBalances || !tokenAddress) {
|
|
95027
|
+
return { chainId, balance: 0, symbol: (token === null || token === void 0 ? void 0 : token.symbol) || 'BTC' };
|
|
95028
|
+
}
|
|
95029
|
+
// Find the balance for this token
|
|
95030
|
+
const tokenBalance = chainBalances.find((b) => { var _a; return ((_a = b.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === tokenAddress.toLowerCase(); });
|
|
95031
|
+
const balance = tokenBalance ? parseFloat(tokenBalance.balance) : 0;
|
|
95032
|
+
return {
|
|
95033
|
+
chainId,
|
|
95034
|
+
chainName: getChainName(chainId),
|
|
95035
|
+
balance,
|
|
95036
|
+
symbol: (token === null || token === void 0 ? void 0 : token.symbol) || 'BTC',
|
|
95037
|
+
};
|
|
95038
|
+
});
|
|
95039
|
+
// Calculate total balance and check eligibility
|
|
95040
|
+
const totalBalance = allBalances.reduce((sum, item) => sum + item.balance, 0);
|
|
95041
|
+
const isEligible = totalBalance >= 0.001;
|
|
95042
|
+
// Find which chains have balance
|
|
95043
|
+
const chainsWithBalance = allBalances.filter((item) => item.balance > 0);
|
|
95044
|
+
const result = {
|
|
95045
|
+
balance: totalBalance,
|
|
95046
|
+
isEligible,
|
|
95047
|
+
balancesByChain: allBalances,
|
|
95048
|
+
chainsWithBalance,
|
|
95049
|
+
};
|
|
95050
|
+
return result;
|
|
95051
|
+
},
|
|
95052
|
+
enabled: cbBTCBalanceChecked && balancesData.some((data) => data && data.length > 0),
|
|
95053
|
+
staleTime: 0,
|
|
95054
|
+
gcTime: 0,
|
|
95055
|
+
});
|
|
95056
|
+
// Mutation to add user to whitelist
|
|
95057
|
+
const addToWhitelistMutation = useMutation({
|
|
95058
|
+
mutationFn: () => addToWhitelist(address),
|
|
95059
|
+
onSuccess: () => {
|
|
95060
|
+
// Refetch eligibility after successful addition
|
|
95061
|
+
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.GOO_ELIGIBILITY, address] });
|
|
95062
|
+
},
|
|
95063
|
+
});
|
|
95064
|
+
const eligibilityQuery = useQuery({
|
|
95030
95065
|
queryKey: [QUERY_KEYS.GOO_ELIGIBILITY, address],
|
|
95031
95066
|
queryFn: () => checkEligibility(address),
|
|
95032
95067
|
refetchInterval: 600000,
|
|
@@ -95034,6 +95069,13 @@ function useGooEligibility() {
|
|
|
95034
95069
|
refetchOnMount: false,
|
|
95035
95070
|
refetchOnReconnect: false,
|
|
95036
95071
|
});
|
|
95072
|
+
// Function to check BTC balance across all chains
|
|
95073
|
+
const checkCbBTCBalance = () => __awaiter$9(this, void 0, void 0, function* () {
|
|
95074
|
+
yield refetchAllBalances();
|
|
95075
|
+
setCbBTCBalanceChecked(true);
|
|
95076
|
+
});
|
|
95077
|
+
return Object.assign(Object.assign({}, eligibilityQuery), { cbBTCBalance: cbBTCBalanceInfo.data, isCbBTCBalanceLoading: cbBTCBalanceInfo.isLoading || cbBTCBalanceInfo.isFetching, cbBTCBalanceChecked,
|
|
95078
|
+
checkCbBTCBalance, addToWhitelist: addToWhitelistMutation.mutate, isAddingToWhitelist: addToWhitelistMutation.isPending, addToWhitelistSuccess: addToWhitelistMutation.isSuccess, addToWhitelistError: addToWhitelistMutation.isError });
|
|
95037
95079
|
}
|
|
95038
95080
|
|
|
95039
95081
|
var BondsViewOptions;
|
|
@@ -95053,9 +95095,17 @@ const GooSale = () => {
|
|
|
95053
95095
|
const { address } = useAccount();
|
|
95054
95096
|
const chainId = useChainId();
|
|
95055
95097
|
const { switchChain } = useSwitchChain();
|
|
95056
|
-
const { data: elegibleForSale } = useGooEligibility();
|
|
95098
|
+
const { data: elegibleForSale, cbBTCBalance, isCbBTCBalanceLoading, cbBTCBalanceChecked, checkCbBTCBalance, addToWhitelist, isAddingToWhitelist, addToWhitelistSuccess, addToWhitelistError, } = useGooEligibility();
|
|
95057
95099
|
const [checkButtonPushed, setCheckButtonPushed] = useState(false);
|
|
95058
|
-
const
|
|
95100
|
+
const whitelisted = checkButtonPushed ? elegibleForSale : undefined;
|
|
95101
|
+
// Handle check eligibility button click
|
|
95102
|
+
const handleCheckEligibility = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
95103
|
+
setCheckButtonPushed(true);
|
|
95104
|
+
if (elegibleForSale === null || elegibleForSale === undefined) {
|
|
95105
|
+
// If not eligible, check cbBTC balance
|
|
95106
|
+
yield checkCbBTCBalance();
|
|
95107
|
+
}
|
|
95108
|
+
});
|
|
95059
95109
|
const currentStageSoldOut = ((_c = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _c === void 0 ? void 0 : _c.progressPercentage) === 100;
|
|
95060
95110
|
// Wrapper function that sets chain filter AND switches wallet chain
|
|
95061
95111
|
const handleChainFilterChange = useCallback((newChainFilter) => {
|
|
@@ -95097,7 +95147,8 @@ const GooSale = () => {
|
|
|
95097
95147
|
? 'Refund Period '
|
|
95098
95148
|
: ((_f = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _f === void 0 ? void 0 : _f.stageNumber) === 5
|
|
95099
95149
|
? 'TGE '
|
|
95100
|
-
: 'Stage ' + ((_g = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _g === void 0 ? void 0 : _g.stageNumber) + ' ', "starts in:"] }), jsx$2(CountdownTimer, { targetTime: ((_h = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _h === void 0 ? void 0 : _h.startTime) || 0 }), !(((_j = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _j === void 0 ? void 0 : _j.stageNumber) === 4 || ((_k = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _k === void 0 ? void 0 : _k.stageNumber) === 5) ? (jsxs(Fragment$1, { children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', mt: '30px' }, children: [address && (jsxs(Flex, { sx: { mr: '1rem', p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { mr: '10px' }, children: jsx$2(Svg, { icon: "wallet" }) }), jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400 }, children: [address === null || address === void 0 ? void 0 : address.slice(0, 4), "...", address === null || address === void 0 ? void 0 : address.slice((address === null || address === void 0 ? void 0 : address.length) - 4, address === null || address === void 0 ? void 0 : address.length)] })] })), jsx$2(Flex, { sx: { fontSize: '18px', fontWeight: 500 }, children: "Are You Eligible?" })] }), !address ? (jsx$2(Flex, { sx: { my: '20px', width: '100%' }, children: jsx$2(ConnectButton, {}) })) : (
|
|
95150
|
+
: 'Stage ' + ((_g = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _g === void 0 ? void 0 : _g.stageNumber) + ' ', "starts in:"] }), jsx$2(CountdownTimer, { targetTime: ((_h = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _h === void 0 ? void 0 : _h.startTime) || 0 }), !(((_j = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _j === void 0 ? void 0 : _j.stageNumber) === 4 || ((_k = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _k === void 0 ? void 0 : _k.stageNumber) === 5) ? (jsxs(Fragment$1, { children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', mt: '30px' }, children: [address && (jsxs(Flex, { sx: { mr: '1rem', p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center' }, children: [jsx$2(Flex, { sx: { mr: '10px' }, children: jsx$2(Svg, { icon: "wallet" }) }), jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400 }, children: [address === null || address === void 0 ? void 0 : address.slice(0, 4), "...", address === null || address === void 0 ? void 0 : address.slice((address === null || address === void 0 ? void 0 : address.length) - 4, address === null || address === void 0 ? void 0 : address.length)] })] })), jsx$2(Flex, { sx: { fontSize: '18px', fontWeight: 500 }, children: "Are You Eligible?" })] }), !address ? (jsx$2(Flex, { sx: { my: '20px', width: '100%' }, children: jsx$2(ConnectButton, {}) })) : (whitelisted === null ||
|
|
95151
|
+
(whitelisted === undefined && !cbBTCBalanceChecked && (jsx$2(Button, { sx: { m: '20px', width: '100%' }, onClick: handleCheckEligibility, children: "CHECK ELIGIBILITY" }))))] }), whitelisted !== null && whitelisted !== undefined && (jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', mt: '20px' }, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You are whitelisted for Stage ", whitelisted, " and beyond!"] }), jsxs(Text, { color: "primaryButton", sx: { fontSize: '12px', fontWeight: 400, pl: '1rem' }, children: ["Tier ", whitelisted, " Access"] })] })), whitelisted === null && (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px' }, children: [cbBTCBalanceChecked && (jsx$2(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px', mt: '10px' }, children: isCbBTCBalanceLoading ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Checking BTC balance across all chains..." })) : cbBTCBalance ? (jsxs(Fragment$1, { children: [cbBTCBalance.isEligible ? (addToWhitelistSuccess ? (jsx$2(Text, { color: "primaryButton", sx: { fontSize: '12px', fontWeight: 700 }, children: "\u2713 Successfully added to whitelist! Please refresh to see your tier." })) : addToWhitelistError ? (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "Failed to add to whitelist. Please try again." })) : (jsx$2(Fragment$1, { children: jsx$2(Flex, { sx: { flexDirection: 'row', alignItems: 'center' }, children: jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You ", jsx$2("span", { sx: { fontWeight: 700 }, children: "ARE" }), " eligible for the sale"] }) }) }))) : (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', gap: '10px' }, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You are ", jsx$2("span", { sx: { fontWeight: 700 }, children: "NOT" }), " eligible for the sale"] }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'error' }, children: "You need at least 0.001 BTC to be eligible" })] })), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Total BTC Balance: ", cbBTCBalance.balance] }), cbBTCBalance.chainsWithBalance && cbBTCBalance.chainsWithBalance.length > 0 && (jsx$2(Flex, { sx: { flexDirection: 'column', gap: '5px', mt: '5px' }, children: cbBTCBalance.chainsWithBalance.map((chain) => (jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center', gap: '10px' }, children: [jsx$2(TokenImage, { symbol: chain.symbol, size: 25, chain: chain.chainId }), jsxs(Text, { sx: { fontSize: '10px', fontWeight: 400, opacity: 0.7 }, children: [chain.balance, " ", chain.symbol] })] }, chain.chainId))) })), cbBTCBalance.isEligible && (jsx$2(Button, { sx: { width: '100%' }, onClick: () => addToWhitelist(), disabled: isAddingToWhitelist, children: isAddingToWhitelist ? 'ADDING TO WHITELIST...' : 'ADD ME TO WHITELIST' }))] })) : (jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: "Unable to fetch BTC balance. Please try again." })) })), jsxs(Link, { href: "https://gmoney.site/whitelist", target: "_blank", color: "primaryButton", sx: { fontSize: '12px', fontWeight: 400, mt: '10px', mb: '20px' }, children: ["Go to whitelist campaign ", '>'] })] }))] })) : (jsx$2(Fragment$1, {}))] })), !(saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.isInBreakPeriod) && !currentStageSoldOut && (jsxs(Fragment$1, { children: [jsx$2(BondsMenu, { setChainFilterOption: handleChainFilterChange, chainFilterOption: chainFilterOption, handleToogle: handleToogle }), activeView === BondsViewOptions.BONDSMARKET && filteredContractsByChain && !isLoadingSaleInfo ? (jsx$2(BondRowsByChain, { contractsByChain: filteredContractsByChain })) : activeView === BondsViewOptions.YOURBONDS && !isLoadingSaleInfo ? (jsx$2(YourGoo, {})) : (jsx$2(Fragment$1, {}))] }))] }));
|
|
95101
95152
|
};
|
|
95102
95153
|
|
|
95103
95154
|
const GooSaleWithProviders = (props) => {
|
|
@@ -1,7 +1,363 @@
|
|
|
1
|
+
import { ChainId } from '@ape.swap/apeswap-lists';
|
|
1
2
|
export interface GooStrapiResponse {
|
|
2
3
|
data: {
|
|
4
|
+
id: number;
|
|
3
5
|
tier: number;
|
|
4
6
|
wallets: string[];
|
|
5
7
|
}[];
|
|
6
8
|
}
|
|
7
|
-
export default function useGooEligibility():
|
|
9
|
+
export default function useGooEligibility(): {
|
|
10
|
+
cbBTCBalance: {
|
|
11
|
+
balance: number;
|
|
12
|
+
isEligible: boolean;
|
|
13
|
+
balancesByChain: ({
|
|
14
|
+
chainId: ChainId;
|
|
15
|
+
balance: number;
|
|
16
|
+
symbol: string;
|
|
17
|
+
chainName?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
chainId: ChainId;
|
|
20
|
+
chainName: string;
|
|
21
|
+
balance: number;
|
|
22
|
+
symbol: string;
|
|
23
|
+
})[];
|
|
24
|
+
chainsWithBalance: ({
|
|
25
|
+
chainId: ChainId;
|
|
26
|
+
balance: number;
|
|
27
|
+
symbol: string;
|
|
28
|
+
chainName?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
chainId: ChainId;
|
|
31
|
+
chainName: string;
|
|
32
|
+
balance: number;
|
|
33
|
+
symbol: string;
|
|
34
|
+
})[];
|
|
35
|
+
} | null | undefined;
|
|
36
|
+
isCbBTCBalanceLoading: boolean;
|
|
37
|
+
cbBTCBalanceChecked: boolean;
|
|
38
|
+
checkCbBTCBalance: () => Promise<void>;
|
|
39
|
+
addToWhitelist: import("@tanstack/react-query").UseMutateFunction<boolean, Error, void, unknown>;
|
|
40
|
+
isAddingToWhitelist: boolean;
|
|
41
|
+
addToWhitelistSuccess: boolean;
|
|
42
|
+
addToWhitelistError: boolean;
|
|
43
|
+
data: number | null;
|
|
44
|
+
error: Error;
|
|
45
|
+
isError: true;
|
|
46
|
+
isPending: false;
|
|
47
|
+
isLoading: false;
|
|
48
|
+
isLoadingError: false;
|
|
49
|
+
isRefetchError: true;
|
|
50
|
+
isSuccess: false;
|
|
51
|
+
isPlaceholderData: false;
|
|
52
|
+
status: "error";
|
|
53
|
+
dataUpdatedAt: number;
|
|
54
|
+
errorUpdatedAt: number;
|
|
55
|
+
failureCount: number;
|
|
56
|
+
failureReason: Error | null;
|
|
57
|
+
errorUpdateCount: number;
|
|
58
|
+
isFetched: boolean;
|
|
59
|
+
isFetchedAfterMount: boolean;
|
|
60
|
+
isFetching: boolean;
|
|
61
|
+
isInitialLoading: boolean;
|
|
62
|
+
isPaused: boolean;
|
|
63
|
+
isRefetching: boolean;
|
|
64
|
+
isStale: boolean;
|
|
65
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<number | null, Error>>;
|
|
66
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
67
|
+
promise: Promise<number | null>;
|
|
68
|
+
} | {
|
|
69
|
+
cbBTCBalance: {
|
|
70
|
+
balance: number;
|
|
71
|
+
isEligible: boolean;
|
|
72
|
+
balancesByChain: ({
|
|
73
|
+
chainId: ChainId;
|
|
74
|
+
balance: number;
|
|
75
|
+
symbol: string;
|
|
76
|
+
chainName?: undefined;
|
|
77
|
+
} | {
|
|
78
|
+
chainId: ChainId;
|
|
79
|
+
chainName: string;
|
|
80
|
+
balance: number;
|
|
81
|
+
symbol: string;
|
|
82
|
+
})[];
|
|
83
|
+
chainsWithBalance: ({
|
|
84
|
+
chainId: ChainId;
|
|
85
|
+
balance: number;
|
|
86
|
+
symbol: string;
|
|
87
|
+
chainName?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
chainId: ChainId;
|
|
90
|
+
chainName: string;
|
|
91
|
+
balance: number;
|
|
92
|
+
symbol: string;
|
|
93
|
+
})[];
|
|
94
|
+
} | null | undefined;
|
|
95
|
+
isCbBTCBalanceLoading: boolean;
|
|
96
|
+
cbBTCBalanceChecked: boolean;
|
|
97
|
+
checkCbBTCBalance: () => Promise<void>;
|
|
98
|
+
addToWhitelist: import("@tanstack/react-query").UseMutateFunction<boolean, Error, void, unknown>;
|
|
99
|
+
isAddingToWhitelist: boolean;
|
|
100
|
+
addToWhitelistSuccess: boolean;
|
|
101
|
+
addToWhitelistError: boolean;
|
|
102
|
+
data: number | null;
|
|
103
|
+
error: null;
|
|
104
|
+
isError: false;
|
|
105
|
+
isPending: false;
|
|
106
|
+
isLoading: false;
|
|
107
|
+
isLoadingError: false;
|
|
108
|
+
isRefetchError: false;
|
|
109
|
+
isSuccess: true;
|
|
110
|
+
isPlaceholderData: false;
|
|
111
|
+
status: "success";
|
|
112
|
+
dataUpdatedAt: number;
|
|
113
|
+
errorUpdatedAt: number;
|
|
114
|
+
failureCount: number;
|
|
115
|
+
failureReason: Error | null;
|
|
116
|
+
errorUpdateCount: number;
|
|
117
|
+
isFetched: boolean;
|
|
118
|
+
isFetchedAfterMount: boolean;
|
|
119
|
+
isFetching: boolean;
|
|
120
|
+
isInitialLoading: boolean;
|
|
121
|
+
isPaused: boolean;
|
|
122
|
+
isRefetching: boolean;
|
|
123
|
+
isStale: boolean;
|
|
124
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<number | null, Error>>;
|
|
125
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
126
|
+
promise: Promise<number | null>;
|
|
127
|
+
} | {
|
|
128
|
+
cbBTCBalance: {
|
|
129
|
+
balance: number;
|
|
130
|
+
isEligible: boolean;
|
|
131
|
+
balancesByChain: ({
|
|
132
|
+
chainId: ChainId;
|
|
133
|
+
balance: number;
|
|
134
|
+
symbol: string;
|
|
135
|
+
chainName?: undefined;
|
|
136
|
+
} | {
|
|
137
|
+
chainId: ChainId;
|
|
138
|
+
chainName: string;
|
|
139
|
+
balance: number;
|
|
140
|
+
symbol: string;
|
|
141
|
+
})[];
|
|
142
|
+
chainsWithBalance: ({
|
|
143
|
+
chainId: ChainId;
|
|
144
|
+
balance: number;
|
|
145
|
+
symbol: string;
|
|
146
|
+
chainName?: undefined;
|
|
147
|
+
} | {
|
|
148
|
+
chainId: ChainId;
|
|
149
|
+
chainName: string;
|
|
150
|
+
balance: number;
|
|
151
|
+
symbol: string;
|
|
152
|
+
})[];
|
|
153
|
+
} | null | undefined;
|
|
154
|
+
isCbBTCBalanceLoading: boolean;
|
|
155
|
+
cbBTCBalanceChecked: boolean;
|
|
156
|
+
checkCbBTCBalance: () => Promise<void>;
|
|
157
|
+
addToWhitelist: import("@tanstack/react-query").UseMutateFunction<boolean, Error, void, unknown>;
|
|
158
|
+
isAddingToWhitelist: boolean;
|
|
159
|
+
addToWhitelistSuccess: boolean;
|
|
160
|
+
addToWhitelistError: boolean;
|
|
161
|
+
data: undefined;
|
|
162
|
+
error: Error;
|
|
163
|
+
isError: true;
|
|
164
|
+
isPending: false;
|
|
165
|
+
isLoading: false;
|
|
166
|
+
isLoadingError: true;
|
|
167
|
+
isRefetchError: false;
|
|
168
|
+
isSuccess: false;
|
|
169
|
+
isPlaceholderData: false;
|
|
170
|
+
status: "error";
|
|
171
|
+
dataUpdatedAt: number;
|
|
172
|
+
errorUpdatedAt: number;
|
|
173
|
+
failureCount: number;
|
|
174
|
+
failureReason: Error | null;
|
|
175
|
+
errorUpdateCount: number;
|
|
176
|
+
isFetched: boolean;
|
|
177
|
+
isFetchedAfterMount: boolean;
|
|
178
|
+
isFetching: boolean;
|
|
179
|
+
isInitialLoading: boolean;
|
|
180
|
+
isPaused: boolean;
|
|
181
|
+
isRefetching: boolean;
|
|
182
|
+
isStale: boolean;
|
|
183
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<number | null, Error>>;
|
|
184
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
185
|
+
promise: Promise<number | null>;
|
|
186
|
+
} | {
|
|
187
|
+
cbBTCBalance: {
|
|
188
|
+
balance: number;
|
|
189
|
+
isEligible: boolean;
|
|
190
|
+
balancesByChain: ({
|
|
191
|
+
chainId: ChainId;
|
|
192
|
+
balance: number;
|
|
193
|
+
symbol: string;
|
|
194
|
+
chainName?: undefined;
|
|
195
|
+
} | {
|
|
196
|
+
chainId: ChainId;
|
|
197
|
+
chainName: string;
|
|
198
|
+
balance: number;
|
|
199
|
+
symbol: string;
|
|
200
|
+
})[];
|
|
201
|
+
chainsWithBalance: ({
|
|
202
|
+
chainId: ChainId;
|
|
203
|
+
balance: number;
|
|
204
|
+
symbol: string;
|
|
205
|
+
chainName?: undefined;
|
|
206
|
+
} | {
|
|
207
|
+
chainId: ChainId;
|
|
208
|
+
chainName: string;
|
|
209
|
+
balance: number;
|
|
210
|
+
symbol: string;
|
|
211
|
+
})[];
|
|
212
|
+
} | null | undefined;
|
|
213
|
+
isCbBTCBalanceLoading: boolean;
|
|
214
|
+
cbBTCBalanceChecked: boolean;
|
|
215
|
+
checkCbBTCBalance: () => Promise<void>;
|
|
216
|
+
addToWhitelist: import("@tanstack/react-query").UseMutateFunction<boolean, Error, void, unknown>;
|
|
217
|
+
isAddingToWhitelist: boolean;
|
|
218
|
+
addToWhitelistSuccess: boolean;
|
|
219
|
+
addToWhitelistError: boolean;
|
|
220
|
+
data: undefined;
|
|
221
|
+
error: null;
|
|
222
|
+
isError: false;
|
|
223
|
+
isPending: true;
|
|
224
|
+
isLoading: true;
|
|
225
|
+
isLoadingError: false;
|
|
226
|
+
isRefetchError: false;
|
|
227
|
+
isSuccess: false;
|
|
228
|
+
isPlaceholderData: false;
|
|
229
|
+
status: "pending";
|
|
230
|
+
dataUpdatedAt: number;
|
|
231
|
+
errorUpdatedAt: number;
|
|
232
|
+
failureCount: number;
|
|
233
|
+
failureReason: Error | null;
|
|
234
|
+
errorUpdateCount: number;
|
|
235
|
+
isFetched: boolean;
|
|
236
|
+
isFetchedAfterMount: boolean;
|
|
237
|
+
isFetching: boolean;
|
|
238
|
+
isInitialLoading: boolean;
|
|
239
|
+
isPaused: boolean;
|
|
240
|
+
isRefetching: boolean;
|
|
241
|
+
isStale: boolean;
|
|
242
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<number | null, Error>>;
|
|
243
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
244
|
+
promise: Promise<number | null>;
|
|
245
|
+
} | {
|
|
246
|
+
cbBTCBalance: {
|
|
247
|
+
balance: number;
|
|
248
|
+
isEligible: boolean;
|
|
249
|
+
balancesByChain: ({
|
|
250
|
+
chainId: ChainId;
|
|
251
|
+
balance: number;
|
|
252
|
+
symbol: string;
|
|
253
|
+
chainName?: undefined;
|
|
254
|
+
} | {
|
|
255
|
+
chainId: ChainId;
|
|
256
|
+
chainName: string;
|
|
257
|
+
balance: number;
|
|
258
|
+
symbol: string;
|
|
259
|
+
})[];
|
|
260
|
+
chainsWithBalance: ({
|
|
261
|
+
chainId: ChainId;
|
|
262
|
+
balance: number;
|
|
263
|
+
symbol: string;
|
|
264
|
+
chainName?: undefined;
|
|
265
|
+
} | {
|
|
266
|
+
chainId: ChainId;
|
|
267
|
+
chainName: string;
|
|
268
|
+
balance: number;
|
|
269
|
+
symbol: string;
|
|
270
|
+
})[];
|
|
271
|
+
} | null | undefined;
|
|
272
|
+
isCbBTCBalanceLoading: boolean;
|
|
273
|
+
cbBTCBalanceChecked: boolean;
|
|
274
|
+
checkCbBTCBalance: () => Promise<void>;
|
|
275
|
+
addToWhitelist: import("@tanstack/react-query").UseMutateFunction<boolean, Error, void, unknown>;
|
|
276
|
+
isAddingToWhitelist: boolean;
|
|
277
|
+
addToWhitelistSuccess: boolean;
|
|
278
|
+
addToWhitelistError: boolean;
|
|
279
|
+
data: undefined;
|
|
280
|
+
error: null;
|
|
281
|
+
isError: false;
|
|
282
|
+
isPending: true;
|
|
283
|
+
isLoadingError: false;
|
|
284
|
+
isRefetchError: false;
|
|
285
|
+
isSuccess: false;
|
|
286
|
+
isPlaceholderData: false;
|
|
287
|
+
status: "pending";
|
|
288
|
+
dataUpdatedAt: number;
|
|
289
|
+
errorUpdatedAt: number;
|
|
290
|
+
failureCount: number;
|
|
291
|
+
failureReason: Error | null;
|
|
292
|
+
errorUpdateCount: number;
|
|
293
|
+
isFetched: boolean;
|
|
294
|
+
isFetchedAfterMount: boolean;
|
|
295
|
+
isFetching: boolean;
|
|
296
|
+
isLoading: boolean;
|
|
297
|
+
isInitialLoading: boolean;
|
|
298
|
+
isPaused: boolean;
|
|
299
|
+
isRefetching: boolean;
|
|
300
|
+
isStale: boolean;
|
|
301
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<number | null, Error>>;
|
|
302
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
303
|
+
promise: Promise<number | null>;
|
|
304
|
+
} | {
|
|
305
|
+
cbBTCBalance: {
|
|
306
|
+
balance: number;
|
|
307
|
+
isEligible: boolean;
|
|
308
|
+
balancesByChain: ({
|
|
309
|
+
chainId: ChainId;
|
|
310
|
+
balance: number;
|
|
311
|
+
symbol: string;
|
|
312
|
+
chainName?: undefined;
|
|
313
|
+
} | {
|
|
314
|
+
chainId: ChainId;
|
|
315
|
+
chainName: string;
|
|
316
|
+
balance: number;
|
|
317
|
+
symbol: string;
|
|
318
|
+
})[];
|
|
319
|
+
chainsWithBalance: ({
|
|
320
|
+
chainId: ChainId;
|
|
321
|
+
balance: number;
|
|
322
|
+
symbol: string;
|
|
323
|
+
chainName?: undefined;
|
|
324
|
+
} | {
|
|
325
|
+
chainId: ChainId;
|
|
326
|
+
chainName: string;
|
|
327
|
+
balance: number;
|
|
328
|
+
symbol: string;
|
|
329
|
+
})[];
|
|
330
|
+
} | null | undefined;
|
|
331
|
+
isCbBTCBalanceLoading: boolean;
|
|
332
|
+
cbBTCBalanceChecked: boolean;
|
|
333
|
+
checkCbBTCBalance: () => Promise<void>;
|
|
334
|
+
addToWhitelist: import("@tanstack/react-query").UseMutateFunction<boolean, Error, void, unknown>;
|
|
335
|
+
isAddingToWhitelist: boolean;
|
|
336
|
+
addToWhitelistSuccess: boolean;
|
|
337
|
+
addToWhitelistError: boolean;
|
|
338
|
+
data: number | null;
|
|
339
|
+
isError: false;
|
|
340
|
+
error: null;
|
|
341
|
+
isPending: false;
|
|
342
|
+
isLoading: false;
|
|
343
|
+
isLoadingError: false;
|
|
344
|
+
isRefetchError: false;
|
|
345
|
+
isSuccess: true;
|
|
346
|
+
isPlaceholderData: true;
|
|
347
|
+
status: "success";
|
|
348
|
+
dataUpdatedAt: number;
|
|
349
|
+
errorUpdatedAt: number;
|
|
350
|
+
failureCount: number;
|
|
351
|
+
failureReason: Error | null;
|
|
352
|
+
errorUpdateCount: number;
|
|
353
|
+
isFetched: boolean;
|
|
354
|
+
isFetchedAfterMount: boolean;
|
|
355
|
+
isFetching: boolean;
|
|
356
|
+
isInitialLoading: boolean;
|
|
357
|
+
isPaused: boolean;
|
|
358
|
+
isRefetching: boolean;
|
|
359
|
+
isStale: boolean;
|
|
360
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<number | null, Error>>;
|
|
361
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
362
|
+
promise: Promise<number | null>;
|
|
363
|
+
};
|