@ape.swap/bonds-sdk 3.0.101 → 3.0.103
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 +9 -7
- package/dist/state/useSDKConfig.d.ts +2 -0
- package/dist/types/bonds.d.ts +2 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -58382,7 +58382,7 @@ const stagingUrls = {
|
|
|
58382
58382
|
};
|
|
58383
58383
|
const useSDKConfig = (config) => {
|
|
58384
58384
|
const urls = process.env.NODE_ENV === 'production' ? defaultUrls : stagingUrls;
|
|
58385
|
-
const initialData = Object.assign(Object.assign({ referenceId: '', chains: [], hotBondChains: [types.ChainId.BSC, types.ChainId.MATIC], useHotBonds: true, useRainbowKit: false, useTiers: false, useTGEBonds: false, showLowValueBonds: false, bondPartner: undefined }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.3' });
|
|
58385
|
+
const initialData = Object.assign(Object.assign({ referenceId: '', chains: [], hotBondChains: [types.ChainId.BSC, types.ChainId.MATIC], useHotBonds: true, useRainbowKit: false, useTiers: false, useTGEBonds: false, showLowValueBonds: false, bondPartner: undefined, namingPreference: 'Bonus' }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.3' });
|
|
58386
58386
|
const { data } = useQuery({
|
|
58387
58387
|
queryKey: [QUERY_KEYS.SDK_CONFIG],
|
|
58388
58388
|
queryFn: () => {
|
|
@@ -78866,7 +78866,7 @@ const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement
|
|
|
78866
78866
|
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
78867
78867
|
|
|
78868
78868
|
const BondCards$1 = ({ bondData }) => {
|
|
78869
|
-
var _a, _b;
|
|
78869
|
+
var _a, _b, _c;
|
|
78870
78870
|
const isMobile = useIsMobile();
|
|
78871
78871
|
const SDKConfig = useSDKConfig();
|
|
78872
78872
|
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", sx: {
|
|
@@ -78879,7 +78879,7 @@ const BondCards$1 = ({ bondData }) => {
|
|
|
78879
78879
|
borderBottomRightRadius: 'normal',
|
|
78880
78880
|
borderBottomLeftRadius: 'normal',
|
|
78881
78881
|
},
|
|
78882
|
-
}, children: [jsxs(Flex, { className: "bond-card-title", children: [
|
|
78882
|
+
}, children: [jsxs(Flex, { className: "bond-card-title", children: [SDKConfig.namingPreference, 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(BonusComponent, { trueBondPrices: SDKConfig.namingPreference !== 'Discount' ? bondData.trueBondPrices : undefined, minTier: bondData.minTier, tooltipPosition: isMobile ? 'bottomRight' : 'bottomLeft', bonus: SDKConfig.namingPreference === 'Discount' ? `${(_a = bondData === null || bondData === void 0 ? void 0 : bondData.discountWithFee) === null || _a === void 0 ? void 0 : _a.toFixed(2)}%` : undefined })] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
78883
78883
|
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
78884
78884
|
'&:first-of-type': {
|
|
78885
78885
|
borderTopRightRadius: 'normal',
|
|
@@ -78899,7 +78899,7 @@ const BondCards$1 = ({ bondData }) => {
|
|
|
78899
78899
|
borderBottomRightRadius: 'normal',
|
|
78900
78900
|
borderBottomLeftRadius: 'normal',
|
|
78901
78901
|
},
|
|
78902
|
-
}, children: [jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((
|
|
78902
|
+
}, children: [jsxs("div", { className: "bond-card-title", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy((_b = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken) === null || _b === void 0 ? void 0 : _b.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: (_c = bondData.showcaseTokenName) !== null && _c !== void 0 ? _c : bondData.earnToken.symbol, size: 20 }) }), formatNumberSI(maxBuy(bondData, SDKConfig.showLowValueBonds).toFixed(0), 2)] })] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
78903
78903
|
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
78904
78904
|
'&:first-of-type': {
|
|
78905
78905
|
borderTopRightRadius: 'normal',
|
|
@@ -80190,6 +80190,7 @@ const BannerTestnet = ({ chainId }) => {
|
|
|
80190
80190
|
|
|
80191
80191
|
const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
|
|
80192
80192
|
const key = chain;
|
|
80193
|
+
const { namingPreference } = useSDKConfig();
|
|
80193
80194
|
const [isOpen, setIsOpen] = useState(true);
|
|
80194
80195
|
return (jsx$2(Flex$1, { className: "bondrowswithtitle", children: jsxs(AnimatePresence, { initial: false, children: [jsx$2(Flex$1, { onClick: () => setIsOpen(!isOpen), sx: { cursor: 'pointer' }, children: jsx$2(ChainTitle, { chain: chain, pt: '5px', hideTitles: bonds.length <= 0, isOpen: isOpen }) }), bonds.length > 0 && isOpen && (jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
|
|
80195
80196
|
position: 'relative',
|
|
@@ -80197,7 +80198,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
|
|
|
80197
80198
|
width: '100%',
|
|
80198
80199
|
marginTop: '0px',
|
|
80199
80200
|
}, className: "bonds-card-container", children: [TESTNET_CHAINS.includes(chain) && jsx$2(BannerTestnet, { chainId: chain }), bonds === null || bonds === void 0 ? void 0 : bonds.map((bondFromMap, index) => {
|
|
80200
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
80201
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
80201
80202
|
if (bondFromMap.soldOut) {
|
|
80202
80203
|
const bond = bondFromMap;
|
|
80203
80204
|
return (jsx$2(BondRow, { bondAddress: (_a = bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond.chainId], bondChain: bond.chainId, payoutToken: bond.earnToken, billType: bond.billType, tag: (_b = bond.tags) === null || _b === void 0 ? void 0 : _b[0], bondSoldOut: true, percentageAvailable: 100, remainingTokensString: `${formatNumberSI(0, 0)} ${bond.earnToken.symbol} ($${formatNumberSI(0, 2)})`, vestingTermString: "-", projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit }, `${bond.contractAddress}-${bond.chainId}-${index}`));
|
|
@@ -80220,7 +80221,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
|
|
|
80220
80221
|
const bond = bondFromMap;
|
|
80221
80222
|
const bondAddress = (_w = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _w === void 0 ? void 0 : _w[bond === null || bond === void 0 ? void 0 : bond.chainId];
|
|
80222
80223
|
const remainingTokensString = getRemainingTokensString(bond);
|
|
80223
|
-
return (jsx$2(BondRow, { bondAddress: bondAddress, bondChain: bond.chainId, payoutToken: bond.earnToken, billType: bond.billType, tag: (_x = bond.tags) === null || _x === void 0 ? void 0 : _x[0], trueBondPrices: bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit }, `${bondAddress}-${bond.chainId}-${index}`));
|
|
80224
|
+
return (jsx$2(BondRow, { bondAddress: bondAddress, bondChain: bond.chainId, payoutToken: bond.earnToken, billType: bond.billType, tag: (_x = bond.tags) === null || _x === void 0 ? void 0 : _x[0], trueBondPrices: namingPreference === 'Bonus' ? bond.trueBondPrices : undefined, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit, bonus: namingPreference === 'Discount' ? `${(_y = bond === null || bond === void 0 ? void 0 : bond.discountWithFee) === null || _y === void 0 ? void 0 : _y.toFixed(2)}%` : undefined }, `${bondAddress}-${bond.chainId}-${index}`));
|
|
80224
80225
|
}
|
|
80225
80226
|
}), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
|
|
80226
80227
|
};
|
|
@@ -80338,6 +80339,7 @@ const FavIcon = ({ filterOption, setFilterOption, }) => {
|
|
|
80338
80339
|
};
|
|
80339
80340
|
|
|
80340
80341
|
const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
80342
|
+
const { namingPreference } = useSDKConfig();
|
|
80341
80343
|
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: {
|
|
80342
80344
|
fontWeight: 600,
|
|
80343
80345
|
background: 'white2',
|
|
@@ -80345,7 +80347,7 @@ const BondsMenu = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFil
|
|
|
80345
80347
|
fontSize: '14px',
|
|
80346
80348
|
color: 'white',
|
|
80347
80349
|
width: ['calc(50vw - 25px)'],
|
|
80348
|
-
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: [
|
|
80350
|
+
}, placeholder: 'Search...' }), jsx$2(FavIcon, { filterOption: filterOption, setFilterOption: setFilterOption })] }) }), jsxs("div", { className: "headers-container", children: [jsxs("div", { className: "discount-header", onClick: () => onSort('bonus'), children: [namingPreference.toUpperCase(), 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" })] })] })] }));
|
|
80349
80351
|
};
|
|
80350
80352
|
|
|
80351
80353
|
const getUserApiStats = (account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
@@ -8,6 +8,7 @@ export interface SDKPropsDTO {
|
|
|
8
8
|
useTGEBonds?: boolean;
|
|
9
9
|
showLowValueBonds?: boolean;
|
|
10
10
|
bondPartner?: string;
|
|
11
|
+
namingPreference?: 'Discount' | 'Bonus';
|
|
11
12
|
urls?: Partial<Record<URLKeys, string>>;
|
|
12
13
|
theme?: any;
|
|
13
14
|
highestCompatibleVersion?: string;
|
|
@@ -22,6 +23,7 @@ export interface SDKProps {
|
|
|
22
23
|
useTGEBonds: boolean;
|
|
23
24
|
showLowValueBonds: boolean;
|
|
24
25
|
bondPartner?: string;
|
|
26
|
+
namingPreference: 'Discount' | 'Bonus';
|
|
25
27
|
urls: Record<URLKeys, string>;
|
|
26
28
|
theme?: any;
|
|
27
29
|
highestCompatibleVersion?: string;
|
package/dist/types/bonds.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface BondsData extends PreTGEConfig, BillsConfig {
|
|
|
13
13
|
tokensRemaining?: string;
|
|
14
14
|
showcaseTokenName?: string;
|
|
15
15
|
feeInPayout?: number;
|
|
16
|
+
discount?: number;
|
|
17
|
+
discountWithFee?: number;
|
|
16
18
|
trueBondPrices?: TrueBondPrices[];
|
|
17
19
|
payoutTokenPrice?: string;
|
|
18
20
|
principalTokenPrice?: string;
|