@goodaofi/bonds-sdk 3.0.125 → 3.0.127
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Confetti';
|
package/dist/main.js
CHANGED
|
@@ -68752,7 +68752,7 @@ const getSaleInfo = (isFake, apiAddress) => __awaiter$9(void 0, void 0, void 0,
|
|
|
68752
68752
|
totalBilled: 0,
|
|
68753
68753
|
overallProgress: 0,
|
|
68754
68754
|
TGEPrice: 4,
|
|
68755
|
-
TGEDate: new Date('2025-11-
|
|
68755
|
+
TGEDate: new Date('2025-11-25T15:00:00'),
|
|
68756
68756
|
};
|
|
68757
68757
|
}
|
|
68758
68758
|
});
|
|
@@ -68841,7 +68841,7 @@ const transformSaleData = (rawData, isFake) => {
|
|
|
68841
68841
|
totalBilled,
|
|
68842
68842
|
overallProgress,
|
|
68843
68843
|
TGEPrice: gooTGEPrice,
|
|
68844
|
-
TGEDate: new Date('2025-11-
|
|
68844
|
+
TGEDate: new Date('2025-11-25T15:00:00'),
|
|
68845
68845
|
};
|
|
68846
68846
|
};
|
|
68847
68847
|
|
|
@@ -94551,14 +94551,96 @@ const BondRowsByChain = ({ contractsByChain }) => {
|
|
|
94551
94551
|
}) }));
|
|
94552
94552
|
};
|
|
94553
94553
|
|
|
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
|
+
|
|
94554
94631
|
const ProgressBar = ({ saleInfo }) => {
|
|
94555
|
-
|
|
94556
|
-
const
|
|
94557
|
-
const
|
|
94558
|
-
|
|
94632
|
+
var _a;
|
|
94633
|
+
const nextStageNumber = (_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _a === void 0 ? void 0 : _a.stageNumber;
|
|
94634
|
+
const stage = (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.isInBreakPeriod) && nextStageNumber
|
|
94635
|
+
? saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.stages.find((stage) => stage.stageNumber === nextStageNumber - 1)
|
|
94636
|
+
: saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage;
|
|
94637
|
+
const stageSoldOut = (stage === null || stage === void 0 ? void 0 : stage.progressPercentage) === 100;
|
|
94638
|
+
const value = useMemo(() => { var _a; return (_a = stage === null || stage === void 0 ? void 0 : stage.progressPercentage) !== null && _a !== void 0 ? _a : 0; }, [stage]);
|
|
94639
|
+
const hardCap = useMemo(() => { var _a; return ((_a = stage === null || stage === void 0 ? void 0 : stage.hardCapSats) !== null && _a !== void 0 ? _a : 0) / 100000000; }, [stage]);
|
|
94640
|
+
const billed = useMemo(() => { var _a; return ((_a = stage === null || stage === void 0 ? void 0 : stage.totalBilledSats) !== null && _a !== void 0 ? _a : 0) / 100000000; }, [stage]);
|
|
94641
|
+
const stageNumber = useMemo(() => { var _a; return (_a = stage === null || stage === void 0 ? void 0 : stage.stageNumber) !== null && _a !== void 0 ? _a : 1; }, [stage]);
|
|
94559
94642
|
const endTime = useMemo(() => {
|
|
94560
|
-
|
|
94561
|
-
const timestamp = (_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _a === void 0 ? void 0 : _a.endTime;
|
|
94643
|
+
const timestamp = stage === null || stage === void 0 ? void 0 : stage.endTime;
|
|
94562
94644
|
if (!timestamp)
|
|
94563
94645
|
return 'N/A';
|
|
94564
94646
|
// endTime is a Unix timestamp in seconds, multiply by 1000 for milliseconds
|
|
@@ -94570,17 +94652,32 @@ const ProgressBar = ({ saleInfo }) => {
|
|
|
94570
94652
|
hour: '2-digit',
|
|
94571
94653
|
minute: '2-digit',
|
|
94572
94654
|
});
|
|
94573
|
-
}, [
|
|
94574
|
-
|
|
94655
|
+
}, [stage]);
|
|
94656
|
+
const nextStageStartTime = useMemo(() => {
|
|
94657
|
+
var _a, _b;
|
|
94658
|
+
return ((_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _a === void 0 ? void 0 : _a.startTime)
|
|
94659
|
+
? new Date(((_b = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _b === void 0 ? void 0 : _b.startTime) * 1000).toLocaleString('en-US', {
|
|
94660
|
+
timeZone: 'UTC',
|
|
94661
|
+
hour12: false,
|
|
94662
|
+
month: 'long',
|
|
94663
|
+
day: 'numeric',
|
|
94664
|
+
hour: '2-digit',
|
|
94665
|
+
minute: '2-digit',
|
|
94666
|
+
})
|
|
94667
|
+
: 'N/A';
|
|
94668
|
+
}, [saleInfo]);
|
|
94669
|
+
return (jsxs(Fragment$1, { children: [jsx$2(Confetti, { trigger: stageSoldOut }), jsxs(Flex$1, { sx: { alignItems: 'end', justifyContent: 'space-between', flexDirection: 'row', mt: '1rem' }, children: [jsxs(Flex$1, { sx: { flexDirection: 'column', width: '200px' }, children: [jsx$2(Text, { sx: {
|
|
94575
94670
|
fontSize: '14px',
|
|
94576
94671
|
fontWeight: '700',
|
|
94577
94672
|
color: 'var(--theme-ui-colors-textDisabledButton)',
|
|
94578
94673
|
mb: '0.2rem',
|
|
94579
|
-
}, children:
|
|
94674
|
+
}, children: stageSoldOut ? 'Stage ' + stageNumber + ' Completed!' : 'Stage ' + stageNumber + ' Progress' }), jsx$2(Text, { sx: { fontSize: '22px', fontWeight: '700' }, children: `${billed.toFixed(2)} BTC/ ${hardCap} BTC` })] }), jsx$2(Text, { sx: {
|
|
94580
94675
|
fontSize: '12px',
|
|
94581
94676
|
fontWeight: '400',
|
|
94582
94677
|
color: 'var(--theme-ui-colors-textDisabledButton)',
|
|
94583
|
-
}, children:
|
|
94678
|
+
}, children: (stage === null || stage === void 0 ? void 0 : stage.hasEnded)
|
|
94679
|
+
? 'Stage ' + nextStageNumber + ' starts: ' + nextStageStartTime + ' UTC'
|
|
94680
|
+
: 'Stage ' + stageNumber + ' Ends: ' + endTime + ' UTC' })] }), jsx$2(Flex$1, { sx: { width: ['100%'], alignItems: 'center', flexDirection: 'row', my: '1rem' }, children: jsx$2(Box$1, { style: {
|
|
94584
94681
|
width: '100%',
|
|
94585
94682
|
height: '11px',
|
|
94586
94683
|
backgroundColor: 'var(--theme-ui-colors-white4)',
|
|
@@ -94925,11 +95022,19 @@ var BondsViewOptions;
|
|
|
94925
95022
|
BondsViewOptions["YOURBONDS"] = "Your Bonds";
|
|
94926
95023
|
})(BondsViewOptions || (BondsViewOptions = {}));
|
|
94927
95024
|
const GooSale = () => {
|
|
94928
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
95025
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
94929
95026
|
// Fetch data
|
|
94930
95027
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
94931
95028
|
const { data: saleInfo, isLoading: isLoadingSaleInfo } = useSaleInfo();
|
|
94932
|
-
const
|
|
95029
|
+
const contractsByChain = (_b = (_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.stages) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.contractsByChain;
|
|
95030
|
+
const saleContracts = contractsByChain === null || contractsByChain === void 0 ? void 0 : contractsByChain[types.ChainId.BASE];
|
|
95031
|
+
const saleData = saleContracts === null || saleContracts === void 0 ? void 0 : saleContracts[0];
|
|
95032
|
+
// Get BTC price
|
|
95033
|
+
const btcPriceData = useCurrencyPrice(saleData === null || saleData === void 0 ? void 0 : saleData.principalToken, types.ChainId.BASE);
|
|
95034
|
+
const btcPrice = (_c = btcPriceData === null || btcPriceData === void 0 ? void 0 : btcPriceData.price) !== null && _c !== void 0 ? _c : 0;
|
|
95035
|
+
const currentStageNumber = (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.isInBreakPeriod)
|
|
95036
|
+
? ((_d = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _d === void 0 ? void 0 : _d.stageNumber) || 1
|
|
95037
|
+
: ((_e = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _e === void 0 ? void 0 : _e.stageNumber) || 1;
|
|
94933
95038
|
const { activeView, handleToogle } = useActiveView(true);
|
|
94934
95039
|
const { address } = useAccount();
|
|
94935
95040
|
const chainId = useChainId();
|
|
@@ -94937,7 +95042,13 @@ const GooSale = () => {
|
|
|
94937
95042
|
const { data: elegibleForSale } = useGooEligibility();
|
|
94938
95043
|
const [checkButtonPushed, setCheckButtonPushed] = useState(false);
|
|
94939
95044
|
const elegible = checkButtonPushed ? elegibleForSale : undefined;
|
|
94940
|
-
const currentStageSoldOut = ((
|
|
95045
|
+
const currentStageSoldOut = ((_f = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _f === void 0 ? void 0 : _f.progressPercentage) === 100;
|
|
95046
|
+
const totalBilledBTC = (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) ? (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) / 100000000 : 0;
|
|
95047
|
+
const totalBilledUSD = (totalBilledBTC * btcPrice).toLocaleString('en-US', {
|
|
95048
|
+
style: 'currency',
|
|
95049
|
+
currency: 'USD',
|
|
95050
|
+
maximumFractionDigits: 0,
|
|
95051
|
+
});
|
|
94941
95052
|
// Wrapper function that sets chain filter AND switches wallet chain
|
|
94942
95053
|
const handleChainFilterChange = useCallback((newChainFilter) => {
|
|
94943
95054
|
setChainFilterOption(newChainFilter);
|
|
@@ -94973,12 +95084,17 @@ const GooSale = () => {
|
|
|
94973
95084
|
}
|
|
94974
95085
|
});
|
|
94975
95086
|
return filtered;
|
|
94976
|
-
}, [(
|
|
94977
|
-
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), jsxs(Flex, { sx: { width: '100%', alignItems: 'center', px: '12%', pb: '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 })] }),
|
|
95087
|
+
}, [(_g = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _g === void 0 ? void 0 : _g.contractsByChain, chainFilterOption]);
|
|
95088
|
+
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), jsxs(Flex, { sx: { width: '100%', alignItems: 'center', px: '12%', pb: '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 })] }), jsxs(Flex, { sx: { flexDirection: 'column', width: '200px' }, children: [jsx$2(Text, { sx: {
|
|
95089
|
+
fontSize: '14px',
|
|
95090
|
+
fontWeight: '700',
|
|
95091
|
+
color: 'var(--theme-ui-colors-textDisabledButton)',
|
|
95092
|
+
mb: '0.2rem',
|
|
95093
|
+
}, children: "Total Raised" }), jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center' }, children: [jsx$2(Text, { sx: { fontSize: '22px', fontWeight: '700' }, children: `${totalBilledBTC.toFixed(0)} BTC` }), jsx$2(Text, { sx: { fontSize: '14px', fontWeight: '400', ml: '10px' }, children: `(${totalBilledUSD})` })] })] }), jsx$2(ProgressBar, { saleInfo: saleInfo }), ((saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.isInBreakPeriod) || currentStageSoldOut) && (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) && !isLoadingSaleInfo && (jsxs(Flex, { sx: { width: '100%', justifyContent: 'center', mt: '40px', flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Text, { sx: { fontSize: '20px', fontWeight: 'bold', mb: '20px' }, children: [((_h = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _h === void 0 ? void 0 : _h.stageNumber) === 4
|
|
94978
95094
|
? 'Refund Period '
|
|
94979
|
-
: ((
|
|
95095
|
+
: ((_j = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _j === void 0 ? void 0 : _j.stageNumber) === 5
|
|
94980
95096
|
? 'TGE '
|
|
94981
|
-
: 'Stage ' + ((
|
|
95097
|
+
: 'Stage ' + ((_k = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _k === void 0 ? void 0 : _k.stageNumber) + ' ', "starts in:"] }), jsx$2(CountdownTimer, { targetTime: ((_l = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _l === void 0 ? void 0 : _l.startTime) || 0 }), !(((_m = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _m === void 0 ? void 0 : _m.stageNumber) === 4 || ((_o = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _o === void 0 ? void 0 : _o.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, {}) })) : (jsx$2(Button, { sx: { m: '20px', width: '100%' }, onClick: () => setCheckButtonPushed(true), children: "CHECK ELIGIBILITY" }))] }), elegible !== null && elegible !== undefined && (jsxs(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 Stage ", elegible, " and beyond!"] }), jsxs(Text, { color: "primaryButton", sx: { fontSize: '12px', fontWeight: 400, pl: '1rem' }, children: ["Tier ", elegible, " Access"] })] })), elegible === null && (jsxs(Flex, { sx: { flexDirection: 'row', alignItems: 'center' }, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["You are ", jsx$2("span", { sx: { fontWeight: 700 }, children: "NOT" }), " eligible for the sale"] }), jsxs(Link, { href: "https://gmoney.site/whitelist", target: "_blank", color: "primaryButton", sx: { fontSize: '12px', fontWeight: 400, pl: '1rem' }, children: ["Get Your Whitelist Spot ", '>'] })] }))] })) : (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, {}))] }))] }));
|
|
94982
95098
|
};
|
|
94983
95099
|
|
|
94984
95100
|
const GooSaleWithProviders = (props) => {
|