@ape.swap/bonds-sdk 1.0.110 → 1.0.112
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';
|
|
@@ -57,6 +57,8 @@ import getTimePeriods from '../../utils/getTimePeriods';
|
|
|
57
57
|
import { defaultTheme } from '../../theme';
|
|
58
58
|
import Svg from '../uikit/Svg';
|
|
59
59
|
import '../../scss/bonds.scss';
|
|
60
|
+
import { BigNumber } from 'bignumber.js';
|
|
61
|
+
import { ChainId } from '@ape.swap/apeswap-lists';
|
|
60
62
|
var Bonds = function (_a) {
|
|
61
63
|
var connectionString = _a.connectionString;
|
|
62
64
|
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
@@ -108,7 +110,7 @@ var Bonds = function (_a) {
|
|
|
108
110
|
};
|
|
109
111
|
useEffect(function () {
|
|
110
112
|
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
111
|
-
var bonds = response.data.bonds.filter(function (x) { return x.soldOut !== true && x.inactive !== true &&
|
|
113
|
+
var bonds = response.data.bonds.filter(function (x) { return x.soldOut !== true && x.inactive !== true && !isSoldOut; });
|
|
112
114
|
setBondData(bonds);
|
|
113
115
|
});
|
|
114
116
|
}, []);
|
|
@@ -134,6 +136,18 @@ var Bonds = function (_a) {
|
|
|
134
136
|
return b.discount - a.discount;
|
|
135
137
|
}
|
|
136
138
|
});
|
|
139
|
+
var isSoldOut = useCallback(function (bond) {
|
|
140
|
+
var _a;
|
|
141
|
+
var tokensRemaining = bond.tokensRemaining, discount = bond.discount, payoutTokenPrice = bond.payoutTokenPrice;
|
|
142
|
+
if (bond.soldOut)
|
|
143
|
+
return true;
|
|
144
|
+
if (!tokensRemaining)
|
|
145
|
+
return false;
|
|
146
|
+
var thresholdToHide = new BigNumber(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
147
|
+
if (discount && discount > 25 && bond.chainId === ChainId.BASE)
|
|
148
|
+
return true;
|
|
149
|
+
return ((_a = new BigNumber(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) || discount === 100;
|
|
150
|
+
}, []);
|
|
137
151
|
var _f = useState(false), isModalOpen = _f[0], setIsModalOpen = _f[1];
|
|
138
152
|
var _g = useState(null), selectedBond = _g[0], setSelectedBond = _g[1];
|
|
139
153
|
var rowClick = function (bond) {
|
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.112",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.es.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"typescript": "^4.0.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@ape.swap/apeswap-lists": "^2.0.9",
|
|
52
53
|
"@emotion/react": "^11.11.4",
|
|
53
54
|
"@emotion/styled": "^11.11.5",
|
|
54
55
|
"@types/node": "^20.14.10",
|