@ape.swap/bonds-sdk 1.0.273 → 1.0.274

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.
@@ -114,17 +114,16 @@ var YourBonds = function (_a) {
114
114
  }
115
115
  });
116
116
  }); };
117
- var _d = useState([]), userBondData = _d[0], setUserBondData = _d[1];
117
+ var _d = useState([]), bondData = _d[0], setBondData = _d[1];
118
118
  var _e = useState([]), hotBonds = _e[0], setHotBonds = _e[1];
119
119
  var vestingTime = function (vestingTerm) {
120
120
  return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
121
121
  };
122
122
  useEffect(function () {
123
123
  axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
124
- var bonds = response.data.bonds;
125
- setUserBondData(bonds);
124
+ var bonds = response.data.bonds.filter(function (bond) { return !isSoldOut(bond); });
125
+ setBondData(bonds);
126
126
  });
127
- usePollUserBills();
128
127
  }, []);
129
128
  useEffect(function () {
130
129
  axios.get('https://apeswap-strapi.herokuapp.com/hot-bonds').then(function (response) {
@@ -147,7 +146,7 @@ var YourBonds = function (_a) {
147
146
  return true;
148
147
  return ((_b = new BigNumber(bond.tokensRemaining)) === null || _b === void 0 ? void 0 : _b.lte(thresholdToHide)) || bond.discount === 100;
149
148
  }, []);
150
- var sortedBonds = userBondData.sort(function (a, b) {
149
+ var sortedBonds = bondData.sort(function (a, b) {
151
150
  var _a, _b;
152
151
  var aIsHot = hotBonds.includes(a.billAddress.toLowerCase()) && ((_a = a.discount) !== null && _a !== void 0 ? _a : 0) > 0;
153
152
  var bIsHot = hotBonds.includes(b.billAddress.toLowerCase()) && ((_b = b.discount) !== null && _b !== void 0 ? _b : 0) > 0;
@@ -208,7 +207,7 @@ var YourBonds = function (_a) {
208
207
  switch (_a.label) {
209
208
  case 0:
210
209
  _a.trys.push([0, 2, , 3]);
211
- bonds = userBondData.filter(function (bond) {
210
+ bonds = bondData.filter(function (bond) {
212
211
  return bond.billVersion !== BillVersion.FixedPrice &&
213
212
  (bond === null || bond === void 0 ? void 0 : bond.chainId) === chainId &&
214
213
  bond.type !== 'migration' &&
@@ -235,6 +234,24 @@ var YourBonds = function (_a) {
235
234
  }
236
235
  });
237
236
  }); };
237
+ useEffect(function () {
238
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
239
+ var results;
240
+ return __generator(this, function (_a) {
241
+ switch (_a.label) {
242
+ case 0:
243
+ if (!account) return [3 /*break*/, 2];
244
+ return [4 /*yield*/, Promise.all(MAINNET_CHAINS.map(function (chain) { return fetchUserOwnedBillsDataAsync(chain, account); }))];
245
+ case 1:
246
+ results = _a.sent();
247
+ console.log('User owned bills data:', results);
248
+ _a.label = 2;
249
+ case 2: return [2 /*return*/];
250
+ }
251
+ });
252
+ }); };
253
+ fetchData();
254
+ }, [account]);
238
255
  var fetchUserOwnedBills = function (chainId, account, bonds) { return __awaiter(void 0, void 0, void 0, function () {
239
256
  var billIdCalls, billIds, billsPendingRewardCall, billDataCalls, billVersions, billData, pendingRewardsCall, result, i, billDataPos, data;
240
257
  var _a, _b, _c, _d, _e;
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.0.273",
6
+ "version": "1.0.274",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",