@ape.swap/bonds-sdk 5.0.7-test.3 → 5.0.7

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const AbondModal: () => React.JSX.Element;
3
+ export default AbondModal;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const OabondModal: () => React.JSX.Element;
3
+ export default OabondModal;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const PmusdModal: ({ onDismiss }: {
3
+ onDismiss?: () => void;
4
+ }) => React.JSX.Element;
5
+ export default PmusdModal;
@@ -0,0 +1,3 @@
1
+ export { default as AbondModal } from './AbondModal';
2
+ export { default as OabondModal } from './OabondModal';
3
+ export { default as PmusdModal } from './PmusdModal';
package/dist/main.js CHANGED
@@ -46816,8 +46816,8 @@ const PUBLIC_RPC_URLS = {
46816
46816
  [main.ChainId.ARBITRUM]: ['https://arb1.arbitrum.io/rpc'],
46817
46817
  [main.ChainId.BSC_TESTNET]: ['https://data-seed-prebsc-2-s3.binance.org:8545/'],
46818
46818
  [main.ChainId.MATIC]: [
46819
- 'https://polygon-rpc.com/',
46820
46819
  'https://polygon.drpc.org',
46820
+ 'https://polygon-rpc.com/',
46821
46821
  'https://polygon-mainnet.public.blastapi.io/',
46822
46822
  'https://rpc-mainnet.matic.network',
46823
46823
  'https://matic-mainnet.chainstacklabs.com',
@@ -46977,7 +46977,6 @@ const useSDKConfig = (config) => {
46977
46977
  throw new Error('Just a hotfix for latest versions of react-query that make queryFn a required prop');
46978
46978
  },
46979
46979
  initialData,
46980
- enabled: typeof window !== 'undefined',
46981
46980
  });
46982
46981
  return data;
46983
46982
  };
@@ -47109,7 +47108,6 @@ function useTierPoints() {
47109
47108
  queryFn: () => fetchUserPoints(account, SDKConfig.useTiers, apiUrl),
47110
47109
  refetchInterval: 120000, // i.e. 2 mins
47111
47110
  refetchOnWindowFocus: false,
47112
- enabled: typeof window !== 'undefined',
47113
47111
  });
47114
47112
  }
47115
47113
 
@@ -47487,7 +47485,6 @@ function useBondsList() {
47487
47485
  staleTime: Infinity,
47488
47486
  refetchInterval: 300000, // 5 min
47489
47487
  refetchOnWindowFocus: false,
47490
- enabled: typeof window !== 'undefined',
47491
47488
  });
47492
47489
  }
