@ape.swap/bonds-sdk 3.0.52 → 3.0.54

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
@@ -18812,7 +18812,7 @@ const supportedByLIFI = [
18812
18812
  types.ChainId.MAINNET,
18813
18813
  types.ChainId.MATIC,
18814
18814
  types.ChainId.BSC,
18815
- types.ChainId.ARBITRUM,
18815
+ // ChainId.ARBITRUM,
18816
18816
  types.ChainId.LINEA,
18817
18817
  types.ChainId.BASE,
18818
18818
  types.ChainId.AVAX,
@@ -18983,16 +18983,25 @@ const AddFavToken = ({ tokenSymbol, hotBond, isGoldBond, }) => {
18983
18983
  }, children: jsx$2(AnimatePresence, { mode: "wait", children: jsx$2(motion.div, { initial: false, animate: { opacity: 1, scale: 1.0 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2 }, style: { display: 'flex' }, children: isFavToken ? (jsx$2(Svg, { icon: "StarFilled", width: 22, height: 22, color: isGoldBond ? '#ffffff' : '#DE62F3' })) : (jsx$2(Svg, { icon: hotBond ? 'FirePink' : 'Star', width: hotBond ? 25 : 20, height: hotBond ? 25 : 20, color: isGoldBond ? '#ffffff' : '#73728E' })) }, isFavToken ? 'StarFilled' : 'Star') }) }));
18984
18984
  };
18985
18985
 
18986
+ // Prod URLS. Do not make changes here
18986
18987
  const defaultUrls = {
18987
18988
  apiV2: 'https://api.ape.bond',
18988
18989
  realTimeApi: 'https://realtime-api.ape.bond',
18989
18990
  apeswapLists: 'https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/refs/heads/main',
18990
18991
  mainUrl: 'https://ape.bond',
18991
18992
  };
