@goodaofi/bonds-sdk 3.0.150 → 3.0.152
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 +87 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -99901,7 +99901,7 @@ const ProgressBar = ({ saleInfo }) => {
|
|
|
99901
99901
|
// Get BTC price
|
|
99902
99902
|
const btcPriceData = useCurrencyPrice(saleData === null || saleData === void 0 ? void 0 : saleData.principalToken, main.ChainId.BASE);
|
|
99903
99903
|
const btcPrice = (_d = btcPriceData === null || btcPriceData === void 0 ? void 0 : btcPriceData.price) !== null && _d !== void 0 ? _d : 0;
|
|
99904
|
-
const totalBilledBTC = (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) ? (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) / 100000000 : 0;
|
|
99904
|
+
const totalBilledBTC = ((saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) ? (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) / 100000000 : 0) + 100;
|
|
99905
99905
|
const totalBilledUSD = (totalBilledBTC * btcPrice).toLocaleString('en-US', {
|
|
99906
99906
|
style: 'currency',
|
|
99907
99907
|
currency: 'USD',
|
|
@@ -100317,13 +100317,96 @@ const getUserGooData = (userAddress, apiAddress) => __awaiter$9(void 0, void 0,
|
|
|
100317
100317
|
}
|
|
100318
100318
|
});
|
|
100319
100319
|
|
|
100320
|
+
// eslint-disable-next-line react/prop-types
|
|
100321
|
+
const CounterCard = ({ digit, text }) => {
|
|
100322
|
+
return (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }, children: [jsx$2(Flex, { sx: {
|
|
100323
|
+
background: 'linear-gradient(-45deg, #251c22 0%, #3a2327 100%)',
|
|
100324
|
+
borderRadius: 'normal',
|
|
100325
|
+
border: '1px solid #FE9E0450',
|
|
100326
|
+
justifyContent: 'center',
|
|
100327
|
+
alignItems: 'center',
|
|
100328
|
+
p: '20px',
|
|
100329
|
+
fontSize: ['24px', '24px', '26px', '36px'],
|
|
100330
|
+
width: ['55px', '55px', '65px', '85px'],
|
|
100331
|
+
height: ['60px', '60px', '70px', '90px'],
|
|
100332
|
+
fontWeight: 700,
|
|
100333
|
+
}, children: digit.toString().padStart(2, '0') }), jsx$2(Text, { color: "textNavbar", sx: {
|
|
100334
|
+
fontSize: ['12px', '12px', '12px', '14px'],
|
|
100335
|
+
fontWeight: 400,
|
|
100336
|
+
mt: '10px',
|
|
100337
|
+
}, children: text })] }));
|
|
100338
|
+
};
|
|
100339
|
+
const Colon = () => {
|
|
100340
|
+
return (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center' }, children: [jsx$2(Text, { sx: {
|
|
100341
|
+
fontSize: '34px',
|
|
100342
|
+
fontWeight: 700,
|
|
100343
|
+
lineHeight: '90px',
|
|
100344
|
+
background: 'linear-gradient(to bottom, #fe9e0420 40%, #FE9E04 60%)',
|
|
100345
|
+
WebkitBackgroundClip: 'text',
|
|
100346
|
+
WebkitTextFillColor: 'transparent',
|
|
100347
|
+
backgroundClip: 'text',
|
|
100348
|
+
}, children: ":" }), jsx$2(Text, { color: "transparent", sx: { fontSize: '14px', fontWeight: 400, mt: '10px' }, children: "t" })] }));
|
|
100349
|
+
};
|
|
100350
|
+
const interval = 1000; // 1 sec
|
|
100351
|
+
const getCountdownObject = (targetIsoTime) => {
|
|
100352
|
+
// Detect if timestamp is in seconds or milliseconds
|
|
100353
|
+
// Timestamps in seconds are typically < 10^10, milliseconds are > 10^12
|
|
100354
|
+
const isSeconds = targetIsoTime < 10000000000;
|
|
100355
|
+
const targetTimeMs = isSeconds ? targetIsoTime * 1000 : targetIsoTime;
|
|
100356
|
+
const targetTime = new Date(targetTimeMs);
|
|
100357
|
+
const now = new Date();
|
|
100358
|
+
let delta = (targetTime.getTime() - now.getTime()) / 1000; // difference in seconds
|
|
100359
|
+
// If the target time has passed, return zero countdown
|
|
100360
|
+
if (delta <= 0)
|
|
100361
|
+
return {
|
|
100362
|
+
days: 0,
|
|
100363
|
+
hours: 0,
|
|
100364
|
+
minutes: 0,
|
|
100365
|
+
seconds: 0,
|
|
100366
|
+
};
|
|
100367
|
+
const days = Math.floor(delta / 86400);
|
|
100368
|
+
delta -= days * 86400;
|
|
100369
|
+
const hours = Math.floor(delta / 3600) % 24;
|
|
100370
|
+
delta -= hours * 3600;
|
|
100371
|
+
const minutes = Math.floor(delta / 60) % 60;
|
|
100372
|
+
const seconds = Math.floor(delta % 60);
|
|
100373
|
+
return {
|
|
100374
|
+
days,
|
|
100375
|
+
hours,
|
|
100376
|
+
minutes,
|
|
100377
|
+
seconds,
|
|
100378
|
+
};
|
|
100379
|
+
};
|
|
100380
|
+
const CountdownTimer = ({ targetTime }) => {
|
|
100381
|
+
const [show, setShow] = useState(false);
|
|
100382
|
+
const [countdown, setCountdown] = useState(getCountdownObject(targetTime));
|
|
100383
|
+
useEffect(() => {
|
|
100384
|
+
if (!show)
|
|
100385
|
+
setShow(true);
|
|
100386
|
+
const intervalId = setInterval(() => {
|
|
100387
|
+
setCountdown(getCountdownObject(targetTime));
|
|
100388
|
+
}, interval);
|
|
100389
|
+
return () => {
|
|
100390
|
+
clearInterval(intervalId);
|
|
100391
|
+
};
|
|
100392
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
100393
|
+
}, [targetTime]);
|
|
100394
|
+
// Render a countdown
|
|
100395
|
+
return (show && (jsxs(Flex, { sx: {
|
|
100396
|
+
flexDirection: 'row',
|
|
100397
|
+
justifyContent: 'center',
|
|
100398
|
+
alignItems: 'center',
|
|
100399
|
+
gap: ['10px', '10px', '20px', '20px'],
|
|
100400
|
+
}, children: [jsx$2(CounterCard, { digit: (countdown === null || countdown === void 0 ? void 0 : countdown.days) || 0, text: "Days" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: (countdown === null || countdown === void 0 ? void 0 : countdown.hours) || 0, text: "Hours" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: (countdown === null || countdown === void 0 ? void 0 : countdown.minutes) || 0, text: "Minutes" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: (countdown === null || countdown === void 0 ? void 0 : countdown.seconds) || 0, text: "Seconds" })] })));
|
|
100401
|
+
};
|
|
100402
|
+
|
|
100320
100403
|
var BondsViewOptions;
|
|
100321
100404
|
(function (BondsViewOptions) {
|
|
100322
100405
|
BondsViewOptions["BONDSMARKET"] = "Bonds Market";
|
|
100323
100406
|
BondsViewOptions["YOURBONDS"] = "Your Bonds";
|
|
100324
100407
|
})(BondsViewOptions || (BondsViewOptions = {}));
|
|
100325
100408
|
const GooSale = () => {
|
|
100326
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
100409
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
100327
100410
|
// Fetch data
|
|
100328
100411
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
100329
100412
|
const { data: saleInfo, isLoading: isLoadingSaleInfo } = useSaleInfo();
|
|
@@ -100388,8 +100471,8 @@ const GooSale = () => {
|
|
|
100388
100471
|
? 'Refund Period '
|
|
100389
100472
|
: ((_f = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _f === void 0 ? void 0 : _f.stageNumber) === 5
|
|
100390
100473
|
? 'TGE '
|
|
100391
|
-
: 'Stage ' + ((_g = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _g === void 0 ? void 0 : _g.stageNumber) + ' ', "starts in:"] }), jsx$2(
|
|
100392
|
-
(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 && (
|
|
100474
|
+
: '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 ||
|
|
100475
|
+
(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 && (jsx$2(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 whitelisted" })] })), 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." })) })) }))] })) : (jsx$2(Fragment$1, {}))] })), jsxs(Flex, { sx: { width: '100%', alignItems: 'center', px: '12%', py: '4rem' }, children: [jsx$2(StepBubble, { number: 1, title: 'STAGE 1', currentStep: currentStageNumber, loading: false }), jsx$2(StepBubble, { number: 2, title: 'STAGE 2', currentStep: currentStageNumber, loading: false }), jsx$2(StepBubble, { number: 3, title: 'STAGE 3', currentStep: currentStageNumber, loading: false }), jsx$2(StepBubble, { number: 5, title: 'TGE', currentStep: currentStageNumber, loading: false, hideBar: true })] }), jsx$2(Divider, { sx: { width: '100%', height: '2px', backgroundColor: 'white2' } }), jsx$2(ProgressBar, { saleInfo: saleInfo }), !(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, { yourGoo: yourGoo, isLoading: isLoading, isFetching: isFetching })) : (jsx$2(Fragment$1, {}))] })) : userParticipated ? (jsxs(Fragment$1, { children: [jsx$2(Divider, { sx: { width: '100%', height: '2px', backgroundColor: 'white2', my: '1rem' } }), jsx$2(YourGoo, { yourGoo: yourGoo, isLoading: isLoading, isFetching: isFetching })] })) : (jsx$2(Fragment$1, {}))] }));
|
|
100393
100476
|
};
|
|
100394
100477
|
|
|
100395
100478
|
const GooSaleWithProviders = (props) => {
|