@ape.swap/bonds-sdk 1.0.466 → 1.0.467
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.
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/** @jsxImportSource theme-ui */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import '../../scss/YourBonds.scss';
|
|
4
|
-
import { ExternalProvider } from '@ethersproject/providers';
|
|
5
4
|
declare global {
|
|
6
5
|
interface Window {
|
|
7
6
|
ethereum?: any;
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
interface YourBondsProps {
|
|
11
|
-
|
|
10
|
+
account: string;
|
|
11
|
+
accountChainId: number;
|
|
12
|
+
isActive: boolean;
|
|
12
13
|
}
|
|
13
14
|
declare const YourBonds: React.FC<YourBondsProps>;
|
|
14
15
|
export default YourBonds;
|
|
@@ -76,15 +76,10 @@ import { getPendingVesting } from '../../hooks/usePendingVesting';
|
|
|
76
76
|
import axios from 'axios';
|
|
77
77
|
import { fetchUserOwnedBillsDataAsync } from './fetchBillsUser';
|
|
78
78
|
import { Input } from '../../components/uikit-sdk/Input';
|
|
79
|
-
import { Web3Provider } from '@ethersproject/providers';
|
|
80
79
|
var YourBonds = function (_a) {
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
console.log(web3Provider);
|
|
85
|
-
console.log("WEB3PROVIDER");
|
|
86
|
-
var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
|
|
87
|
-
var _c = useSearchParams(), searchParams = _c[0], setSearchParams = _c[1];
|
|
80
|
+
var account = _a.account, isActive = _a.isActive, accountChainId = _a.accountChainId;
|
|
81
|
+
//const { account, isActive } = useWeb3React();
|
|
82
|
+
var _b = useSearchParams(), searchParams = _b[0], setSearchParams = _b[1];
|
|
88
83
|
var navigate = useNavigate();
|
|
89
84
|
var USDT_ABI = [
|
|
90
85
|
// The ERC-20 approve function ABI
|
|
@@ -126,8 +121,8 @@ var YourBonds = function (_a) {
|
|
|
126
121
|
});
|
|
127
122
|
}); };
|
|
128
123
|
// Fetch data
|
|
129
|
-
var
|
|
130
|
-
var
|
|
124
|
+
var _c = useState([]), bondData = _c[0], setBondData = _c[1];
|
|
125
|
+
var _d = useState([]), mappedUserBills = _d[0], setMappedUserBills = _d[1];
|
|
131
126
|
useEffect(function () {
|
|
132
127
|
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
133
128
|
var bonds = response.data.bonds;
|
|
@@ -160,8 +155,8 @@ var YourBonds = function (_a) {
|
|
|
160
155
|
}); };
|
|
161
156
|
fetchData();
|
|
162
157
|
}, [account]);
|
|
163
|
-
var
|
|
164
|
-
var
|
|
158
|
+
var _e = useState(null), sortConfig = _e[0], setSortConfig = _e[1];
|
|
159
|
+
var _f = useState(mappedUserBills), sortedBonds = _f[0], setSortedBonds = _f[1];
|
|
165
160
|
var handleSort = function (key) {
|
|
166
161
|
var direction = 'asc';
|
|
167
162
|
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'asc') {
|
|
@@ -242,16 +237,16 @@ var YourBonds = function (_a) {
|
|
|
242
237
|
return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
|
|
243
238
|
};
|
|
244
239
|
// Modal
|
|
245
|
-
var
|
|
246
|
-
var
|
|
240
|
+
var _g = useState(false), isModalOpen = _g[0], setIsModalOpen = _g[1];
|
|
241
|
+
var _h = useState(null), selectedBill = _h[0], setSelectedBill = _h[1];
|
|
247
242
|
var rowClick = function (bill) {
|
|
248
243
|
setSelectedBill(bill);
|
|
249
244
|
setIsModalOpen(true);
|
|
250
245
|
navigate("/YourBonds/?bondAddress=".concat(bill.address, "&bondChain=").concat(bill.bond.chainId), { replace: true });
|
|
251
246
|
};
|
|
252
247
|
// Search logic
|
|
253
|
-
var
|
|
254
|
-
var
|
|
248
|
+
var _j = useState(''), inputValue = _j[0], setInputValue = _j[1];
|
|
249
|
+
var _k = useState(sortedBonds), filteredBonds = _k[0], setFilteredBonds = _k[1];
|
|
255
250
|
useEffect(function () {
|
|
256
251
|
if (inputValue === '') {
|
|
257
252
|
setFilteredBonds(sortedBonds);
|
|
@@ -266,7 +261,7 @@ var YourBonds = function (_a) {
|
|
|
266
261
|
setInputValue(event.target.value);
|
|
267
262
|
};
|
|
268
263
|
// Page render logic
|
|
269
|
-
var
|
|
264
|
+
var _l = useState(false), bondsRendered = _l[0], setBondsRendered = _l[1];
|
|
270
265
|
useEffect(function () {
|
|
271
266
|
if (filteredBonds.length > 0) {
|
|
272
267
|
setBondsRendered(true);
|