@goodaofi/bonds-sdk 3.0.128 → 3.0.130
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 +30 -27
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -94629,7 +94629,7 @@ const Confetti = ({ trigger }) => {
|
|
|
94629
94629
|
};
|
|
94630
94630
|
|
|
94631
94631
|
const ProgressBar = ({ saleInfo }) => {
|
|
94632
|
-
var _a;
|
|
94632
|
+
var _a, _b, _c, _d;
|
|
94633
94633
|
const nextStageNumber = (_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _a === void 0 ? void 0 : _a.stageNumber;
|
|
94634
94634
|
const stage = (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.isInBreakPeriod) && nextStageNumber
|
|
94635
94635
|
? saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.stages.find((stage) => stage.stageNumber === nextStageNumber - 1)
|
|
@@ -94639,6 +94639,18 @@ const ProgressBar = ({ saleInfo }) => {
|
|
|
94639
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
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
94641
|
const stageNumber = useMemo(() => { var _a; return (_a = stage === null || stage === void 0 ? void 0 : stage.stageNumber) !== null && _a !== void 0 ? _a : 1; }, [stage]);
|
|
94642
|
+
const contractsByChain = (_c = (_b = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.stages) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.contractsByChain;
|
|
94643
|
+
const saleContracts = contractsByChain === null || contractsByChain === void 0 ? void 0 : contractsByChain[types.ChainId.BASE];
|
|
94644
|
+
const saleData = saleContracts === null || saleContracts === void 0 ? void 0 : saleContracts[0];
|
|
94645
|
+
// Get BTC price
|
|
94646
|
+
const btcPriceData = useCurrencyPrice(saleData === null || saleData === void 0 ? void 0 : saleData.principalToken, types.ChainId.BASE);
|
|
94647
|
+
const btcPrice = (_d = btcPriceData === null || btcPriceData === void 0 ? void 0 : btcPriceData.price) !== null && _d !== void 0 ? _d : 0;
|
|
94648
|
+
const totalBilledBTC = (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) ? (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.totalBilled) / 100000000 : 0;
|
|
94649
|
+
const totalBilledUSD = (totalBilledBTC * btcPrice).toLocaleString('en-US', {
|
|
94650
|
+
style: 'currency',
|
|
94651
|
+
currency: 'USD',
|
|
94652
|
+
maximumFractionDigits: 0,
|
|
94653
|
+
});
|
|
94642
94654
|
const endTime = useMemo(() => {
|
|
94643
94655
|
const timestamp = stage === null || stage === void 0 ? void 0 : stage.endTime;
|
|
94644
94656
|
if (!timestamp)
|
|
@@ -94666,14 +94678,22 @@ const ProgressBar = ({ saleInfo }) => {
|
|
|
94666
94678
|
})
|
|
94667
94679
|
: 'N/A';
|
|
94668
94680
|
}, [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: {
|
|
94681
|
+
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', alignItems: 'start' }, children: [jsx$2(Text, { sx: {
|
|
94682
|
+
fontSize: '14px',
|
|
94683
|
+
fontWeight: '700',
|
|
94684
|
+
color: 'var(--theme-ui-colors-textDisabledButton)',
|
|
94685
|
+
mb: '0.2rem',
|
|
94686
|
+
}, children: "Total Raised" }), jsxs(Flex$1, { 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(Text, { sx: {
|
|
94670
94687
|
fontSize: '14px',
|
|
94671
94688
|
fontWeight: '700',
|
|
94672
94689
|
color: 'var(--theme-ui-colors-textDisabledButton)',
|
|
94673
94690
|
mb: '0.2rem',
|
|
94691
|
+
mt: '1rem',
|
|
94674
94692
|
}, 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: {
|
|
94675
94693
|
fontSize: '12px',
|
|
94676
94694
|
fontWeight: '400',
|
|
94695
|
+
textAlign: 'right',
|
|
94696
|
+
ml: '10px',
|
|
94677
94697
|
color: 'var(--theme-ui-colors-textDisabledButton)',
|
|
94678
94698
|
}, children: (stage === null || stage === void 0 ? void 0 : stage.hasEnded)
|
|
94679
94699
|
? 'Stage ' + nextStageNumber + ' starts: ' + nextStageStartTime + ' UTC'
|
|
@@ -95022,19 +95042,13 @@ var BondsViewOptions;
|
|
|
95022
95042
|
BondsViewOptions["YOURBONDS"] = "Your Bonds";
|
|
95023
95043
|
})(BondsViewOptions || (BondsViewOptions = {}));
|
|
95024
95044
|
const GooSale = () => {
|
|
95025
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
95045
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
95026
95046
|
// Fetch data
|
|
95027
95047
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
95028
95048
|
const { data: saleInfo, isLoading: isLoadingSaleInfo } = useSaleInfo();
|
|
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
95049
|
const currentStageNumber = (saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.isInBreakPeriod)
|
|
95036
|
-
? ((
|
|
95037
|
-
: ((
|
|
95050
|
+
? ((_a = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _a === void 0 ? void 0 : _a.stageNumber) || 1
|
|
95051
|
+
: ((_b = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _b === void 0 ? void 0 : _b.stageNumber) || 1;
|
|
95038
95052
|
const { activeView, handleToogle } = useActiveView(true);
|
|
95039
95053
|
const { address } = useAccount();
|
|
95040
95054
|
const chainId = useChainId();
|
|
@@ -95042,13 +95056,7 @@ const GooSale = () => {
|
|
|
95042
95056
|
const { data: elegibleForSale } = useGooEligibility();
|
|
95043
95057
|
const [checkButtonPushed, setCheckButtonPushed] = useState(false);
|
|
95044
95058
|
const elegible = checkButtonPushed ? elegibleForSale : undefined;
|
|
95045
|
-
const currentStageSoldOut = ((
|
|
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
|
-
});
|
|
95059
|
+
const currentStageSoldOut = ((_c = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _c === void 0 ? void 0 : _c.progressPercentage) === 100;
|
|
95052
95060
|
// Wrapper function that sets chain filter AND switches wallet chain
|
|
95053
95061
|
const handleChainFilterChange = useCallback((newChainFilter) => {
|
|
95054
95062
|
setChainFilterOption(newChainFilter);
|
|
@@ -95084,17 +95092,12 @@ const GooSale = () => {
|
|
|
95084
95092
|
}
|
|
95085
95093
|
});
|
|
95086
95094
|
return filtered;
|
|
95087
|
-
}, [(
|
|
95088
|
-
return (jsxs(Flex, {
|
|
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
|
|
95095
|
+
}, [(_d = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.currentStage) === null || _d === void 0 ? void 0 : _d.contractsByChain, chainFilterOption]);
|
|
95096
|
+
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 })] }), 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: [((_e = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _e === void 0 ? void 0 : _e.stageNumber) === 4
|
|
95094
95097
|
? 'Refund Period '
|
|
95095
|
-
: ((
|
|
95098
|
+
: ((_f = saleInfo === null || saleInfo === void 0 ? void 0 : saleInfo.nextStage) === null || _f === void 0 ? void 0 : _f.stageNumber) === 5
|
|
95096
95099
|
? 'TGE '
|
|
95097
|
-
: 'Stage ' + ((
|
|
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, {}) })) : (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, {}))] }))] }));
|
|
95098
95101
|
};
|
|
95099
95102
|
|
|
95100
95103
|
const GooSaleWithProviders = (props) => {
|