@ape.swap/bonds-sdk 4.5.5 → 4.5.6

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
@@ -63465,7 +63465,7 @@ const claimedUSD = (userBill) => {
63465
63465
  };
63466
63466
  const getPercentageVested = (bond) => {
63467
63467
  var _a;
63468
- const vestingTerm = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.vesting) !== null && _a !== void 0 ? _a : '0');
63468
+ const vestingTerm = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _a !== void 0 ? _a : '0');
63469
63469
  const timeLeftForFullyVested = getTimeLeftForFullyVested(bond);
63470
63470
  if (timeLeftForFullyVested <= 0)
63471
63471
  return 100;
@@ -63473,7 +63473,7 @@ const getPercentageVested = (bond) => {
63473
63473
  };
63474
63474
  const getTimeLeftForFullyVested = (bond) => {
63475
63475
  var _a, _b;
63476
- const vestingTerm = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.vesting) !== null && _a !== void 0 ? _a : '0');
63476
+ const vestingTerm = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _a !== void 0 ? _a : '0');
63477
63477
  const purchaseTimestamp = parseInt((_b = bond === null || bond === void 0 ? void 0 : bond.vestingStartTimestamp) !== null && _b !== void 0 ? _b : '0');
63478
63478
  const now = Math.round(Date.now() / 1000);
63479
63479
  return purchaseTimestamp + vestingTerm - now;
@@ -64774,7 +64774,7 @@ const fetchUserOwnedBillsDataAsync = (chainId, account, bondData, tokenPrices, p
64774
64774
  }
64775
64775
  });
64776
64776
  const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices, priceApiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
64777
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
64777
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
64778
64778
  // Maps all the bills in the list repo to make a call to each of them to get Bills Id, meaning purchased bill ids
64779
64779
  const billIdCalls = bonds.map((b) => {
64780
64780
  var _a;
@@ -64814,7 +64814,7 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices, priceApiUrl)
64814
64814
  console.log('Individual call for: ', bond.lpToken.symbol, '. Price: ', res.data.price);
64815
64815
  principalTokenPrice = parseFloat((_g = res.data.price) !== null && _g !== void 0 ? _g : '0');
64816
64816
  }
64817
- catch (_z) {
64817
+ catch (_0) {
64818
64818
  principalTokenPrice = 0;
64819
64819
  }
64820
64820
  }
@@ -64824,7 +64824,7 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices, priceApiUrl)
64824
64824
  console.log('Individual call for: ', bond.earnToken.symbol, '. Price: ', res.data.price);
64825
64825
  payoutTokenPrice = parseFloat((_k = res.data.price) !== null && _k !== void 0 ? _k : '0');
64826
64826
  }
64827
- catch (_0) {
64827
+ catch (_1) {
64828
64828
  payoutTokenPrice = 0;
64829
64829
  }
64830
64830
  }
@@ -64840,19 +64840,20 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices, priceApiUrl)
64840
64840
  payoutClaimed: (_p = billData[billPos][0]) === null || _p === void 0 ? void 0 : _p.payoutClaimed.toString(),
64841
64841
  billNftAddress: (_q = bond.billNnftAddress[bond.chainId]) !== null && _q !== void 0 ? _q : '',
64842
64842
  vesting: (_r = billData[billPos][0]) === null || _r === void 0 ? void 0 : _r.vesting.toString(),
64843
+ vestingTerm: (_s = billData[billPos][0]) === null || _s === void 0 ? void 0 : _s.vestingTerm.toString(),
64843
64844
  // TODO: sync this with solana so that both implementation have the same logic
64844
- lastBlockTimestamp: (_s = billData[billPos][0]) === null || _s === void 0 ? void 0 : _s.lastClaimTimestamp.toString(),
64845
- vestingStartTimestamp: (_t = billData[billPos][0]) === null || _t === void 0 ? void 0 : _t.vestingStartTimestamp.toString(),
64846
- truePricePaid: (_u = billData[billPos][0]) === null || _u === void 0 ? void 0 : _u.truePricePaid.toString(),
64845
+ lastBlockTimestamp: (_t = billData[billPos][0]) === null || _t === void 0 ? void 0 : _t.lastClaimTimestamp.toString(),
64846
+ vestingStartTimestamp: (_u = billData[billPos][0]) === null || _u === void 0 ? void 0 : _u.vestingStartTimestamp.toString(),
64847
+ truePricePaid: (_v = billData[billPos][0]) === null || _v === void 0 ? void 0 : _v.truePricePaid.toString(),
64847
64848
  pendingRewards: billData[billPos + 1][0].toString(),
64848
64849
  bond,
64849
64850
  }
64850
64851
  : {
64851
64852
  address: billDataCalls[billPos].address,
64852
64853
  id: billDataCalls[billPos].params[0].toString(),
64853
- payoutClaimed: (_x = (_w = (_v = billData === null || billData === void 0 ? void 0 : billData[billPos]) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.payoutClaimed) === null || _x === void 0 ? void 0 : _x.toString(),
64854
+ payoutClaimed: (_y = (_x = (_w = billData === null || billData === void 0 ? void 0 : billData[billPos]) === null || _w === void 0 ? void 0 : _w[0]) === null || _x === void 0 ? void 0 : _x.payoutClaimed) === null || _y === void 0 ? void 0 : _y.toString(),
64854
64855
  payout: billData[billPos][0].toString(),
64855
- billNftAddress: (_y = bond.billNnftAddress[bond.chainId]) !== null && _y !== void 0 ? _y : '',
64856
+ billNftAddress: (_z = bond.billNnftAddress[bond.chainId]) !== null && _z !== void 0 ? _z : '',
64856
64857
  vesting: billData[billPos][1].toString(),
64857
64858
  lastBlockTimestamp: billData[billPos][2].toString(),
64858
64859
  truePricePaid: billData[billPos][3].toString(),
@@ -65203,6 +65204,7 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices, priceApiUrl) {
65203
65204
  id: idTrimmed,
65204
65205
  asset: nftMint.toBase58(),
65205
65206
  vesting: bondAccount.vesting.toString(),
65207
+ vestingTerm: bondAccount.vestingTerm.toString(),
65206
65208
  payout: (Number(bondAccount.payout) - Number(bondAccount.payoutClaimed)).toString(),
65207
65209
  totalPayout: bondAccount.payout.toString(),
65208
65210
  truePricePaid: bondAccount.truePricePaid.toString(),
@@ -79495,7 +79497,15 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
79495
79497
  setInputValue(balance.toFixed(decimals));
79496
79498
  }
79497
79499
  }
79498
- }, [bondData, isZap, userPoints, SDKConfig.showLowValueBonds, inputTokenPrice, enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.token]);
79500
+ }, [
79501
+ bondData,
79502
+ isZap,
79503
+ userPoints,
79504
+ SDKConfig.showLowValueBonds,
79505
+ inputTokenPrice,
79506
+ enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.token,
79507
+ inputCurrencyBalance,
79508
+ ]);
79499
79509
  const handleOpenZapModal = () => {
79500
79510
  var _a;
79501
79511
  onOpenZapModal();
@@ -9,6 +9,7 @@ export interface UserBill {
9
9
  id: string;
10
10
  asset?: string;
11
11
  vesting: string;
12
+ vestingTerm?: string;
12
13
  payout: string;
13
14
  totalPayout?: string;
14
15
  truePricePaid: string;
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.5.5",
6
+ "version": "4.5.6",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",