47493
47490
  const getBondsList = async (queryClient) => {
@@ -48734,20 +48731,19 @@ const fetchUserOwnedBills = async (chainId, account, bonds, tokenPrices, priceAp
48734
48731
  };
48735
48732
 
48736
48733
  function useTokenPrices() {
48737
- const queryClient = useQueryClient();
48734
+ var _a, _b;
48735
+ const SDKConfig = useSDKConfig();
48736
+ const priceApi = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.priceApi;
48737
+ const apiv2 = (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _b === void 0 ? void 0 : _b.apiV2;
48738
48738
  return useQuery({
48739
48739
  queryKey: [QUERY_KEYS.TOKEN_PRICES],
48740
- queryFn: () => getTokenPrices(queryClient),
48740
+ queryFn: () => getTokenPrices(priceApi, apiv2),
48741
48741
  refetchInterval: 30000, // 30 sec
48742
48742
  refetchOnMount: false,
48743
48743
  refetchOnWindowFocus: false,
48744
- enabled: typeof window !== 'undefined',
48745
48744
  });
48746
48745
  }
48747
- const getTokenPrices = async (queryClient) => {
48748
- const { urls } = queryClient === null || queryClient === void 0 ? void 0 : queryClient.getQueryData([QUERY_KEYS.SDK_CONFIG]);
48749
- const apiv2 = urls['apiV2'];
48750
- const priceApi = urls['priceApi'];
48746
+ const getTokenPrices = async (priceApi, apiv2) => {
48751
48747
  try {
48752
48748
  const response = await axios.get(`${priceApi}/realtime/prices`);
48753
48749
  return response.data;
@@ -49167,7 +49163,7 @@ function useUserBonds() {
49167
49163
  return useQuery({
49168
49164
  queryKey: [QUERY_KEYS.USER_BONDS, address, publicKey, (_b = (_a = Object.keys(tokenPrices !== null && tokenPrices !== void 0 ? tokenPrices : {})) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : null],
49169
49165
  queryFn: () => getUserBonds(address, solanaAccount, bondList, queryClient),
49170
- enabled: !!bondList && !!(address || solanaAccount) && !!tokenPrices && typeof window !== 'undefined',
49166
+ enabled: !!bondList && !!(address || solanaAccount) && !!tokenPrices,
49171
49167
  refetchInterval: 120000,
49172
49168
  refetchOnWindowFocus: false,
49173
49169
  refetchOnMount: false,
@@ -49322,7 +49318,6 @@ function useChainFilterOption() {
49322
49318
  queryKey: [`${QUERY_KEYS.CHAIN_FILTER_OPTION}`],
49323
49319
  queryFn: () => cookie,
49324
49320
  initialData: cookie,
49325
- enabled: typeof window !== 'undefined',
49326
49321
  });
49327
49322
  // eslint-disable-next-line react-hooks/exhaustive-deps
49328
49323
  const urlParams = typeof window !== 'undefined' ? new URLSearchParams(window.location.search) : null;
@@ -52280,7 +52275,6 @@ const usePopups = () => {
52280
52275
  throw new Error('Just a hotfix for latest versions of react-query that make queryFn a required prop');
52281
52276
  },
52282
52277
  initialData: [],
52283
- enabled: typeof window !== 'undefined',
52284
52278
  });
52285
52279
  const queryClient = useQueryClient();
52286
52280
  const addPopup = useCallback((newPopup) => {
@@ -53597,7 +53591,6 @@ function useFavoriteTokens() {
53597
53591
  queryKey: [QUERY_KEYS.FAVORITE_TOKENS],
53598
53592
  queryFn: () => cookie,
53599
53593
  initialData: cookie,
53600
- enabled: typeof window !== 'undefined',
53601
53594
  });
53602
53595
  const queryClient = useQueryClient();
53603
53596
  const addFavToken = useCallback((newValue) => {
@@ -53788,7 +53781,6 @@ function useGetBondRecommendations(user, contract, limit = '3') {
53788
53781
  staleTime: Infinity,
53789
53782
  refetchOnWindowFocus: false,
53790
53783
  refetchOnMount: false,
53791
- enabled: typeof window !== 'undefined',
53792
53784
  });
53793
53785
  }
53794
53786
 
@@ -56200,7 +56192,6 @@ function useBondsListPreTGE() {
56200
56192
  staleTime: Infinity,
56201
56193
  refetchInterval: 300000, // 5 min
56202
56194
  refetchOnWindowFocus: false,
56203
- enabled: typeof window !== 'undefined',
56204
56195
  });
56205
56196
  }
56206
56197
  const getPreTGEList = async (apiRealTimeURL, apiUrl) => {
@@ -59226,7 +59217,7 @@ function useBondsData() {
59226
59217
  queryKey: [QUERY_KEYS.BONDS_DATA, bondList === null || bondList === void 0 ? void 0 : bondList.length, preTGEList === null || preTGEList === void 0 ? void 0 : preTGEList.length],
59227
59218
  queryFn: () => calculateBondsData(queryClient),
59228
59219
  refetchInterval: 25000, // i.e. 25 sec
59229
- enabled: !!bondList && !!preTGEList && typeof window !== 'undefined',
59220
+ enabled: !!bondList && !!preTGEList,
59230
59221
  refetchOnWindowFocus: true,
59231
59222
  refetchOnMount: false,
59232
59223
  refetchOnReconnect: true,
@@ -59297,20 +59288,31 @@ const remove0xPrefix = (str) => {
59297
59288
  return str;
59298
59289
  };
59299
59290
 
59300
- const CircularModal = () => {
59291
+ const AbondModal = () => {
59301
59292
  const handleClick = () => {
59302
59293
  window.location.href = 'https://ape.bond/true-yield';
59303
59294
  };
59304
59295
  return (jsx$2(Modal, { title: "You've Claimed ABOND!", children: jsxs(Flex, { sx: { flexDirection: 'column' }, children: [jsx$2(Flex, { sx: { fontSize: '12px', lineHeight: '20px', color: 'primaryButton', mt: '10px' }, children: "Did You Know?" }), jsxs(Flex, { sx: { flexDirection: 'column', gap: '10px', cursor: 'pointer' }, onClick: handleClick, children: [jsx$2(Flex, { children: "You can stake ABOND to earn $USDT and extra discounts on Bonds:" }), jsx$2(Image$1, { src: 'https://ape.bond/images/circular-staking/real-yield.png' }), jsx$2(Image$1, { src: 'https://ape.bond/images/circular-staking/extra-discounts.png' }), jsx$2(Button, { sx: { width: '100%', mt: '10px' }, children: " Stake now" })] })] }) }));
59305
59296
  };
59306
59297
 
59307
- const OABONDModal = () => {
59298
+ const OabondModal = () => {
59308
59299
  const handleClick = () => {
59309
59300
  window.location.href = 'https://ape.bond/true-yield?createPosition=oABOND';
59310
59301
  };
59311
59302
  return (jsx$2(Modal, { title: "You've Claimed oABOND!", children: jsx$2(Flex, { sx: { flexDirection: 'column' }, children: jsxs(Flex, { sx: { flexDirection: 'column', gap: '10px', cursor: 'pointer' }, onClick: handleClick, children: [jsx$2(Flex, { children: "You can now stake your oABOND and turn it into veABOND at permalock:" }), jsx$2(Image$1, { src: 'https://ape.bond/images/circular-staking/real-yield.png' }), jsx$2(Button, { sx: { width: '100%', mt: '10px' }, children: "Lock now" })] }) }) }));
59312
59303
  };
59313
59304
 
59305
+ const PmusdModal = ({ onDismiss }) => {
59306
+ return (jsx$2(Modal, { title: "You've Claimed pmUSD!", children: jsx$2(Flex, { sx: { flexDirection: 'column' }, children: jsxs(Flex, { sx: { flexDirection: 'column', gap: '10px' }, children: [jsxs(Flex, { sx: {
59307
+ fontWeight: 500,
59308
+ fontSize: '14px',
59309
+ textAlign: 'left',
59310
+ color: 'textDisabledButton',
59311
+ my: '10px',
59312
+ display: 'block',
59313
+ }, children: ["Base pmUSD rewards succesfully claimed. The additional PVE rewards (10\u201315%) will be automatically transferred to your wallet within the next 24 hours. If you experience any issues or delay, please contact with", ' ', jsx$2("a", { href: "https://discord.gg/raac", target: "_blank", rel: "noreferrer", sx: { color: 'primaryButton' }, children: "RACC support channel" }), "."] }), jsx$2(Button, { sx: { width: '100%', mt: '10px' }, onClick: onDismiss, children: "close" })] }) }) }));
59314
+ };
59315
+
59314
59316
  const Actions = ({ userBill }) => {
59315
59317
  var _a, _b, _c;
59316
59318
  // Hooks
@@ -59382,17 +59384,21 @@ const Actions = ({ userBill }) => {
59382
59384
  }
59383
59385
  };
59384
59386
  // Modals
59385
- const [openCircularModal] = useModal(jsx$2(CircularModal, {}), true, false, 'circularModal');
59386
- const [openOABONDModal] = useModal(jsx$2(OABONDModal, {}), true, false, 'oABONDModal');
59387
+ const [openAbondModal] = useModal(jsx$2(AbondModal, {}), true, false, 'abondModal');
59388
+ const [openOabondModal] = useModal(jsx$2(OabondModal, {}), true, false, 'oAbondModal');
59389
+ const [openPmusdModal] = useModal(jsx$2(PmusdModal, {}), true, false, 'pmUSDModal');
59387
59390
  useEffect(() => {
59388
- var _a, _b;
59391
+ var _a, _b, _c;
59389
59392
  if (isConfirmed) {
59390
59393
  refetchUserBonds();
59391
59394
  if (((_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.earnToken.symbol.toLowerCase()) === 'abond') {
59392
- openCircularModal();
59395
+ openAbondModal();
59393
59396
  }
59394
59397
  if (((_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.earnToken.symbol.toLowerCase()) === 'oabond') {
59395
- openOABONDModal();
59398
+ openOabondModal();
59399
+ }
59400
+ if (((_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken.symbol.toLowerCase()) === 'pmusd') {
59401
+ openPmusdModal();
59396
59402
  }
59397
59403
  }
59398
59404
  /* eslint-disable react-hooks/exhaustive-deps */
@@ -59822,10 +59828,11 @@ const UserBondRow = ({ bill }) => {
59822
59828
  const isPendingCliff = vestingCliff ? currentTime - purchaseTimestamp < vestingCliff : false;
59823
59829
  const cliffCountdown = getTimePeriods(purchaseTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
59824
59830
  // Modals
59825
- const [openCircularModal] = useModal(jsx$2(CircularModal, {}), true, false, 'circularModal');
59826
- const [openOABONDModal] = useModal(jsx$2(OABONDModal, {}), true, false, 'oABONDModal');
59831
+ const [openCircularModal] = useModal(jsx$2(AbondModal, {}), true, false, 'circularModal');
59832
+ const [openOABONDModal] = useModal(jsx$2(OabondModal, {}), true, false, 'oABONDModal');
59833
+ const [openPmusdModal] = useModal(jsx$2(PmusdModal, {}), true, false, 'pmUSDModal');
59827
59834
  useEffect(() => {
59828
- var _a, _b;
59835
+ var _a, _b, _c;
59829
59836
  if (isConfirmed) {
59830
59837
  refetchUserBonds();
59831
59838
  if (((_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.earnToken.symbol.toLowerCase()) === 'abond') {
@@ -59834,6 +59841,9 @@ const UserBondRow = ({ bill }) => {
59834
59841
  if (((_b = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _b === void 0 ? void 0 : _b.earnToken.symbol.toLowerCase()) === 'oabond') {
59835
59842
  openOABONDModal();
59836
59843
  }
59844
+ if (((_c = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _c === void 0 ? void 0 : _c.earnToken.symbol.toLowerCase()) === 'pmusd') {
59845
+ openPmusdModal();
59846
+ }
59837
59847
  }
59838
59848
  /* eslint-disable react-hooks/exhaustive-deps */
59839
59849
  }, [isConfirmed]);
@@ -60003,7 +60013,7 @@ function useUserBondsPreTGE() {
60003
60013
  queryFn: () => fetchPreTGEUserBonds(chains, tokenPrices, preTGEList, address, apiUrl),
60004
60014
  refetchInterval: 30000,
60005
60015
  refetchOnWindowFocus: false,
60006
- enabled: !!preTGEList && preTGEList.length > 0 && !!address && !!tokenPrices && typeof window !== 'undefined',
60016
+ enabled: !!preTGEList && preTGEList.length > 0 && !!address && !!tokenPrices,
60007
60017
  });
60008
60018
  }
60009
60019
  const fetchPreTGEUserBonds = async (chains, tokenPrices, preTGEList, account, apiUrl) => {
@@ -62550,7 +62560,7 @@ function useUserTokensBalance(tokens, chainId) {
62550
62560
  queryFn: () => getTokensBalance(accountToUse, tokens, chainId, apiUrl),
62551
62561
  staleTime: 45000,
62552
62562
  refetchOnWindowFocus: false,
62553
- enabled: !!accountToUse && typeof window !== 'undefined',
62563
+ enabled: !!accountToUse,
62554
62564
  });
62555
62565
  }
62556
62566
  const getTokensBalance = async (account, tokens, chainId, apiUrl) => {
@@ -63471,7 +63481,6 @@ function useAllowance(currency, spender, account, chainId) {
63471
63481
  refetchInterval: 10000, // i.e. 10 sec
63472
63482
  refetchOnWindowFocus: false,
63473
63483
  retry: 1,
63474
- enabled: typeof window !== 'undefined',
63475
63484
  });
63476
63485
  }
63477
63486
  const getTokenAllowance = async (currency, spender, account, chainId) => {
@@ -63648,7 +63657,6 @@ const useSlippage = () => {
63648
63657
  queryFn: () => {
63649
63658
  throw new Error('Just a hotfix for latest versions of react-query that make queryFn a required prop');
63650
63659
  },
63651
- enabled: typeof window !== 'undefined',
63652
63660
  });
63653
63661
  // Handler to modify the setting within React Query's cache
63654
63662
  const setSlippage = (newValue, chainId) => {
@@ -63808,7 +63816,7 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account, tierProof
63808
63816
  queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
63809
63817
  queryFn: fetchZapDetails,
63810
63818
  refetchInterval: 60000, // i.e. 60 sec
63811
- enabled: !!queryKey && typeof window !== 'undefined',
63819
+ enabled: !!queryKey,
63812
63820
  retry: 1,
63813
63821
  });
63814
63822
  const zapError = !!error;
@@ -64430,13 +64438,7 @@ function useTierProofSignature(bondAddress, chainId, isUserRestricted) {
64430
64438
  retry: 1,
64431
64439
  refetchInterval: 1800000, // 30 mins
64432
64440
  initialData: null,
64433
- enabled: !!bondAddress &&
64434
- !!account &&
64435
- !!apiAddress &&
64436
- !!chainId &&
64437
- SDKConfig.useTiers &&
64438
- !isUserRestricted &&
64439
- typeof window !== 'undefined',
64441
+ enabled: !!bondAddress && !!account && !!apiAddress && !!chainId && SDKConfig.useTiers && !isUserRestricted,
64440
64442
  });
64441
64443
  }
64442
64444
  const getTierProofSig = async (apiAddress, account, bondAddress, chainId) => {
@@ -66030,7 +66032,7 @@ slippage = 0.5) => {
66030
66032
  queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, 'jupiter-solana', directQueryParams, preferDirectRoutes, slippage],
66031
66033
  queryFn: fetchJupiterQuote,
66032
66034
  refetchInterval: 60000,
66033
- enabled: !!directQueryParams && typeof window !== 'undefined',
66035
+ enabled: !!directQueryParams,
66034
66036
  retry: 1,
66035
66037
  staleTime: 30000,
66036
66038
  });
@@ -66833,7 +66835,6 @@ function useCurrencyBalance(currency, account, chainId) {
66833
66835
  refetchInterval: 10000, // i.e. 10 sec
66834
66836
  refetchOnWindowFocus: false,
66835
66837
  retry: 1,
66836
- enabled: typeof window !== 'undefined',
66837
66838
  });
66838
66839
  }
66839
66840
  const getTokenBalance = async (currency, account, chainId) => {
@@ -67129,7 +67130,6 @@ function useHotBondContracts() {
67129
67130
  refetchOnWindowFocus: false,
67130
67131
  refetchOnMount: false,
67131
67132
  retry: 1,
67132
- enabled: typeof window !== 'undefined',
67133
67133
  });
67134
67134
  }
67135
67135
  function useHotBonds() {
@@ -67140,11 +67140,7 @@ function useHotBonds() {
67140
67140
  queryFn: () => getHotBonds(bondsData, hotBondContracts),
67141
67141
  refetchOnWindowFocus: false,
67142
67142
  refetchInterval: 30000,
67143
- enabled: !!bondsData &&
67144
- bondsData.length > 0 &&
67145
- !!hotBondContracts &&
67146
- hotBondContracts.length > 0 &&
67147
- typeof window !== 'undefined',
67143
+ enabled: !!bondsData && bondsData.length > 0 && !!hotBondContracts && hotBondContracts.length > 0,
67148
67144
  retry: 0,
67149
67145
  });
67150
67146
  }
@@ -88809,7 +88805,6 @@ function useGetBondApiStats(contractAddress) {
88809
88805
  refetchOnWindowFocus: false,
88810
88806
  refetchOnMount: false,
88811
88807
  retry: 1,
88812
- enabled: typeof window !== 'undefined',
88813
88808
  });
88814
88809
  }
88815
88810
 
@@ -89704,7 +89699,7 @@ function useHistoricalPrice(cgId) {
89704
89699
  queryFn: () => getHistoricalPrice(cgId, queryClient),
89705
89700
  refetchOnWindowFocus: false,
89706
89701
  refetchInterval: 300000,
89707
- enabled: !!cgId && typeof window !== 'undefined',
89702
+ enabled: !!cgId,
89708
89703
  retry: 0,
89709
89704
  });
89710
89705
  }
@@ -1,4 +1,4 @@
1
- import { QueryClient, UseQueryResult } from '@tanstack/react-query';
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ChainId } from '@ape.swap/apeswap-lists';
3
3
  export interface TokenPrices {
4
4
  chainId: ChainId;
@@ -12,4 +12,4 @@ export interface TokenPrices {
12
12
  secondsAgoUpdated: number;
13
13
  }
14
14
  export default function useTokenPrices(): UseQueryResult<Partial<Record<ChainId, TokenPrices[]>>>;
15
- export declare const getTokenPrices: (queryClient: QueryClient) => Promise<Partial<Record<ChainId, TokenPrices[]>>>;
15
+ export declare const getTokenPrices: (priceApi: string, apiv2: string) => Promise<Partial<Record<ChainId, TokenPrices[]>>>;
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": "5.0.7-test.3",
6
+ "version": "5.0.7",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const CircularModal: () => React.JSX.Element;
3
- export default CircularModal;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const OABONDModal: () => React.JSX.Element;
3
- export default OABONDModal;