18993
+ // Staging URLS.
18994
+ const stagingUrls = {
18995
+ apiV2: 'https://staging-api.ape.bond',
18996
+ realTimeApi: 'https://realtime-api-staging.ape.bond',
18997
+ apeswapLists: 'https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/refs/heads/staging',
18998
+ mainUrl: 'https://staging.ape.bond',
18999
+ };
18992
19000
  const useSDKConfig = (config) => {
19001
+ const urls = process.env.NODE_ENV === 'production' ? defaultUrls : stagingUrls;
18993
19002
  const { data } = useQuery({
18994
19003
  queryKey: [QUERY_KEYS.SDK_CONFIG],
18995
- initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false }, config), { urls: Object.assign(Object.assign({}, defaultUrls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.1' }),
19004
+ initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.1' }),
18996
19005
  });
18997
19006
  return data;
18998
19007
  };
@@ -19002,10 +19011,10 @@ const useURLByEnvironment = (key) => {
19002
19011
  };
19003
19012
 
19004
19013
  /*
19005
- * bignumber.js v9.1.2
19014
+ * bignumber.js v9.3.0
19006
19015
  * A JavaScript library for arbitrary-precision arithmetic.
19007
19016
  * https://github.com/MikeMcl/bignumber.js
19008
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
19017
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
19009
19018
  * MIT Licensed.
19010
19019
  *
19011
19020
  * BigNumber.prototype methods | BigNumber methods
@@ -19906,7 +19915,7 @@ function clone$2(configObject) {
19906
19915
 
19907
19916
  // xc now represents str converted to baseOut.
19908
19917
 
19909
- // THe index of the rounding digit.
19918
+ // The index of the rounding digit.
19910
19919
  d = e + dp + 1;
19911
19920
 
19912
19921
  // The rounding digit: the digit to the right of the digit that may be rounded up.
@@ -24147,6 +24156,7 @@ bn$1.exports;
24147
24156
  this.words[i] = carry;
24148
24157
  this.length++;
24149
24158
  }
24159
+ this.length = num === 0 ? 1 : this.length;
24150
24160
 
24151
24161
  return isNegNum ? this.ineg() : this;
24152
24162
  };
@@ -68773,7 +68783,7 @@ const zapInputTokens = {
68773
68783
  {
68774
68784
  symbol: 'USDC',
68775
68785
  address: {
68776
- [types.ChainId.ARBITRUM]: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8',
68786
+ [types.ChainId.ARBITRUM]: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // Circle's USDC, not USDC.e
68777
68787
  },
68778
68788
  decimals: {
68779
68789
  [types.ChainId.ARBITRUM]: 6,
@@ -69019,7 +69029,7 @@ const zapInputTokens = {
69019
69029
  },
69020
69030
  active: true,
69021
69031
  },
69022
- ]
69032
+ ],
69023
69033
  };
69024
69034
 
69025
69035
  var PRICE_GETTER_V3_ABI = [
@@ -72018,7 +72028,7 @@ const YourBonds = ({ showOnly }) => {
72018
72028
  const handleFilterOption = useCallback((newOption) => {
72019
72029
  setFilterOption(newOption);
72020
72030
  }, []);
72021
- 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 ? (bondsToRender === null || bondsToRender === void 0 ? void 0 : bondsToRender.map((bill) => jsx$2(UserBondRow, { bill: bill }, bill.id))) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters.' })) : userBondsFetched && (userBonds === null || userBonds === void 0 ? void 0 : userBonds.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 }) }))] }));
72031
+ 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 ? (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 && (userBonds === null || userBonds === void 0 ? void 0 : userBonds.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 }) }))] }));
72022
72032
  };
72023
72033
 
72024
72034
  // This basically returns the 2 tags with the higher active bond count
@@ -75013,7 +75023,7 @@ const TokenSelectorModal = ({ bondPrincipalToken, bondEarnToken, handleCurrencyS
75013
75023
  height: '300px',
75014
75024
  overflowY: 'auto',
75015
75025
  }, children: uniqueTokensList.map((token, i) => {
75016
- return jsx$2(TokenRow, { token: token, chainId: chainId, handleTokenSelect: handleTokenSelect }, i);
75026
+ return (jsx$2(TokenRow, { token: token, chainId: chainId, handleTokenSelect: handleTokenSelect }, token === 'NATIVE' ? 'NATIVE' : token.address[chainId]));
75017
75027
  }) })] }) }) }));
75018
75028
  };
75019
75029
 
@@ -76046,7 +76056,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
76046
76056
  return [approvalState !== null && approvalState !== void 0 ? approvalState : ApprovalState.NOT_APPROVED, handleApprove];
76047
76057
  };
76048
76058
 
76049
- const version$1 = '2.23.6';
76059
+ const version$1 = '2.29.1';
76050
76060
 
76051
76061
  let errorConfig = {
76052
76062
  getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
@@ -94154,11 +94164,11 @@ const styles = {
94154
94164
  };
94155
94165
 
94156
94166
  const PriceChart = ({ selectedBond, historicalPrices, }) => {
94157
- var _a, _b, _c, _d, _e;
94167
+ var _a, _b, _c, _d;
94158
94168
  const earnTokenPrice = parseFloat((_a = selectedBond === null || selectedBond === void 0 ? void 0 : selectedBond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
94159
94169
  const trueBondPrice = findHighestTrueBondPrice(TIERS_WEIGHT[types.LaunchBondTiers.Legend], selectedBond);
94160
- const bondPrice = getFirstNonZeroDigits(earnTokenPrice - earnTokenPrice * (((_b = trueBondPrice.bonus) !== null && _b !== void 0 ? _b : 0) / 100));
94161
- const hasDiscount = ((_c = trueBondPrice.bonus) !== null && _c !== void 0 ? _c : 0) > 0;
94170
+ const bondPrice = discountEarnTokenPrice(selectedBond, true);
94171
+ const hasDiscount = ((_b = trueBondPrice.bonus) !== null && _b !== void 0 ? _b : 0) > 0;
94162
94172
  const [show, setShow] = useState(false);
94163
94173
  const [chartOption, setChartOption] = useState('line');
94164
94174
  useEffect(() => {
@@ -94173,7 +94183,7 @@ const PriceChart = ({ selectedBond, historicalPrices, }) => {
94173
94183
  }, 50);
94174
94184
  return () => clearTimeout(timer);
94175
94185
  }, [selectedBond.billAddress]);
94176
- return (jsxs(Flex, { sx: styles.priceContainer, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mb: '15px', pr: '20px' }, children: [jsx$2(Flex, { children: "Prices" }), jsxs(Flex, { children: [jsxs(Flex, { sx: { color: hasDiscount ? 'success' : 'error', fontSize: '12px', fontWeight: 500, mr: '15px' }, children: ["Bond Price: $", bondPrice] }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 500 }, children: ["Market Price: $", getFirstNonZeroDigits(earnTokenPrice !== null && earnTokenPrice !== void 0 ? earnTokenPrice : 0)] })] })] }), show && (jsxs(Flex, { sx: styles.container, children: [jsxs(Flex, { sx: styles.buttonsContainer, children: [jsx$2(Flex, { sx: Object.assign(Object.assign({}, styles.button), { mr: '15px' }), onClick: () => setChartOption('line'), children: jsx$2(Svg, { icon: "lineChart", width: 20 }) }), jsx$2(Flex, { sx: styles.button, onClick: () => setChartOption('candleStick'), children: "D" })] }), historicalPrices && historicalPrices.length > 0 ? (chartOption === 'line' ? (jsx$2(LineChart, { historicalPrices: historicalPrices, hasDiscount: hasDiscount, bondPrice: bondPrice, tokenPrice: (_d = selectedBond.payoutTokenPrice) !== null && _d !== void 0 ? _d : '0' })) : (jsx$2(CandleStickChart, { historicalPrices: historicalPrices, hasDiscount: hasDiscount, bondPrice: bondPrice, tokenPrice: (_e = selectedBond.payoutTokenPrice) !== null && _e !== void 0 ? _e : '0' }))) : (jsxs(Flex, { sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%' }, children: [jsx$2(Svg, { icon: "placeholderMonkey" }), jsx$2(Flex, { sx: { mt: '15px' }, children: "No Historical Price for this Token" })] }))] }))] }));
94186
+ return (jsxs(Flex, { sx: styles.priceContainer, children: [jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mb: '15px', pr: '20px' }, children: [jsx$2(Flex, { children: "Prices" }), jsxs(Flex, { children: [jsxs(Flex, { sx: { color: hasDiscount ? 'success' : 'error', fontSize: '12px', fontWeight: 500, mr: '15px' }, children: ["Bond Price: $", bondPrice] }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 500 }, children: ["Market Price: $", getFirstNonZeroDigits(earnTokenPrice !== null && earnTokenPrice !== void 0 ? earnTokenPrice : 0)] })] })] }), show && (jsxs(Flex, { sx: styles.container, children: [jsxs(Flex, { sx: styles.buttonsContainer, children: [jsx$2(Flex, { sx: Object.assign(Object.assign({}, styles.button), { mr: '15px' }), onClick: () => setChartOption('line'), children: jsx$2(Svg, { icon: "lineChart", width: 20 }) }), jsx$2(Flex, { sx: styles.button, onClick: () => setChartOption('candleStick'), children: "D" })] }), historicalPrices && historicalPrices.length > 0 ? (chartOption === 'line' ? (jsx$2(LineChart, { historicalPrices: historicalPrices, hasDiscount: hasDiscount, bondPrice: bondPrice, tokenPrice: (_c = selectedBond.payoutTokenPrice) !== null && _c !== void 0 ? _c : '0' })) : (jsx$2(CandleStickChart, { historicalPrices: historicalPrices, hasDiscount: hasDiscount, bondPrice: bondPrice, tokenPrice: (_d = selectedBond.payoutTokenPrice) !== null && _d !== void 0 ? _d : '0' }))) : (jsxs(Flex, { sx: { flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%' }, children: [jsx$2(Svg, { icon: "placeholderMonkey" }), jsx$2(Flex, { sx: { mt: '15px' }, children: "No Historical Price for this Token" })] }))] }))] }));
94177
94187
  };
94178
94188
 
94179
94189
  const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
@@ -1,4 +1,3 @@
1
- import { BigNumber } from 'bignumber.js';
2
1
  import { UserBill } from '../types/yourbonds';
3
2
  import { BondsData } from '../types/bonds';
4
3
  import { BillsConfig } from '@ape.swap/apeswap-lists';
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.52",
6
+ "version": "3.0.54",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",