@ape.swap/bonds-sdk 4.0.2-test.2 → 4.0.2-test.3

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 +10 -1
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -67370,7 +67370,7 @@ function useUserBonds() {
67370
67370
  return useQuery({
67371
67371
  queryKey: [QUERY_KEYS.USER_BONDS, address, publicKey, (_b = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices.length) !== null && _b !== void 0 ? _b : null],
67372
67372
  queryFn: () => getUserBonds(address, solanaAccount, bondList, chains, tokenPrices, apiUrl),
67373
- refetchInterval: 120000,
67373
+ refetchInterval: 60000,
67374
67374
  enabled: !!bondList && !!(address || solanaAccount) && !!tokenPrices,
67375
67375
  refetchOnWindowFocus: false,
67376
67376
  refetchOnMount: false,
@@ -67380,6 +67380,7 @@ function useUserBonds() {
67380
67380
  }
67381
67381
  const getUserBonds = (account, solanaAccount, bondList, chains, tokenPrices, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
67382
67382
  try {
67383
+ console.time('getUserBonds');
67383
67384
  const bondsByChain = bondList.reduce((acc, bond) => {
67384
67385
  var _a;
67385
67386
  // Exclude ACF to ABOND bonds, fixed price bonds, and migration bonds
@@ -67412,6 +67413,7 @@ const getUserBonds = (account, solanaAccount, bondList, chains, tokenPrices, api
67412
67413
  const fulfilledResults = results
67413
67414
  .filter((result) => result.status === 'fulfilled')
67414
67415
  .map((result) => result.value);
67416
+ console.timeEnd('getUserBonds');
67415
67417
  return fulfilledResults.flat().flatMap((result) => result.userOwnedBills);
67416
67418
  }
67417
67419
  catch (e) {
@@ -76926,6 +76928,7 @@ const UserBondRow = ({ bill }) => {
76926
76928
  const { switchChain } = useSwitchChain();
76927
76929
  const { writeContractAsync } = useWriteContract();
76928
76930
  const { addToastError } = usePopups();
76931
+ const { refetch: refetchUserBonds } = useUserBonds();
76929
76932
  const [claimTxHash, setClaimTxHash] = useState(null);
76930
76933
  const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTxHash(claimTxHash, (_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
76931
76934
  const [loadingTx, setLoadingTx] = useState(false);
@@ -76979,6 +76982,12 @@ const UserBondRow = ({ bill }) => {
76979
76982
  const lastBlockTimestamp = parseInt((_e = bill === null || bill === void 0 ? void 0 : bill.lastBlockTimestamp) !== null && _e !== void 0 ? _e : '0');
76980
76983
  const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
76981
76984
  const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
76985
+ useEffect(() => {
76986
+ if (isConfirmed) {
76987
+ refetchUserBonds();
76988
+ }
76989
+ /* eslint-disable react-hooks/exhaustive-deps */
76990
+ }, [isConfirmed]);
76982
76991
  return (jsxs("div", { className: "your-bonds", onClick: onOpenPurchasedBond, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: (_g = (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.earnToken) === null || _g === void 0 ? void 0 : _g.symbol, chain: (_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.chainId, tag: (_k = (_j = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _j === void 0 ? void 0 : _j.tags) === null || _k === void 0 ? void 0 : _k[0], vestEnds: `Ends in ${getPendingVestingString(bill)}`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_l = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _l === void 0 ? void 0 : _l.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_m = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _m === void 0 ? void 0 : _m.earnToken.symbol) || '', bondContract: (_o = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _o !== void 0 ? _o : '', projectLink: (_p = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _p === void 0 ? void 0 : _p.projectLink, twitter: (_q = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _q === void 0 ? void 0 : _q.twitter, audit: (_r = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _r === void 0 ? void 0 : _r.audit, chain: (_s = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _s === void 0 ? void 0 : _s.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
76983
76992
  opacity: 0.8,
76984
76993
  }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(totalPending(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(totalPending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: vestingTimeRemainingString(bill) }), jsx$2("div", { className: "your-bonds-column-button", children: userChainId !== ((_t = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _t === void 0 ? void 0 : _t.chainId) ? (jsxs(Button, { className: "button", disabled: claimable(bill) === 0 || load, load: load, onClick: (event) => {
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": "4.0.2-test.2",
6
+ "version": "4.0.2-test.3",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",