@ape.swap/bonds-sdk 1.0.345 → 1.0.346
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.
|
@@ -45,15 +45,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
-
if (ar || !(i in from)) {
|
|
51
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
-
ar[i] = from[i];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
-
};
|
|
57
48
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
58
49
|
/** @jsxImportSource theme-ui */
|
|
59
50
|
import { useEffect, useState } from 'react';
|
|
@@ -185,24 +176,24 @@ var YourBonds = function (_a) {
|
|
|
185
176
|
return getTimePeriods(parseInt(userBill.lastBlockTimestamp) + parseInt(userBill.vesting) - currentTime, true);
|
|
186
177
|
};
|
|
187
178
|
var fetchUserOwnedBillsDataAsync = function (chainId, account) { return __awaiter(void 0, void 0, void 0, function () {
|
|
188
|
-
var
|
|
179
|
+
var bonds, userOwnedBills_1, mapUserOwnedBills_1, userOwnedBillsData_1, ownedBillsData, userBillNftData, error_2;
|
|
189
180
|
return __generator(this, function (_a) {
|
|
190
181
|
switch (_a.label) {
|
|
191
182
|
case 0:
|
|
192
183
|
_a.trys.push([0, 3, , 4]);
|
|
193
|
-
|
|
184
|
+
bonds = bondData.filter(function (bond) {
|
|
194
185
|
return bond.billVersion !== BillVersion.FixedPrice &&
|
|
195
186
|
(bond === null || bond === void 0 ? void 0 : bond.chainId) === chainId &&
|
|
196
187
|
bond.type !== 'migration' &&
|
|
197
188
|
bond.billAddress.toLowerCase() !== ACF_TO_ABOND.toLowerCase();
|
|
198
189
|
});
|
|
199
|
-
return [4 /*yield*/, fetchUserOwnedBills(chainId, account,
|
|
190
|
+
return [4 /*yield*/, fetchUserOwnedBills(chainId, account, bonds)];
|
|
200
191
|
case 1:
|
|
201
192
|
userOwnedBills_1 = _a.sent();
|
|
202
|
-
mapUserOwnedBills_1 =
|
|
193
|
+
mapUserOwnedBills_1 = bonds.map(function (bill) {
|
|
203
194
|
return userOwnedBills_1.filter(function (b) { return b.address.toLowerCase() === bill.billAddress.toLowerCase(); });
|
|
204
195
|
});
|
|
205
|
-
userOwnedBillsData_1 =
|
|
196
|
+
userOwnedBillsData_1 = bonds.map(function (bill, i) { return ({
|
|
206
197
|
index: bill.index,
|
|
207
198
|
userOwnedBills: mapUserOwnedBills_1[i],
|
|
208
199
|
}); });
|
|
@@ -211,20 +202,32 @@ var YourBonds = function (_a) {
|
|
|
211
202
|
return { id: b.id, billNftAddress: b.billNftAddress, contractAddress: b.address };
|
|
212
203
|
});
|
|
213
204
|
});
|
|
214
|
-
return [4 /*yield*/, fetchUserOwnedBillNftData(ownedBillsData, chainId,
|
|
205
|
+
return [4 /*yield*/, fetchUserOwnedBillNftData(ownedBillsData, chainId, bonds)
|
|
206
|
+
// const ownedBillsWithNftData = mapUserOwnedBills.map((bs: any, index: number) => {
|
|
207
|
+
// return {
|
|
208
|
+
// index: bonds[index].index,
|
|
209
|
+
// userOwnedBillsNfts: [
|
|
210
|
+
// ...bs.map((b: UserBillNftData) => {
|
|
211
|
+
// return userBillNftData.find((nftB) => parseInt(nftB.id) === b.data.billNftId)?.data
|
|
212
|
+
// }),
|
|
213
|
+
// ],
|
|
214
|
+
// }
|
|
215
|
+
// });
|
|
216
|
+
];
|
|
215
217
|
case 2:
|
|
216
|
-
|
|
217
|
-
ownedBillsWithNftData =
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
218
|
+
userBillNftData = _a.sent();
|
|
219
|
+
// const ownedBillsWithNftData = mapUserOwnedBills.map((bs: any, index: number) => {
|
|
220
|
+
// return {
|
|
221
|
+
// index: bonds[index].index,
|
|
222
|
+
// userOwnedBillsNfts: [
|
|
223
|
+
// ...bs.map((b: UserBillNftData) => {
|
|
224
|
+
// return userBillNftData.find((nftB) => parseInt(nftB.id) === b.data.billNftId)?.data
|
|
225
|
+
// }),
|
|
226
|
+
// ],
|
|
227
|
+
// }
|
|
228
|
+
// });
|
|
226
229
|
console.log("ownedBillsWithNftData");
|
|
227
|
-
console.log(
|
|
230
|
+
console.log(userBillNftData);
|
|
228
231
|
console.log("ownedBillsWithNftData");
|
|
229
232
|
console.log("userOwnedBillsData");
|
|
230
233
|
console.log(userOwnedBillsData_1);
|