@ape.swap/bonds-sdk 1.1.0-test.88 → 1.1.0-test.91

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.
@@ -1,8 +1,5 @@
1
1
  import { ChainId } from '@ape.swap/apeswap-lists';
2
- export declare const apiV2BaseUrl = "https://staging-api.ape.bond";
3
- export declare const bondsRealTimeApi = "https://realtime-api-staging.ape.bond/bonds";
4
2
  export declare const supportedByLIFI: ChainId[];
5
- export declare const APESWAP_LIST_REPO_BRANCH = "staging";
6
- export declare const APESWAP_LISTS_URL = "https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging";
7
3
  export declare const APESWAP_LIST_REPO = "https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/staging";
8
- export declare const APESWAP = "https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/staging/lists/apeswap.json";
4
+ export declare const STRAPI_URL = "https://apeswap-strapi.herokuapp.com";
5
+ export declare const SOUL_ZAP_API = "https://soulsolidity-zap-api-902f1d839e8d.herokuapp.com/zap?batch=1";
package/dist/main.js CHANGED
@@ -18385,7 +18385,6 @@ var types = {};
18385
18385
 
18386
18386
  } (types));
18387
18387
 
18388
- const apiV2BaseUrl = 'https://staging-api.ape.bond';
18389
18388
  const supportedByLIFI = [
18390
18389
  types.ChainId.MAINNET,
18391
18390
  types.ChainId.MATIC,
@@ -18394,8 +18393,10 @@ const supportedByLIFI = [
18394
18393
  types.ChainId.LINEA,
18395
18394
  types.ChainId.BASE,
18396
18395
  ];
18397
- const APESWAP_LIST_REPO_BRANCH = 'staging';
18398
- const APESWAP_LIST_REPO = `https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/${APESWAP_LIST_REPO_BRANCH}`;
18396
+ // we should be good just by using staging on this, as it is only used for token images
18397
+ const APESWAP_LIST_REPO = `https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/staging`;
18398
+ const STRAPI_URL = `https://apeswap-strapi.herokuapp.com`;
18399
+ const SOUL_ZAP_API = `https://soulsolidity-zap-api-902f1d839e8d.herokuapp.com/zap?batch=1`;
18399
18400
 
18400
18401
  // Network chain ids
18401
18402
  // These are the lists we will display to the user
@@ -18764,7 +18765,6 @@ const NETWORK_COLORS = {
18764
18765
  const TokenInfoAndName = ({ bill, vestEnds, isHotBond, }) => {
18765
18766
  var _a, _b, _c, _d;
18766
18767
  const tokenName = 'showcaseTokenName' in bill ? bill.showcaseTokenName : bill.earnToken.symbol;
18767
- console.log(tokenName);
18768
18768
  return (jsxs(Flex, { className: "tokeninfoname container", children: [jsx$2(Flex, { className: "tokeninfoname chain", children: jsx$2(Svg, { width: 20, height: 20, icon: (_a = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _a !== void 0 ? _a : 'question' }) }), jsx$2(Flex, { className: "tokeninfoname gradient", sx: {
18769
18769
  background: isHotBond || vestEnds ? 'transparent' : NETWORK_COLORS[bill.chainId],
18770
18770
  } }), jsxs(Flex, { className: "tokeninfoname tokencontainer", sx: { marginTop: vestEnds ? ['10px', '10px', '10px', '0px'] : 0 }, children: [jsx$2(TokenImage, { symbol: tokenName, size: 33 }), jsxs(Flex, { className: "tokeninfoname tokentext", children: [tokenName, vestEnds && (jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400, opacity: 0.6, lineHeight: '14px' }, children: vestEnds }))] }), jsx$2(Flex, { sx: { minWidth: '25px', p: '5px' }, children: jsx$2(AddFavToken, { tokenSymbol: tokenName, hotBond: isHotBond }) })] }), jsx$2(Flex, { sx: {
@@ -41485,21 +41485,35 @@ const UserBillTooltipText = {
41485
41485
  Claimable: 'This is the amount of tokens that have vested and are available to claim.',
41486
41486
  };
41487
41487
 
41488
+ // export const getBillNftData = async (billNftId: string, billNftAddress: string, chainId: number) => {
41489
+ // try {
41490
+ // const response = await axios.get(`${apiV2BaseUrl}/bills/single/${chainId}/${billNftAddress}/${billNftId}`)
41491
+ // const billNftDataResp = await response.data
41492
+ // if (billNftDataResp.statusCode === 500) {
41493
+ // return null
41494
+ // }
41495
+ // return billNftDataResp
41496
+ // } catch (e) {
41497
+ // console.error(e)
41498
+ // return null
41499
+ // }
41500
+ // }
41488
41501
  /**
41489
41502
  * Retrieves batch data for a list of bill NFT IDs from the API.
41503
+ * @param apiV2URL - prod or staging url to get NFT data from.
41490
41504
  * @param billNftIds - An array of bill NFT IDs to retrieve data for.
41491
41505
  * @param billNftAddress - The address of the bill NFT contract.
41492
41506
  * @param chainId - The ID of the blockchain network to retrieve data from.
41493
41507
  * @returns A Promise that resolves to the batch data for the specified bill NFT IDs, or null if an error occurs.
41494
41508
  */
41495
- const getBillNftBatchData = (billNftIds, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
41509
+ const getBillNftBatchData = (apiV2URL, billNftIds, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
41496
41510
  try {
41497
41511
  // If no bill NFT IDs are provided, return null
41498
41512
  if (!billNftIds || billNftIds.length === 0) {
41499
41513
  return null;
41500
41514
  }
41501
41515
  // Make a GET request to the API to retrieve the batch data for the specified bill NFT IDs
41502
- const response = yield axios.get(`${apiV2BaseUrl}/bills/batch/${chainId}/${billNftAddress}/?billIds[]=${billNftIds.join('&billIds[]=')}`);
41516
+ const response = yield axios.get(`${apiV2URL}/bills/batch/${chainId}/${billNftAddress}/?billIds[]=${billNftIds.join('&billIds[]=')}`);
41503
41517
  // If the response status code is 500, return null
41504
41518
  const billNftDataResp = yield response.data;
41505
41519
  if (billNftDataResp.statusCode === 500) {
@@ -41515,18 +41529,49 @@ const getBillNftBatchData = (billNftIds, billNftAddress, chainId) => __awaiter$9
41515
41529
  }
41516
41530
  });
41517
41531
 
41532
+ const useSDKConfig = (config) => {
41533
+ const { data } = useQuery({
41534
+ queryKey: [QUERY_KEYS.SDK_CONFIG],
41535
+ initialData: config === null || config === void 0 ? void 0 : config.config,
41536
+ });
41537
+ return data;
41538
+ };
41539
+ const useURLByEnvironment = (key) => {
41540
+ const config = useSDKConfig();
41541
+ const { environment } = config !== null && config !== void 0 ? config : {};
41542
+ return getURLByEnvironment(key, environment);
41543
+ };
41544
+ const URLS = {
41545
+ ['apiV2']: {
41546
+ ['main']: 'https://api.ape.bond',
41547
+ ['staging']: 'https://staging-api.ape.bond',
41548
+ },
41549
+ ['realTimeApi']: {
41550
+ ['main']: 'https://realtime-api.ape.bond/bonds',
41551
+ ['staging']: 'https://realtime-api-staging.ape.bond/bonds',
41552
+ },
41553
+ ['apeswap-lists']: {
41554
+ ['main']: 'https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/main',
41555
+ ['staging']: 'https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging',
41556
+ },
41557
+ };
41558
+ const getURLByEnvironment = (key, environment = 'main') => {
41559
+ return URLS[key][environment];
41560
+ };
41561
+
41518
41562
  function useBondNFTData(id, billNftAddress, chainId) {
41563
+ const apiV2URL = useURLByEnvironment('apiV2');
41519
41564
  return useQuery({
41520
41565
  queryKey: [QUERY_KEYS.BOND_NFT_DATA, id, billNftAddress, chainId],
41521
- queryFn: () => getBondNFTData(id, billNftAddress, chainId),
41566
+ queryFn: () => getBondNFTData(apiV2URL, id, billNftAddress, chainId),
41522
41567
  refetchOnWindowFocus: false,
41523
41568
  enabled: !!id && !!billNftAddress && !!chainId,
41524
41569
  });
41525
41570
  }
41526
- const getBondNFTData = (id, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
41571
+ const getBondNFTData = (apiV2URL, id, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
41527
41572
  try {
41528
41573
  // console.log('Bond NFT Data: Started')
41529
- const billNFTData = yield getBillNftBatchData([id], billNftAddress, chainId);
41574
+ const billNFTData = yield getBillNftBatchData(apiV2URL, [id], billNftAddress, chainId);
41530
41575
  // console.log('Bond NFT Data: Finished')
41531
41576
  return billNFTData[0];
41532
41577
  }
@@ -42862,14 +42907,15 @@ const TransferModal = ({ onDismiss, userBill }) => {
42862
42907
  };
42863
42908
  var TransferBondModal = React__default.memo(TransferModal);
42864
42909
 
42865
- const getBondRecommendations = (user, contract, limit) => __awaiter$9(void 0, void 0, void 0, function* () {
42866
- const { data } = yield axios.get(`${apiV2BaseUrl}/recommendations/bonds?user=${user}&contract=${contract}&limit=${limit}`);
42910
+ const getBondRecommendations = (apiV2URL, user, contract, limit) => __awaiter$9(void 0, void 0, void 0, function* () {
42911
+ const { data } = yield axios.get(`${apiV2URL}/recommendations/bonds?user=${user}&contract=${contract}&limit=${limit}`);
42867
42912
  return data === null || data === void 0 ? void 0 : data.bonds;
42868
42913
  });
42869
42914
  function useGetBondRecommendations(user, contract, limit = '3') {
42915
+ const apiV2URL = useURLByEnvironment('apiV2');
42870
42916
  return useQuery({
42871
42917
  queryKey: [`${QUERY_KEYS.BOND_RECOMMENDATIONS}-${contract}-${limit}`],
42872
- queryFn: () => getBondRecommendations(user, contract, limit),
42918
+ queryFn: () => getBondRecommendations(apiV2URL, user, contract, limit),
42873
42919
  staleTime: Infinity,
42874
42920
  refetchOnWindowFocus: false,
42875
42921
  refetchOnMount: false,
@@ -70416,18 +70462,18 @@ var PRICE_GETTER_ABI = [
70416
70462
 
70417
70463
  const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
70418
70464
  function useTokenPrices() {
70465
+ const apeswapListsURL = useURLByEnvironment('apeswap-lists');
70419
70466
  return useQuery({
70420
70467
  queryKey: [QUERY_KEYS.TOKEN_PRICES],
70421
- queryFn: getTokenPrices,
70468
+ queryFn: () => getTokenPrices(apeswapListsURL),
70422
70469
  refetchInterval: 60000, // 60 sec
70423
70470
  refetchOnMount: false,
70424
70471
  refetchOnWindowFocus: false,
70425
70472
  });
70426
70473
  }
70427
- const getTokenPrices = () => __awaiter$9(void 0, void 0, void 0, function* () {
70474
+ const getTokenPrices = (apeswapListsURL) => __awaiter$9(void 0, void 0, void 0, function* () {
70428
70475
  try {
70429
- // console.log('Token Prices: Started')
70430
- const response = yield axios.get('https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging/config/tokens.json');
70476
+ const response = yield axios.get(`${apeswapListsURL}/config/tokens.json`);
70431
70477
  const tokenList = response.data;
70432
70478
  const prices = [];
70433
70479
  for (let index = 0; index < MAINNET_CHAINS.length; index++) {
@@ -70438,7 +70484,6 @@ const getTokenPrices = () => __awaiter$9(void 0, void 0, void 0, function* () {
70438
70484
  // Keep only successfully fulfilled promises and discard the rest
70439
70485
  const successfulPromises = all === null || all === void 0 ? void 0 : all.filter((result) => result.status === 'fulfilled');
70440
70486
  const successfulPrices = successfulPromises.map((result) => result.value);
70441
- // console.log('Token Prices: Finished')
70442
70487
  return successfulPrices.flat();
70443
70488
  }
70444
70489
  catch (_a) {
@@ -71002,17 +71047,17 @@ const UserBondRow = ({ bill }) => {
71002
71047
  };
71003
71048
 
71004
71049
  function useBondsList() {
71050
+ const apeswapListsURL = useURLByEnvironment('apeswap-lists');
71005
71051
  return useQuery({
71006
71052
  queryKey: [QUERY_KEYS.BONDS_LIST],
71007
- queryFn: getBondsList,
71053
+ queryFn: () => getBondsList(apeswapListsURL),
71008
71054
  staleTime: Infinity,
71009
71055
  refetchOnWindowFocus: false,
71010
71056
  });
71011
71057
  }
71012
- const getBondsList = () => __awaiter$9(void 0, void 0, void 0, function* () {
71058
+ const getBondsList = (apeswapListsURL) => __awaiter$9(void 0, void 0, void 0, function* () {
71013
71059
  try {
71014
- // console.log('Bond List: Fetching')
71015
- const response = yield axios.get('https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging/config/bills.json');
71060
+ const response = yield axios.get(`${apeswapListsURL}/config/bills.json`);
71016
71061
  return response.data;
71017
71062
  }
71018
71063
  catch (_a) {
@@ -71141,14 +71186,6 @@ const getUserBonds = (account, bondList) => __awaiter$9(void 0, void 0, void 0,
71141
71186
  }
71142
71187
  });
71143
71188
 
71144
- const useSDKConfig = (config) => {
71145
- const { data } = useQuery({
71146
- queryKey: [QUERY_KEYS.SDK_CONFIG],
71147
- initialData: config === null || config === void 0 ? void 0 : config.config,
71148
- });
71149
- return data;
71150
- };
71151
-
71152
71189
  const RainbowKitButton = () => {
71153
71190
  return (jsx$2(ConnectButton$1.Custom, { children: ({ openConnectModal }) => {
71154
71191
  return (jsx$2(Button, { fullWidth: true, onClick: openConnectModal, sx: { height: '45px', padding: '10px 10px', alignItems: 'center', width: '100%' }, children: "Connect!!!!" }));
@@ -71308,7 +71345,7 @@ const BondFilters = ({ setChainFilterOption, chainFilterOption, filterOptions, f
71308
71345
  value: filter,
71309
71346
  };
71310
71347
  });
71311
- const asPath = window.location.pathname + window.location.search;
71348
+ const asPath = typeof window !== 'undefined' ? window.location.pathname + window.location.search : '';
71312
71349
  const handleFilterSelection = useCallback((newOption) => {
71313
71350
  setChainFilterOption(['All Chains']);
71314
71351
  setFilterOption(newOption);
@@ -71472,18 +71509,19 @@ const useTopTags = (initialBondList) => {
71472
71509
  };
71473
71510
 
71474
71511
  function useBondsData() {
71512
+ const realTimeApiURL = useURLByEnvironment('realTimeApi');
71475
71513
  return useQuery({
71476
71514
  queryKey: [QUERY_KEYS.BONDS_DATA],
71477
- queryFn: getBondsData,
71515
+ queryFn: () => getBondsData(realTimeApiURL),
71478
71516
  refetchInterval: 30000, // i.e. 30 sec
71479
71517
  refetchOnWindowFocus: false,
71480
71518
  retry: 1,
71481
71519
  initialData: [],
71482
71520
  });
71483
71521
  }
71484
- const getBondsData = () => __awaiter$9(void 0, void 0, void 0, function* () {
71522
+ const getBondsData = (realTimeApiURL) => __awaiter$9(void 0, void 0, void 0, function* () {
71485
71523
  try {
71486
- const response = yield axios.get('https://realtime-api.ape.bond/bonds');
71524
+ const response = yield axios.get(realTimeApiURL);
71487
71525
  return response.data.bonds;
71488
71526
  }
71489
71527
  catch (_a) {
@@ -72191,7 +72229,7 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
72191
72229
  const fetchZapDetails = () => __awaiter$9(void 0, void 0, void 0, function* () {
72192
72230
  var _a, _b, _c;
72193
72231
  console.log('Making SoulZap Token Call');
72194
- const response = yield axios.post('https://soulsolidity-zap-api-902f1d839e8d.herokuapp.com/zap?batch=1', {
72232
+ const response = yield axios.post(SOUL_ZAP_API, {
72195
72233
  '0': zapInputData,
72196
72234
  });
72197
72235
  return (_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.data;
@@ -72728,7 +72766,7 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
72728
72766
  const fetchZapDetails = () => __awaiter$9(void 0, void 0, void 0, function* () {
72729
72767
  var _a, _b, _c, _d, _e, _f;
72730
72768
  console.log('Making Bond Zap call');
72731
- const response = yield axios.post('https://soulsolidity-zap-api-902f1d839e8d.herokuapp.com/zap?batch=1', {
72769
+ const response = yield axios.post(SOUL_ZAP_API, {
72732
72770
  '0': zapInputData,
72733
72771
  });
72734
72772
  console.log((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.data);
@@ -72770,6 +72808,7 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
72770
72808
 
72771
72809
  const useSendReferenceId = () => {
72772
72810
  const config = useSDKConfig();
72811
+ const apiV2URL = useURLByEnvironment('apiV2');
72773
72812
  return useCallback((billContract, chainId, hash) => __awaiter$9(void 0, void 0, void 0, function* () {
72774
72813
  const data = {
72775
72814
  chainId,
@@ -72777,9 +72816,9 @@ const useSendReferenceId = () => {
72777
72816
  referenceId: config === null || config === void 0 ? void 0 : config.referenceId,
72778
72817
  billContract,
72779
72818
  };
72780
- const response = yield axios.post(`https://api-v2.apeswap.finance/bills/widget`, data);
72819
+ const response = yield axios.post(`${apiV2URL}/bills/widget`, data);
72781
72820
  console.log(response);
72782
- }), [config === null || config === void 0 ? void 0 : config.referenceId]);
72821
+ }), [config === null || config === void 0 ? void 0 : config.referenceId, apiV2URL]);
72783
72822
  };
72784
72823
 
72785
72824
  const BondModalHeader = ({ bondData, onDismiss }) => {
@@ -72962,7 +73001,7 @@ accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = f
72962
73001
  window.open(`https://ape.bond/swap?outputcurrency=${bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.address[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]}&outputChain=${bondData === null || bondData === void 0 ? void 0 : bondData.chainId}`, '_blank');
72963
73002
  }
72964
73003
  };
72965
- return (jsx$2(Modal, { className: "modal", children: modalVariant === 'standard' ? (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content", children: [window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white', fontSize: '14px', mb: '10px' }, children: ["Dev mode - Current view: \"standard\"", jsx$2(Text, { onClick: () => setModalVariant('alt'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(BondCards, { bondData: bondData }), jsx$2(Estimations, { bondData: bondData, inputValue: inputValue, inputToken: inputToken, estimatedOutput: estimatedOutput, inputTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { className: "modaltable-container button-container", children: [jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => (supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? onOpenZapModal() : openExternal()), variant: "secondary", children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) }), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
73004
+ return (jsx$2(Modal, { className: "modal", children: modalVariant === 'standard' ? (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white', fontSize: '14px', mb: '10px' }, children: ["Dev mode - Current view: \"standard\"", jsx$2(Text, { onClick: () => setModalVariant('alt'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(BondCards, { bondData: bondData }), jsx$2(Estimations, { bondData: bondData, inputValue: inputValue, inputToken: inputToken, estimatedOutput: estimatedOutput, inputTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { className: "modaltable-container button-container", children: [jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => (supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? onOpenZapModal() : openExternal()), variant: "secondary", children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) }), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
72966
73005
  event.stopPropagation();
72967
73006
  switchChain({ chainId: bondData.chainId });
72968
73007
  }, style: { fontSize: '14px', padding: '6px', marginLeft: '0px' }, children: `Switch to ${NETWORK_LABEL[bondData.chainId]}` })) : approvalState === ApprovalState.APPROVED ? (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
@@ -72975,7 +73014,7 @@ accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = f
72975
73014
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
72976
73015
  !account ||
72977
73016
  !inputValue ||
72978
- parseFloat(inputValue) === 0, onClick: approveCallback, children: ["approve ", isZap ? 'zap' : 'normal'] })) })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] })] })) })) : (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content font-small gpt", children: [window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev Mode - Current view: \"alt\"", jsx$2(Text, { onClick: () => setModalVariant('standard'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), jsx$2(Flex, { className: "modal-header" }), jsxs(Flex, { className: "modaltable-container", sx: { flexDirection: 'row', gap: '20px' }, children: [jsxs(Flex, { sx: { width: '500px', flexDirection: 'column' }, children: [jsx$2("img", { src: "https://placehold.co/400x200" }), jsx$2(Flex, { className: "modaltable-container description-container paragraph-spaced", sx: { marginTop: '20px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription })] }), jsxs(Flex, { sx: { flexDirection: 'column', width: '600px' }, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: { minWidth: '300px' }, children: jsxs("h2", { sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' ', jsx$2(Svg, { width: 20, height: 20, icon: (_k = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bondData.chainId]) !== null && _k !== void 0 ? _k : 'question' })] }) }), jsxs(Flex, { sx: { justifyContent: 'space-between', flexGrow: 1 }, children: [jsx$2(TokenImage, { symbol: (_l = bondData.showcaseTokenName) !== null && _l !== void 0 ? _l : bondData.earnToken.symbol, size: 20 }), jsx$2("span", { children: bondData.earnToken.symbol }), " ", jsx$2("span", { children: "|" }), ' ', jsxs("span", { children: ["Market Price: $", earnTokenPrice(bondData)] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', marginTop: '20px' }, children: [jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { sx: { justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { children: ["You will receive:", jsx$2(Flex, { sx: { marginLeft: '15px', marginRight: '5px' }, children: jsx$2(TokenImage, { symbol: (_m = bondData.showcaseTokenName) !== null && _m !== void 0 ? _m : bondData.earnToken.symbol, size: 20 }) }), (lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), ' ', bondData.earnToken.symbol, " + \u00A0", (youGet(bondData, inputValue) -
73017
+ parseFloat(inputValue) === 0, onClick: approveCallback, children: ["approve ", isZap ? 'zap' : 'normal'] })) })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] })] })) })) : (jsx$2(Fragment$1, { children: bondData && (jsxs(Flex, { className: "modal-content font-small gpt", children: [typeof window !== 'undefined' && window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev Mode - Current view: \"alt\"", jsx$2(Text, { onClick: () => setModalVariant('standard'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), jsx$2(Flex, { className: "modal-header" }), jsxs(Flex, { className: "modaltable-container", sx: { flexDirection: 'row', gap: '20px' }, children: [jsxs(Flex, { sx: { width: '500px', flexDirection: 'column' }, children: [jsx$2("img", { src: "https://placehold.co/400x200" }), jsx$2(Flex, { className: "modaltable-container description-container paragraph-spaced", sx: { marginTop: '20px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription })] }), jsxs(Flex, { sx: { flexDirection: 'column', width: '600px' }, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: { minWidth: '300px' }, children: jsxs("h2", { sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' ', jsx$2(Svg, { width: 20, height: 20, icon: (_k = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bondData.chainId]) !== null && _k !== void 0 ? _k : 'question' })] }) }), jsxs(Flex, { sx: { justifyContent: 'space-between', flexGrow: 1 }, children: [jsx$2(TokenImage, { symbol: (_l = bondData.showcaseTokenName) !== null && _l !== void 0 ? _l : bondData.earnToken.symbol, size: 20 }), jsx$2("span", { children: bondData.earnToken.symbol }), " ", jsx$2("span", { children: "|" }), ' ', jsxs("span", { children: ["Market Price: $", earnTokenPrice(bondData)] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', marginTop: '20px' }, children: [jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { sx: { justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { children: ["You will receive:", jsx$2(Flex, { sx: { marginLeft: '15px', marginRight: '5px' }, children: jsx$2(TokenImage, { symbol: (_m = bondData.showcaseTokenName) !== null && _m !== void 0 ? _m : bondData.earnToken.symbol, size: 20 }) }), (lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), ' ', bondData.earnToken.symbol, " + \u00A0", (youGet(bondData, inputValue) -
72979
73018
  lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), jsx$2("span", { className: "text-highlight", children: "\u00A0additional" })] }), jsx$2(Flex, { className: "button-container buy", sx: { justifyContent: 'end' }, children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button button-narrow", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
72980
73019
  event.stopPropagation();
72981
73020
  switchChain({ chainId: bondData.chainId });
@@ -73202,7 +73241,7 @@ function useHotBonds() {
73202
73241
  }
73203
73242
  const getHotBondsContracts = () => __awaiter$9(void 0, void 0, void 0, function* () {
73204
73243
  try {
73205
- const response = yield axios.get('https://apeswap-strapi.herokuapp.com/hot-bonds');
73244
+ const response = yield axios.get(`${STRAPI_URL}/hot-bonds`);
73206
73245
  return response.data.map((bond) => bond.BondAddress.toLowerCase());
73207
73246
  }
73208
73247
  catch (_a) {
@@ -2,4 +2,4 @@ import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { ChainId } from '@ape.swap/apeswap-lists';
3
3
  import { UserBillNftData } from '../../types/yourbonds';
4
4
  export default function useBondNFTData(id?: string, billNftAddress?: string, chainId?: ChainId): UseQueryResult<UserBillNftData>;
5
- export declare const getBondNFTData: (id: string, billNftAddress: string, chainId: ChainId) => Promise<UserBillNftData | undefined>;
5
+ export declare const getBondNFTData: (apiV2URL: string, id: string, billNftAddress: string, chainId: ChainId) => Promise<UserBillNftData | undefined>;
@@ -1,4 +1,4 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { BondsData } from '../../types/bonds';
3
3
  export default function useBondsData(): UseQueryResult<BondsData[]>;
4
- export declare const getBondsData: () => Promise<BondsData[]>;
4
+ export declare const getBondsData: (realTimeApiURL: string) => Promise<BondsData[]>;
@@ -1,4 +1,4 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
2
  import { BillsConfig } from '@ape.swap/apeswap-lists';
3
3
  export default function useBondsList(): UseQueryResult<BillsConfig[]>;
4
- export declare const getBondsList: () => Promise<BillsConfig[][]>;
4
+ export declare const getBondsList: (apeswapListsURL: string) => Promise<BillsConfig[][]>;
@@ -23,5 +23,5 @@ export interface BondRecommendation {
23
23
  tags: string[];
24
24
  arr: number;
25
25
  }
26
- export declare const getBondRecommendations: (user?: string, contract?: string, limit?: string) => Promise<BondRecommendation[]>;
26
+ export declare const getBondRecommendations: (apiV2URL: string, user?: string, contract?: string, limit?: string) => Promise<BondRecommendation[]>;
27
27
  export default function useGetBondRecommendations(user?: string, contract?: string, limit?: string): import("@tanstack/react-query").UseQueryResult<BondRecommendation[], Error>;
@@ -9,7 +9,7 @@ export interface TokenPrices {
9
9
  chainId: ChainId | undefined;
10
10
  }
11
11
  export default function useTokenPrices(): UseQueryResult<TokenPrices[]>;
12
- export declare const getTokenPrices: () => Promise<TokenPrices[]>;
12
+ export declare const getTokenPrices: (apeswapListsURL: string) => Promise<TokenPrices[]>;
13
13
  export declare const getBatchTokenPriceWithDexscreener: (params: {
14
14
  chainId: ChainId;
15
15
  tokens: {
@@ -1,12 +1,16 @@
1
1
  export interface SDKProps {
2
2
  config: {
3
- useRainbowKit: boolean;
4
3
  referenceId: string;
4
+ environment: 'main' | 'staging';
5
+ useRainbowKit: boolean;
5
6
  modalVariant: 'alt' | 'standard';
6
7
  };
7
8
  }
8
9
  export declare const useSDKConfig: (config?: SDKProps) => {
9
- useRainbowKit: boolean;
10
10
  referenceId: string;
11
+ environment: "main" | "staging";
12
+ useRainbowKit: boolean;
11
13
  modalVariant: "alt" | "standard";
12
14
  } | undefined;
15
+ export type URLKeys = 'apiV2' | 'realTimeApi' | 'apeswap-lists';
16
+ export declare const useURLByEnvironment: (key: URLKeys) => string;
@@ -1,16 +1 @@
1
- import { Contract } from '@ethersproject/contracts';
2
- import type { JsonRpcProvider } from '@ethersproject/providers';
3
- import { ChainId } from '@ape.swap/apeswap-lists';
4
1
  export declare function isAddress(value: any): string | false;
5
- export declare function getContract(address: string, ABI: any, provider: JsonRpcProvider, account?: string): Contract;
6
- export declare function isSupportedChain(chainId: number | null | undefined): chainId is ChainId;
7
- export declare function getEtherscanLink(data: string | number, type: 'transaction' | 'token' | 'address' | 'block' | 'countdown', chainId: ChainId): string;
8
- /**
9
- * Prompt the user to add a custom token to metamask
10
- * @param tokenAddress
11
- * @param tokenSymbol
12
- * @param tokenDecimals
13
- * @param tokenImage
14
- * @returns {boolean} true if the token has been added, false otherwise
15
- */
16
- export declare const registerToken: (tokenAddress: string, tokenSymbol: string | undefined, tokenDecimals: number, tokenImage: string | undefined) => Promise<any>;
@@ -1,16 +1,4 @@
1
1
  import { UserBill, UserOwnedBillsData } from '../../types/yourbonds';
2
2
  import { BillsConfig, ChainId } from '@ape.swap/apeswap-lists';
3
- /**
4
- * Fetches user-owned bill NFT data for a given set of owned bills data, chain ID, and bills.
5
- * @param ownedBillsData An array of objects containing the ID, bill NFT address, and contract address of the owned bills.
6
- * @param chainId The ID of the blockchain network.
7
- * @param bills An array of objects containing the contract address and user-owned bill NFT data.
8
- * @returns An array of objects containing the ID and data of the user-owned bill NFTs.
9
- */
10
- export declare const fetchUserOwnedBillNftData: (ownedBillsData: {
11
- id: string;
12
- billNftAddress: string;
13
- contractAddress: string;
14
- }[], chainId: ChainId, bills: BillsConfig[]) => Promise<any[]>;
15
3
  export declare const fetchUserOwnedBillsDataAsync: (chainId: ChainId, account: string, bondData: BillsConfig[]) => Promise<UserOwnedBillsData[]>;
16
4
  export declare const fetchUserOwnedBills: (chainId: ChainId, account: string, bonds: BillsConfig[]) => Promise<UserBill[]>;
@@ -1,9 +1,9 @@
1
- export declare const getBillNftData: (billNftId: string, billNftAddress: string, chainId: number) => Promise<any>;
2
1
  /**
3
2
  * Retrieves batch data for a list of bill NFT IDs from the API.
3
+ * @param apiV2URL - prod or staging url to get NFT data from.
4
4
  * @param billNftIds - An array of bill NFT IDs to retrieve data for.
5
5
  * @param billNftAddress - The address of the bill NFT contract.
6
6
  * @param chainId - The ID of the blockchain network to retrieve data from.
7
7
  * @returns A Promise that resolves to the batch data for the specified bill NFT IDs, or null if an error occurs.
8
8
  */
9
- export declare const getBillNftBatchData: (billNftIds: string[], billNftAddress: string, chainId: number) => Promise<any>;
9
+ export declare const getBillNftBatchData: (apiV2URL: string, billNftIds: string[], billNftAddress: string, chainId: number) => Promise<any>;
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": "1.1.0-test.88",
6
+ "version": "1.1.0-test.91",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",