@ape.swap/bonds-sdk 3.0.38 → 3.0.39
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/components/TokenInfoAndName/index.d.ts +0 -1
- package/dist/main.js +435 -365
- package/dist/state/abtesting/useABTesting.d.ts +2 -1
- package/dist/styles.css +1 -2
- package/dist/views/Bonds/components/BondRows/BondRow.d.ts +1 -0
- package/dist/views/Bonds/components/BonusComponents/BonusContainer.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BondsData } from '../../types/bonds';
|
|
3
3
|
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
4
|
-
export declare const NETWORK_COLORS: Partial<Record<number, string>>;
|
|
5
4
|
declare const TokenInfoAndName: ({ bill, vestEnds, isHotBond, isGoldBond, }: {
|
|
6
5
|
bill: BondsData | BillsConfig;
|
|
7
6
|
vestEnds?: string;
|
package/dist/main.js
CHANGED
|
@@ -18808,6 +18808,7 @@ const TokenImage = ({ symbol, symbol2, size, chain, }) => {
|
|
|
18808
18808
|
|
|
18809
18809
|
const QUERY_KEYS = {
|
|
18810
18810
|
TIERS: 'tiers',
|
|
18811
|
+
AB_TEST_VALUE: 'ABTestValue',
|
|
18811
18812
|
// used values on SDK
|
|
18812
18813
|
BOND_API_STATS: 'ApeBond-SDK-bondApiStats',
|
|
18813
18814
|
SDK_CONFIG: 'ApeBond-SDK-sdkConfig',
|
|
@@ -18945,75 +18946,6 @@ const useURLByEnvironment = (key) => {
|
|
|
18945
18946
|
return config === null || config === void 0 ? void 0 : config.urls[key];
|
|
18946
18947
|
};
|
|
18947
18948
|
|
|
18948
|
-
const NETWORK_COLORS = {
|
|
18949
|
-
[types.ChainId.BSC]: '#F3BA2F',
|
|
18950
|
-
[types.ChainId.MAINNET]: '#627eea',
|
|
18951
|
-
[types.ChainId.MATIC]: '#8247e5',
|
|
18952
|
-
[types.ChainId.LIGHTLINK]: '#6087ff',
|
|
18953
|
-
[types.ChainId.BASE]: '#0052ff',
|
|
18954
|
-
[types.ChainId.ARBITRUM]: '#289fef',
|
|
18955
|
-
[types.ChainId.LINEA]: '#fff',
|
|
18956
|
-
[types.ChainId.IOTA]: '#fff',
|
|
18957
|
-
[types.ChainId.GRAPHLINQ]: '#ded2ff',
|
|
18958
|
-
[types.ChainId.AVAX]: '#e74344',
|
|
18959
|
-
[types.ChainId.BLAST]: '#fcfc03',
|
|
18960
|
-
[types.ChainId.CROSSFI]: '#7c8084',
|
|
18961
|
-
[types.ChainId.MONAD_TESTNET]: '#836EF9',
|
|
18962
|
-
[types.ChainId.SONIC]: '#fb9a4c',
|
|
18963
|
-
};
|
|
18964
|
-
const TokenInfoAndName = ({ bill, vestEnds, isHotBond, isGoldBond, }) => {
|
|
18965
|
-
var _a, _b, _c, _d, _e;
|
|
18966
|
-
const SDKConfig = useSDKConfig();
|
|
18967
|
-
const tokenName = 'showcaseTokenName' in bill ? bill.showcaseTokenName : bill.earnToken.symbol;
|
|
18968
|
-
return (jsxs(Flex, { className: "tokeninfoname container", children: [SDKConfig.referenceId === 'seedify' ? (jsx$2(Flex, { sx: {
|
|
18969
|
-
p: '10px',
|
|
18970
|
-
opacity: 0.2,
|
|
18971
|
-
position: 'absolute',
|
|
18972
|
-
left: '-20px',
|
|
18973
|
-
}, children: jsx$2(Flex, { sx: { borderRadius: 'normal', overflow: 'hidden' }, children: jsx$2(Svg, { width: 100, height: 100, icon: (_a = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _a !== void 0 ? _a : 'question' }) }) })) : (jsxs(Fragment$1, { children: [jsx$2(Flex, { className: "tokeninfoname chain", children: jsx$2(Svg, { width: 20, height: 20, icon: (_b = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _b !== void 0 ? _b : 'question' }) }), jsx$2(Flex, { className: "tokeninfoname gradient", sx: {
|
|
18974
|
-
background: isHotBond || vestEnds ? 'transparent' : NETWORK_COLORS[bill.chainId],
|
|
18975
|
-
} })] })), jsxs(Flex, { className: "tokeninfoname tokencontainer", sx: {
|
|
18976
|
-
marginTop: vestEnds ? ['10px', '10px', '10px', '0px'] : 0,
|
|
18977
|
-
maxWidth: ['140px', '140px', '140px', '190px', '190px'],
|
|
18978
|
-
}, children: [jsx$2(TokenImage, { symbol: tokenName, size: 33 }), jsxs(Flex, { className: "tokeninfoname tokentext", children: [tokenName, vestEnds && (jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400, opacity: 0.6, lineHeight: '14px' }, children: vestEnds }))] }), jsx$2(Flex, { className: "tokeninfofav", sx: { minWidth: '25px', p: '5px' }, children: jsx$2(AddFavToken, { tokenSymbol: tokenName, hotBond: isHotBond, isGoldBond: isGoldBond }) })] }), jsx$2(Flex, { sx: {
|
|
18979
|
-
justifyContent: isHotBond ? 'center' : 'flex-start',
|
|
18980
|
-
alignItems: 'center',
|
|
18981
|
-
}, children: jsx$2(Flex, { sx: { display: isHotBond ? 'flex' : ['none', 'none', 'none', 'none', 'flex'] }, children: ((_c = bill.tags) === null || _c === void 0 ? void 0 : _c[0]) && jsx$2(ListTag, { text: (_e = (_d = bill.tags) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.toUpperCase() }) }) }), jsx$2(Flex, { className: vestEnds ? '' : 'short-description-basepad', sx: { display: 'none' }, children: bill.shortDescription })] }));
|
|
18982
|
-
};
|
|
18983
|
-
|
|
18984
|
-
const formatNumber$3 = (number, minPrecision = 2, maxPrecision = 2) => {
|
|
18985
|
-
const options = {
|
|
18986
|
-
minimumFractionDigits: minPrecision,
|
|
18987
|
-
maximumFractionDigits: maxPrecision,
|
|
18988
|
-
};
|
|
18989
|
-
return number.toLocaleString('en-US', options);
|
|
18990
|
-
};
|
|
18991
|
-
// Formats a number with SI (International System of Units) sufixes
|
|
18992
|
-
const formatNumberSI = (num, digits = 2) => {
|
|
18993
|
-
const number = typeof num === 'string' ? parseFloat(num) : num;
|
|
18994
|
-
const lookupSI = [
|
|
18995
|
-
{ value: 1, symbol: '' },
|
|
18996
|
-
{ value: 1e6, symbol: 'M' },
|
|
18997
|
-
{ value: 1e9, symbol: 'B' },
|
|
18998
|
-
{ value: 1e12, symbol: 'T' },
|
|
18999
|
-
];
|
|
19000
|
-
const regEx = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
|
19001
|
-
let formatted;
|
|
19002
|
-
if (number >= 1e18) {
|
|
19003
|
-
formatted = '∞';
|
|
19004
|
-
}
|
|
19005
|
-
else {
|
|
19006
|
-
let i;
|
|
19007
|
-
for (i = lookupSI.length - 1; i > 0; i--) {
|
|
19008
|
-
if (number >= lookupSI[i].value) {
|
|
19009
|
-
break;
|
|
19010
|
-
}
|
|
19011
|
-
}
|
|
19012
|
-
formatted = formatNumber$3(number / lookupSI[i].value, digits, digits).replace(regEx, '$1') + lookupSI[i].symbol;
|
|
19013
|
-
}
|
|
19014
|
-
return formatted;
|
|
19015
|
-
};
|
|
19016
|
-
|
|
19017
18949
|
/*
|
|
19018
18950
|
* bignumber.js v9.1.2
|
|
19019
18951
|
* A JavaScript library for arbitrary-precision arithmetic.
|
|
@@ -21920,71 +21852,6 @@ function toFixedPoint(str, e, z) {
|
|
|
21920
21852
|
|
|
21921
21853
|
var BigNumber$1 = clone$2();
|
|
21922
21854
|
|
|
21923
|
-
const getBalanceNumber = (balance, decimals = 18) => {
|
|
21924
|
-
// use with caution. JS can only safely represent up to 15-17 digits of precision
|
|
21925
|
-
// so you will lose precision in decimals and really big numbers, for those cases use getBNWithDecimals
|
|
21926
|
-
const displayBalance = new BigNumber$1(balance).dividedBy(new BigNumber$1(10).pow(decimals));
|
|
21927
|
-
return displayBalance.toNumber();
|
|
21928
|
-
};
|
|
21929
|
-
|
|
21930
|
-
/**
|
|
21931
|
-
* Rounds a number to precision amount of signifant numbers
|
|
21932
|
-
* @param n the number
|
|
21933
|
-
* @param precision how many significant numbers to show
|
|
21934
|
-
* @returns @number
|
|
21935
|
-
*/
|
|
21936
|
-
const getFirstNonZeroDigits = (numberToParse, precision = 3) => {
|
|
21937
|
-
const n = parseFloat(numberToParse.toFixed(18));
|
|
21938
|
-
let amountToShow = precision - 1;
|
|
21939
|
-
if (n !== 0)
|
|
21940
|
-
amountToShow -= Math.floor(Math.log(n) / Math.log(10));
|
|
21941
|
-
return n.toFixed(amountToShow < 0 ? 0 : amountToShow);
|
|
21942
|
-
};
|
|
21943
|
-
|
|
21944
|
-
const MINUTE_IN_SECONDS = 60;
|
|
21945
|
-
const HOUR_IN_SECONDS = 3600;
|
|
21946
|
-
const DAY_IN_SECONDS = 86400;
|
|
21947
|
-
const MONTH_IN_SECONDS = 2629800;
|
|
21948
|
-
const YEAR_IN_SECONDS = 31557600;
|
|
21949
|
-
/**
|
|
21950
|
-
* Format number of seconds into year, month, day, hour, minute, seconds
|
|
21951
|
-
*
|
|
21952
|
-
* @param seconds
|
|
21953
|
-
*/
|
|
21954
|
-
const getTimePeriods = (seconds, days) => {
|
|
21955
|
-
let delta = seconds;
|
|
21956
|
-
const timeLeft = {
|
|
21957
|
-
years: 0,
|
|
21958
|
-
months: 0,
|
|
21959
|
-
days: 0,
|
|
21960
|
-
hours: 0,
|
|
21961
|
-
minutes: 0,
|
|
21962
|
-
seconds: 0,
|
|
21963
|
-
};
|
|
21964
|
-
if (delta >= YEAR_IN_SECONDS && false) {
|
|
21965
|
-
timeLeft.years = Math.floor(delta / YEAR_IN_SECONDS);
|
|
21966
|
-
delta -= timeLeft.years * YEAR_IN_SECONDS;
|
|
21967
|
-
}
|
|
21968
|
-
if (delta >= MONTH_IN_SECONDS && false) {
|
|
21969
|
-
timeLeft.months = Math.floor(delta / MONTH_IN_SECONDS);
|
|
21970
|
-
delta -= timeLeft.months * MONTH_IN_SECONDS;
|
|
21971
|
-
}
|
|
21972
|
-
if (delta >= DAY_IN_SECONDS) {
|
|
21973
|
-
timeLeft.days = Math.floor(delta / DAY_IN_SECONDS);
|
|
21974
|
-
delta -= timeLeft.days * DAY_IN_SECONDS;
|
|
21975
|
-
}
|
|
21976
|
-
if (delta >= HOUR_IN_SECONDS) {
|
|
21977
|
-
timeLeft.hours = Math.floor(delta / HOUR_IN_SECONDS);
|
|
21978
|
-
delta -= timeLeft.hours * HOUR_IN_SECONDS;
|
|
21979
|
-
}
|
|
21980
|
-
if (delta >= MINUTE_IN_SECONDS) {
|
|
21981
|
-
timeLeft.minutes = Math.floor(delta / MINUTE_IN_SECONDS);
|
|
21982
|
-
delta -= timeLeft.minutes * MINUTE_IN_SECONDS;
|
|
21983
|
-
}
|
|
21984
|
-
timeLeft.seconds = delta;
|
|
21985
|
-
return timeLeft;
|
|
21986
|
-
};
|
|
21987
|
-
|
|
21988
21855
|
/**
|
|
21989
21856
|
* Finds the highest TrueBondPrices element where userPoints is higher than points in the array.
|
|
21990
21857
|
* @param userPoints - The user's points as a string representing a BigNumber.
|
|
@@ -35719,7 +35586,7 @@ function computeAddress(key) {
|
|
|
35719
35586
|
function recoverAddress(digest, signature) {
|
|
35720
35587
|
return computeAddress(recoverPublicKey(arrayify(digest), signature));
|
|
35721
35588
|
}
|
|
35722
|
-
function formatNumber$
|
|
35589
|
+
function formatNumber$3(value, name) {
|
|
35723
35590
|
const result = stripZeros(BigNumber.from(value).toHexString());
|
|
35724
35591
|
if (result.length > 32) {
|
|
35725
35592
|
logger$7.throwArgumentError("invalid length for " + name, ("transaction:" + name), value);
|
|
@@ -35776,19 +35643,19 @@ function _serializeEip1559(transaction, signature) {
|
|
|
35776
35643
|
}
|
|
35777
35644
|
}
|
|
35778
35645
|
const fields = [
|
|
35779
|
-
formatNumber$
|
|
35780
|
-
formatNumber$
|
|
35781
|
-
formatNumber$
|
|
35782
|
-
formatNumber$
|
|
35783
|
-
formatNumber$
|
|
35646
|
+
formatNumber$3(transaction.chainId || 0, "chainId"),
|
|
35647
|
+
formatNumber$3(transaction.nonce || 0, "nonce"),
|
|
35648
|
+
formatNumber$3(transaction.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
|
|
35649
|
+
formatNumber$3(transaction.maxFeePerGas || 0, "maxFeePerGas"),
|
|
35650
|
+
formatNumber$3(transaction.gasLimit || 0, "gasLimit"),
|
|
35784
35651
|
((transaction.to != null) ? getAddress(transaction.to) : "0x"),
|
|
35785
|
-
formatNumber$
|
|
35652
|
+
formatNumber$3(transaction.value || 0, "value"),
|
|
35786
35653
|
(transaction.data || "0x"),
|
|
35787
35654
|
(formatAccessList(transaction.accessList || []))
|
|
35788
35655
|
];
|
|
35789
35656
|
if (signature) {
|
|
35790
35657
|
const sig = splitSignature(signature);
|
|
35791
|
-
fields.push(formatNumber$
|
|
35658
|
+
fields.push(formatNumber$3(sig.recoveryParam, "recoveryParam"));
|
|
35792
35659
|
fields.push(stripZeros(sig.r));
|
|
35793
35660
|
fields.push(stripZeros(sig.s));
|
|
35794
35661
|
}
|
|
@@ -35796,18 +35663,18 @@ function _serializeEip1559(transaction, signature) {
|
|
|
35796
35663
|
}
|
|
35797
35664
|
function _serializeEip2930(transaction, signature) {
|
|
35798
35665
|
const fields = [
|
|
35799
|
-
formatNumber$
|
|
35800
|
-
formatNumber$
|
|
35801
|
-
formatNumber$
|
|
35802
|
-
formatNumber$
|
|
35666
|
+
formatNumber$3(transaction.chainId || 0, "chainId"),
|
|
35667
|
+
formatNumber$3(transaction.nonce || 0, "nonce"),
|
|
35668
|
+
formatNumber$3(transaction.gasPrice || 0, "gasPrice"),
|
|
35669
|
+
formatNumber$3(transaction.gasLimit || 0, "gasLimit"),
|
|
35803
35670
|
((transaction.to != null) ? getAddress(transaction.to) : "0x"),
|
|
35804
|
-
formatNumber$
|
|
35671
|
+
formatNumber$3(transaction.value || 0, "value"),
|
|
35805
35672
|
(transaction.data || "0x"),
|
|
35806
35673
|
(formatAccessList(transaction.accessList || []))
|
|
35807
35674
|
];
|
|
35808
35675
|
if (signature) {
|
|
35809
35676
|
const sig = splitSignature(signature);
|
|
35810
|
-
fields.push(formatNumber$
|
|
35677
|
+
fields.push(formatNumber$3(sig.recoveryParam, "recoveryParam"));
|
|
35811
35678
|
fields.push(stripZeros(sig.r));
|
|
35812
35679
|
fields.push(stripZeros(sig.s));
|
|
35813
35680
|
}
|
|
@@ -58310,6 +58177,368 @@ function useTierPoints() {
|
|
|
58310
58177
|
});
|
|
58311
58178
|
}
|
|
58312
58179
|
|
|
58180
|
+
const YouTooltip = () => {
|
|
58181
|
+
return (jsx$2(Flex, { sx: { position: 'relative', ml: '10px' }, children: jsx$2(Flex, { sx: {
|
|
58182
|
+
background: 'primaryButton',
|
|
58183
|
+
height: '18px',
|
|
58184
|
+
justifyContent: 'center',
|
|
58185
|
+
borderRadius: '4px',
|
|
58186
|
+
px: '5px',
|
|
58187
|
+
fontWeight: 400,
|
|
58188
|
+
fontSize: '12px',
|
|
58189
|
+
position: 'absolute',
|
|
58190
|
+
left: 0,
|
|
58191
|
+
top: '50%', // Start 50% down the parent
|
|
58192
|
+
transform: 'translateY(-50%)', // Adjust by the element's own height
|
|
58193
|
+
'::after': {
|
|
58194
|
+
content: '""',
|
|
58195
|
+
position: 'absolute',
|
|
58196
|
+
top: '50%', // Vertically center
|
|
58197
|
+
left: '-11px', // Position outside the tooltip box
|
|
58198
|
+
transform: 'translateY(-50%)', // Center arrow vertically
|
|
58199
|
+
borderWidth: '6px', // Arrow size
|
|
58200
|
+
borderStyle: 'solid',
|
|
58201
|
+
borderColor: 'transparent var(--theme-ui-colors-primaryButton) transparent transparent', // Arrow now points left
|
|
58202
|
+
},
|
|
58203
|
+
}, children: "You" }) }));
|
|
58204
|
+
};
|
|
58205
|
+
|
|
58206
|
+
const BonusTable = ({ bond, hideTitle }) => {
|
|
58207
|
+
const { data: userPoints } = useTierPoints();
|
|
58208
|
+
const usersTrueBondPrices = findHighestTrueBondPrice(userPoints, bond);
|
|
58209
|
+
const minTier = (bond === null || bond === void 0 ? void 0 : bond.minTier) !== undefined ? bond.minTier : null;
|
|
58210
|
+
return (jsxs(Flex, { sx: { width: '100%', flexDirection: 'column' }, children: [!hideTitle && jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mb: '10px' }, children: "Ape Tier Bonuses" }), bond.trueBondPrices
|
|
58211
|
+
.sort((a, b) => new BigNumber$1(b.points).minus(new BigNumber$1(a.points)).toNumber())
|
|
58212
|
+
.map((tier, i) => {
|
|
58213
|
+
var _a, _b;
|
|
58214
|
+
const tierToUse = getUserTier(tier.points);
|
|
58215
|
+
const tierName = `${TIERS_NAMES[tierToUse]}`;
|
|
58216
|
+
const you = tier.points === (usersTrueBondPrices === null || usersTrueBondPrices === void 0 ? void 0 : usersTrueBondPrices.points);
|
|
58217
|
+
const isUnavailable = minTier > tierToUse || (minTier === 0 && tier.points === '0');
|
|
58218
|
+
return (jsxs(Flex, { sx: {
|
|
58219
|
+
width: '100%',
|
|
58220
|
+
justifyContent: 'space-between',
|
|
58221
|
+
height: '30px',
|
|
58222
|
+
background: (_a = TIERS_COLORS[tierToUse]) !== null && _a !== void 0 ? _a : 'white3',
|
|
58223
|
+
borderRadius: 'normal',
|
|
58224
|
+
alignItems: 'center',
|
|
58225
|
+
px: '8px',
|
|
58226
|
+
mb: '1px',
|
|
58227
|
+
}, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [tier.points !== '0' && (jsx$2("img", { src: `/images/launch/${(_b = TIERS_NAMES[tierToUse]) === null || _b === void 0 ? void 0 : _b.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } })), jsx$2(Flex, { children: tier.points === '0' ? 'No Tier' : tierName }), you && jsx$2(YouTooltip, {})] }), isUnavailable ? (jsx$2(Flex, { sx: { fontWeight: 600, opacity: 0.8 }, children: "UNAVAILABLE" })) : (jsxs(Flex, { sx: { color: tier.bonusWithFee > 0 ? 'success' : 'text', fontWeight: 700, alignItems: 'center' }, children: [tier.bonusWithFee > 0 ? tier.bonusWithFee.toFixed(2) : '0', "%", tier.points !== '0' && (jsx$2(Flex, { sx: {
|
|
58228
|
+
borderRadius: 'normal',
|
|
58229
|
+
border: '1px solid var(--theme-ui-colors-success)',
|
|
58230
|
+
px: '4px',
|
|
58231
|
+
ml: '3px',
|
|
58232
|
+
color: 'success',
|
|
58233
|
+
}, children: boostMap[tierToUse] }))] }))] }, tier.points));
|
|
58234
|
+
}), !hideTitle && (jsx$2(Button, { variant: "secondary", sx: { width: '100%', mt: '10px' }, onClick: () => window.open('https://ape.bond/tier-staking', '_blank'), children: "get tier" }))] }));
|
|
58235
|
+
};
|
|
58236
|
+
|
|
58237
|
+
const MINUTE_IN_SECONDS = 60;
|
|
58238
|
+
const HOUR_IN_SECONDS = 3600;
|
|
58239
|
+
const DAY_IN_SECONDS = 86400;
|
|
58240
|
+
const MONTH_IN_SECONDS = 2629800;
|
|
58241
|
+
const YEAR_IN_SECONDS = 31557600;
|
|
58242
|
+
/**
|
|
58243
|
+
* Format number of seconds into year, month, day, hour, minute, seconds
|
|
58244
|
+
*
|
|
58245
|
+
* @param seconds
|
|
58246
|
+
*/
|
|
58247
|
+
const getTimePeriods = (seconds, days) => {
|
|
58248
|
+
let delta = seconds;
|
|
58249
|
+
const timeLeft = {
|
|
58250
|
+
years: 0,
|
|
58251
|
+
months: 0,
|
|
58252
|
+
days: 0,
|
|
58253
|
+
hours: 0,
|
|
58254
|
+
minutes: 0,
|
|
58255
|
+
seconds: 0,
|
|
58256
|
+
};
|
|
58257
|
+
if (delta >= YEAR_IN_SECONDS && false) {
|
|
58258
|
+
timeLeft.years = Math.floor(delta / YEAR_IN_SECONDS);
|
|
58259
|
+
delta -= timeLeft.years * YEAR_IN_SECONDS;
|
|
58260
|
+
}
|
|
58261
|
+
if (delta >= MONTH_IN_SECONDS && false) {
|
|
58262
|
+
timeLeft.months = Math.floor(delta / MONTH_IN_SECONDS);
|
|
58263
|
+
delta -= timeLeft.months * MONTH_IN_SECONDS;
|
|
58264
|
+
}
|
|
58265
|
+
if (delta >= DAY_IN_SECONDS) {
|
|
58266
|
+
timeLeft.days = Math.floor(delta / DAY_IN_SECONDS);
|
|
58267
|
+
delta -= timeLeft.days * DAY_IN_SECONDS;
|
|
58268
|
+
}
|
|
58269
|
+
if (delta >= HOUR_IN_SECONDS) {
|
|
58270
|
+
timeLeft.hours = Math.floor(delta / HOUR_IN_SECONDS);
|
|
58271
|
+
delta -= timeLeft.hours * HOUR_IN_SECONDS;
|
|
58272
|
+
}
|
|
58273
|
+
if (delta >= MINUTE_IN_SECONDS) {
|
|
58274
|
+
timeLeft.minutes = Math.floor(delta / MINUTE_IN_SECONDS);
|
|
58275
|
+
delta -= timeLeft.minutes * MINUTE_IN_SECONDS;
|
|
58276
|
+
}
|
|
58277
|
+
timeLeft.seconds = delta;
|
|
58278
|
+
return timeLeft;
|
|
58279
|
+
};
|
|
58280
|
+
|
|
58281
|
+
const isBondSoldOut = (bill) => {
|
|
58282
|
+
var _a;
|
|
58283
|
+
if (bill.soldOut)
|
|
58284
|
+
return true;
|
|
58285
|
+
if (bill.inactive)
|
|
58286
|
+
return true;
|
|
58287
|
+
const { tokensRemaining, payoutTokenPrice } = bill;
|
|
58288
|
+
if (!tokensRemaining)
|
|
58289
|
+
return false;
|
|
58290
|
+
const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
58291
|
+
if ((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) {
|
|
58292
|
+
// If there's less than 100 usd bond will be hidden
|
|
58293
|
+
return true;
|
|
58294
|
+
}
|
|
58295
|
+
else
|
|
58296
|
+
return false;
|
|
58297
|
+
};
|
|
58298
|
+
const sortBonds = (sortConfig, bonds) => {
|
|
58299
|
+
const bondsToSort = bonds !== null && bonds !== void 0 ? bonds : [];
|
|
58300
|
+
if (!sortConfig) {
|
|
58301
|
+
return bondsToSort;
|
|
58302
|
+
}
|
|
58303
|
+
return [...bondsToSort].sort((a, b) => {
|
|
58304
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
58305
|
+
let aValue;
|
|
58306
|
+
let bValue;
|
|
58307
|
+
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === 'arr') {
|
|
58308
|
+
aValue = (_b = (_a = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], a)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0;
|
|
58309
|
+
bValue = (_d = (_c = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], b)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0;
|
|
58310
|
+
}
|
|
58311
|
+
else if (sortConfig.key === 'tokensRemaining') {
|
|
58312
|
+
aValue = remainingPercentage(a);
|
|
58313
|
+
bValue = remainingPercentage(b);
|
|
58314
|
+
}
|
|
58315
|
+
else if (sortConfig.key === 'terms') {
|
|
58316
|
+
aValue = vestingTime(a.vestingTerm).days;
|
|
58317
|
+
bValue = vestingTime(b.vestingTerm).days;
|
|
58318
|
+
}
|
|
58319
|
+
else {
|
|
58320
|
+
aValue = (_f = (_e = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], a)) === null || _e === void 0 ? void 0 : _e.bonusWithFee) !== null && _f !== void 0 ? _f : 0;
|
|
58321
|
+
bValue = (_h = (_g = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], b)) === null || _g === void 0 ? void 0 : _g.bonusWithFee) !== null && _h !== void 0 ? _h : 0;
|
|
58322
|
+
}
|
|
58323
|
+
if (aValue < bValue) {
|
|
58324
|
+
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
58325
|
+
}
|
|
58326
|
+
if (aValue > bValue) {
|
|
58327
|
+
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
58328
|
+
}
|
|
58329
|
+
return 0;
|
|
58330
|
+
});
|
|
58331
|
+
};
|
|
58332
|
+
const vestingTime = (vestingTerm) => {
|
|
58333
|
+
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0);
|
|
58334
|
+
};
|
|
58335
|
+
const remainingPercentage = (bond) => {
|
|
58336
|
+
var _a, _b, _c, _d;
|
|
58337
|
+
const totalMaxPayout = new BigNumber$1((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber$1(10).pow((_c = (_b = bond.earnToken.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
|
|
58338
|
+
const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
|
|
58339
|
+
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
58340
|
+
};
|
|
58341
|
+
const getDiscountColor = (discount) => {
|
|
58342
|
+
if (!discount)
|
|
58343
|
+
return '';
|
|
58344
|
+
return discount < 0 ? 'discount-negative' : 'discount-positive';
|
|
58345
|
+
};
|
|
58346
|
+
const calculateARR = (bond, useTiers) => {
|
|
58347
|
+
var _a;
|
|
58348
|
+
if (!('trueBondPrices' in bond))
|
|
58349
|
+
return '-';
|
|
58350
|
+
const bonus = (_a = findHighestTrueBondPrice(useTiers ? TIERS_WEIGHT[types.LaunchBondTiers.Legend] : '0', bond)) === null || _a === void 0 ? void 0 : _a.bonusWithFee;
|
|
58351
|
+
const vestingTerm = 'vestingTerm' in bond ? bond === null || bond === void 0 ? void 0 : bond.vestingTerm : undefined;
|
|
58352
|
+
if (!bonus)
|
|
58353
|
+
return '-';
|
|
58354
|
+
const discount = bonus !== null && bonus !== void 0 ? bonus : 0;
|
|
58355
|
+
if (discount < 0)
|
|
58356
|
+
return '-';
|
|
58357
|
+
const vestingDays = vestingTime(vestingTerm).days;
|
|
58358
|
+
return `${((discount * 365) / vestingDays).toFixed(2)}%`;
|
|
58359
|
+
};
|
|
58360
|
+
const isBondSupported = (SDKVersion, bondVersion) => {
|
|
58361
|
+
var _a, _b;
|
|
58362
|
+
// Split the versions into major, minor, and patch parts
|
|
58363
|
+
const [major1, minor1, patch1] = (_a = SDKVersion.split('.').map(Number)) !== null && _a !== void 0 ? _a : [];
|
|
58364
|
+
const [major2, minor2, patch2] = (_b = bondVersion === null || bondVersion === void 0 ? void 0 : bondVersion.split('.').map(Number)) !== null && _b !== void 0 ? _b : [];
|
|
58365
|
+
// Compare major versions
|
|
58366
|
+
if (major1 > major2)
|
|
58367
|
+
return true;
|
|
58368
|
+
if (major1 < major2)
|
|
58369
|
+
return false;
|
|
58370
|
+
// Compare minor versions
|
|
58371
|
+
if (minor1 > minor2)
|
|
58372
|
+
return true;
|
|
58373
|
+
if (minor1 < minor2)
|
|
58374
|
+
return false;
|
|
58375
|
+
// Compare patch versions
|
|
58376
|
+
if (patch1 >= patch2)
|
|
58377
|
+
return true;
|
|
58378
|
+
// If none of the above conditions are met, version1 is less
|
|
58379
|
+
return false;
|
|
58380
|
+
};
|
|
58381
|
+
|
|
58382
|
+
const BonusComponent = ({ bond, tooltipPosition, }) => {
|
|
58383
|
+
var _a, _b, _c, _d;
|
|
58384
|
+
const SDKConfig = useSDKConfig();
|
|
58385
|
+
const highestPointsElement = (_a = bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) === null || _a === void 0 ? void 0 : _a.reduce((max, current) => {
|
|
58386
|
+
return new BigNumber$1(current.points).isGreaterThan(new BigNumber$1(max.points)) ? current : max;
|
|
58387
|
+
}, bond === null || bond === void 0 ? void 0 : bond.trueBondPrices[0]);
|
|
58388
|
+
const baseTrueBondPrice = findHighestTrueBondPrice('0', bond);
|
|
58389
|
+
return (jsx$2(Flex, { children: (bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) && ((_b = bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) === null || _b === void 0 ? void 0 : _b.length) > 1 && SDKConfig.useTiers ? (jsx$2(Flex, { sx: { alignItems: 'center' }, children: (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) > 0 ? (jsx$2(TooltipBubble, { width: "280px", placement: tooltipPosition, transformTip: tooltipPosition === 'bottomLeft' ? 'translate(0%, 0%)' : 'translate(0%, 0%)', body: jsx$2(BonusTable, { bond: bond }), children: jsxs(Flex, { sx: {
|
|
58390
|
+
p: '3px 6px',
|
|
58391
|
+
border: '1px solid var(--theme-ui-colors-primaryButton)',
|
|
58392
|
+
borderRadius: 'normal',
|
|
58393
|
+
background: 'transparent',
|
|
58394
|
+
position: 'relative',
|
|
58395
|
+
overflow: 'hidden',
|
|
58396
|
+
cursor: 'pointer',
|
|
58397
|
+
width: ['130px', '130px', '150px', '150px'],
|
|
58398
|
+
}, children: [jsx$2(Flex, { sx: {
|
|
58399
|
+
position: 'absolute',
|
|
58400
|
+
width: '100%',
|
|
58401
|
+
height: '100%',
|
|
58402
|
+
top: 0,
|
|
58403
|
+
left: 0,
|
|
58404
|
+
zIndex: 1,
|
|
58405
|
+
background: 'primaryButton',
|
|
58406
|
+
opacity: 0.3,
|
|
58407
|
+
} }), jsxs(Flex, { sx: { width: '100%', zIndex: 2, alignItems: 'center', justifyContent: 'center' }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { fontSize: ['12px', '12px', '14px', '14px'], mr: '3px' }, children: "Up to" }), jsxs(Flex, { sx: {
|
|
58408
|
+
color: (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) > 0 ? 'success' : 'error',
|
|
58409
|
+
fontSize: ['14px', '14px', '16px', '16px'],
|
|
58410
|
+
}, children: [(_c = highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) === null || _c === void 0 ? void 0 : _c.toFixed(2), "%"] })] })] }) })) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : (jsx$2(Flex, { sx: { alignItems: 'center' }, className: `${getDiscountColor(+(baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee))}`, children: (baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) > 0 ? (`${(_d = baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) === null || _d === void 0 ? void 0 : _d.toFixed(2)}%`) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) }));
|
|
58411
|
+
};
|
|
58412
|
+
|
|
58413
|
+
const useIsMobile = () => {
|
|
58414
|
+
const [isMobile, setIsMobile] = useState(window.innerWidth < 852);
|
|
58415
|
+
// Hardcoded toggle for debounce
|
|
58416
|
+
const useDebounce = false;
|
|
58417
|
+
useEffect(() => {
|
|
58418
|
+
const resizeHandler = () => {
|
|
58419
|
+
{
|
|
58420
|
+
setIsMobile(window.innerWidth < 852);
|
|
58421
|
+
}
|
|
58422
|
+
};
|
|
58423
|
+
window.addEventListener('resize', resizeHandler);
|
|
58424
|
+
return () => {
|
|
58425
|
+
window.removeEventListener('resize', resizeHandler);
|
|
58426
|
+
};
|
|
58427
|
+
}, [useDebounce]);
|
|
58428
|
+
return isMobile;
|
|
58429
|
+
};
|
|
58430
|
+
|
|
58431
|
+
const BonusContainer = ({ bond, tooltipPosition = 'bottomRight', }) => {
|
|
58432
|
+
var _a, _b;
|
|
58433
|
+
const SDKConfig = useSDKConfig();
|
|
58434
|
+
const isMobile = useIsMobile();
|
|
58435
|
+
return (jsx$2("div", { className: `discount-column`, children: 'trueBondPrices' in bond ? (((_b = (_a = findHighestTrueBondPrice((SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) ? TIERS_WEIGHT[types.LaunchBondTiers.Legend] : '0', bond)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0) > 0 ? (jsx$2(BonusComponent, { bond: bond, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' })) : (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }))) : ('-') }));
|
|
58436
|
+
};
|
|
58437
|
+
|
|
58438
|
+
var ABTestKeys;
|
|
58439
|
+
(function (ABTestKeys) {
|
|
58440
|
+
ABTestKeys["BOND_DESCRIPTION"] = "bondDescription";
|
|
58441
|
+
ABTestKeys["BOND_BUY_BUTTON"] = "bondBuyButton";
|
|
58442
|
+
})(ABTestKeys || (ABTestKeys = {}));
|
|
58443
|
+
function useABTesting({ key, defaultValue = (Math.random() < 0.5).toString(), }) {
|
|
58444
|
+
const { cookie, updateCookie } = useCookie(QUERY_KEYS.AB_TEST_VALUE, null);
|
|
58445
|
+
let abTestValue = '';
|
|
58446
|
+
let parseCookie = null;
|
|
58447
|
+
if (cookie === null || cookie === undefined || cookie[key] === undefined) {
|
|
58448
|
+
parseCookie = Object.assign(Object.assign({}, cookie), { [key]: defaultValue.toString() });
|
|
58449
|
+
abTestValue = defaultValue.toString();
|
|
58450
|
+
updateCookie(parseCookie);
|
|
58451
|
+
}
|
|
58452
|
+
if (cookie) {
|
|
58453
|
+
parseCookie = cookie;
|
|
58454
|
+
if (parseCookie && parseCookie[key]) {
|
|
58455
|
+
abTestValue = parseCookie[key].toString();
|
|
58456
|
+
}
|
|
58457
|
+
}
|
|
58458
|
+
return { abTestValue };
|
|
58459
|
+
}
|
|
58460
|
+
|
|
58461
|
+
const TokenInfoAndName = ({ bill, vestEnds, isHotBond, isGoldBond, }) => {
|
|
58462
|
+
var _a, _b, _c, _d, _e;
|
|
58463
|
+
const SDKConfig = useSDKConfig();
|
|
58464
|
+
const tokenName = 'showcaseTokenName' in bill ? bill.showcaseTokenName : bill.earnToken.symbol;
|
|
58465
|
+
const { abTestValue } = useABTesting({ key: ABTestKeys.BOND_BUY_BUTTON });
|
|
58466
|
+
return (jsxs(Flex, { className: "tokeninfoname container", children: [SDKConfig.referenceId === 'seedify' ? (jsx$2(Flex, { sx: {
|
|
58467
|
+
p: '10px',
|
|
58468
|
+
opacity: 0.2,
|
|
58469
|
+
position: 'absolute',
|
|
58470
|
+
left: '-20px',
|
|
58471
|
+
}, children: jsx$2(Flex, { sx: { borderRadius: 'normal', overflow: 'hidden' }, children: jsx$2(Svg, { width: 100, height: 100, icon: (_a = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _a !== void 0 ? _a : 'question' }) }) })) : (jsx$2(Fragment$1, { children: jsx$2(Flex, { className: "tokeninfoname chain", children: jsx$2(Svg, { width: 20, height: 20, icon: (_b = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _b !== void 0 ? _b : 'question' }) }) })), jsxs(Flex, { className: "tokeninfoname tokencontainer", sx: {
|
|
58472
|
+
marginTop: vestEnds ? ['10px', '10px', '10px', '0px'] : 0,
|
|
58473
|
+
maxWidth: ['175px', '175px', '140px', '190px', '190px'],
|
|
58474
|
+
}, children: [jsx$2(TokenImage, { symbol: tokenName, size: 33 }), jsxs(Flex, { className: "tokeninfoname tokentext", children: [jsxs(Flex, { sx: { justifyContent: 'space-between', width: '100%', alignItems: 'center' }, children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '14px', '16px'] }, children: tokenName }), jsx$2(Flex, { className: "tokeninfofav", sx: {
|
|
58475
|
+
minWidth: '25px',
|
|
58476
|
+
p: '5px',
|
|
58477
|
+
display: abTestValue === 'true' ? ['flex', 'flex', 'none', 'none'] : 'none',
|
|
58478
|
+
}, children: jsx$2(AddFavToken, { tokenSymbol: tokenName, hotBond: isHotBond, isGoldBond: isGoldBond }) })] }), jsx$2("div", { sx: { display: abTestValue === 'true' ? ['flex', 'flex', 'none', 'none'] : 'none' }, children: jsx$2(BonusContainer, { bond: bill, tooltipPosition: "bottomLeft" }) }), vestEnds && (jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400, opacity: 0.6, lineHeight: '14px' }, children: vestEnds }))] }), jsx$2(Flex, { className: "tokeninfofav", sx: {
|
|
58479
|
+
minWidth: '25px',
|
|
58480
|
+
p: '5px',
|
|
58481
|
+
display: abTestValue === 'true' ? ['none', 'none', 'flex', 'flex'] : 'flex',
|
|
58482
|
+
}, children: jsx$2(AddFavToken, { tokenSymbol: tokenName, hotBond: isHotBond, isGoldBond: isGoldBond }) })] }), jsx$2(Flex, { sx: {
|
|
58483
|
+
justifyContent: isHotBond ? 'center' : 'flex-start',
|
|
58484
|
+
alignItems: 'center',
|
|
58485
|
+
}, children: jsx$2(Flex, { sx: { display: isHotBond ? 'flex' : ['none', 'none', 'none', 'none', 'flex'] }, children: ((_c = bill.tags) === null || _c === void 0 ? void 0 : _c[0]) && jsx$2(ListTag, { text: (_e = (_d = bill.tags) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.toUpperCase() }) }) }), jsx$2(Flex, { className: vestEnds ? '' : 'short-description-basepad', sx: { display: 'none' }, children: bill.shortDescription })] }));
|
|
58486
|
+
};
|
|
58487
|
+
|
|
58488
|
+
const formatNumber$2 = (number, minPrecision = 2, maxPrecision = 2) => {
|
|
58489
|
+
const options = {
|
|
58490
|
+
minimumFractionDigits: minPrecision,
|
|
58491
|
+
maximumFractionDigits: maxPrecision,
|
|
58492
|
+
};
|
|
58493
|
+
return number.toLocaleString('en-US', options);
|
|
58494
|
+
};
|
|
58495
|
+
// Formats a number with SI (International System of Units) sufixes
|
|
58496
|
+
const formatNumberSI = (num, digits = 2) => {
|
|
58497
|
+
const number = typeof num === 'string' ? parseFloat(num) : num;
|
|
58498
|
+
const lookupSI = [
|
|
58499
|
+
{ value: 1, symbol: '' },
|
|
58500
|
+
{ value: 1e6, symbol: 'M' },
|
|
58501
|
+
{ value: 1e9, symbol: 'B' },
|
|
58502
|
+
{ value: 1e12, symbol: 'T' },
|
|
58503
|
+
];
|
|
58504
|
+
const regEx = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
|
58505
|
+
let formatted;
|
|
58506
|
+
if (number >= 1e18) {
|
|
58507
|
+
formatted = '∞';
|
|
58508
|
+
}
|
|
58509
|
+
else {
|
|
58510
|
+
let i;
|
|
58511
|
+
for (i = lookupSI.length - 1; i > 0; i--) {
|
|
58512
|
+
if (number >= lookupSI[i].value) {
|
|
58513
|
+
break;
|
|
58514
|
+
}
|
|
58515
|
+
}
|
|
58516
|
+
formatted = formatNumber$2(number / lookupSI[i].value, digits, digits).replace(regEx, '$1') + lookupSI[i].symbol;
|
|
58517
|
+
}
|
|
58518
|
+
return formatted;
|
|
58519
|
+
};
|
|
58520
|
+
|
|
58521
|
+
const getBalanceNumber = (balance, decimals = 18) => {
|
|
58522
|
+
// use with caution. JS can only safely represent up to 15-17 digits of precision
|
|
58523
|
+
// so you will lose precision in decimals and really big numbers, for those cases use getBNWithDecimals
|
|
58524
|
+
const displayBalance = new BigNumber$1(balance).dividedBy(new BigNumber$1(10).pow(decimals));
|
|
58525
|
+
return displayBalance.toNumber();
|
|
58526
|
+
};
|
|
58527
|
+
|
|
58528
|
+
/**
|
|
58529
|
+
* Rounds a number to precision amount of signifant numbers
|
|
58530
|
+
* @param n the number
|
|
58531
|
+
* @param precision how many significant numbers to show
|
|
58532
|
+
* @returns @number
|
|
58533
|
+
*/
|
|
58534
|
+
const getFirstNonZeroDigits = (numberToParse, precision = 3) => {
|
|
58535
|
+
const n = parseFloat(numberToParse.toFixed(18));
|
|
58536
|
+
let amountToShow = precision - 1;
|
|
58537
|
+
if (n !== 0)
|
|
58538
|
+
amountToShow -= Math.floor(Math.log(n) / Math.log(10));
|
|
58539
|
+
return n.toFixed(amountToShow < 0 ? 0 : amountToShow);
|
|
58540
|
+
};
|
|
58541
|
+
|
|
58313
58542
|
const claimable = (userBill) => {
|
|
58314
58543
|
var _a, _b, _c;
|
|
58315
58544
|
return getBalanceNumber(new BigNumber$1(userBill.pendingRewards), (_c = (_b = (_a = userBill.bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[userBill.bond.chainId]) !== null && _c !== void 0 ? _c : 18);
|
|
@@ -70550,7 +70779,7 @@ function getTemplateHTML(data) {
|
|
|
70550
70779
|
</div>
|
|
70551
70780
|
<div class="sharebondimage-container-off">
|
|
70552
70781
|
<span>
|
|
70553
|
-
${formatNumber$
|
|
70782
|
+
${formatNumber$2(getCalculateOff())}% OFF
|
|
70554
70783
|
</span>
|
|
70555
70784
|
</div>
|
|
70556
70785
|
</div>
|
|
@@ -70561,7 +70790,7 @@ function getTemplateHTML(data) {
|
|
|
70561
70790
|
${formatTransactionAmount(data.data.deposit)}
|
|
70562
70791
|
</div>
|
|
70563
70792
|
<div class="sharebondimage-dollarvalue">
|
|
70564
|
-
$${formatNumber$
|
|
70793
|
+
$${formatNumber$2(data.data.dollarValue)}
|
|
70565
70794
|
</div>
|
|
70566
70795
|
</div>
|
|
70567
70796
|
<div class="sharebondimage-container-token">
|
|
@@ -70569,15 +70798,15 @@ function getTemplateHTML(data) {
|
|
|
70569
70798
|
<div class="sharebondimage-container-earntoken">
|
|
70570
70799
|
<div class="sharebondimage-amount-earntoken">
|
|
70571
70800
|
<div class="sharebondimage-amount-payout">
|
|
70572
|
-
${formatNumber$
|
|
70801
|
+
${formatNumber$2(data.data.payout)}
|
|
70573
70802
|
</div>
|
|
70574
70803
|
<div class="sharebondimage-amount-dollarvalue">
|
|
70575
|
-
$${formatNumber$
|
|
70804
|
+
$${formatNumber$2(data.data.payout * +data.data.payoutTokenPrice)}
|
|
70576
70805
|
</div>
|
|
70577
70806
|
</div>
|
|
70578
70807
|
<div class="sharebondimage-profit" style="${!isProfit ? 'display: none' : ''}">
|
|
70579
70808
|
<span>
|
|
70580
|
-
+${formatNumber$
|
|
70809
|
+
+${formatNumber$2(data.data.payout * +data.data.payoutTokenPrice - data.data.dollarValue)}
|
|
70581
70810
|
profit!
|
|
70582
70811
|
</span>
|
|
70583
70812
|
</div>
|
|
@@ -71685,107 +71914,6 @@ const useTopTags = (initialBondList) => {
|
|
|
71685
71914
|
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
71686
71915
|
};
|
|
71687
71916
|
|
|
71688
|
-
const isBondSoldOut = (bill) => {
|
|
71689
|
-
var _a;
|
|
71690
|
-
if (bill.soldOut)
|
|
71691
|
-
return true;
|
|
71692
|
-
if (bill.inactive)
|
|
71693
|
-
return true;
|
|
71694
|
-
const { tokensRemaining, payoutTokenPrice } = bill;
|
|
71695
|
-
if (!tokensRemaining)
|
|
71696
|
-
return false;
|
|
71697
|
-
const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
71698
|
-
if ((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) {
|
|
71699
|
-
// If there's less than 100 usd bond will be hidden
|
|
71700
|
-
return true;
|
|
71701
|
-
}
|
|
71702
|
-
else
|
|
71703
|
-
return false;
|
|
71704
|
-
};
|
|
71705
|
-
const sortBonds = (sortConfig, bonds) => {
|
|
71706
|
-
const bondsToSort = bonds !== null && bonds !== void 0 ? bonds : [];
|
|
71707
|
-
if (!sortConfig) {
|
|
71708
|
-
return bondsToSort;
|
|
71709
|
-
}
|
|
71710
|
-
return [...bondsToSort].sort((a, b) => {
|
|
71711
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
71712
|
-
let aValue;
|
|
71713
|
-
let bValue;
|
|
71714
|
-
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === 'arr') {
|
|
71715
|
-
aValue = (_b = (_a = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], a)) === null || _a === void 0 ? void 0 : _a.bonusWithFee) !== null && _b !== void 0 ? _b : 0;
|
|
71716
|
-
bValue = (_d = (_c = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], b)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) !== null && _d !== void 0 ? _d : 0;
|
|
71717
|
-
}
|
|
71718
|
-
else if (sortConfig.key === 'tokensRemaining') {
|
|
71719
|
-
aValue = remainingPercentage(a);
|
|
71720
|
-
bValue = remainingPercentage(b);
|
|
71721
|
-
}
|
|
71722
|
-
else if (sortConfig.key === 'terms') {
|
|
71723
|
-
aValue = vestingTime(a.vestingTerm).days;
|
|
71724
|
-
bValue = vestingTime(b.vestingTerm).days;
|
|
71725
|
-
}
|
|
71726
|
-
else {
|
|
71727
|
-
aValue = (_f = (_e = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], a)) === null || _e === void 0 ? void 0 : _e.bonusWithFee) !== null && _f !== void 0 ? _f : 0;
|
|
71728
|
-
bValue = (_h = (_g = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], b)) === null || _g === void 0 ? void 0 : _g.bonusWithFee) !== null && _h !== void 0 ? _h : 0;
|
|
71729
|
-
}
|
|
71730
|
-
if (aValue < bValue) {
|
|
71731
|
-
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
71732
|
-
}
|
|
71733
|
-
if (aValue > bValue) {
|
|
71734
|
-
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
71735
|
-
}
|
|
71736
|
-
return 0;
|
|
71737
|
-
});
|
|
71738
|
-
};
|
|
71739
|
-
const vestingTime = (vestingTerm) => {
|
|
71740
|
-
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0);
|
|
71741
|
-
};
|
|
71742
|
-
const remainingPercentage = (bond) => {
|
|
71743
|
-
var _a, _b, _c, _d;
|
|
71744
|
-
const totalMaxPayout = new BigNumber$1((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber$1(10).pow((_c = (_b = bond.earnToken.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
|
|
71745
|
-
const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
|
|
71746
|
-
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
71747
|
-
};
|
|
71748
|
-
const getDiscountColor = (discount) => {
|
|
71749
|
-
if (!discount)
|
|
71750
|
-
return '';
|
|
71751
|
-
return discount < 0 ? 'discount-negative' : 'discount-positive';
|
|
71752
|
-
};
|
|
71753
|
-
const calculateARR = (bond, useTiers) => {
|
|
71754
|
-
var _a;
|
|
71755
|
-
if (!('trueBondPrices' in bond))
|
|
71756
|
-
return '-';
|
|
71757
|
-
const bonus = (_a = findHighestTrueBondPrice(useTiers ? TIERS_WEIGHT[types.LaunchBondTiers.Legend] : '0', bond)) === null || _a === void 0 ? void 0 : _a.bonusWithFee;
|
|
71758
|
-
const vestingTerm = 'vestingTerm' in bond ? bond === null || bond === void 0 ? void 0 : bond.vestingTerm : undefined;
|
|
71759
|
-
if (!bonus)
|
|
71760
|
-
return '-';
|
|
71761
|
-
const discount = bonus !== null && bonus !== void 0 ? bonus : 0;
|
|
71762
|
-
if (discount < 0)
|
|
71763
|
-
return '-';
|
|
71764
|
-
const vestingDays = vestingTime(vestingTerm).days;
|
|
71765
|
-
return `${((discount * 365) / vestingDays).toFixed(2)}%`;
|
|
71766
|
-
};
|
|
71767
|
-
const isBondSupported = (SDKVersion, bondVersion) => {
|
|
71768
|
-
var _a, _b;
|
|
71769
|
-
// Split the versions into major, minor, and patch parts
|
|
71770
|
-
const [major1, minor1, patch1] = (_a = SDKVersion.split('.').map(Number)) !== null && _a !== void 0 ? _a : [];
|
|
71771
|
-
const [major2, minor2, patch2] = (_b = bondVersion === null || bondVersion === void 0 ? void 0 : bondVersion.split('.').map(Number)) !== null && _b !== void 0 ? _b : [];
|
|
71772
|
-
// Compare major versions
|
|
71773
|
-
if (major1 > major2)
|
|
71774
|
-
return true;
|
|
71775
|
-
if (major1 < major2)
|
|
71776
|
-
return false;
|
|
71777
|
-
// Compare minor versions
|
|
71778
|
-
if (minor1 > minor2)
|
|
71779
|
-
return true;
|
|
71780
|
-
if (minor1 < minor2)
|
|
71781
|
-
return false;
|
|
71782
|
-
// Compare patch versions
|
|
71783
|
-
if (patch1 >= patch2)
|
|
71784
|
-
return true;
|
|
71785
|
-
// If none of the above conditions are met, version1 is less
|
|
71786
|
-
return false;
|
|
71787
|
-
};
|
|
71788
|
-
|
|
71789
71917
|
var BOND_2_4_0 = [
|
|
71790
71918
|
{
|
|
71791
71919
|
inputs: [
|
|
@@ -75780,7 +75908,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
75780
75908
|
return [approvalState !== null && approvalState !== void 0 ? approvalState : ApprovalState.NOT_APPROVED, handleApprove];
|
|
75781
75909
|
};
|
|
75782
75910
|
|
|
75783
|
-
const version$1 = '2.
|
|
75911
|
+
const version$1 = '2.23.6';
|
|
75784
75912
|
|
|
75785
75913
|
let errorConfig = {
|
|
75786
75914
|
getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
|
|
@@ -76318,108 +76446,6 @@ const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
|
76318
76446
|
}, children: ["$", discountEarnTokenPrice(bondData, true)] })] })] })) : (jsxs(Flex, { sx: { fontSize: '24px', fontWeight: 700 }, children: ["$", discountEarnTokenPrice(bondData)] }))] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'], ml: '10px' }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) })] })] }));
|
|
76319
76447
|
};
|
|
76320
76448
|
|
|
76321
|
-
const YouTooltip = () => {
|
|
76322
|
-
return (jsx$2(Flex, { sx: { position: 'relative', ml: '10px' }, children: jsx$2(Flex, { sx: {
|
|
76323
|
-
background: 'primaryButton',
|
|
76324
|
-
height: '18px',
|
|
76325
|
-
justifyContent: 'center',
|
|
76326
|
-
borderRadius: '4px',
|
|
76327
|
-
px: '5px',
|
|
76328
|
-
fontWeight: 400,
|
|
76329
|
-
fontSize: '12px',
|
|
76330
|
-
position: 'absolute',
|
|
76331
|
-
left: 0,
|
|
76332
|
-
top: '50%', // Start 50% down the parent
|
|
76333
|
-
transform: 'translateY(-50%)', // Adjust by the element's own height
|
|
76334
|
-
'::after': {
|
|
76335
|
-
content: '""',
|
|
76336
|
-
position: 'absolute',
|
|
76337
|
-
top: '50%', // Vertically center
|
|
76338
|
-
left: '-11px', // Position outside the tooltip box
|
|
76339
|
-
transform: 'translateY(-50%)', // Center arrow vertically
|
|
76340
|
-
borderWidth: '6px', // Arrow size
|
|
76341
|
-
borderStyle: 'solid',
|
|
76342
|
-
borderColor: 'transparent var(--theme-ui-colors-primaryButton) transparent transparent', // Arrow now points left
|
|
76343
|
-
},
|
|
76344
|
-
}, children: "You" }) }));
|
|
76345
|
-
};
|
|
76346
|
-
|
|
76347
|
-
const BonusTable = ({ bond, hideTitle }) => {
|
|
76348
|
-
const { data: userPoints } = useTierPoints();
|
|
76349
|
-
const usersTrueBondPrices = findHighestTrueBondPrice(userPoints, bond);
|
|
76350
|
-
const minTier = (bond === null || bond === void 0 ? void 0 : bond.minTier) !== undefined ? bond.minTier : null;
|
|
76351
|
-
return (jsxs(Flex, { sx: { width: '100%', flexDirection: 'column' }, children: [!hideTitle && jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mb: '10px' }, children: "Ape Tier Bonuses" }), bond.trueBondPrices
|
|
76352
|
-
.sort((a, b) => new BigNumber$1(b.points).minus(new BigNumber$1(a.points)).toNumber())
|
|
76353
|
-
.map((tier, i) => {
|
|
76354
|
-
var _a, _b;
|
|
76355
|
-
const tierToUse = getUserTier(tier.points);
|
|
76356
|
-
const tierName = `${TIERS_NAMES[tierToUse]}`;
|
|
76357
|
-
const you = tier.points === (usersTrueBondPrices === null || usersTrueBondPrices === void 0 ? void 0 : usersTrueBondPrices.points);
|
|
76358
|
-
const isUnavailable = minTier > tierToUse || (minTier === 0 && tier.points === '0');
|
|
76359
|
-
return (jsxs(Flex, { sx: {
|
|
76360
|
-
width: '100%',
|
|
76361
|
-
justifyContent: 'space-between',
|
|
76362
|
-
height: '30px',
|
|
76363
|
-
background: (_a = TIERS_COLORS[tierToUse]) !== null && _a !== void 0 ? _a : 'white3',
|
|
76364
|
-
borderRadius: 'normal',
|
|
76365
|
-
alignItems: 'center',
|
|
76366
|
-
px: '8px',
|
|
76367
|
-
mb: '1px',
|
|
76368
|
-
}, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [tier.points !== '0' && (jsx$2("img", { src: `/images/launch/${(_b = TIERS_NAMES[tierToUse]) === null || _b === void 0 ? void 0 : _b.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } })), jsx$2(Flex, { children: tier.points === '0' ? 'No Tier' : tierName }), you && jsx$2(YouTooltip, {})] }), isUnavailable ? (jsx$2(Flex, { sx: { fontWeight: 600, opacity: 0.8 }, children: "UNAVAILABLE" })) : (jsxs(Flex, { sx: { color: tier.bonusWithFee > 0 ? 'success' : 'text', fontWeight: 700, alignItems: 'center' }, children: [tier.bonusWithFee > 0 ? tier.bonusWithFee.toFixed(2) : '0', "%", tier.points !== '0' && (jsx$2(Flex, { sx: {
|
|
76369
|
-
borderRadius: 'normal',
|
|
76370
|
-
border: '1px solid var(--theme-ui-colors-success)',
|
|
76371
|
-
px: '4px',
|
|
76372
|
-
ml: '3px',
|
|
76373
|
-
color: 'success',
|
|
76374
|
-
}, children: boostMap[tierToUse] }))] }))] }, tier.points));
|
|
76375
|
-
}), !hideTitle && (jsx$2(Button, { variant: "secondary", sx: { width: '100%', mt: '10px' }, onClick: () => window.open('https://ape.bond/tier-staking', '_blank'), children: "get tier" }))] }));
|
|
76376
|
-
};
|
|
76377
|
-
|
|
76378
|
-
const BonusComponent = ({ bond, tooltipPosition, }) => {
|
|
76379
|
-
var _a, _b, _c, _d;
|
|
76380
|
-
const SDKConfig = useSDKConfig();
|
|
76381
|
-
const highestPointsElement = (_a = bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) === null || _a === void 0 ? void 0 : _a.reduce((max, current) => {
|
|
76382
|
-
return new BigNumber$1(current.points).isGreaterThan(new BigNumber$1(max.points)) ? current : max;
|
|
76383
|
-
}, bond === null || bond === void 0 ? void 0 : bond.trueBondPrices[0]);
|
|
76384
|
-
const baseTrueBondPrice = findHighestTrueBondPrice('0', bond);
|
|
76385
|
-
return (jsx$2(Flex, { children: (bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) && ((_b = bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) === null || _b === void 0 ? void 0 : _b.length) > 1 && SDKConfig.useTiers ? (jsx$2(Flex, { sx: { alignItems: 'center' }, children: (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) > 0 ? (jsx$2(TooltipBubble, { width: "280px", placement: tooltipPosition, transformTip: tooltipPosition === 'bottomLeft' ? 'translate(0%, 0%)' : 'translate(0%, 0%)', body: jsx$2(BonusTable, { bond: bond }), children: jsxs(Flex, { sx: {
|
|
76386
|
-
p: '3px 6px',
|
|
76387
|
-
border: '1px solid var(--theme-ui-colors-primaryButton)',
|
|
76388
|
-
borderRadius: 'normal',
|
|
76389
|
-
background: 'transparent',
|
|
76390
|
-
position: 'relative',
|
|
76391
|
-
overflow: 'hidden',
|
|
76392
|
-
cursor: 'pointer',
|
|
76393
|
-
}, children: [jsx$2(Flex, { sx: {
|
|
76394
|
-
position: 'absolute',
|
|
76395
|
-
width: '100%',
|
|
76396
|
-
height: '100%',
|
|
76397
|
-
top: 0,
|
|
76398
|
-
left: 0,
|
|
76399
|
-
zIndex: 1,
|
|
76400
|
-
background: 'primaryButton',
|
|
76401
|
-
opacity: 0.3,
|
|
76402
|
-
} }), jsxs(Flex, { sx: { width: '100%', zIndex: 2, alignItems: 'center' }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { fontSize: '14px', mr: '3px' }, children: "Up to" }), jsxs(Flex, { sx: { color: (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) > 0 ? 'success' : 'error' }, children: [(_c = highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) === null || _c === void 0 ? void 0 : _c.toFixed(2), "%"] })] })] }) })) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : (jsx$2(Flex, { sx: { alignItems: 'center' }, children: (baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) > 0 ? (`${(_d = baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) === null || _d === void 0 ? void 0 : _d.toFixed(2)}%`) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) }));
|
|
76403
|
-
};
|
|
76404
|
-
|
|
76405
|
-
const useIsMobile = () => {
|
|
76406
|
-
const [isMobile, setIsMobile] = useState(window.innerWidth < 852);
|
|
76407
|
-
// Hardcoded toggle for debounce
|
|
76408
|
-
const useDebounce = false;
|
|
76409
|
-
useEffect(() => {
|
|
76410
|
-
const resizeHandler = () => {
|
|
76411
|
-
{
|
|
76412
|
-
setIsMobile(window.innerWidth < 852);
|
|
76413
|
-
}
|
|
76414
|
-
};
|
|
76415
|
-
window.addEventListener('resize', resizeHandler);
|
|
76416
|
-
return () => {
|
|
76417
|
-
window.removeEventListener('resize', resizeHandler);
|
|
76418
|
-
};
|
|
76419
|
-
}, [useDebounce]);
|
|
76420
|
-
return isMobile;
|
|
76421
|
-
};
|
|
76422
|
-
|
|
76423
76449
|
const BondCards = ({ bondData }) => {
|
|
76424
76450
|
var _a, _b, _c;
|
|
76425
76451
|
const isMobile = useIsMobile();
|
|
@@ -76692,6 +76718,14 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
76692
76718
|
const { data: userPoints } = useTierPoints();
|
|
76693
76719
|
const bondData = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
76694
76720
|
const isMobile = useIsMobile();
|
|
76721
|
+
const { abTestValue } = useABTesting({ key: ABTestKeys.BOND_BUY_BUTTON });
|
|
76722
|
+
let reason = '';
|
|
76723
|
+
if (isMobile) {
|
|
76724
|
+
reason = abTestValue === 'true' ? 'bondBuyButtonMobile' : 'noBondBuyButtonMobile';
|
|
76725
|
+
}
|
|
76726
|
+
else {
|
|
76727
|
+
reason = abTestValue === 'true' ? 'bondBuyButtonDesktop' : 'noBondBuyButtonDesktop';
|
|
76728
|
+
}
|
|
76695
76729
|
// Tier Gating
|
|
76696
76730
|
const userTier = getUserTier(userPoints !== null && userPoints !== void 0 ? userPoints : '0');
|
|
76697
76731
|
const minTier = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined ? bondData.minTier : null;
|
|
@@ -76785,7 +76819,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
76785
76819
|
});
|
|
76786
76820
|
if (hash) {
|
|
76787
76821
|
setBuyTxHash(hash);
|
|
76788
|
-
yield sendReferenceId(billAddress, userChainId, hash);
|
|
76822
|
+
yield sendReferenceId(billAddress, userChainId, hash, reason);
|
|
76789
76823
|
handlePurchasedBond === null || handlePurchasedBond === void 0 ? void 0 : handlePurchasedBond(hash);
|
|
76790
76824
|
track({
|
|
76791
76825
|
event: 'bond',
|
|
@@ -76832,7 +76866,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
76832
76866
|
});
|
|
76833
76867
|
if (hash) {
|
|
76834
76868
|
setBuyTxHash(hash);
|
|
76835
|
-
yield sendReferenceId((_d = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress) !== null && _d !== void 0 ? _d : '', userChainId, hash);
|
|
76869
|
+
yield sendReferenceId((_d = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress) !== null && _d !== void 0 ? _d : '', userChainId, hash, reason);
|
|
76836
76870
|
handlePurchasedBond === null || handlePurchasedBond === void 0 ? void 0 : handlePurchasedBond(hash);
|
|
76837
76871
|
track({
|
|
76838
76872
|
event: 'zap',
|
|
@@ -77089,17 +77123,34 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
|
|
|
77089
77123
|
};
|
|
77090
77124
|
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
77091
77125
|
|
|
77126
|
+
const NETWORK_COLORS = {
|
|
77127
|
+
[types.ChainId.BSC]: '#F3BA2F4d',
|
|
77128
|
+
[types.ChainId.MAINNET]: '#627eea4d',
|
|
77129
|
+
[types.ChainId.MATIC]: '#8247e54d',
|
|
77130
|
+
[types.ChainId.LIGHTLINK]: '#6087ff4d',
|
|
77131
|
+
[types.ChainId.BASE]: '#0052ff4d',
|
|
77132
|
+
[types.ChainId.ARBITRUM]: '#289fef4d',
|
|
77133
|
+
[types.ChainId.LINEA]: '#ffffff4d',
|
|
77134
|
+
[types.ChainId.IOTA]: '#ffffff4d',
|
|
77135
|
+
[types.ChainId.GRAPHLINQ]: '#ded2ff4d',
|
|
77136
|
+
[types.ChainId.AVAX]: '#e743444d',
|
|
77137
|
+
[types.ChainId.BLAST]: '#fcfc034d',
|
|
77138
|
+
[types.ChainId.CROSSFI]: '#7c80844d',
|
|
77139
|
+
[types.ChainId.MONAD_TESTNET]: '#836EF94d',
|
|
77140
|
+
[types.ChainId.SONIC]: '#fb9a4c4d',
|
|
77141
|
+
};
|
|
77092
77142
|
const BondRow = ({ bond }) => {
|
|
77093
|
-
var _a, _b, _c, _d, _e
|
|
77094
|
-
const isMobile = useIsMobile();
|
|
77095
|
-
const SDKConfig = useSDKConfig();
|
|
77143
|
+
var _a, _b, _c, _d, _e;
|
|
77096
77144
|
const locationPath = window.location.pathname.replace('/', '');
|
|
77145
|
+
const isMobile = useIsMobile();
|
|
77146
|
+
const rangeColorNetworkRow = isMobile ? { from: '0%', to: '20%' } : { from: '3%', to: '8%' };
|
|
77097
77147
|
const billAddress = 'billAddress' in bond
|
|
77098
77148
|
? bond.billAddress
|
|
77099
77149
|
: 'contractAddress' in bond
|
|
77100
77150
|
? bond.contractAddress[bond.chainId]
|
|
77101
77151
|
: undefined;
|
|
77102
77152
|
const isGoldRush = 'billArt' in bond ? bond.billArt.collection === types.BillArtCollection.GoldenTicket_Collection1 : false;
|
|
77153
|
+
const { abTestValue } = useABTesting({ key: ABTestKeys.BOND_BUY_BUTTON });
|
|
77103
77154
|
// Modal
|
|
77104
77155
|
const [openBuyModal] = useModal(jsx$2(ModalHandler, { bondAddress: billAddress, bondChain: bond.chainId }), true, true, `buyBondModal-${billAddress}-${bond.chainId}`);
|
|
77105
77156
|
const handleOpenModal = () => {
|
|
@@ -77137,7 +77188,12 @@ const BondRow = ({ bond }) => {
|
|
|
77137
77188
|
const tokens = new BigNumber$1(tokensRemaining);
|
|
77138
77189
|
return tokens.times(payoutTokenPrice);
|
|
77139
77190
|
};
|
|
77140
|
-
return (jsxs("div", { className: `bond-row ${isGoldRush ? 'gold-rush' : ''}`, onClick: handleOpenModal, sx: {
|
|
77191
|
+
return (jsxs("div", { className: `bond-row ${isGoldRush ? 'gold-rush' : ''}`, onClick: handleOpenModal, sx: {
|
|
77192
|
+
borderRadius: 'normal',
|
|
77193
|
+
background: NETWORK_COLORS[bond.chainId]
|
|
77194
|
+
? `linear-gradient(90deg, ${NETWORK_COLORS[bond.chainId]} ${rangeColorNetworkRow.from}, rgba(21,20,32,1) ${rangeColorNetworkRow.to})`
|
|
77195
|
+
: 'linear-gradient(90deg, rgba(21,20,32,0.3) 3%, rgba(21,20,32,1) 8%)',
|
|
77196
|
+
}, children: [jsx$2("div", { className: "gold-ribbon" }), jsx$2("div", { className: "token-info-container", sx: { width: ['70%', '70%', '65%', '30%'] }, children: jsx$2(TokenInfoAndName, { bill: bond, isGoldBond: isGoldRush }) }), jsxs("div", { className: "bond-info-columns", sx: { width: '55%' }, children: [jsx$2("div", { sx: { display: abTestValue === 'true' ? ['none', 'none', 'flex', 'flex'] : 'flex' }, children: jsx$2(BonusContainer, { bond: bond }) }), jsxs("div", { className: "terms-column", children: [getVestingTermsString(bond), bond.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bond) }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
|
|
77141
77197
|
width: '127px',
|
|
77142
77198
|
height: '25px',
|
|
77143
77199
|
flexDirection: 'column',
|
|
@@ -77146,7 +77202,20 @@ const BondRow = ({ bond }) => {
|
|
|
77146
77202
|
}, showTooltip: true, toolTip: `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
|
|
77147
77203
|
num: remainingTokensUsd(bond).toNumber(),
|
|
77148
77204
|
isPrice: true,
|
|
77149
|
-
})})` }) }),
|
|
77205
|
+
})})` }) }), abTestValue === 'true' && (jsx$2("div", { sx: { width: ['70px', '70px', '120px', '120px', '70px'] }, children: jsx$2(Button, { sx: {
|
|
77206
|
+
width: '100%',
|
|
77207
|
+
height: '40px',
|
|
77208
|
+
fontSize: '14px',
|
|
77209
|
+
}, className: "action-button", onClick: () => {
|
|
77210
|
+
var _a;
|
|
77211
|
+
return track({
|
|
77212
|
+
event: 'newBuyButton',
|
|
77213
|
+
chain: bond === null || bond === void 0 ? void 0 : bond.chainId,
|
|
77214
|
+
data: {
|
|
77215
|
+
cat: (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.symbol,
|
|
77216
|
+
},
|
|
77217
|
+
});
|
|
77218
|
+
}, children: "BUY" }) })), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : '', earnTokenSymbol: (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) !== null && _e !== void 0 ? _e : '', bondContract: billAddress !== null && billAddress !== void 0 ? billAddress : '', projectLink: bond === null || bond === void 0 ? void 0 : bond.projectLink, twitter: bond === null || bond === void 0 ? void 0 : bond.twitter, audit: bond === null || bond === void 0 ? void 0 : bond.audit, chain: bond === null || bond === void 0 ? void 0 : bond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, billAddress));
|
|
77150
77219
|
};
|
|
77151
77220
|
|
|
77152
77221
|
const HotBondCard = ({ bond }) => {
|
|
@@ -77467,6 +77536,7 @@ const FavIcon = ({ filterOption, setFilterOption, }) => {
|
|
|
77467
77536
|
};
|
|
77468
77537
|
|
|
77469
77538
|
const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
77539
|
+
const { abTestValue } = useABTesting({ key: ABTestKeys.BOND_BUY_BUTTON });
|
|
77470
77540
|
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setSearchQuery('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsxs(Flex$1, { sx: { width: '100%', maxWidth: '340px' }, children: [jsx$2(Input, { value: searchQuery, onChange: (event) => setSearchQuery(event.target.value), variant: "search", width: '100%', sx: {
|
|
77471
77541
|
fontWeight: 600,
|
|
77472
77542
|
background: 'white2',
|
|
@@ -77474,7 +77544,7 @@ const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFil
|
|
|
77474
77544
|
fontSize: '14px',
|
|
77475
77545
|
color: 'white',
|
|
77476
77546
|
width: ['calc(50vw - 25px)'],
|
|
77477
|
-
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: ["BONUS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "terms-header", onClick: () => onSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "tokens-remaining-header", onClick: () => onSort('tokensRemaining'), children: ["TOKENS REMAINING", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2("div", { className: "tooltip-header" })] })] })] }));
|
|
77547
|
+
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: ["BONUS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: 10, color: "textDisabledButton" }) })] }), jsxs("div", { className: "terms-header", onClick: () => onSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "tokens-remaining-header", onClick: () => onSort('tokensRemaining'), children: ["TOKENS REMAINING", jsx$2(Flex$1, { sx: { ml: '5px', mb: '3px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2("div", { className: "tooltip-header" }), abTestValue === 'true' && jsx$2("div", { className: "tooltip-header" })] })] })] }));
|
|
77478
77548
|
};
|
|
77479
77549
|
|
|
77480
77550
|
const Bonds = () => {
|
package/dist/styles.css
CHANGED
|
@@ -635,6 +635,7 @@ span.flex-inline {
|
|
|
635
635
|
flex-direction: row;
|
|
636
636
|
align-items: center;
|
|
637
637
|
justify-content: flex-end;
|
|
638
|
+
gap: 15px;
|
|
638
639
|
}
|
|
639
640
|
@media screen and (min-width: 1000px) {
|
|
640
641
|
.bond-row .bond-info-columns {
|
|
@@ -957,7 +958,6 @@ span.flex-inline {
|
|
|
957
958
|
height: 100%;
|
|
958
959
|
align-items: center;
|
|
959
960
|
padding-left: 20px;
|
|
960
|
-
overflow: hidden;
|
|
961
961
|
border-radius: 10px;
|
|
962
962
|
}
|
|
963
963
|
|
|
@@ -987,7 +987,6 @@ span.flex-inline {
|
|
|
987
987
|
|
|
988
988
|
.tokeninfoname.tokentext {
|
|
989
989
|
margin-left: 10px;
|
|
990
|
-
font-size: 16px;
|
|
991
990
|
font-weight: 700;
|
|
992
991
|
width: 100%;
|
|
993
992
|
flex-direction: column;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BondsData } from '../../../../types/bonds';
|
|
3
3
|
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
4
|
+
export declare const NETWORK_COLORS: Partial<Record<number, string>>;
|
|
4
5
|
interface BondRowProps {
|
|
5
6
|
key?: string;
|
|
6
7
|
bond: BondsData | BillsConfig;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
3
|
+
import { BondsData } from '../../../../types/bonds';
|
|
4
|
+
declare const BonusContainer: ({ bond, tooltipPosition, }: {
|
|
5
|
+
bond: BondsData | BillsConfig;
|
|
6
|
+
tooltipPosition?: "bottomRight" | "bottomLeft";
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default BonusContainer;
|