@ape.swap/bonds-sdk 3.0.88 → 3.0.89-test.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
@@ -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: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false, useTGEBonds: false, showLowValueBonds: false }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.2' }),
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) {
@@ -80145,7 +80147,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
80145
80147
  const totalPrincipalBilled = Math.round(getBalanceNumber(new BigNumber$1((_c = bond === null || bond === void 0 ? void 0 : bond.totalPrincipalBilled) !== null && _c !== void 0 ? _c : '0'), (_e = (_d = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _d === void 0 ? void 0 : _d.decimals) === null || _e === void 0 ? void 0 : _e[bond === null || bond === void 0 ? void 0 : bond.chainId])) / ((_f = bond.initPrice) !== null && _f !== void 0 ? _f : 0);
80146
80148
  const raiseGoal = Math.round(getBalanceNumber(new BigNumber$1((_g = bond === null || bond === void 0 ? void 0 : bond.totalRaise) !== null && _g !== void 0 ? _g : '0'), (_j = (_h = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _h === void 0 ? void 0 : _h.decimals) === null || _j === void 0 ? void 0 : _j[bond === null || bond === void 0 ? void 0 : bond.chainId])) / ((_k = bond.initPrice) !== null && _k !== void 0 ? _k : 0);
80147
80149
  const tokensRemaining = raiseGoal - totalPrincipalBilled;
80148
- const tokensRemainingUSD = tokensRemaining * parseFloat((_l = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _l !== void 0 ? _l : '0');
80150
+ const tokensRemainingUSD = tokensRemaining * ((_l = bond === null || bond === void 0 ? void 0 : bond.initPrice) !== null && _l !== void 0 ? _l : 0);
80149
80151
  const percentageAvailable = 100 - Math.floor((totalPrincipalBilled * 100) / raiseGoal);
80150
80152
  const earnToken = (_m = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _m === void 0 ? void 0 : _m.symbol;
80151
80153
  return (jsx$2(BondRow, { bondAddress: (_o = bond.contractAddress) === null || _o === void 0 ? void 0 : _o[bond.chainId], bondChain: bond.chainId, payoutToken: bond.earnToken, billType: bond.billType, tag: (_p = bond.tags) === null || _p === void 0 ? void 0 : _p[0], bonus: `${(_r = (_q = bond === null || bond === void 0 ? void 0 : bond.trueBondPrices) === null || _q === void 0 ? void 0 : _q[0]) === null || _r === void 0 ? void 0 : _r.bonus}%`, percentageAvailable: percentageAvailable, remainingTokensString: `${formatNumberSI(tokensRemaining, 0)} ${earnToken} ($${formatNumberSI(tokensRemainingUSD, 2)})`, vestingTermString: `${getTimePeriods((_s = bond.vestingTerm) !== null && _s !== void 0 ? _s : 0).months} Mo`, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit }, `${bond.contractAddress}-${bond.chainId}-${index}`));
@@ -80413,7 +80415,10 @@ const Bonds = () => {
80413
80415
  const filterOptions = ['ALL', 'FAVORITES', ...topTags, 'SOLD OUT'];
80414
80416
  const billsToRender = useMemo(() => {
80415
80417
  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) => isBondSupported(SDKConfig.highestCompatibleVersion, bill.version));
80418
+ billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
80419
+ return (isBondSupported(SDKConfig.highestCompatibleVersion, bill.version) &&
80420
+ (bill.onlyPartner ? SDKConfig.bondPartner === bill.bondPartner : true));
80421
+ });
80417
80422
  if (searchQuery) {
80418
80423
  billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => {
80419
80424
  var _a, _b;
@@ -80425,6 +80430,9 @@ const Bonds = () => {
80425
80430
  return 'minTier' in bill ? bill.minTier === null || bill.minTier === undefined : true; //TODO: check this
80426
80431
  });
80427
80432
  }
80433
+ if (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) {
80434
+ billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => bill.bondPartner === SDKConfig.bondPartner);
80435
+ }
80428
80436
  if (topTags.includes(filterOption)) {
80429
80437
  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
80438
  }
@@ -1,29 +1,29 @@
1
- export interface SDKProps {
1
+ export interface SDKPropsDTO {
2
2
  referenceId: string;
3
3
  chains: number[];
4
- useRainbowKit: boolean;
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 declare const useSDKConfig: (config?: SDKProps) => {
13
- urls: {
14
- apiV2: string;
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
- theme?: any;
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,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: boolean) => boolean;
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;
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.88",
6
+ "version": "3.0.89-test.0",
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.25",
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",