@ape.swap/bonds-sdk 3.0.89 → 3.0.90
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 +25 -6
- package/dist/state/useSDKConfig.d.ts +13 -13
- package/dist/views/Bonds/index.d.ts +2 -2
- package/dist/views/Bonds/utils.d.ts +1 -1
- package/dist/views/FullBondsView/index.d.ts +2 -2
- package/dist/views/ProjectView/index.d.ts +2 -2
- package/dist/views/SingleBond/index.d.ts +2 -2
- package/dist/views/YourBonds/index.d.ts +2 -2
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -58352,15 +58352,17 @@ const stagingUrls = {
|
|
|
58352
58352
|
};
|
|
58353
58353
|
const useSDKConfig = (config) => {
|
|
58354
58354
|
const urls = process.env.NODE_ENV === 'production' ? defaultUrls : stagingUrls;
|
|
58355
|
+
const initialData = Object.assign(Object.assign({ referenceId: '', chains: [], 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.2' });
|
|
58355
58356
|
const { data } = useQuery({
|
|
58356
58357
|
queryKey: [QUERY_KEYS.SDK_CONFIG],
|
|
58357
|
-
initialData
|
|
58358
|
+
initialData,
|
|
58358
58359
|
});
|
|
58359
58360
|
return data;
|
|
58360
58361
|
};
|
|
58361
58362
|
const useURLByEnvironment = (key) => {
|
|
58363
|
+
var _a;
|
|
58362
58364
|
const config = useSDKConfig();
|
|
58363
|
-
return config === null || config === void 0 ? void 0 : config.urls[key];
|
|
58365
|
+
return (_a = config === null || config === void 0 ? void 0 : config.urls) === null || _a === void 0 ? void 0 : _a[key];
|
|
58364
58366
|
};
|
|
58365
58367
|
|
|
58366
58368
|
function reportError$1(_a) {
|
|
@@ -73613,6 +73615,7 @@ const PreTgeUserRow = ({ userBond }) => {
|
|
|
73613
73615
|
const YourBonds = ({ showOnly }) => {
|
|
73614
73616
|
useTokenPrices();
|
|
73615
73617
|
// Hooks
|
|
73618
|
+
const SDKConfig = useSDKConfig();
|
|
73616
73619
|
const { address: account } = useAccount();
|
|
73617
73620
|
const { data: userBonds, isFetched: userBondsFetched } = useUserBonds();
|
|
73618
73621
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
@@ -73638,6 +73641,16 @@ const YourBonds = ({ showOnly }) => {
|
|
|
73638
73641
|
return [];
|
|
73639
73642
|
let bondsToReturn = userBonds;
|
|
73640
73643
|
// Handle Filtering //
|
|
73644
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
73645
|
+
var _a;
|
|
73646
|
+
return ((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.onlyPartner) ? bond.bond.bondPartner === SDKConfig.bondPartner : true;
|
|
73647
|
+
});
|
|
73648
|
+
if (SDKConfig.bondPartner) {
|
|
73649
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
73650
|
+
var _a;
|
|
73651
|
+
return ((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.bondPartner) === SDKConfig.bondPartner;
|
|
73652
|
+
});
|
|
73653
|
+
}
|
|
73641
73654
|
// Filter Single Token View
|
|
73642
73655
|
if (showOnly) {
|
|
73643
73656
|
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
@@ -73709,11 +73722,11 @@ const YourBonds = ({ showOnly }) => {
|
|
|
73709
73722
|
return 0;
|
|
73710
73723
|
});
|
|
73711
73724
|
return bondsToReturn;
|
|
73712
|
-
}, [userBonds, showOnly, inputValue, chainFilterOption, filterOption, sortConfig]);
|
|
73725
|
+
}, [userBonds, showOnly, inputValue, chainFilterOption, filterOption, sortConfig, SDKConfig.bondPartner]);
|
|
73713
73726
|
const handleFilterOption = useCallback((newOption) => {
|
|
73714
73727
|
setFilterOption(newOption);
|
|
73715
73728
|
}, []);
|
|
73716
|
-
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [!showOnly && (jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort })), !account ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected.' })) : (bondsToRender && (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.length) > 0) || (preTGEBondsToRender && preTGEBondsToRender.length > 0) ? (jsxs(Fragment$1, { children: [preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.map((userBond, index) => jsx$2(PreTgeUserRow, { userBond: userBond }, index)), bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.map((bill, index) => jsx$2(UserBondRow, { bill: bill }, `${bill.id}-${index}`))] })) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters.' })) : userBondsFetched && (
|
|
73729
|
+
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [!showOnly && (jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort })), !account ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected.' })) : (bondsToRender && (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.length) > 0) || (preTGEBondsToRender && preTGEBondsToRender.length > 0) ? (jsxs(Fragment$1, { children: [preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.map((userBond, index) => jsx$2(PreTgeUserRow, { userBond: userBond }, index)), bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.map((bill, index) => jsx$2(UserBondRow, { bill: bill }, `${bill.id}-${index}`))] })) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters.' })) : userBondsFetched && (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.length) === 0 ? (jsx$2(PlaceholderMonkey, { text: 'You do not own any Bonds.' })) : (jsx$2(Flex$1, { className: "yourbonds-spinner", children: jsx$2(Spinner, { size: 100 }) }))] }));
|
|
73717
73730
|
};
|
|
73718
73731
|
|
|
73719
73732
|
// This basically returns the 2 tags with the higher active bond count
|
|
@@ -80413,7 +80426,10 @@ const Bonds = () => {
|
|
|
80413
80426
|
const filterOptions = ['ALL', 'FAVORITES', ...topTags, 'SOLD OUT'];
|
|
80414
80427
|
const billsToRender = useMemo(() => {
|
|
80415
80428
|
let billsToReturn = filterOption === 'SOLD OUT' ? [...(allPreBonds !== null && allPreBonds !== void 0 ? allPreBonds : []), ...(allBonds !== null && allBonds !== void 0 ? allBonds : [])] : (sortedBonds !== null && sortedBonds !== void 0 ? sortedBonds : []);
|
|
80416
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) =>
|
|
80429
|
+
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
|
|
80430
|
+
return (isBondSupported(SDKConfig.highestCompatibleVersion, bill.version) &&
|
|
80431
|
+
(bill.onlyPartner ? SDKConfig.bondPartner === bill.bondPartner : true));
|
|
80432
|
+
});
|
|
80417
80433
|
if (searchQuery) {
|
|
80418
80434
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
|
|
80419
80435
|
var _a, _b;
|
|
@@ -80425,6 +80441,9 @@ const Bonds = () => {
|
|
|
80425
80441
|
return 'minTier' in bill ? bill.minTier === null || bill.minTier === undefined : true; //TODO: check this
|
|
80426
80442
|
});
|
|
80427
80443
|
}
|
|
80444
|
+
if (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) {
|
|
80445
|
+
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => bill.bondPartner === SDKConfig.bondPartner);
|
|
80446
|
+
}
|
|
80428
80447
|
if (topTags.includes(filterOption)) {
|
|
80429
80448
|
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => { var _a; return (_a = bill === null || bill === void 0 ? void 0 : bill.tags) === null || _a === void 0 ? void 0 : _a.includes(filterOption); });
|
|
80430
80449
|
}
|
|
@@ -80463,7 +80482,7 @@ const Bonds = () => {
|
|
|
80463
80482
|
const handleChangeFilterOption = useCallback((newOption) => {
|
|
80464
80483
|
setFilterOption(newOption);
|
|
80465
80484
|
}, []);
|
|
80466
|
-
return (jsxs(Flex$1, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), jsx$2(BondsMenu, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, setChainFilterOption: setChainFilterOption, chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onSort: handleSortOptions }), SDKConfig.useHotBonds && jsx$2(BuyAgainRow, {}), (billsToRender === null || billsToRender === void 0 ? void 0 : billsToRender.length) > 0 ? (jsx$2(BondRowsByChain, { bonds: billsToRender, hideTitles: searchQuery !== '' })) : searchQuery ? (jsx$2(PlaceholderMonkey, { text: 'No results' })) : filterOption === 'FAVORITES' ? (jsxs(Flex$1, { sx: {
|
|
80485
|
+
return (jsxs(Flex$1, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), jsx$2(BondsMenu, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, setChainFilterOption: setChainFilterOption, chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onSort: handleSortOptions }), SDKConfig.useHotBonds && !SDKConfig.bondPartner && jsx$2(BuyAgainRow, {}), (billsToRender === null || billsToRender === void 0 ? void 0 : billsToRender.length) > 0 ? (jsx$2(BondRowsByChain, { bonds: billsToRender, hideTitles: searchQuery !== '' })) : searchQuery ? (jsx$2(PlaceholderMonkey, { text: 'No results' })) : filterOption === 'FAVORITES' ? (jsxs(Flex$1, { sx: {
|
|
80467
80486
|
width: '100%',
|
|
80468
80487
|
height: '300px',
|
|
80469
80488
|
background: 'white2',
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface SDKPropsDTO {
|
|
2
2
|
referenceId: string;
|
|
3
3
|
chains: number[];
|
|
4
|
-
useRainbowKit
|
|
4
|
+
useRainbowKit?: boolean;
|
|
5
5
|
useHotBonds?: boolean;
|
|
6
6
|
useTiers?: boolean;
|
|
7
7
|
useTGEBonds?: boolean;
|
|
8
8
|
showLowValueBonds?: boolean;
|
|
9
|
+
bondPartner?: string;
|
|
9
10
|
urls?: Partial<Record<URLKeys, string>>;
|
|
10
11
|
theme?: any;
|
|
12
|
+
highestCompatibleVersion?: string;
|
|
11
13
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
realTimeApi: string;
|
|
16
|
-
mainUrl: string;
|
|
17
|
-
};
|
|
18
|
-
highestCompatibleVersion: string;
|
|
19
|
-
referenceId?: string | undefined;
|
|
20
|
-
chains?: number[] | undefined;
|
|
14
|
+
export interface SDKProps {
|
|
15
|
+
referenceId: string;
|
|
16
|
+
chains: number[];
|
|
21
17
|
useRainbowKit: boolean;
|
|
22
18
|
useHotBonds: boolean;
|
|
23
19
|
useTiers: boolean;
|
|
24
20
|
useTGEBonds: boolean;
|
|
25
21
|
showLowValueBonds: boolean;
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
bondPartner?: string;
|
|
23
|
+
urls: Record<URLKeys, string>;
|
|
24
|
+
theme: any;
|
|
25
|
+
highestCompatibleVersion?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const useSDKConfig: (config?: SDKPropsDTO) => SDKProps;
|
|
28
28
|
export type URLKeys = 'apiV2' | 'realTimeApi' | 'mainUrl';
|
|
29
29
|
export declare const useURLByEnvironment: (key: URLKeys) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const BondsWithProviders: React.FC<
|
|
2
|
+
import { SDKPropsDTO } from '../../state/useSDKConfig';
|
|
3
|
+
declare const BondsWithProviders: React.FC<SDKPropsDTO>;
|
|
4
4
|
export default BondsWithProviders;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BondsData } from '../../types/bonds';
|
|
2
2
|
import { SortOptions } from './Bonds';
|
|
3
3
|
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
4
|
-
export declare const isBondSoldOut: (bill: BondsData, showLowValueBonds
|
|
4
|
+
export declare const isBondSoldOut: (bill: BondsData, showLowValueBonds?: boolean) => boolean;
|
|
5
5
|
export declare const sortBonds: (sortConfig?: SortOptions, bonds?: BondsData[]) => BondsData[];
|
|
6
6
|
export declare const vestingTime: (vestingTerm?: number) => {
|
|
7
7
|
years: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const FullBondsViewWithProviders: React.FC<
|
|
2
|
+
import { SDKPropsDTO } from '../../state/useSDKConfig';
|
|
3
|
+
declare const FullBondsViewWithProviders: React.FC<SDKPropsDTO>;
|
|
4
4
|
export default FullBondsViewWithProviders;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SDKPropsDTO } from '../../state/useSDKConfig';
|
|
3
3
|
import { ProjectViewProps } from './ProjectView';
|
|
4
|
-
interface Props extends
|
|
4
|
+
interface Props extends SDKPropsDTO, ProjectViewProps {
|
|
5
5
|
}
|
|
6
6
|
declare const ProjectViewWithProviders: React.FC<Props>;
|
|
7
7
|
export default ProjectViewWithProviders;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SDKPropsDTO } from '../../state/useSDKConfig';
|
|
3
3
|
import { SingleBondProps } from './SingleBond';
|
|
4
|
-
interface Props extends
|
|
4
|
+
interface Props extends SDKPropsDTO, SingleBondProps {
|
|
5
5
|
}
|
|
6
6
|
declare const SingleBondWithProviders: React.FC<Props>;
|
|
7
7
|
export default SingleBondWithProviders;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare const YourBondsWithProviders: React.FC<
|
|
2
|
+
import { SDKPropsDTO } from '../../state/useSDKConfig';
|
|
3
|
+
declare const YourBondsWithProviders: React.FC<SDKPropsDTO>;
|
|
4
4
|
export default YourBondsWithProviders;
|
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": "3.0.
|
|
6
|
+
"version": "3.0.90",
|
|
7
7
|
"module": "dist/main.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"types": "dist/main.d.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"yalc": "^1.0.0-pre.53"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@ape.swap/apeswap-lists": "4.3.
|
|
71
|
+
"@ape.swap/apeswap-lists": "4.3.26-test.0",
|
|
72
72
|
"@emotion/react": "11.11.4",
|
|
73
73
|
"bignumber.js": "^9.1.2",
|
|
74
74
|
"chart.js": "4.2.0",
|