@ape.swap/bonds-sdk 1.0.349 → 1.0.351
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.
|
@@ -176,24 +176,24 @@ var YourBonds = function (_a) {
|
|
|
176
176
|
return getTimePeriods(parseInt(userBill.lastBlockTimestamp) + parseInt(userBill.vesting) - currentTime, true);
|
|
177
177
|
};
|
|
178
178
|
var fetchUserOwnedBillsDataAsync = function (chainId, account) { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
-
var
|
|
179
|
+
var bonds, userOwnedBills_1, mapUserOwnedBills_1, userOwnedBillsData_1, ownedBillsData, userBillNftData_1, combinedData, error_2;
|
|
180
180
|
return __generator(this, function (_a) {
|
|
181
181
|
switch (_a.label) {
|
|
182
182
|
case 0:
|
|
183
183
|
_a.trys.push([0, 3, , 4]);
|
|
184
|
-
|
|
184
|
+
bonds = bondData.filter(function (bond) {
|
|
185
185
|
return bond.billVersion !== BillVersion.FixedPrice &&
|
|
186
186
|
(bond === null || bond === void 0 ? void 0 : bond.chainId) === chainId &&
|
|
187
187
|
bond.type !== 'migration' &&
|
|
188
188
|
bond.billAddress.toLowerCase() !== ACF_TO_ABOND.toLowerCase();
|
|
189
189
|
});
|
|
190
|
-
return [4 /*yield*/, fetchUserOwnedBills(chainId, account,
|
|
190
|
+
return [4 /*yield*/, fetchUserOwnedBills(chainId, account, bonds)];
|
|
191
191
|
case 1:
|
|
192
192
|
userOwnedBills_1 = _a.sent();
|
|
193
|
-
mapUserOwnedBills_1 =
|
|
193
|
+
mapUserOwnedBills_1 = bonds.map(function (bill) {
|
|
194
194
|
return userOwnedBills_1.filter(function (b) { return b.address.toLowerCase() === bill.billAddress.toLowerCase(); });
|
|
195
195
|
});
|
|
196
|
-
userOwnedBillsData_1 =
|
|
196
|
+
userOwnedBillsData_1 = bonds.map(function (bill, i) { return ({
|
|
197
197
|
index: bill.index,
|
|
198
198
|
userOwnedBills: mapUserOwnedBills_1[i],
|
|
199
199
|
}); });
|
|
@@ -202,32 +202,36 @@ var YourBonds = function (_a) {
|
|
|
202
202
|
return { id: b.id, billNftAddress: b.billNftAddress, contractAddress: b.address };
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
-
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: bs.map((b: any) => {
|
|
210
|
+
// const nftData = userBillNftData.find((nftB) => parseInt(nftB.id) === b.id);
|
|
211
|
+
// return {
|
|
212
|
+
// ...b,
|
|
213
|
+
// ...nftData
|
|
214
|
+
// } as UserBillNftData;
|
|
215
|
+
// }),
|
|
216
|
+
// };
|
|
217
|
+
// });
|
|
218
|
+
// Combine userBillNftData with userOwnedBillsData
|
|
219
|
+
];
|
|
206
220
|
case 2:
|
|
207
221
|
userBillNftData_1 = _a.sent();
|
|
208
|
-
|
|
209
|
-
return
|
|
210
|
-
|
|
211
|
-
userOwnedBillsNfts: bs.map(function (b) {
|
|
212
|
-
var nftData = userBillNftData_1.find(function (nftB) { return parseInt(nftB.id) === b.id; });
|
|
213
|
-
return __assign(__assign({}, b), nftData);
|
|
214
|
-
}),
|
|
215
|
-
};
|
|
222
|
+
combinedData = ownedBillsData.map(function (ownedBill) {
|
|
223
|
+
var nftData = userBillNftData_1.find(function (nft) { return parseInt(nft.id) === parseInt(ownedBill.id); });
|
|
224
|
+
return __assign(__assign({}, ownedBill), { image: nftData === null || nftData === void 0 ? void 0 : nftData.image, attributes: nftData === null || nftData === void 0 ? void 0 : nftData.attributes });
|
|
216
225
|
});
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
// return {
|
|
221
|
-
// ...ownedBill,
|
|
222
|
-
// ...nftData
|
|
223
|
-
// };
|
|
224
|
-
// });
|
|
225
|
-
console.log("ownedBillsWithNftData");
|
|
226
|
-
console.log(ownedBillsWithNftData);
|
|
227
|
-
console.log("ownedBillsWithNftData");
|
|
226
|
+
console.log("userBillNftData");
|
|
227
|
+
console.log(userBillNftData_1);
|
|
228
|
+
console.log("userBillNftData");
|
|
228
229
|
console.log("userOwnedBillsData");
|
|
229
230
|
console.log(userOwnedBillsData_1);
|
|
230
231
|
console.log("userOwnedBillsData");
|
|
232
|
+
console.log("combinedData");
|
|
233
|
+
console.log(combinedData);
|
|
234
|
+
console.log("combinedData");
|
|
231
235
|
return [2 /*return*/, Promise.resolve(userOwnedBillsData_1)];
|
|
232
236
|
case 3:
|
|
233
237
|
error_2 = _a.sent();
|