@ape.swap/bonds-sdk 2.6.15 → 2.7.0
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
CHANGED
|
@@ -7035,16 +7035,6 @@ const Farcaster = ({ width }) => {
|
|
|
7035
7035
|
};
|
|
7036
7036
|
|
|
7037
7037
|
const Timer = ({ direction = 'right', color = 'text', width, getStyles }) => {
|
|
7038
|
-
const deg = {
|
|
7039
|
-
left: 180,
|
|
7040
|
-
up: 270,
|
|
7041
|
-
right: 0,
|
|
7042
|
-
down: 90,
|
|
7043
|
-
};
|
|
7044
|
-
getStyles({
|
|
7045
|
-
degree: deg[direction],
|
|
7046
|
-
color,
|
|
7047
|
-
});
|
|
7048
7038
|
return (jsx$2("svg", { width: width || '28', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", fill: color, children: jsx$2("path", { d: "M256 0a256 256 0 1 1 0 512A256 256 0 1 1 256 0zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" }) }));
|
|
7049
7039
|
};
|
|
7050
7040
|
|
|
@@ -18460,6 +18450,10 @@ var types = {};
|
|
|
18460
18450
|
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F',
|
|
18461
18451
|
protocol: Protocols.Curve,
|
|
18462
18452
|
}),
|
|
18453
|
+
(_e[LiquidityDex.PancakeSwapV3] = {
|
|
18454
|
+
factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865',
|
|
18455
|
+
protocol: Protocols.V3,
|
|
18456
|
+
}),
|
|
18463
18457
|
_e)),
|
|
18464
18458
|
(_a[ChainId.LINEA] =
|
|
18465
18459
|
((_f = {}),
|
|
@@ -19092,56 +19086,6 @@ const TokenInfoAndName = ({ bill, vestEnds, isHotBond, }) => {
|
|
|
19092
19086
|
}, 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 })] }));
|
|
19093
19087
|
};
|
|
19094
19088
|
|
|
19095
|
-
const MINUTE_IN_SECONDS = 60;
|
|
19096
|
-
const HOUR_IN_SECONDS = 3600;
|
|
19097
|
-
const DAY_IN_SECONDS = 86400;
|
|
19098
|
-
const MONTH_IN_SECONDS = 2629800;
|
|
19099
|
-
const YEAR_IN_SECONDS = 31557600;
|
|
19100
|
-
/**
|
|
19101
|
-
* Format number of seconds into year, month, day, hour, minute, seconds
|
|
19102
|
-
*
|
|
19103
|
-
* @param seconds
|
|
19104
|
-
*/
|
|
19105
|
-
const getTimePeriods = (seconds, days) => {
|
|
19106
|
-
let delta = seconds;
|
|
19107
|
-
const timeLeft = {
|
|
19108
|
-
years: 0,
|
|
19109
|
-
months: 0,
|
|
19110
|
-
days: 0,
|
|
19111
|
-
hours: 0,
|
|
19112
|
-
minutes: 0,
|
|
19113
|
-
seconds: 0,
|
|
19114
|
-
};
|
|
19115
|
-
if (delta >= YEAR_IN_SECONDS && !days) {
|
|
19116
|
-
timeLeft.years = Math.floor(delta / YEAR_IN_SECONDS);
|
|
19117
|
-
delta -= timeLeft.years * YEAR_IN_SECONDS;
|
|
19118
|
-
}
|
|
19119
|
-
if (delta >= MONTH_IN_SECONDS && !days) {
|
|
19120
|
-
timeLeft.months = Math.floor(delta / MONTH_IN_SECONDS);
|
|
19121
|
-
delta -= timeLeft.months * MONTH_IN_SECONDS;
|
|
19122
|
-
}
|
|
19123
|
-
if (delta >= DAY_IN_SECONDS) {
|
|
19124
|
-
timeLeft.days = Math.floor(delta / DAY_IN_SECONDS);
|
|
19125
|
-
delta -= timeLeft.days * DAY_IN_SECONDS;
|
|
19126
|
-
}
|
|
19127
|
-
if (delta >= HOUR_IN_SECONDS) {
|
|
19128
|
-
timeLeft.hours = Math.floor(delta / HOUR_IN_SECONDS);
|
|
19129
|
-
delta -= timeLeft.hours * HOUR_IN_SECONDS;
|
|
19130
|
-
}
|
|
19131
|
-
if (delta >= MINUTE_IN_SECONDS) {
|
|
19132
|
-
timeLeft.minutes = Math.floor(delta / MINUTE_IN_SECONDS);
|
|
19133
|
-
delta -= timeLeft.minutes * MINUTE_IN_SECONDS;
|
|
19134
|
-
}
|
|
19135
|
-
timeLeft.seconds = delta;
|
|
19136
|
-
return timeLeft;
|
|
19137
|
-
};
|
|
19138
|
-
|
|
19139
|
-
const getPendingVesting = (lastBlockTimestamp, vesting) => {
|
|
19140
|
-
const currentTime = new Date().getTime() / 1000;
|
|
19141
|
-
const vestingTime = getTimePeriods(parseInt(lastBlockTimestamp) + parseInt(vesting) - currentTime, true);
|
|
19142
|
-
return `${vestingTime.days}d, ${vestingTime.hours}h, ${vestingTime.minutes}m`;
|
|
19143
|
-
};
|
|
19144
|
-
|
|
19145
19089
|
const formatNumber$3 = (number, minPrecision = 2, maxPrecision = 2) => {
|
|
19146
19090
|
const options = {
|
|
19147
19091
|
minimumFractionDigits: minPrecision,
|
|
@@ -22101,6 +22045,50 @@ const getFirstNonZeroDigits = (numberToParse, precision = 3) => {
|
|
|
22101
22045
|
return n.toFixed(amountToShow < 0 ? 0 : amountToShow);
|
|
22102
22046
|
};
|
|
22103
22047
|
|
|
22048
|
+
const MINUTE_IN_SECONDS = 60;
|
|
22049
|
+
const HOUR_IN_SECONDS = 3600;
|
|
22050
|
+
const DAY_IN_SECONDS = 86400;
|
|
22051
|
+
const MONTH_IN_SECONDS = 2629800;
|
|
22052
|
+
const YEAR_IN_SECONDS = 31557600;
|
|
22053
|
+
/**
|
|
22054
|
+
* Format number of seconds into year, month, day, hour, minute, seconds
|
|
22055
|
+
*
|
|
22056
|
+
* @param seconds
|
|
22057
|
+
*/
|
|
22058
|
+
const getTimePeriods = (seconds, days) => {
|
|
22059
|
+
let delta = seconds;
|
|
22060
|
+
const timeLeft = {
|
|
22061
|
+
years: 0,
|
|
22062
|
+
months: 0,
|
|
22063
|
+
days: 0,
|
|
22064
|
+
hours: 0,
|
|
22065
|
+
minutes: 0,
|
|
22066
|
+
seconds: 0,
|
|
22067
|
+
};
|
|
22068
|
+
if (delta >= YEAR_IN_SECONDS && !days) {
|
|
22069
|
+
timeLeft.years = Math.floor(delta / YEAR_IN_SECONDS);
|
|
22070
|
+
delta -= timeLeft.years * YEAR_IN_SECONDS;
|
|
22071
|
+
}
|
|
22072
|
+
if (delta >= MONTH_IN_SECONDS && !days) {
|
|
22073
|
+
timeLeft.months = Math.floor(delta / MONTH_IN_SECONDS);
|
|
22074
|
+
delta -= timeLeft.months * MONTH_IN_SECONDS;
|
|
22075
|
+
}
|
|
22076
|
+
if (delta >= DAY_IN_SECONDS) {
|
|
22077
|
+
timeLeft.days = Math.floor(delta / DAY_IN_SECONDS);
|
|
22078
|
+
delta -= timeLeft.days * DAY_IN_SECONDS;
|
|
22079
|
+
}
|
|
22080
|
+
if (delta >= HOUR_IN_SECONDS) {
|
|
22081
|
+
timeLeft.hours = Math.floor(delta / HOUR_IN_SECONDS);
|
|
22082
|
+
delta -= timeLeft.hours * HOUR_IN_SECONDS;
|
|
22083
|
+
}
|
|
22084
|
+
if (delta >= MINUTE_IN_SECONDS) {
|
|
22085
|
+
timeLeft.minutes = Math.floor(delta / MINUTE_IN_SECONDS);
|
|
22086
|
+
delta -= timeLeft.minutes * MINUTE_IN_SECONDS;
|
|
22087
|
+
}
|
|
22088
|
+
timeLeft.seconds = delta;
|
|
22089
|
+
return timeLeft;
|
|
22090
|
+
};
|
|
22091
|
+
|
|
22104
22092
|
var lodash = {exports: {}};
|
|
22105
22093
|
|
|
22106
22094
|
/**
|
|
@@ -39329,8 +39317,55 @@ const totalPendingUSD = (userBill) => {
|
|
|
39329
39317
|
return pendingTokens * parseFloat(userBill.bond.payoutTokenPrice);
|
|
39330
39318
|
};
|
|
39331
39319
|
const vestingTimeRemaining = (userBill) => {
|
|
39320
|
+
var _a, _b;
|
|
39332
39321
|
const currentTime = new Date().getTime() / 1000;
|
|
39333
|
-
|
|
39322
|
+
const vestingCliff = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff) !== null && _b !== void 0 ? _b : 0;
|
|
39323
|
+
return getTimePeriods(parseInt(userBill.lastBlockTimestamp) + parseInt(userBill.vesting) - vestingCliff - currentTime, true);
|
|
39324
|
+
};
|
|
39325
|
+
const vestingTimeRemainingString = (userBill) => {
|
|
39326
|
+
var _a, _b, _c;
|
|
39327
|
+
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
39328
|
+
const lastBlockTimestamp = parseInt((_a = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _a !== void 0 ? _a : '0');
|
|
39329
|
+
const vesting = parseInt((_b = userBill === null || userBill === void 0 ? void 0 : userBill.vesting) !== null && _b !== void 0 ? _b : '0');
|
|
39330
|
+
const vestingCliff = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.vestingCliff;
|
|
39331
|
+
const vestingTime = getTimePeriods(lastBlockTimestamp + vesting - currentTime, true);
|
|
39332
|
+
if (vestingCliff && currentTime - lastBlockTimestamp < vestingCliff) {
|
|
39333
|
+
const linearVesting = getTimePeriods(vesting - vestingCliff, true);
|
|
39334
|
+
const cliffCountdown = getTimePeriods(lastBlockTimestamp + vestingCliff - currentTime, true);
|
|
39335
|
+
return `${cliffCountdown.days !== 0 ? `${cliffCountdown.days}d` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours}hs` : `${cliffCountdown.minutes}mins`} + ${linearVesting.days}d`;
|
|
39336
|
+
}
|
|
39337
|
+
return `${vestingTime.days}d, ${vestingTime.hours}h, ${vestingTime.minutes}m`;
|
|
39338
|
+
};
|
|
39339
|
+
const getPendingVestingString = (bond) => {
|
|
39340
|
+
var _a, _b;
|
|
39341
|
+
const currentTime = new Date().getTime() / 1000;
|
|
39342
|
+
const lastBlockTimestamp = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.lastBlockTimestamp) !== null && _a !== void 0 ? _a : '0');
|
|
39343
|
+
const vesting = parseInt((_b = bond === null || bond === void 0 ? void 0 : bond.vesting) !== null && _b !== void 0 ? _b : '0');
|
|
39344
|
+
const vestingTime = getTimePeriods(lastBlockTimestamp + vesting - currentTime, true);
|
|
39345
|
+
return `${vestingTime.days}d, ${vestingTime.hours}h, ${vestingTime.minutes}m`;
|
|
39346
|
+
};
|
|
39347
|
+
const getVestingTermsString = (bond) => {
|
|
39348
|
+
var _a, _b;
|
|
39349
|
+
const vestingTerm = (_a = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _a !== void 0 ? _a : 0;
|
|
39350
|
+
const vestingCliff = (_b = bond === null || bond === void 0 ? void 0 : bond.vestingCliff) !== null && _b !== void 0 ? _b : 0;
|
|
39351
|
+
if (!vestingCliff) {
|
|
39352
|
+
const vestingTime = getTimePeriods(vestingTerm, true);
|
|
39353
|
+
return `${vestingTime.days} D`;
|
|
39354
|
+
}
|
|
39355
|
+
else if (vestingCliff) {
|
|
39356
|
+
const vestingTime = getTimePeriods(vestingTerm - vestingCliff, true);
|
|
39357
|
+
const vestingCliffString = getTimePeriods(vestingCliff, true);
|
|
39358
|
+
return `${vestingCliffString.days} D + ${vestingTime.days} D`;
|
|
39359
|
+
}
|
|
39360
|
+
return '-';
|
|
39361
|
+
};
|
|
39362
|
+
const getVestingTermsTooltipString = (bond) => {
|
|
39363
|
+
var _a, _b;
|
|
39364
|
+
const vestingTerm = (_a = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _a !== void 0 ? _a : 0;
|
|
39365
|
+
const vestingCliff = (_b = bond === null || bond === void 0 ? void 0 : bond.vestingCliff) !== null && _b !== void 0 ? _b : 0;
|
|
39366
|
+
const vestingTime = getTimePeriods(vestingTerm - vestingCliff, true);
|
|
39367
|
+
const vestingCliffString = getTimePeriods(vestingCliff, true);
|
|
39368
|
+
return `${vestingCliffString.days} days cliff + ${vestingTime.days} days linear vesting.`;
|
|
39334
39369
|
};
|
|
39335
39370
|
const discountEarnTokenPrice = (bond) => {
|
|
39336
39371
|
var _a, _b;
|
|
@@ -43205,7 +43240,7 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
43205
43240
|
};
|
|
43206
43241
|
|
|
43207
43242
|
const TransferModal = ({ onDismiss, userBill }) => {
|
|
43208
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
43243
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
43209
43244
|
// State
|
|
43210
43245
|
const [confirmSend, setConfirmSend] = useState(false);
|
|
43211
43246
|
const [toAddress, setToAddress] = useState('');
|
|
@@ -43215,7 +43250,7 @@ const TransferModal = ({ onDismiss, userBill }) => {
|
|
|
43215
43250
|
const { lpToken, earnToken } = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) !== null && _a !== void 0 ? _a : {};
|
|
43216
43251
|
const pending = chainId &&
|
|
43217
43252
|
((_e = getBalanceNumber(new BigNumber$1((_b = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _b !== void 0 ? _b : 0), (_d = (_c = earnToken === null || earnToken === void 0 ? void 0 : earnToken.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18)) === null || _e === void 0 ? void 0 : _e.toFixed(4));
|
|
43218
|
-
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", zIndex: 130, children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [lpToken === null || lpToken === void 0 ? void 0 : lpToken.symbol, " #", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }),
|
|
43253
|
+
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", zIndex: 130, children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [lpToken === null || lpToken === void 0 ? void 0 : lpToken.symbol, " #", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getPendingVestingString(userBill)] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName) !== null && _g !== void 0 ? _g : (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.earnToken) === null || _j === void 0 ? void 0 : _j.symbol, size: 20, chain: (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend((prev) => !prev), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend, onChange: () => null }), jsx$2(Text, { sx: { ml: '10px', fontSize: '12px', fontWeight: 500, lineHeight: '18px' }, children: "I understand the new wallet gains ownership of all unclaimed assets." })] }), jsx$2(Flex, { sx: { justifyContent: 'center', mt: '15px' }, children: jsx$2(TransferAction, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress }) })] }));
|
|
43219
43254
|
};
|
|
43220
43255
|
var TransferBondModal = React__default.memo(TransferModal);
|
|
43221
43256
|
|
|
@@ -69202,6 +69237,12 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69202
69237
|
const { isLoading, isSuccess: isConfirmed } = useMonitorTxHash(claimTxHash, (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.chainId);
|
|
69203
69238
|
const { addToastError } = usePopups();
|
|
69204
69239
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
69240
|
+
// Cliff display info:
|
|
69241
|
+
const vestingCliff = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.vestingCliff;
|
|
69242
|
+
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
69243
|
+
const lastBlockTimestamp = parseInt((_d = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _d !== void 0 ? _d : '0');
|
|
69244
|
+
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
69245
|
+
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
69205
69246
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69206
69247
|
const address = billAddress;
|
|
69207
69248
|
try {
|
|
@@ -69242,9 +69283,9 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69242
69283
|
var _a, _b, _c, _d, _e, _f;
|
|
69243
69284
|
return getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.pendingRewards) !== null && _a !== void 0 ? _a : '0'), (_f = (_d = (_c = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals) === null || _d === void 0 ? void 0 : _d[(_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.chainId]) !== null && _f !== void 0 ? _f : 18);
|
|
69244
69285
|
};
|
|
69245
|
-
const earnTokenPrice = useCurrencyPrice((
|
|
69286
|
+
const earnTokenPrice = useCurrencyPrice((_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond.earnToken) !== null && _e !== void 0 ? _e : null, (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.chainId) !== null && _g !== void 0 ? _g : null);
|
|
69246
69287
|
const BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
|
|
69247
|
-
const attributes = (
|
|
69288
|
+
const attributes = (_h = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.attributes) === null || _h === void 0 ? void 0 : _h.filter((attrib) => BILL_ATTRIBUTES.includes(attrib.trait_type));
|
|
69248
69289
|
const handleImageLoad = () => {
|
|
69249
69290
|
setImgLoaded(true);
|
|
69250
69291
|
};
|
|
@@ -69256,11 +69297,11 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69256
69297
|
justifyContent: 'center',
|
|
69257
69298
|
alignItems: 'center',
|
|
69258
69299
|
zIndex: 1,
|
|
69259
|
-
}, children: jsx$2(Spinner, { width: 100 }) }))] }), jsxs(Flex$1, { className: "yourbondsmodal yourbondinfo", children: [jsxs(Flex$1, { className: "yourbondinfo title-container", children: [jsx$2(Flex$1, { className: "title-container bondicon", children: userBill && (jsx$2(TokenImage, { symbol: (
|
|
69300
|
+
}, children: jsx$2(Spinner, { width: 100 }) }))] }), jsxs(Flex$1, { className: "yourbondsmodal yourbondinfo", children: [jsxs(Flex$1, { className: "yourbondinfo title-container", children: [jsx$2(Flex$1, { className: "title-container bondicon", children: userBill && (jsx$2(TokenImage, { symbol: (_k = (_j = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _j === void 0 ? void 0 : _j.showcaseTokenName) !== null && _k !== void 0 ? _k : (_m = (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.earnToken) === null || _m === void 0 ? void 0 : _m.symbol, size: 40, chain: userBill === null || userBill === void 0 ? void 0 : userBill.bond.chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: (_p = (_o = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _o === void 0 ? void 0 : _o.showcaseTokenName) !== null && _p !== void 0 ? _p : userBill === null || userBill === void 0 ? void 0 : userBill.bond.earnToken.symbol }), jsx$2(Flex$1, { className: "title-container tokentags", children: (_r = (_q = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _q === void 0 ? void 0 : _q.tags) === null || _r === void 0 ? void 0 : _r.slice(0, 1).map((tag) => {
|
|
69260
69301
|
return (jsx$2(Flex$1, { sx: { marginRight: '10px' }, children: jsx$2(ListTag, { text: tag === null || tag === void 0 ? void 0 : tag.toUpperCase() }) }, tag));
|
|
69261
69302
|
}) }), jsxs(Text, { sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] }, children: ["#", userBill === null || userBill === void 0 ? void 0 : userBill.id] })] }), jsxs(Flex$1, { className: "yourbondinfo blocks-container", children: [jsxs(Flex$1, { className: "attributes-container", children: [jsxs(Flex$1, { className: "attributes-header", sx: {
|
|
69262
69303
|
borderRadius: `${isOpenTraits ? '6px 6px 0px 0px' : 'normal'}`,
|
|
69263
|
-
}, onClick: () => setIsOpenTraits(!isOpenTraits), children: [jsxs(Flex$1, { sx: { gap: '10px', alignItems: 'center' }, children: [jsx$2(Svg, { icon: "tag", direction: "down" }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' }, children: "Traits" })] }), jsx$2(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] }), ((
|
|
69304
|
+
}, onClick: () => setIsOpenTraits(!isOpenTraits), children: [jsxs(Flex$1, { sx: { gap: '10px', alignItems: 'center' }, children: [jsx$2(Svg, { icon: "tag", direction: "down" }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' }, children: "Traits" })] }), jsx$2(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] }), ((_s = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _s === void 0 ? void 0 : _s.billType) === 'staking' && (jsxs(Flex$1, { sx: {
|
|
69264
69305
|
p: '5px 10px',
|
|
69265
69306
|
width: '100%',
|
|
69266
69307
|
background: '#8E568F',
|
|
@@ -69274,7 +69315,7 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69274
69315
|
? attributes.map((a) => (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a === null || a === void 0 ? void 0 : a.trait_type }), jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a === null || a === void 0 ? void 0 : a.value })] }, a.value)))
|
|
69275
69316
|
: BILL_ATTRIBUTES.map((attrib) => {
|
|
69276
69317
|
return (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: attrib }), jsx$2(Skeleton, { width: "150px" })] }, attrib));
|
|
69277
|
-
}) }) })) })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Fully Vested" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon" }), jsx$2(Flex$1, { className: "block-info text", children:
|
|
69318
|
+
}) }) })) })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Fully Vested" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon" }), jsx$2(Flex$1, { className: "block-info text", children: jsxs(Flex$1, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: [vestingTimeRemainingString(userBill), isPendingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex$1, { children: ["Bond will be claimable in", ' ', `${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`, "."] }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex$1, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }) })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-pending", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Pending" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_u = (_t = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _t === void 0 ? void 0 : _t.showcaseTokenName) !== null && _u !== void 0 ? _u : (_w = (_v = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _v === void 0 ? void 0 : _v.earnToken) === null || _w === void 0 ? void 0 : _w.symbol, size: 25, chain: (_x = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _x === void 0 ? void 0 : _x.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(parseFloat(totalPending(userBill).toFixed(4)), 4) }), jsx$2(Text, { sx: {
|
|
69278
69319
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
69279
69320
|
fontWeight: [500, 500, 500, 400],
|
|
69280
69321
|
paddingLeft: '10px',
|
|
@@ -69286,10 +69327,12 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69286
69327
|
var _a;
|
|
69287
69328
|
event.stopPropagation();
|
|
69288
69329
|
switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId });
|
|
69289
|
-
}, children: ["Switch to ", NETWORK_LABEL[(_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || load || !userBill, load: load, onClick: (event) => {
|
|
69330
|
+
}, children: ["Switch to ", NETWORK_LABEL[(_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || load || !userBill || isPendingCliff, load: load, onClick: (event) => {
|
|
69290
69331
|
event.stopPropagation();
|
|
69291
69332
|
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
69292
|
-
}, children:
|
|
69333
|
+
}, children: isPendingCliff
|
|
69334
|
+
? `Claimable in ${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`
|
|
69335
|
+
: 'Claim' })) }), jsx$2(Flex$1, { className: "button-container transfer", children: jsx$2(Button, { className: "transfer-button", variant: "secondary", onClick: onTransferBondModal, disabled: !userBill, children: "TRANSFER" }) })] })] })] }), jsx$2(Recommendations, { onDismiss: onDismiss, billAddress: userBill === null || userBill === void 0 ? void 0 : userBill.address })] }) }));
|
|
69293
69336
|
};
|
|
69294
69337
|
|
|
69295
69338
|
const styles$a = {
|
|
@@ -69404,7 +69447,7 @@ const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, pro
|
|
|
69404
69447
|
};
|
|
69405
69448
|
|
|
69406
69449
|
const UserBondRow = ({ bill }) => {
|
|
69407
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
69450
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
69408
69451
|
const userChainId = useChainId();
|
|
69409
69452
|
const { switchChain } = useSwitchChain();
|
|
69410
69453
|
const { writeContractAsync } = useWriteContract();
|
|
@@ -69447,16 +69490,23 @@ const UserBondRow = ({ bill }) => {
|
|
|
69447
69490
|
});
|
|
69448
69491
|
// Display Info
|
|
69449
69492
|
const earnTokenPrice = useCurrencyPrice(bill.bond.earnToken, bill.bond.chainId);
|
|
69450
|
-
|
|
69493
|
+
const vestingCliff = (_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff;
|
|
69494
|
+
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
69495
|
+
const lastBlockTimestamp = parseInt((_b = bill === null || bill === void 0 ? void 0 : bill.lastBlockTimestamp) !== null && _b !== void 0 ? _b : '0');
|
|
69496
|
+
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
69497
|
+
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
69498
|
+
return (jsxs("div", { className: "your-bonds", onClick: onOpenPurchasedBond, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { bill: bill.bond, vestEnds: `Ends in ${getPendingVestingString(bill)}` }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_c = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _c === void 0 ? void 0 : _c.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_d = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _d === void 0 ? void 0 : _d.earnToken.symbol) || '', bondContract: (_e = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _e !== void 0 ? _e : '', projectLink: (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.projectLink, twitter: (_g = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _g === void 0 ? void 0 : _g.twitter, audit: (_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.audit, chain: (_j = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _j === void 0 ? void 0 : _j.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
|
|
69451
69499
|
opacity: 0.8,
|
|
69452
|
-
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(parseFloat(claimable(bill).toFixed(4)), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * ((
|
|
69500
|
+
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(parseFloat(claimable(bill).toFixed(4)), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * ((_k = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _k !== void 0 ? _k : 0)).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(totalPending(bill) * ((_l = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _l !== void 0 ? _l : 0)).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: vestingTimeRemainingString(bill) }), jsx$2("div", { className: "your-bonds-column-button", children: userChainId !== bill.bond.chainId ? (jsxs(Button, { className: "button", disabled: claimable(bill) === 0 || load, load: load, onClick: (event) => {
|
|
69453
69501
|
event.stopPropagation();
|
|
69454
69502
|
// Add your claim logic here
|
|
69455
69503
|
switchChain({ chainId: bill.bond.chainId });
|
|
69456
|
-
}, fullWidth: true, children: ["Switch to ", NETWORK_LABEL[bill.bond.chainId]] })) : (jsx$2(Button, { className: "button", disabled: claimable(bill) === 0 || load, load: load, onClick: (event) => {
|
|
69504
|
+
}, fullWidth: true, children: ["Switch to ", NETWORK_LABEL[bill.bond.chainId]] })) : (jsx$2(Button, { className: "button", disabled: claimable(bill) === 0 || load || isPendingCliff, load: load, onClick: (event) => {
|
|
69457
69505
|
event.stopPropagation();
|
|
69458
69506
|
handleClaim(bill.id, bill.address);
|
|
69459
|
-
}, fullWidth: true, children:
|
|
69507
|
+
}, fullWidth: true, children: isPendingCliff
|
|
69508
|
+
? `Claimable in ${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`
|
|
69509
|
+
: 'Claim' })) })] })] }));
|
|
69460
69510
|
};
|
|
69461
69511
|
|
|
69462
69512
|
function useBondsList() {
|
|
@@ -69903,7 +69953,7 @@ const ChainOptionsButtons = ({ selectedChain, setSelectedChain, setViewAllChains
|
|
|
69903
69953
|
|
|
69904
69954
|
const ClaimAllModal = () => {
|
|
69905
69955
|
var _a, _b;
|
|
69906
|
-
const { chainId
|
|
69956
|
+
const { chainId } = useAccount();
|
|
69907
69957
|
const { switchChain } = useSwitchChain();
|
|
69908
69958
|
const SDKConfig = useSDKConfig();
|
|
69909
69959
|
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
@@ -70056,6 +70106,9 @@ const YourBonds = () => {
|
|
|
70056
70106
|
// Filter by filter option (claimable or all buttons)
|
|
70057
70107
|
if (filterOption === 'CLAIMABLE') {
|
|
70058
70108
|
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
70109
|
+
if (bond.bond.vestingCliff) {
|
|
70110
|
+
return bond.payout !== '0';
|
|
70111
|
+
}
|
|
70059
70112
|
return bond.pendingRewards !== '0';
|
|
70060
70113
|
});
|
|
70061
70114
|
}
|
|
@@ -70132,7 +70185,7 @@ const useTopTags = (initialBondList) => {
|
|
|
70132
70185
|
|
|
70133
70186
|
const isBondSoldOut = (bill) => {
|
|
70134
70187
|
var _a;
|
|
70135
|
-
const { tokensRemaining,
|
|
70188
|
+
const { tokensRemaining, payoutTokenPrice, bonus } = bill;
|
|
70136
70189
|
if (bill.soldOut)
|
|
70137
70190
|
return true;
|
|
70138
70191
|
if (bill.inactive)
|
|
@@ -72400,24 +72453,20 @@ const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
|
|
|
72400
72453
|
};
|
|
72401
72454
|
|
|
72402
72455
|
const BondCards = ({ bondData }) => {
|
|
72403
|
-
var _a, _b, _c, _d, _e, _f
|
|
72456
|
+
var _a, _b, _c, _d, _e, _f;
|
|
72404
72457
|
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", style: { color: getDiscountColor(bondData === null || bondData === void 0 ? void 0 : bondData.bonus) }, children: [jsxs("div", { className: "bond-card-title", children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: (bondData === null || bondData === void 0 ? void 0 : bondData.bonus) < 0 ? '0%' : `${(_a = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) === null || _a === void 0 ? void 0 : _a.toFixed(2)}%` })] }), bondData.type !== 'staking' && (jsxs("div", { className: "bond-card-block hide-mobile", children: [jsxs("div", { className: "bond-card-title", children: ["ARR", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: (bondData === null || bondData === void 0 ? void 0 : bondData.bonus) < 0
|
|
72405
72458
|
? '0%'
|
|
72406
|
-
: `${((((_b = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0).days).toFixed(2)}%` })] })), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2("div", { className: "bond-card-content", children: bondData.
|
|
72407
|
-
? `${daysLeftOnBasepadPool()} D Lock`
|
|
72408
|
-
: vestingTime((_d = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _d !== void 0 ? _d : 0).days
|
|
72409
|
-
? `${vestingTime((_e = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _e !== void 0 ? _e : 0).days} D`
|
|
72410
|
-
: '-' })] }), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((_f = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _f === void 0 ? void 0 : _f.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs("div", { className: "bond-card-content", children: [jsx$2("div", { style: { paddingRight: '3px' }, children: jsx$2(TokenImage, { symbol: (_g = bondData.showcaseTokenName) !== null && _g !== void 0 ? _g : bondData.earnToken.symbol, size: 20 }) }), (_h = parseFloat(maxBuy(bondData).toFixed(0))) === null || _h === void 0 ? void 0 : _h.toLocaleString('en-US')] })] })] }));
|
|
72459
|
+
: `${((((_b = bondData === null || bondData === void 0 ? void 0 : bondData.bonus) !== null && _b !== void 0 ? _b : 0) * 365) / vestingTime((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0).days).toFixed(2)}%` })] })), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs("div", { className: "bond-card-content", children: [bondData.type === 'staking' ? `${daysLeftOnBasepadPool()} D Lock` : getVestingTermsString(bondData), bondData.vestingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: getVestingTermsTooltipString(bondData) }), 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" }) }) }))] })] }), jsxs("div", { className: "bond-card-block", children: [jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((_d = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs("div", { className: "bond-card-content", children: [jsx$2("div", { style: { paddingRight: '3px' }, children: jsx$2(TokenImage, { symbol: (_e = bondData.showcaseTokenName) !== null && _e !== void 0 ? _e : bondData.earnToken.symbol, size: 20 }) }), (_f = parseFloat(maxBuy(bondData).toFixed(0))) === null || _f === void 0 ? void 0 : _f.toLocaleString('en-US')] })] })] }));
|
|
72411
72460
|
};
|
|
72412
72461
|
|
|
72413
72462
|
const Estimations = ({ bondData, inputValue, inputToken, estimatedOutput, inputTokenPrice, isZap, fetchingZapQuote, zapError, }) => {
|
|
72414
|
-
var _a, _b;
|
|
72463
|
+
var _a, _b, _c;
|
|
72415
72464
|
// Estimations
|
|
72416
72465
|
const estimatedOutputUSD = estimatedOutput * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
|
|
72417
72466
|
const estimatedInputUSD = parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0);
|
|
72418
72467
|
const normalPremium = premium(bondData, inputValue);
|
|
72419
72468
|
const premiumString = isZap ? formatUSDNumber((estimatedOutputUSD - estimatedInputUSD).toString()) : normalPremium;
|
|
72420
|
-
return (jsxs(Flex, { className: "modaltable-container text-container", children: [jsxs(Flex, { className: "text-container row", children: [jsx$2(Flex, { className: "row-container spend", children: "You Spend:" }), jsxs(Flex, { className: "row-container spend-val", children: [youSpend(inputValue), " ", getSymbol(inputToken, bondData.chainId), " = $", ' ', formatUSDNumber(estimatedInputUSD === null || estimatedInputUSD === void 0 ? void 0 : estimatedInputUSD.toString())] })] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val ${getPremiumColor(premiumString)}`, children: ["$ ", premiumString] }))] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime((_b = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _b !== void 0 ? _b : 0).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$2(estimatedOutput.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
|
|
72469
|
+
return (jsxs(Flex, { className: "modaltable-container text-container", children: [jsxs(Flex, { className: "text-container row", children: [jsx$2(Flex, { className: "row-container spend", children: "You Spend:" }), jsxs(Flex, { className: "row-container spend-val", children: [youSpend(inputValue), " ", getSymbol(inputToken, bondData.chainId), " = $", ' ', formatUSDNumber(estimatedInputUSD === null || estimatedInputUSD === void 0 ? void 0 : estimatedInputUSD.toString())] })] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val ${getPremiumColor(premiumString)}`, children: ["$ ", premiumString] }))] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime(((_b = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _b !== void 0 ? _b : 0) - ((_c = bondData.vestingCliff) !== null && _c !== void 0 ? _c : 0)).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$2(estimatedOutput.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
|
|
72421
72470
|
};
|
|
72422
72471
|
|
|
72423
72472
|
// Custom HTML sanitizer
|
|
@@ -73445,7 +73494,7 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
|
|
|
73445
73494
|
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
73446
73495
|
|
|
73447
73496
|
const BondRow = ({ bond }) => {
|
|
73448
|
-
var _a, _b, _c, _d, _e
|
|
73497
|
+
var _a, _b, _c, _d, _e;
|
|
73449
73498
|
const locationPath = window.location.pathname.replace('/', '');
|
|
73450
73499
|
const billAddress = 'billAddress' in bond
|
|
73451
73500
|
? bond.billAddress
|
|
@@ -73491,11 +73540,7 @@ const BondRow = ({ bond }) => {
|
|
|
73491
73540
|
const tokens = new BigNumber$1(tokensRemaining);
|
|
73492
73541
|
return tokens.times(payoutTokenPrice);
|
|
73493
73542
|
};
|
|
73494
|
-
return (jsxs("div", { className: `bond-row ${isXmasStyle ? 'xmas-border' : ''}`, onClick: handleOpenModal, children: [jsxs("div", { className: "token-info-container", children: [isXmasStyle && jsx$2("img", { src: "/images/bills/xmasHat.png", alt: "xmas-hat", className: "xmas-hat" }), jsx$2(TokenInfoAndName, { bill: bond })] }), jsxs("div", { className: "bond-info-columns", children: [jsx$2("div", { className: `discount-column ${getDiscountColor(bonus)}`, children: bonus !== undefined ? (bonus <= 0 ? (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" }) })) : (`${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`)) : ('-') }), jsx$2("div", { className: "arr-column", children: bonus !== undefined && bonus <= 0 ? (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" }) })) : calculateARR(bond) !== undefined ? (calculateARR(bond)) : ('-') }),
|
|
73495
|
-
? `${daysLeftOnBasepadPool()} D Lock`
|
|
73496
|
-
: vestingTime((_a = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _a !== void 0 ? _a : 0).days
|
|
73497
|
-
? `${vestingTime((_b = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _b !== void 0 ? _b : 0).days} D`
|
|
73498
|
-
: '-' }), jsx$2("div", { className: "tokens-remaining-column", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bond) }), style: {
|
|
73543
|
+
return (jsxs("div", { className: `bond-row ${isXmasStyle ? 'xmas-border' : ''}`, onClick: handleOpenModal, children: [jsxs("div", { className: "token-info-container", children: [isXmasStyle && jsx$2("img", { src: "/images/bills/xmasHat.png", alt: "xmas-hat", className: "xmas-hat" }), jsx$2(TokenInfoAndName, { bill: bond })] }), jsxs("div", { className: "bond-info-columns", children: [jsx$2("div", { className: `discount-column ${getDiscountColor(bonus)}`, children: bonus !== undefined ? (bonus <= 0 ? (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" }) })) : (`${bonus === null || bonus === void 0 ? void 0 : bonus.toFixed(2)}%`)) : ('-') }), jsx$2("div", { className: "arr-column", children: bonus !== undefined && bonus <= 0 ? (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" }) })) : calculateARR(bond) !== undefined ? (calculateARR(bond)) : ('-') }), jsxs("div", { className: "terms-column", children: [bond.type === 'staking' ? `${daysLeftOnBasepadPool()} D Lock` : 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: {
|
|
73499
73544
|
width: '127px',
|
|
73500
73545
|
height: '25px',
|
|
73501
73546
|
flexDirection: 'column',
|
|
@@ -73504,7 +73549,7 @@ const BondRow = ({ bond }) => {
|
|
|
73504
73549
|
}, showTooltip: true, toolTip: `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
|
|
73505
73550
|
num: remainingTokensUsd(bond).toNumber(),
|
|
73506
73551
|
isPrice: true,
|
|
73507
|
-
})})` }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (
|
|
73552
|
+
})})` }) }), 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));
|
|
73508
73553
|
};
|
|
73509
73554
|
|
|
73510
73555
|
const HotBondCard = ({ bond }) => {
|
package/dist/styles.css
CHANGED
|
@@ -755,8 +755,8 @@ span.flex-inline {
|
|
|
755
755
|
}
|
|
756
756
|
.bond-row .bond-info-columns .terms-column {
|
|
757
757
|
display: none;
|
|
758
|
-
width:
|
|
759
|
-
align-items:
|
|
758
|
+
width: 115px;
|
|
759
|
+
align-items: center;
|
|
760
760
|
justify-content: center;
|
|
761
761
|
}
|
|
762
762
|
@media screen and (min-width: 1000px) {
|
|
@@ -924,7 +924,7 @@ span.flex-inline {
|
|
|
924
924
|
}
|
|
925
925
|
.bonds-menu .terms-header {
|
|
926
926
|
display: none;
|
|
927
|
-
width:
|
|
927
|
+
width: 115px;
|
|
928
928
|
align-items: flex-end;
|
|
929
929
|
justify-content: center;
|
|
930
930
|
cursor: pointer;
|
package/dist/types/bonds.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
import { UserBill } from '../types/yourbonds';
|
|
3
3
|
import { BondsData } from '../types/bonds';
|
|
4
|
+
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
4
5
|
export declare const claimable: (userBill: UserBill) => number;
|
|
5
6
|
export declare const claimableUSD: (userBill: UserBill) => number;
|
|
6
7
|
export declare const earnTokenPrice: (bond: BondsData) => string;
|
|
@@ -14,7 +15,10 @@ export declare const vestingTimeRemaining: (userBill: UserBill) => {
|
|
|
14
15
|
minutes: number;
|
|
15
16
|
seconds: number;
|
|
16
17
|
};
|
|
17
|
-
export declare const
|
|
18
|
+
export declare const vestingTimeRemainingString: (userBill?: UserBill) => string;
|
|
19
|
+
export declare const getPendingVestingString: (bond?: UserBill) => string;
|
|
20
|
+
export declare const getVestingTermsString: (bond?: BondsData | BillsConfig) => string;
|
|
21
|
+
export declare const getVestingTermsTooltipString: (bond?: BondsData | BillsConfig) => string;
|
|
18
22
|
export declare const discountEarnTokenPrice: (bond: BondsData) => string;
|
|
19
23
|
export declare const maxBuy: (bond: BondsData) => 0 | BigNumber;
|
|
20
24
|
export declare function formatNumber(input: string): string;
|
|
@@ -12,6 +12,5 @@ export declare const vestingTime: (vestingTerm?: number) => {
|
|
|
12
12
|
seconds: number;
|
|
13
13
|
};
|
|
14
14
|
export declare const remainingPercentage: (bond: BondsData) => number;
|
|
15
|
-
export declare const getBillContractURL: (bond: BondsData | BillsConfig) => string;
|
|
16
15
|
export declare const getDiscountColor: (discount?: number) => string;
|
|
17
16
|
export declare const calculateARR: (bond: BondsData | BillsConfig) => string;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ape Bond SDK",
|
|
4
4
|
"author": "Ape Bond",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.7.0",
|
|
7
7
|
"module": "dist/main.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"types": "dist/main.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"yalc": "^1.0.0-pre.53"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@ape.swap/apeswap-lists": "3.
|
|
59
|
+
"@ape.swap/apeswap-lists": "3.75.0",
|
|
60
60
|
"@emotion/react": "11.11.4",
|
|
61
61
|
"bignumber.js": "^9.1.2",
|
|
62
62
|
"chart.js": "4.2.0",
|