@ape.swap/bonds-sdk 3.0.75 → 3.0.77

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.
Files changed (2) hide show
  1. package/dist/main.js +14 -8
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -58486,8 +58486,7 @@ function useTierPoints() {
58486
58486
  return useQuery({
58487
58487
  queryKey: [QUERY_KEYS.TIERS, account],
58488
58488
  queryFn: () => fetchUserPoints(account, SDKConfig.useTiers, apiUrl),
58489
- staleTime: 60000,
58490
- refetchInterval: 30000, // i.e. 30 secs
58489
+ refetchInterval: 120000, // i.e. 2 mins
58491
58490
  refetchOnWindowFocus: false,
58492
58491
  });
58493
58492
  }
@@ -76622,7 +76621,6 @@ const fetchBills = (chainId, tokenPrices, bills) => __awaiter$9(void 0, void 0,
76622
76621
  });
76623
76622
  });
76624
76623
  const treasuryBalances = yield multicall(chainId, ERC_20_ABI, treasuryBalanceCalls);
76625
- console.log(vals);
76626
76624
  const updatedVals = vals.reduce((acc, val, index) => {
76627
76625
  acc.push(val);
76628
76626
  if ((index + 1) % 5 === 0) {
@@ -78019,7 +78017,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
78019
78017
  catch (error) {
78020
78018
  setConfirmingTxOnWallet(false);
78021
78019
  console.error('Approval failed:', error);
78022
- addToastError(error.message);
78020
+ addToastError((error === null || error === void 0 ? void 0 : error.shortMessage) || (error === null || error === void 0 ? void 0 : error.details) || (error === null || error === void 0 ? void 0 : error.message));
78023
78021
  reportError({
78024
78022
  apiUrl,
78025
78023
  error,
@@ -79068,7 +79066,7 @@ const LoadingSpinner = ({ isLoading, size }) => {
79068
79066
  return jsx$2(Flex, { sx: isLoading ? stylesLoading : styles });
79069
79067
  };
79070
79068
 
79071
- const stepDelay = 3000;
79069
+ const stepDelay = 1000;
79072
79070
  const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, bondData, inputToken, inputValue, depositAmount, buyTxHash, rateChanged, }) => {
79073
79071
  var _a, _b, _c, _d, _e;
79074
79072
  // Hooks
@@ -79121,8 +79119,8 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
79121
79119
  const hasTriggeredApproval = useRef(false);
79122
79120
  useEffect(() => {
79123
79121
  if (!hasToSwitchChain || !showSwitchChainFlow) {
79124
- setApproveLoading(true);
79125
79122
  if (approvalState === ApprovalState.APPROVED) {
79123
+ setApproveLoading(true);
79126
79124
  const delay = setTimeout(() => {
79127
79125
  setApproveLoading(false);
79128
79126
  setHasToApprove(false);
@@ -81221,6 +81219,13 @@ const Toast = ({ popIndex, popup }) => {
81221
81219
  }, 500);
81222
81220
  }, 10000);
81223
81221
  }, []);
81222
+ const showSupportLink = variant === 'error' && !url && !popup.description.includes('User rejected the request');
81223
+ const isSlippageError = popup.description.includes('INSUFFICIENT') ||
81224
+ popup.description.includes('Slippage') ||
81225
+ popup.description.includes('Return amount is not enough');
81226
+ const parsedErrorString = isSlippageError
81227
+ ? 'Slippage error. Try increasing Slippage in the cog icon ⚙️.'
81228
+ : popup.description;
81224
81229
  return (jsx$2(AnimatePresence, { children: show && (jsxs(motion.div, { initial: { right: '-300px' }, animate: { right: '10px' }, transition: { duration: 0.5 }, exit: { right: '-300px' }, sx: Object.assign(Object.assign({}, styles$5.alert), { top: 108 * popIndex, zIndex: 103 }), children: [jsx$2(Flex, { children: jsx$2(Svg, { icon: variant, color: variant, width: "30px" }) }), jsxs(Flex, { sx: styles$5.content, children: [jsx$2(Text, { sx: { color: variant, fontSize: '14px', fontWeight: 500 }, children: title }), description && (jsx$2(Text, { sx: {
81225
81230
  fontSize: '12px',
81226
81231
  fontWeight: 400,
@@ -81232,12 +81237,13 @@ const Toast = ({ popIndex, popup }) => {
81232
81237
  display: '-webkit-box',
81233
81238
  WebkitBoxOrient: 'vertical',
81234
81239
  WebkitLineClamp: 3, // Limit text to 3 lines
81235
- }, children: description })), url && (jsxs(Link, { href: url, sx: styles$5.link, color: "text", target: "_blank", children: [jsx$2(Text, { mr: "5px", children: "View on Explorer" }), jsx$2(Svg, { icon: "external" })] }))] }), jsx$2(Flex, { sx: { alignItems: 'flex-start', pt: '3px' }, onClick: () => removePopup(popup), children: jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent" }) })] })) }));
81240
+ }, children: parsedErrorString })), url && (jsxs(Link, { href: url, sx: styles$5.link, color: "text", target: "_blank", children: [jsx$2(Text, { mr: "5px", children: "View on Explorer" }), jsx$2(Svg, { icon: "external" })] })), showSupportLink && (jsxs(Link, { href: 'https://discord.com/channels/821817977917538375/1110438345701593088', sx: styles$5.link, color: "text", target: "_blank", children: [jsx$2(Text, { mr: "5px", children: "Having issues? Get support" }), jsx$2(Svg, { icon: "external" })] }))] }), jsx$2(Flex, { sx: { alignItems: 'flex-start', pt: '3px' }, onClick: () => removePopup(popup), children: jsx$2(IconButton, { icon: "close", color: "text", variant: "transparent" }) })] })) }));
81236
81241
  };
81237
81242
 
81238
81243
  const Popups = ({ children }) => {
81239
81244
  const { data: activePopups } = usePopups();
81240
- return (jsxs(Flex, { sx: { width: '100%', height: '100%', position: 'relative', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: { position: 'absolute', top: 0, right: 0 }, children: activePopups === null || activePopups === void 0 ? void 0 : activePopups.map((popup, i) => {
81245
+ const filteredPopups = activePopups === null || activePopups === void 0 ? void 0 : activePopups.filter((popup) => popup.timestamp > Date.now() - 10000);
81246
+ return (jsxs(Flex, { sx: { width: '100%', height: '100%', position: 'relative', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: { position: 'absolute', top: 0, right: 0 }, children: filteredPopups === null || filteredPopups === void 0 ? void 0 : filteredPopups.map((popup, i) => {
81241
81247
  return jsx$2(Toast, { popIndex: i + 1, popup: popup }, popup.timestamp);
81242
81248
  }) }), children] }));
81243
81249
  };
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.75",
6
+ "version": "3.0.77",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",