@goodaofi/bonds-sdk 3.0.176 → 3.0.177
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 +16 -342
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -59494,9 +59494,7 @@ const QUERY_KEYS = {
|
|
|
59494
59494
|
ACTIVE_VIEW: 'Goomoney-SDK-activeView',
|
|
59495
59495
|
PRE_TGE_LIST: 'Goomoney-SDK-preTGEList',
|
|
59496
59496
|
PRE_TGE_USER_BONDS: 'Goomoney-SDK-preTGEUserBonds',
|
|
59497
|
-
USER_TOKENS_BALANCES: 'Goomoney-SDK-userTokensBalances'
|
|
59498
|
-
REFUND_DATA: 'Goomoney-SDK-refundData',
|
|
59499
|
-
};
|
|
59497
|
+
USER_TOKENS_BALANCES: 'Goomoney-SDK-userTokensBalances'};
|
|
59500
59498
|
|
|
59501
59499
|
// Prod URLS. Do not make changes here
|
|
59502
59500
|
const defaultUrls = {
|
|
@@ -66563,7 +66561,7 @@ const YourBondsMenu = ({ handleSort, }) => {
|
|
|
66563
66561
|
return (jsx$2("div", { className: "bonds-menu", children: jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' } }) }), jsxs("div", { className: "headers-container", sx: { pr: ['0', '0', '0', '20px'] }, children: [jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('claimable'), children: ["CLAIMABLE", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('pending'), children: ["PENDING", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "claim-all-button-container", children: SDKConfig.referenceId === 'apebond' && jsx$2(ClaimAll, {}) })] })] }) }));
|
|
66564
66562
|
};
|
|
66565
66563
|
|
|
66566
|
-
var
|
|
66564
|
+
var launchBondsABI_V2_2_0 = [
|
|
66567
66565
|
{
|
|
66568
66566
|
anonymous: false,
|
|
66569
66567
|
inputs: [
|
|
@@ -68993,7 +68991,7 @@ const fetchPreTGEUserBonds = async (chains, tokenPrices, preTGEList, account, ap
|
|
|
68993
68991
|
name: 'trueBillPrice',
|
|
68994
68992
|
},
|
|
68995
68993
|
];
|
|
68996
|
-
const res = await multicall(bond.chainId,
|
|
68994
|
+
const res = await multicall(bond.chainId, launchBondsABI_V2_2_0, calls);
|
|
68997
68995
|
const billId = res[0][0][0]?.toString();
|
|
68998
68996
|
let userOwnedBillsData;
|
|
68999
68997
|
if (billId) {
|
|
@@ -69013,7 +69011,7 @@ const fetchPreTGEUserBonds = async (chains, tokenPrices, preTGEList, account, ap
|
|
|
69013
69011
|
params: [billId],
|
|
69014
69012
|
},
|
|
69015
69013
|
];
|
|
69016
|
-
const billData = await multicall(bond.chainId,
|
|
69014
|
+
const billData = await multicall(bond.chainId, launchBondsABI_V2_2_0, billDataCalls);
|
|
69017
69015
|
userOwnedBillsData = {
|
|
69018
69016
|
address: bond.contractAddress[bond.chainId] ?? '',
|
|
69019
69017
|
id: billId,
|
|
@@ -69096,7 +69094,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
69096
69094
|
setLoading(true);
|
|
69097
69095
|
writeContractAsync({
|
|
69098
69096
|
address: userBond.contractAddress[userBond.chainId],
|
|
69099
|
-
abi:
|
|
69097
|
+
abi: launchBondsABI_V2_2_0,
|
|
69100
69098
|
functionName: 'redeem',
|
|
69101
69099
|
chain: userBond.chainId,
|
|
69102
69100
|
account,
|
|
@@ -69124,7 +69122,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
69124
69122
|
return;
|
|
69125
69123
|
writeContractAsync({
|
|
69126
69124
|
address: userBond.contractAddress[userBond.chainId],
|
|
69127
|
-
abi:
|
|
69125
|
+
abi: launchBondsABI_V2_2_0,
|
|
69128
69126
|
functionName: 'claim',
|
|
69129
69127
|
args: [userBond?.userOwnedBillsData?.id],
|
|
69130
69128
|
chain: userBond.chainId,
|
|
@@ -69389,7 +69387,7 @@ const fetchGooPreTGEUserBonds = async (chains, tokenPrices, gooContracts, accoun
|
|
|
69389
69387
|
name: 'trueBillPrice',
|
|
69390
69388
|
},
|
|
69391
69389
|
];
|
|
69392
|
-
const res = await multicall(contract.chainId,
|
|
69390
|
+
const res = await multicall(contract.chainId, launchBondsABI_V2_2_0, calls);
|
|
69393
69391
|
const billId = res[0][0][0]?.toString();
|
|
69394
69392
|
let userOwnedBillsData;
|
|
69395
69393
|
if (billId) {
|
|
@@ -69409,7 +69407,7 @@ const fetchGooPreTGEUserBonds = async (chains, tokenPrices, gooContracts, accoun
|
|
|
69409
69407
|
params: [billId],
|
|
69410
69408
|
},
|
|
69411
69409
|
];
|
|
69412
|
-
const billData = await multicall(contract.chainId,
|
|
69410
|
+
const billData = await multicall(contract.chainId, launchBondsABI_V2_2_0, billDataCalls);
|
|
69413
69411
|
userOwnedBillsData = {
|
|
69414
69412
|
address: contract.address,
|
|
69415
69413
|
id: billId,
|
|
@@ -72521,7 +72519,7 @@ const getPreTGEBondsData = async (chain, tokenPrices, preTGEBonds, apiUrl) => {
|
|
|
72521
72519
|
},
|
|
72522
72520
|
];
|
|
72523
72521
|
});
|
|
72524
|
-
const vals = await multicall(chainId,
|
|
72522
|
+
const vals = await multicall(chainId, launchBondsABI_V2_2_0, launchBondsCalls);
|
|
72525
72523
|
const chunkSize = vals.length / preTGEBonds.length;
|
|
72526
72524
|
const chunkedBills = lodashExports.chunk(vals, chunkSize);
|
|
72527
72525
|
const returnedBills = chunkedBills?.map((chunk, index) => {
|
|
@@ -75709,7 +75707,7 @@ const PreTGEBuyComponent = ({ bondAddress, bondChain, onDismiss, handlePurchased
|
|
|
75709
75707
|
const args = [amount, maxPrice, address];
|
|
75710
75708
|
await writeContractAsync({
|
|
75711
75709
|
address: bond?.contractAddress?.[bond.chainId],
|
|
75712
|
-
abi:
|
|
75710
|
+
abi: launchBondsABI_V2_2_0,
|
|
75713
75711
|
functionName: 'deposit',
|
|
75714
75712
|
args: args,
|
|
75715
75713
|
chain: bond.chainId,
|
|
@@ -100407,283 +100405,6 @@ const getUserGooData = async (userAddress, apiAddress) => {
|
|
|
100407
100405
|
}
|
|
100408
100406
|
};
|
|
100409
100407
|
|
|
100410
|
-
// eslint-disable-next-line react/prop-types
|
|
100411
|
-
const CounterCard = ({ digit, text }) => {
|
|
100412
|
-
return (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }, children: [jsx$2(Flex, { sx: {
|
|
100413
|
-
background: 'linear-gradient(-45deg, #251c22 0%, #3a2327 100%)',
|
|
100414
|
-
borderRadius: 'normal',
|
|
100415
|
-
border: '1px solid #FE9E0450',
|
|
100416
|
-
justifyContent: 'center',
|
|
100417
|
-
alignItems: 'center',
|
|
100418
|
-
p: '20px',
|
|
100419
|
-
fontSize: ['24px', '24px', '26px', '36px'],
|
|
100420
|
-
width: ['55px', '55px', '65px', '85px'],
|
|
100421
|
-
height: ['60px', '60px', '70px', '90px'],
|
|
100422
|
-
fontWeight: 700,
|
|
100423
|
-
}, children: digit.toString().padStart(2, '0') }), jsx$2(Text, { color: "textNavbar", sx: {
|
|
100424
|
-
fontSize: ['12px', '12px', '12px', '14px'],
|
|
100425
|
-
fontWeight: 400,
|
|
100426
|
-
mt: '10px',
|
|
100427
|
-
}, children: text })] }));
|
|
100428
|
-
};
|
|
100429
|
-
const Colon = () => {
|
|
100430
|
-
return (jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center' }, children: [jsx$2(Text, { sx: {
|
|
100431
|
-
fontSize: '34px',
|
|
100432
|
-
fontWeight: 700,
|
|
100433
|
-
lineHeight: '90px',
|
|
100434
|
-
background: 'linear-gradient(to bottom, #fe9e0420 40%, #FE9E04 60%)',
|
|
100435
|
-
WebkitBackgroundClip: 'text',
|
|
100436
|
-
WebkitTextFillColor: 'transparent',
|
|
100437
|
-
backgroundClip: 'text',
|
|
100438
|
-
}, children: ":" }), jsx$2(Text, { color: "transparent", sx: { fontSize: '14px', fontWeight: 400, mt: '10px' }, children: "t" })] }));
|
|
100439
|
-
};
|
|
100440
|
-
const interval = 1000; // 1 sec
|
|
100441
|
-
const getCountdownObject = (targetIsoTime) => {
|
|
100442
|
-
// Detect if timestamp is in seconds or milliseconds
|
|
100443
|
-
// Timestamps in seconds are typically < 10^10, milliseconds are > 10^12
|
|
100444
|
-
const isSeconds = targetIsoTime < 10000000000;
|
|
100445
|
-
const targetTimeMs = isSeconds ? targetIsoTime * 1000 : targetIsoTime;
|
|
100446
|
-
const targetTime = new Date(targetTimeMs);
|
|
100447
|
-
const now = new Date();
|
|
100448
|
-
let delta = (targetTime.getTime() - now.getTime()) / 1000; // difference in seconds
|
|
100449
|
-
// If the target time has passed, return zero countdown
|
|
100450
|
-
if (delta <= 0)
|
|
100451
|
-
return {
|
|
100452
|
-
days: 0,
|
|
100453
|
-
hours: 0,
|
|
100454
|
-
minutes: 0,
|
|
100455
|
-
seconds: 0,
|
|
100456
|
-
};
|
|
100457
|
-
const days = Math.floor(delta / 86400);
|
|
100458
|
-
delta -= days * 86400;
|
|
100459
|
-
const hours = Math.floor(delta / 3600) % 24;
|
|
100460
|
-
delta -= hours * 3600;
|
|
100461
|
-
const minutes = Math.floor(delta / 60) % 60;
|
|
100462
|
-
const seconds = Math.floor(delta % 60);
|
|
100463
|
-
return {
|
|
100464
|
-
days,
|
|
100465
|
-
hours,
|
|
100466
|
-
minutes,
|
|
100467
|
-
seconds,
|
|
100468
|
-
};
|
|
100469
|
-
};
|
|
100470
|
-
const CountdownTimer = ({ targetTime }) => {
|
|
100471
|
-
const [show, setShow] = useState(false);
|
|
100472
|
-
const [countdown, setCountdown] = useState(getCountdownObject(targetTime));
|
|
100473
|
-
useEffect(() => {
|
|
100474
|
-
if (!show)
|
|
100475
|
-
setShow(true);
|
|
100476
|
-
const intervalId = setInterval(() => {
|
|
100477
|
-
setCountdown(getCountdownObject(targetTime));
|
|
100478
|
-
}, interval);
|
|
100479
|
-
return () => {
|
|
100480
|
-
clearInterval(intervalId);
|
|
100481
|
-
};
|
|
100482
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
100483
|
-
}, [targetTime]);
|
|
100484
|
-
// Render a countdown
|
|
100485
|
-
return (show && (jsxs(Flex, { sx: {
|
|
100486
|
-
flexDirection: 'row',
|
|
100487
|
-
justifyContent: 'center',
|
|
100488
|
-
alignItems: 'center',
|
|
100489
|
-
gap: ['10px', '10px', '20px', '20px'],
|
|
100490
|
-
}, children: [jsx$2(CounterCard, { digit: countdown?.days || 0, text: "Days" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: countdown?.hours || 0, text: "Hours" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: countdown?.minutes || 0, text: "Minutes" }), jsx$2(Colon, {}), jsx$2(CounterCard, { digit: countdown?.seconds || 0, text: "Seconds" })] })));
|
|
100491
|
-
};
|
|
100492
|
-
|
|
100493
|
-
function useRefundData() {
|
|
100494
|
-
const { address } = useAccount();
|
|
100495
|
-
const { chains } = useSDKConfig();
|
|
100496
|
-
const apiUrl = useSDKConfig()?.urls?.apiV2;
|
|
100497
|
-
const { data: saleInfo, isLoading: isSaleInfoLoading } = useSaleInfo();
|
|
100498
|
-
// Get stage 1 and stage 2 contracts (refundable stages)
|
|
100499
|
-
// Check by stageNumber since key naming may vary
|
|
100500
|
-
const refundableStages = saleInfo?.stages?.filter((stage) => stage.stageNumber === 1 || stage.stageNumber === 2);
|
|
100501
|
-
console.log('Refundable stages:', refundableStages);
|
|
100502
|
-
console.log('All stages from saleInfo:', saleInfo?.stages);
|
|
100503
|
-
// Flatten ALL contracts from refundable stages across ALL chains
|
|
100504
|
-
const allContracts = [];
|
|
100505
|
-
refundableStages?.forEach((stage) => {
|
|
100506
|
-
console.log(`Stage ${stage.stageNumber} (${stage.key}) contractsByChain:`, stage.contractsByChain);
|
|
100507
|
-
Object.entries(stage.contractsByChain).forEach(([chainId, contracts]) => {
|
|
100508
|
-
contracts.forEach((contract) => {
|
|
100509
|
-
console.log(`Adding contract: ${contract.address} on chain ${chainId} for stage ${stage.stageNumber}`);
|
|
100510
|
-
allContracts.push({
|
|
100511
|
-
...contract,
|
|
100512
|
-
chainId: parseInt(chainId),
|
|
100513
|
-
stageKey: stage.key,
|
|
100514
|
-
stageNumber: stage.stageNumber,
|
|
100515
|
-
});
|
|
100516
|
-
});
|
|
100517
|
-
});
|
|
100518
|
-
});
|
|
100519
|
-
console.log('All contracts to check for refund:', allContracts);
|
|
100520
|
-
return useQuery({
|
|
100521
|
-
queryKey: [QUERY_KEYS.REFUND_DATA, address, allContracts?.length],
|
|
100522
|
-
queryFn: () => fetchRefundData(chains, allContracts, address, apiUrl),
|
|
100523
|
-
refetchInterval: 30000,
|
|
100524
|
-
refetchOnWindowFocus: true,
|
|
100525
|
-
enabled: !isSaleInfoLoading && allContracts.length > 0 && !!address,
|
|
100526
|
-
});
|
|
100527
|
-
}
|
|
100528
|
-
const fetchRefundData = async (chains, contracts, account, apiUrl) => {
|
|
100529
|
-
try {
|
|
100530
|
-
console.log('fetchRefundData called with:', { chains, contractCount: contracts.length, account });
|
|
100531
|
-
// Filter out invalid contracts
|
|
100532
|
-
const validContracts = contracts.filter((contract) => contract.address !== '0x0000000000000000000000000000000000000000' && contract.address !== '');
|
|
100533
|
-
console.log('Valid contracts after filtering:', validContracts.length, validContracts);
|
|
100534
|
-
const results = await Promise.all(validContracts.map(async (contract) => {
|
|
100535
|
-
try {
|
|
100536
|
-
const calls = [
|
|
100537
|
-
{
|
|
100538
|
-
address: contract.address,
|
|
100539
|
-
name: 'accountInfo',
|
|
100540
|
-
params: [account],
|
|
100541
|
-
},
|
|
100542
|
-
{
|
|
100543
|
-
address: contract.address,
|
|
100544
|
-
name: 'accountStatus',
|
|
100545
|
-
params: [account],
|
|
100546
|
-
},
|
|
100547
|
-
];
|
|
100548
|
-
console.log(`Calling multicall for ${contract.address} on chain ${contract.chainId}`);
|
|
100549
|
-
const res = await multicall(contract.chainId, launchBondsABI, calls);
|
|
100550
|
-
console.log(`Multicall result for ${contract.address}:`, res);
|
|
100551
|
-
const depositAmount = res[0].depositAmount.toString();
|
|
100552
|
-
const hasRefunded = res[1].hasRefunded;
|
|
100553
|
-
console.log(`Contract ${contract.address}: depositAmount=${depositAmount}, hasRefunded=${hasRefunded}`);
|
|
100554
|
-
return {
|
|
100555
|
-
address: contract.address,
|
|
100556
|
-
chainId: contract.chainId,
|
|
100557
|
-
type: contract.type,
|
|
100558
|
-
stageKey: contract.stageKey,
|
|
100559
|
-
stageNumber: contract.stageNumber,
|
|
100560
|
-
depositAmount,
|
|
100561
|
-
depositAmountBTC: Number(depositAmount) / 100000000,
|
|
100562
|
-
hasRefunded,
|
|
100563
|
-
principalToken: contract.principalToken,
|
|
100564
|
-
};
|
|
100565
|
-
}
|
|
100566
|
-
catch (error) {
|
|
100567
|
-
console.error(`Error fetching refund data for ${contract.address} on chain ${contract.chainId}:`, error);
|
|
100568
|
-
return null;
|
|
100569
|
-
}
|
|
100570
|
-
}));
|
|
100571
|
-
const validResults = results.filter((r) => r !== null);
|
|
100572
|
-
// Filter to only show contracts with deposits
|
|
100573
|
-
const contractsWithDeposits = validResults.filter((r) => r.depositAmountBTC > 0.00000001);
|
|
100574
|
-
const totalDepositBTC = contractsWithDeposits.reduce((sum, c) => sum + c.depositAmountBTC, 0);
|
|
100575
|
-
return {
|
|
100576
|
-
contracts: contractsWithDeposits,
|
|
100577
|
-
totalDepositBTC,
|
|
100578
|
-
};
|
|
100579
|
-
}
|
|
100580
|
-
catch (e) {
|
|
100581
|
-
console.error('fetchRefundData error:', e);
|
|
100582
|
-
reportError$1({
|
|
100583
|
-
apiUrl,
|
|
100584
|
-
error: e,
|
|
100585
|
-
extraInfo: { type: 'fetchRefundData', contracts, e },
|
|
100586
|
-
account,
|
|
100587
|
-
});
|
|
100588
|
-
return {
|
|
100589
|
-
contracts: [],
|
|
100590
|
-
totalDepositBTC: 0,
|
|
100591
|
-
};
|
|
100592
|
-
}
|
|
100593
|
-
};
|
|
100594
|
-
|
|
100595
|
-
const RefundRow = ({ contract, onRefundSuccess }) => {
|
|
100596
|
-
const { address: account } = useAccount();
|
|
100597
|
-
const chainId = useChainId();
|
|
100598
|
-
const { switchChain } = useSwitchChain();
|
|
100599
|
-
const { writeContractAsync } = useWriteContract();
|
|
100600
|
-
const { addToastError, addToastSuccess } = usePopups();
|
|
100601
|
-
const [txHash, setTxHash] = useState();
|
|
100602
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
100603
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTxHash(txHash, contract.chainId);
|
|
100604
|
-
const needsChainSwitch = chainId !== contract.chainId;
|
|
100605
|
-
const chainName = NETWORK_LABEL[contract.chainId] || `Chain ${contract.chainId}`;
|
|
100606
|
-
const tokenSymbol = contract.type === 'goo' ? 'GOO' : 'sGOO';
|
|
100607
|
-
const handleRefund = async () => {
|
|
100608
|
-
if (needsChainSwitch) {
|
|
100609
|
-
switchChain?.({ chainId: contract.chainId });
|
|
100610
|
-
return;
|
|
100611
|
-
}
|
|
100612
|
-
setIsLoading(true);
|
|
100613
|
-
try {
|
|
100614
|
-
const hash = await writeContractAsync({
|
|
100615
|
-
address: contract.address,
|
|
100616
|
-
abi: launchBondsABI,
|
|
100617
|
-
functionName: 'redeemRefund',
|
|
100618
|
-
args: [],
|
|
100619
|
-
chain: contract.chainId,
|
|
100620
|
-
account,
|
|
100621
|
-
});
|
|
100622
|
-
if (hash) {
|
|
100623
|
-
setTxHash(hash);
|
|
100624
|
-
addToastSuccess('Refund transaction submitted!');
|
|
100625
|
-
onRefundSuccess();
|
|
100626
|
-
}
|
|
100627
|
-
}
|
|
100628
|
-
catch (error) {
|
|
100629
|
-
console.error('Refund error:', error);
|
|
100630
|
-
addToastError(error?.shortMessage || 'Failed to process refund');
|
|
100631
|
-
}
|
|
100632
|
-
finally {
|
|
100633
|
-
setIsLoading(false);
|
|
100634
|
-
}
|
|
100635
|
-
};
|
|
100636
|
-
const loading = isLoading || (isConfirming && !isConfirmed);
|
|
100637
|
-
if (contract.hasRefunded) {
|
|
100638
|
-
return (jsxs(Flex, { sx: {
|
|
100639
|
-
width: '100%',
|
|
100640
|
-
background: 'white2',
|
|
100641
|
-
p: '20px',
|
|
100642
|
-
borderRadius: 'normal',
|
|
100643
|
-
mb: '10px',
|
|
100644
|
-
alignItems: 'center',
|
|
100645
|
-
justifyContent: 'space-between',
|
|
100646
|
-
opacity: 0.6,
|
|
100647
|
-
}, children: [jsxs(Flex, { sx: { alignItems: 'center', gap: '15px' }, children: [jsx$2(TokenImage, { symbol: tokenSymbol, size: 40, chain: contract.chainId }), jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(Text, { sx: { fontSize: '16px', fontWeight: 'bold' }, children: tokenSymbol }), jsxs(Text, { sx: { fontSize: '12px', opacity: 0.7 }, children: ["Stage ", contract.stageNumber, " \u2022 ", chainName] })] })] }), jsxs(Flex, { sx: { alignItems: 'center', gap: '20px' }, children: [jsxs(Text, { sx: { fontSize: '14px', fontWeight: 500 }, children: [contract.depositAmountBTC.toFixed(8), " BTC"] }), jsx$2(Button, { disabled: true, sx: { minWidth: '120px' }, children: "REFUNDED" })] })] }));
|
|
100648
|
-
}
|
|
100649
|
-
return (jsxs(Flex, { sx: {
|
|
100650
|
-
width: '100%',
|
|
100651
|
-
background: 'white2',
|
|
100652
|
-
p: '20px',
|
|
100653
|
-
borderRadius: 'normal',
|
|
100654
|
-
mb: '10px',
|
|
100655
|
-
alignItems: 'center',
|
|
100656
|
-
justifyContent: 'space-between',
|
|
100657
|
-
flexDirection: ['column', 'column', 'row', 'row'],
|
|
100658
|
-
gap: ['15px', '15px', '0', '0'],
|
|
100659
|
-
}, children: [jsxs(Flex, { sx: { alignItems: 'center', gap: '15px' }, children: [jsx$2(TokenImage, { symbol: tokenSymbol, size: 40, chain: contract.chainId }), jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(Text, { sx: { fontSize: '16px', fontWeight: 'bold' }, children: tokenSymbol }), jsxs(Text, { sx: { fontSize: '12px', opacity: 0.7 }, children: ["Stage ", contract.stageNumber, " \u2022 ", chainName] })] })] }), jsxs(Flex, { sx: { alignItems: 'center', gap: '20px', flexDirection: ['column', 'column', 'row', 'row'] }, children: [jsxs(Flex, { sx: { flexDirection: 'column', alignItems: ['center', 'center', 'flex-end', 'flex-end'] }, children: [jsxs(Text, { sx: { fontSize: '16px', fontWeight: 'bold' }, children: [contract.depositAmountBTC.toFixed(8), " BTC"] }), jsx$2(Text, { sx: { fontSize: '12px', opacity: 0.7 }, children: "Deposited" })] }), jsx$2(Button, { onClick: handleRefund, disabled: loading, load: loading, sx: { minWidth: '140px' }, variant: needsChainSwitch ? 'secondary' : 'primary', children: loading ? 'PROCESSING...' : needsChainSwitch ? `SWITCH CHAIN` : 'REFUND' })] })] }));
|
|
100660
|
-
};
|
|
100661
|
-
const RefundView = () => {
|
|
100662
|
-
const { address } = useAccount();
|
|
100663
|
-
const { data: refundData, isLoading, refetch } = useRefundData();
|
|
100664
|
-
const handleRefundSuccess = () => {
|
|
100665
|
-
// Refetch data after successful refund
|
|
100666
|
-
setTimeout(() => refetch(), 2000);
|
|
100667
|
-
};
|
|
100668
|
-
if (!address) {
|
|
100669
|
-
return (jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', alignItems: 'center', p: '40px' }, children: [jsx$2(Text, { sx: { fontSize: '18px', fontWeight: 'bold', mb: '20px' }, children: "Connect wallet to view your refundable deposits" }), jsx$2(ConnectButton, {})] }));
|
|
100670
|
-
}
|
|
100671
|
-
if (isLoading) {
|
|
100672
|
-
return (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', p: '60px', width: '100%' }, children: jsx$2(Spinner, {}) }));
|
|
100673
|
-
}
|
|
100674
|
-
const contracts = refundData?.contracts || [];
|
|
100675
|
-
const hasDeposits = contracts.length > 0;
|
|
100676
|
-
return (jsx$2(Flex, { sx: { width: '100%', flexDirection: 'column', p: ['10px', '20px', '20px', '40px'] }, children: !hasDeposits ? (jsxs(Flex, { sx: {
|
|
100677
|
-
width: '100%',
|
|
100678
|
-
background: 'white2',
|
|
100679
|
-
p: '40px',
|
|
100680
|
-
borderRadius: 'normal',
|
|
100681
|
-
alignItems: 'center',
|
|
100682
|
-
justifyContent: 'center',
|
|
100683
|
-
flexDirection: 'column',
|
|
100684
|
-
}, children: [jsx$2(Text, { sx: { fontSize: '16px', fontWeight: 500, opacity: 0.7 }, children: "No refundable deposits found" }), jsx$2(Text, { sx: { fontSize: '14px', opacity: 0.5, mt: '10px' }, children: "You have not participated in Stage 1 or Stage 2 on the selected chain." })] })) : (jsx$2(Fragment$1, { children: contracts.map((contract) => (jsx$2(RefundRow, { contract: contract, onRefundSuccess: handleRefundSuccess }, `${contract.address}-${contract.chainId}`))) })) }));
|
|
100685
|
-
};
|
|
100686
|
-
|
|
100687
100408
|
var BondsViewOptions;
|
|
100688
100409
|
(function (BondsViewOptions) {
|
|
100689
100410
|
BondsViewOptions["BONDSMARKET"] = "Bonds Market";
|
|
@@ -100694,25 +100415,16 @@ const GooSale = () => {
|
|
|
100694
100415
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
100695
100416
|
const { data: saleInfo, isLoading: isLoadingSaleInfo } = useSaleInfo();
|
|
100696
100417
|
const SDKConfig = useSDKConfig();
|
|
100697
|
-
|
|
100418
|
+
saleInfo?.isInBreakPeriod
|
|
100698
100419
|
? saleInfo?.nextStage?.stageNumber || 1
|
|
100699
100420
|
: saleInfo?.currentStage?.stageNumber || 1;
|
|
100700
100421
|
const { address } = useAccount();
|
|
100701
100422
|
const { data: yourGoo, isLoading, isFetching } = useYourGoo(address);
|
|
100702
100423
|
const userParticipated = address && !isLoading && !isFetching && (yourGoo?.depositToGooBond !== '0' || yourGoo?.depositToSGooBond !== '0');
|
|
100703
100424
|
const chainId = useChainId();
|
|
100704
|
-
|
|
100425
|
+
useGooEligibility();
|
|
100705
100426
|
const [checkButtonPushed, setCheckButtonPushed] = useState(false);
|
|
100706
|
-
|
|
100707
|
-
// Handle check eligibility button click
|
|
100708
|
-
const handleCheckEligibility = async () => {
|
|
100709
|
-
setCheckButtonPushed(true);
|
|
100710
|
-
if (elegibleForSale === null || elegibleForSale === undefined) {
|
|
100711
|
-
// If not eligible, check cbBTC balance
|
|
100712
|
-
await checkCbBTCBalance();
|
|
100713
|
-
}
|
|
100714
|
-
};
|
|
100715
|
-
const currentStageSoldOut = saleInfo?.currentStage?.progressPercentage === 100;
|
|
100427
|
+
saleInfo?.currentStage?.progressPercentage === 100;
|
|
100716
100428
|
// // Wrapper function that sets chain filter AND switches wallet chain
|
|
100717
100429
|
// const handleChainFilterChange = useCallback(
|
|
100718
100430
|
// (newChainFilter: string[]) => {
|
|
@@ -100751,59 +100463,21 @@ const GooSale = () => {
|
|
|
100751
100463
|
// return filtered
|
|
100752
100464
|
// }, [saleInfo?.currentStage?.contractsByChain, chainFilterOption])
|
|
100753
100465
|
// Dynamic title based on current period (hidden during refund period)
|
|
100754
|
-
|
|
100466
|
+
useMemo(() => {
|
|
100755
100467
|
if (saleInfo?.isRefundPeriod)
|
|
100756
100468
|
return null;
|
|
100757
100469
|
if (saleInfo?.currentStage?.key === 'TGE')
|
|
100758
100470
|
return 'GOO Token Generation Event';
|
|
100759
100471
|
return 'Buy GOO at a discount';
|
|
100760
100472
|
}, [saleInfo?.isRefundPeriod, saleInfo?.currentStage?.key]);
|
|
100761
|
-
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), !SDKConfig.bondsComingSoon &&
|
|
100762
|
-
saleInfo?.nextStage &&
|
|
100763
|
-
!isLoadingSaleInfo &&
|
|
100764
|
-
!saleInfo?.isSaleEnded && (jsxs(Flex, { sx: { width: '100%', justifyContent: 'center', mt: '40px', flexDirection: 'column', alignItems: 'center' }, children: [jsxs(Text, { sx: { fontSize: '20px', fontWeight: 'bold', mb: '20px' }, children: [saleInfo?.nextStage?.key === 'refund'
|
|
100765
|
-
? 'Refund Period '
|
|
100766
|
-
: saleInfo?.nextStage?.key === 'TGE'
|
|
100767
|
-
? 'TGE '
|
|
100768
|
-
: 'Stage ' + saleInfo?.nextStage?.stageNumber + ' ', "starts in:"] }), jsx$2(CountdownTimer, { targetTime: saleInfo?.nextStage?.startTime || 0 }), !(saleInfo?.nextStage?.key === 'refund' || saleInfo?.nextStage?.key === 'TGE') ? (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: {
|
|
100769
|
-
mr: '1rem',
|
|
100770
|
-
p: '10px',
|
|
100771
|
-
borderRadius: 'normal',
|
|
100772
|
-
background: 'white3',
|
|
100773
|
-
alignItems: 'center',
|
|
100774
|
-
}, children: [jsx$2(Flex, { sx: { mr: '10px' }, children: jsx$2(Svg, { icon: "wallet" }) }), jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400 }, children: [address?.slice(0, 4), "...", address?.slice(address?.length - 4, 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 ||
|
|
100775
|
-
(whitelisted === undefined && !cbBTCBalanceChecked && (jsx$2(Button, { sx: { m: '20px', width: '100%' }, onClick: handleCheckEligibility, children: "CHECK ELIGIBILITY" }))))] }), whitelisted !== null && whitelisted !== undefined && (jsxs(Flex, { sx: {
|
|
100776
|
-
flexDirection: 'row',
|
|
100777
|
-
alignItems: 'center',
|
|
100778
|
-
mt: '20px',
|
|
100779
|
-
background: 'white2',
|
|
100780
|
-
p: '20px',
|
|
100781
|
-
m: '20px',
|
|
100782
|
-
borderRadius: 'normal',
|
|
100783
|
-
}, 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: {
|
|
100784
|
-
flexDirection: 'column',
|
|
100785
|
-
alignItems: 'center',
|
|
100786
|
-
gap: '10px',
|
|
100787
|
-
background: 'white2',
|
|
100788
|
-
p: '20px',
|
|
100789
|
-
m: '20px',
|
|
100790
|
-
borderRadius: 'normal',
|
|
100791
|
-
}, 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, {}))] })), !SDKConfig.bondsComingSoon && (jsx$2(Flex, { sx: {
|
|
100473
|
+
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), !SDKConfig.bondsComingSoon && (jsx$2(Flex, { sx: {
|
|
100792
100474
|
display: 'flex',
|
|
100793
100475
|
flexDirection: 'column',
|
|
100794
100476
|
alignItems: 'center',
|
|
100795
100477
|
justifyContent: 'center',
|
|
100796
100478
|
width: '100%',
|
|
100797
100479
|
p: '6%',
|
|
100798
|
-
}, children: jsx$2(Button, { sx: { width: '230px' }, onClick: () => (window.location.href = `${window.location.origin}/bonds`), children: "Start Bonding" }) })),
|
|
100799
|
-
width: '100%',
|
|
100800
|
-
alignItems: 'center',
|
|
100801
|
-
px: '12%',
|
|
100802
|
-
pt: (saleInfo?.isInBreakPeriod || currentStageSoldOut) && saleInfo?.nextStage ? '4rem' : '1rem',
|
|
100803
|
-
pb: '4rem',
|
|
100804
|
-
}, 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: 'REFUND', currentStep: currentStageNumber, loading: false }), jsx$2(StepBubble, { number: 4, title: 'TGE', currentStep: currentStageNumber, loading: false, hideBar: true })] }), jsx$2(Divider, { sx: { width: '100%', height: '2px', backgroundColor: 'white2' } }), saleInfo?.isRefundPeriod ? (
|
|
100805
|
-
// Refund period - show refund view for ALL chains
|
|
100806
|
-
jsx$2(RefundView, {})) : userParticipated ? (
|
|
100480
|
+
}, children: jsx$2(Button, { sx: { width: '230px' }, onClick: () => (window.location.href = `${window.location.origin}/bonds`), children: "Start Bonding" }) })), userParticipated ? (
|
|
100807
100481
|
// Break period but user has participated - show their goo
|
|
100808
100482
|
jsx$2(Fragment$1, { children: jsx$2(YourGoo, { yourGoo: yourGoo, isLoading: isLoading, isFetching: isFetching }) })) : (jsx$2(Fragment$1, {}))] }));
|
|
100809
100483
|
};
|