@ape.swap/bonds-sdk 1.0.552 → 1.0.553
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.
|
@@ -48,7 +48,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
|
48
48
|
import { useEffect, useState } from 'react';
|
|
49
49
|
import { Flex, ThemeUIProvider } from 'theme-ui';
|
|
50
50
|
import { useWeb3React } from '@web3-react/core';
|
|
51
|
-
import { useSearchParams, useNavigate } from 'react-router-dom';
|
|
52
51
|
import getTimePeriods from '../../utils/getTimePeriods';
|
|
53
52
|
import { defaultTheme } from '../../theme';
|
|
54
53
|
import '../../scss/YourBonds.scss';
|
|
@@ -68,24 +67,7 @@ import { YourBondsModal } from "../../index";
|
|
|
68
67
|
import BOND_ABI from '../../config/abi/bond.json';
|
|
69
68
|
import { useWriteContract } from 'wagmi';
|
|
70
69
|
var YourBonds = function (_a) {
|
|
71
|
-
|
|
72
|
-
// const { onClaimBill } = useClaimBill(billAddress, billIds)
|
|
73
|
-
var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive;
|
|
74
|
-
// const [pendingTrx, setPendingTrx] = useState(false)
|
|
75
|
-
// const handleClaim = async (billAddress: string, billIds: string[], chainId: number, event: any) => {
|
|
76
|
-
// event?.stopPropagation();
|
|
77
|
-
// console.log('CLAIM CLICKED');
|
|
78
|
-
// console.log(account);
|
|
79
|
-
// if (!account) return;
|
|
80
|
-
// const { onClaimBill } = useClaimBill(billAddress, billIds, chainId);
|
|
81
|
-
// setPendingTrx(true);
|
|
82
|
-
// await onClaimBill().catch((e) => {
|
|
83
|
-
// console.error(e);
|
|
84
|
-
// //toastError(e);
|
|
85
|
-
// setPendingTrx(false);
|
|
86
|
-
// });
|
|
87
|
-
// setPendingTrx(false);
|
|
88
|
-
// };
|
|
70
|
+
var account = _a.account;
|
|
89
71
|
var writeContract = useWriteContract().writeContract;
|
|
90
72
|
var handleClaim = function (billId, billAddress) { return __awaiter(void 0, void 0, void 0, function () {
|
|
91
73
|
var address, tx, error_1;
|
|
@@ -118,12 +100,9 @@ var YourBonds = function (_a) {
|
|
|
118
100
|
}
|
|
119
101
|
});
|
|
120
102
|
}); };
|
|
121
|
-
// const { account, isActive } = useWeb3React();
|
|
122
|
-
var _b = useSearchParams(), searchParams = _b[0], setSearchParams = _b[1];
|
|
123
|
-
var navigate = useNavigate();
|
|
124
103
|
// Fetch data
|
|
125
|
-
var
|
|
126
|
-
var
|
|
104
|
+
var _b = useState([]), bondData = _b[0], setBondData = _b[1];
|
|
105
|
+
var _c = useState([]), mappedUserBills = _c[0], setMappedUserBills = _c[1];
|
|
127
106
|
useEffect(function () {
|
|
128
107
|
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
129
108
|
var bonds = response.data.bonds;
|
|
@@ -157,8 +136,8 @@ var YourBonds = function (_a) {
|
|
|
157
136
|
}); };
|
|
158
137
|
fetchData();
|
|
159
138
|
}, [account, bondData]);
|
|
160
|
-
var
|
|
161
|
-
var
|
|
139
|
+
var _d = useState(null), sortConfig = _d[0], setSortConfig = _d[1];
|
|
140
|
+
var _e = useState(mappedUserBills), sortedBonds = _e[0], setSortedBonds = _e[1];
|
|
162
141
|
var handleSort = function (key) {
|
|
163
142
|
var direction = 'asc';
|
|
164
143
|
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'asc') {
|
|
@@ -239,8 +218,8 @@ var YourBonds = function (_a) {
|
|
|
239
218
|
return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
|
|
240
219
|
};
|
|
241
220
|
// Modal
|
|
242
|
-
var
|
|
243
|
-
var
|
|
221
|
+
var _f = useState(false), isModalOpen = _f[0], setIsModalOpen = _f[1];
|
|
222
|
+
var _g = useState(undefined), selectedBill = _g[0], setSelectedBill = _g[1];
|
|
244
223
|
var rowClick = function (bill) {
|
|
245
224
|
console.log(bill);
|
|
246
225
|
setSelectedBill(bill);
|
|
@@ -248,8 +227,8 @@ var YourBonds = function (_a) {
|
|
|
248
227
|
// navigate(`/yourBonds/?bondAddress=${bill.address}&bondChain=${bill.bond.chainId}`, { replace: true });
|
|
249
228
|
};
|
|
250
229
|
// Search logic
|
|
251
|
-
var
|
|
252
|
-
var
|
|
230
|
+
var _h = useState(''), inputValue = _h[0], setInputValue = _h[1];
|
|
231
|
+
var _j = useState(sortedBonds), filteredBonds = _j[0], setFilteredBonds = _j[1];
|
|
253
232
|
useEffect(function () {
|
|
254
233
|
if (inputValue === '') {
|
|
255
234
|
setFilteredBonds(sortedBonds);
|
|
@@ -264,7 +243,7 @@ var YourBonds = function (_a) {
|
|
|
264
243
|
setInputValue(event.target.value);
|
|
265
244
|
};
|
|
266
245
|
// Page render logic
|
|
267
|
-
var
|
|
246
|
+
var _k = useState(false), bondsRendered = _k[0], setBondsRendered = _k[1];
|
|
268
247
|
useEffect(function () {
|
|
269
248
|
if (filteredBonds.length > 0) {
|
|
270
249
|
setBondsRendered(true);
|