@ape.swap/bonds-sdk 2.1.1-test.5 → 2.1.2

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 +23 -18
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -71572,22 +71572,27 @@ const useTopTags = (initialBondList) => {
71572
71572
  };
71573
71573
 
71574
71574
  const isBondSoldOut = (bill) => {
71575
- return false;
71576
- // const { tokensRemaining, discount, payoutTokenPrice } = bill
71577
- // if (bill.soldOut) return true
71578
- // if (bill.inactive) return true
71579
- // if (!tokensRemaining) return false
71580
- // const thresholdToHide = new BigNumber(100).div(payoutTokenPrice ?? 0)
71581
- // if (discount && discount > 50) {
71582
- // // If discount is over 50% it will be hidden
71583
- // // console.log('Soldout contract:', billAddress)
71584
- // return true
71585
- // }
71586
- // if (new BigNumber(tokensRemaining)?.lte(thresholdToHide) || discount === 100) {
71587
- // // If there's less than 100 usd bond will be hidden
71588
- // // console.log('Soldout contract: ', billAddress)
71589
- // return true
71590
- // } else return false
71575
+ var _a;
71576
+ const { tokensRemaining, discount, payoutTokenPrice } = bill;
71577
+ if (bill.soldOut)
71578
+ return true;
71579
+ if (bill.inactive)
71580
+ return true;
71581
+ if (!tokensRemaining)
71582
+ return false;
71583
+ const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
71584
+ if (discount && discount > 50) {
71585
+ // If discount is over 50% it will be hidden
71586
+ // console.log('Soldout contract:', billAddress)
71587
+ return true;
71588
+ }
71589
+ if (((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) || discount === 100) {
71590
+ // If there's less than 100 usd bond will be hidden
71591
+ // console.log('Soldout contract: ', billAddress)
71592
+ return true;
71593
+ }
71594
+ else
71595
+ return false;
71591
71596
  };
71592
71597
  const sortBonds = (sortConfig, bonds) => {
71593
71598
  const bondsToSort = bonds !== null && bonds !== void 0 ? bonds : [];
@@ -74547,7 +74552,7 @@ const BuyAgainRow = () => {
74547
74552
  const buyAgainBond = useMemo(() => {
74548
74553
  if (userData && (userData === null || userData === void 0 ? void 0 : userData.Sales.length) > 0) {
74549
74554
  const sortedPurchases = userData === null || userData === void 0 ? void 0 : userData.Sales.sort((a, b) => b.dollarValue - a.dollarValue);
74550
- const activeBills = bills === null || bills === void 0 ? void 0 : bills.filter((bill) => (chains === null || chains === void 0 ? void 0 : chains.includes(bill.chainId)));
74555
+ const activeBills = bills === null || bills === void 0 ? void 0 : bills.filter((bill) => !isBondSoldOut(bill) && (chains === null || chains === void 0 ? void 0 : chains.includes(bill.chainId)));
74551
74556
  const highestActivePurchase = sortedPurchases === null || sortedPurchases === void 0 ? void 0 : sortedPurchases.find((purchase) => activeBills === null || activeBills === void 0 ? void 0 : activeBills.find((bill) => {
74552
74557
  var _a;
74553
74558
  if (purchase.contractAddress.toLowerCase() === ((_a = bill === null || bill === void 0 ? void 0 : bill.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()))
@@ -74726,7 +74731,7 @@ const Bonds = () => {
74726
74731
  billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bill) => { var _a; return chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes((_a = bill === null || bill === void 0 ? void 0 : bill.chainId) === null || _a === void 0 ? void 0 : _a.toString()); });
74727
74732
  }
74728
74733
  if (filterOption !== 'SOLD OUT') {
74729
- billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !isBondSoldOut());
74734
+ billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !isBondSoldOut(bond));
74730
74735
  }
74731
74736
  if (filterOption === 'SOLD OUT') {
74732
74737
  billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter((bond) => !bond.soldOut);
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": "2.1.1-test.5",
6
+ "version": "2.1.2",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",