@ape.swap/bonds-sdk 1.0.150 → 1.0.151
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.
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
49
49
|
/** @jsxImportSource theme-ui */
|
|
50
|
-
import { useEffect, useState } from 'react';
|
|
50
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
51
51
|
import { Flex, ThemeUIProvider } from 'theme-ui';
|
|
52
52
|
import axios from 'axios';
|
|
53
53
|
import { ethers } from 'ethers';
|
|
@@ -112,12 +112,10 @@ var Bonds = function (_a) {
|
|
|
112
112
|
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
113
113
|
var bonds = response.data.bonds;
|
|
114
114
|
setBondData(bonds);
|
|
115
|
+
var bondsToRender = bondData.filter(function (bond) { return !isSoldOut(bond); });
|
|
116
|
+
setBondData(bondsToRender);
|
|
115
117
|
});
|
|
116
118
|
}, []);
|
|
117
|
-
useEffect(function () {
|
|
118
|
-
var bondsToRender = bondData.filter(function (bond) { return !isSoldOut(bond); });
|
|
119
|
-
setBondData(bondsToRender);
|
|
120
|
-
}, []);
|
|
121
119
|
useEffect(function () {
|
|
122
120
|
axios.get('https://apeswap-strapi.herokuapp.com/hot-bonds').then(function (response) {
|
|
123
121
|
var hotBondAddresses = response.data.map(function (bond) {
|
|
@@ -126,7 +124,7 @@ var Bonds = function (_a) {
|
|
|
126
124
|
setHotBonds(hotBondAddresses);
|
|
127
125
|
});
|
|
128
126
|
}, []);
|
|
129
|
-
var isSoldOut = function (bond) {
|
|
127
|
+
var isSoldOut = useCallback(function (bond) {
|
|
130
128
|
var _a, _b;
|
|
131
129
|
var thresholdToHide = new BigNumber(100).div((_a = bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : 0);
|
|
132
130
|
if (bond.soldOut)
|
|
@@ -136,13 +134,7 @@ var Bonds = function (_a) {
|
|
|
136
134
|
if (bond.discount && bond.discount > 25 && bond.chainId === ChainId.BASE)
|
|
137
135
|
return true;
|
|
138
136
|
return ((_b = new BigNumber(bond.tokensRemaining)) === null || _b === void 0 ? void 0 : _b.lte(thresholdToHide)) || bond.discount === 100;
|
|
139
|
-
};
|
|
140
|
-
var bondsToRender = [];
|
|
141
|
-
bondData.forEach(function (bond) {
|
|
142
|
-
if (!isSoldOut(bond)) {
|
|
143
|
-
bondsToRender.push(bond);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
137
|
+
}, []);
|
|
146
138
|
var sortedBonds = bondData.sort(function (a, b) {
|
|
147
139
|
var _a, _b;
|
|
148
140
|
var aIsHot = hotBonds.includes(a.billAddress.toLowerCase()) && ((_a = a.discount) !== null && _a !== void 0 ? _a : 0) > 0;
|
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.
|
|
6
|
+
"version": "1.0.151",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.es.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"theme-ui": "^0.16.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@ape.swap/apeswap-lists": "^2.0.9",
|
|
29
28
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
30
29
|
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
|
|
31
30
|
"@types/lodash": "^4.17.6",
|