@ape.swap/bonds-sdk 1.0.348 → 1.0.350

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 bonds_1, userOwnedBills_1, mapUserOwnedBills_1, userOwnedBillsData_1, ownedBillsData, userBillNftData_1, ownedBillsWithNftData, error_2;
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
- bonds_1 = bondData.filter(function (bond) {
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, bonds_1)];
190
+ return [4 /*yield*/, fetchUserOwnedBills(chainId, account, bonds)];
191
191
  case 1:
192
192
  userOwnedBills_1 = _a.sent();
193
- mapUserOwnedBills_1 = bonds_1.map(function (bill) {
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 = bonds_1.map(function (bill, i) { return ({
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, bonds_1)];
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
- ownedBillsWithNftData = mapUserOwnedBills_1.map(function (bs, index) {
209
- return {
210
- index: bonds_1[index].index,
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), nftData);
216
225
  });
217
- // // Combine userBillNftData with userOwnedBillsData
218
- // const combinedData = ownedBillsData.map((ownedBill) => {
219
- // const nftData = userBillNftData.find((nft) => parseInt(nft.id) === parseInt(ownedBill.id));
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();
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.348",
6
+ "version": "1.0.350",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",