@ape.swap/bonds-sdk 1.0.361 → 1.0.362

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.
@@ -56,20 +56,16 @@ import getTimePeriods from '../../utils/getTimePeriods';
56
56
  import { defaultTheme } from '../../theme';
57
57
  import '../../scss/YourBonds.scss';
58
58
  import { BigNumber } from 'bignumber.js';
59
- import { BillVersion } from '../../enum/apeswaplists';
60
59
  import { Text, Button } from '../uikit-sdk';
61
60
  import { MAINNET_CHAINS } from '../../config/constants/chains';
62
61
  import TokenInfoAndName from '../TokenInfoAndName';
63
- import { ACF_TO_ABOND } from '../../config/constants/addresses';
64
- import multicall from '../../utils/multicall';
65
- import billAbi from '../../config/abi/bond.json';
66
62
  import { getBalanceNumber } from '../../utils/getBalanceNumber';
67
63
  import { getFirstNonZeroDigits } from '../../utils/roundNumber';
68
64
  import { formatNumberSI } from '../../utils/formatNumber';
69
65
  import useCurrentTime from '../../hooks/useTimer';
70
66
  import { getPendingVesting } from '../../hooks/usePendingVesting';
71
67
  import axios from 'axios';
72
- import { fetchUserOwnedBillNftData } from './fetchBillsUser';
68
+ import { fetchUserOwnedBillsDataAsync } from './fetchBillsUser';
73
69
  var YourBonds = function (_a) {
74
70
  var connectionString = _a.connectionString;
75
71
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -120,145 +116,18 @@ var YourBonds = function (_a) {
120
116
  setBondData(bonds);
121
117
  });
122
118
  }, []);
123
- var _d = useState(false), isModalOpen = _d[0], setIsModalOpen = _d[1];
124
- var _e = useState(null), selectedBond = _e[0], setSelectedBond = _e[1];
125
- var _f = useState([]), bondData = _f[0], setBondData = _f[1];
126
- var rowClick = function (bond) {
127
- setSelectedBond(bond);
119
+ var _d = useState([]), bondData = _d[0], setBondData = _d[1];
120
+ var _e = useState(false), isModalOpen = _e[0], setIsModalOpen = _e[1];
121
+ var _f = useState(null), selectedBill = _f[0], setSelectedBill = _f[1];
122
+ var rowClick = function (bill) {
123
+ setSelectedBill(bill);
128
124
  setIsModalOpen(true);
129
- navigate("/YourBonds/?bondAddress=".concat(bond.billAddress, "&bondChain=").concat(bond.chainId), { replace: true });
125
+ navigate("/YourBonds/?bondAddress=".concat(bill.address, "&bondChain=").concat(bill.bond.chainId), { replace: true });
130
126
  };
131
- var fetchUserOwnedBillsDataAsync = function (chainId, account) { return __awaiter(void 0, void 0, void 0, function () {
132
- var bonds, userOwnedBills_1, mapUserOwnedBills_1, userOwnedBillsData_1, ownedBillsData, userBillNftData_1, combinedData, error_2;
133
- return __generator(this, function (_a) {
134
- switch (_a.label) {
135
- case 0:
136
- _a.trys.push([0, 3, , 4]);
137
- bonds = bondData.filter(function (bond) {
138
- return bond.billVersion !== BillVersion.FixedPrice &&
139
- (bond === null || bond === void 0 ? void 0 : bond.chainId) === chainId &&
140
- bond.type !== 'migration' &&
141
- bond.billAddress.toLowerCase() !== ACF_TO_ABOND.toLowerCase();
142
- });
143
- return [4 /*yield*/, fetchUserOwnedBills(chainId, account, bonds)];
144
- case 1:
145
- userOwnedBills_1 = _a.sent();
146
- mapUserOwnedBills_1 = bonds.map(function (bill) {
147
- return userOwnedBills_1.filter(function (b) { return b.address.toLowerCase() === bill.billAddress.toLowerCase(); });
148
- });
149
- userOwnedBillsData_1 = bonds.map(function (bill, i) { return ({
150
- index: bill.index,
151
- userOwnedBills: mapUserOwnedBills_1[i],
152
- }); });
153
- ownedBillsData = mapUserOwnedBills_1.flatMap(function (bs) {
154
- return bs.map(function (b) {
155
- return { id: b.id, billNftAddress: b.billNftAddress, contractAddress: b.address };
156
- });
157
- });
158
- return [4 /*yield*/, fetchUserOwnedBillNftData(ownedBillsData, chainId, bonds)
159
- // Merge userBillNftData into userOwnedBillsData
160
- ];
161
- case 2:
162
- userBillNftData_1 = _a.sent();
163
- combinedData = userOwnedBillsData_1.map(function (data) {
164
- var enrichedUserBills = data.userOwnedBills.map(function (bill) {
165
- var nftData = userBillNftData_1.find(function (nft) { return nft.id === parseInt(bill.id); });
166
- return __assign(__assign({}, bill), { nftData: nftData ? nftData : undefined });
167
- });
168
- return __assign(__assign({}, data), { userOwnedBills: enrichedUserBills });
169
- });
170
- console.log("combinedData");
171
- console.log(combinedData);
172
- console.log("combinedData");
173
- return [2 /*return*/, Promise.resolve(combinedData)];
174
- case 3:
175
- error_2 = _a.sent();
176
- console.error('Error fetching user owned bills data:', error_2);
177
- return [2 /*return*/, Promise.reject(error_2)];
178
- case 4: return [2 /*return*/];
179
- }
180
- });
181
- }); };
182
- var fetchUserOwnedBills = function (chainId, account, bonds) { return __awaiter(void 0, void 0, void 0, function () {
183
- var billIdCalls, billIds, billsPendingRewardCall, billDataCalls, billVersions, billData, pendingRewardsCall, result, i, billDataPos, data;
184
- var _a, _b, _c, _d, _e;
185
- return __generator(this, function (_f) {
186
- switch (_f.label) {
187
- case 0:
188
- billIdCalls = bonds.map(function (b) { return ({
189
- address: b.billAddress,
190
- name: 'getBillIds',
191
- params: [account],
192
- }); });
193
- return [4 /*yield*/, multicall(chainId, billAbi, billIdCalls, true, 15)];
194
- case 1:
195
- billIds = _f.sent();
196
- billsPendingRewardCall = [];
197
- billDataCalls = [];
198
- billVersions = [];
199
- billIds.forEach(function (idArray, index) {
200
- return idArray[0].forEach(function (id) {
201
- return id.gt(0) &&
202
- (billDataCalls.push({
203
- address: bonds[index].billAddress,
204
- name: bonds[index].billVersion !== BillVersion.V1 ? 'getBillInfo' : 'billInfo',
205
- params: [id],
206
- bond: bonds[index]
207
- }),
208
- billDataCalls.push({ address: bonds[index].billAddress, name: 'billNft' }),
209
- billsPendingRewardCall.push({
210
- address: bonds[index].billAddress,
211
- name: bonds[index].billVersion !== BillVersion.V1 ? 'claimablePayout' : 'pendingPayoutFor',
212
- params: [id],
213
- bond: bonds[index]
214
- }),
215
- billVersions.push(bonds[index].billVersion));
216
- });
217
- });
218
- return [4 /*yield*/, multicall(chainId, billAbi, billDataCalls, true, 150)];
219
- case 2:
220
- billData = _f.sent();
221
- return [4 /*yield*/, multicall(chainId, billAbi, billsPendingRewardCall)];
222
- case 3:
223
- pendingRewardsCall = _f.sent();
224
- result = [];
225
- for (i = 0; i < billsPendingRewardCall.length; i++) {
226
- billDataPos = i === 0 ? 0 : i * 2;
227
- data = billVersions[i] !== BillVersion.V1
228
- ? {
229
- address: billsPendingRewardCall[i].address,
230
- id: billsPendingRewardCall[i].params[0].toString(),
231
- payout: new BigNumber((_a = billData[billDataPos][0]) === null || _a === void 0 ? void 0 : _a.payout.toString())
232
- .minus((_b = billData[billDataPos][0]) === null || _b === void 0 ? void 0 : _b.payoutClaimed.toString())
233
- .toString(),
234
- billNftAddress: billData[billDataPos + 1][0].toString(),
235
- vesting: (_c = billData[billDataPos][0]) === null || _c === void 0 ? void 0 : _c.vesting.toString(),
236
- lastBlockTimestamp: (_d = billData[billDataPos][0]) === null || _d === void 0 ? void 0 : _d.lastClaimTimestamp.toString(),
237
- truePricePaid: (_e = billData[billDataPos][0]) === null || _e === void 0 ? void 0 : _e.truePricePaid.toString(),
238
- pendingRewards: pendingRewardsCall[i][0].toString(),
239
- bond: billsPendingRewardCall[i].bond
240
- }
241
- : {
242
- address: billsPendingRewardCall[i].address,
243
- id: billsPendingRewardCall[i].params[0].toString(),
244
- payout: billData[billDataPos][0].toString(),
245
- billNftAddress: billData[billDataPos + 1][0].toString(),
246
- vesting: billData[billDataPos][1].toString(),
247
- lastBlockTimestamp: billData[billDataPos][2].toString(),
248
- truePricePaid: billData[billDataPos][3].toString(),
249
- pendingRewards: pendingRewardsCall[i][0].toString(),
250
- bond: billsPendingRewardCall[i].bond
251
- };
252
- result.push(data);
253
- }
254
- return [2 /*return*/, result];
255
- }
256
- });
257
- }); };
258
127
  var _g = useState([]), userOwnedBillsData = _g[0], setUserOwnedBillsData = _g[1];
259
128
  useEffect(function () {
260
129
  var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
261
- var results, error_3;
130
+ var results, error_2;
262
131
  return __generator(this, function (_a) {
263
132
  switch (_a.label) {
264
133
  case 0:
@@ -266,14 +135,14 @@ var YourBonds = function (_a) {
266
135
  _a.label = 1;
267
136
  case 1:
268
137
  _a.trys.push([1, 3, , 4]);
269
- return [4 /*yield*/, Promise.all(MAINNET_CHAINS.map(function (chain) { return fetchUserOwnedBillsDataAsync(chain, account); }))];
138
+ return [4 /*yield*/, Promise.all(MAINNET_CHAINS.map(function (chain) { return fetchUserOwnedBillsDataAsync(chain, account, bondData); }))];
270
139
  case 2:
271
140
  results = _a.sent();
272
141
  setUserOwnedBillsData(results);
273
142
  return [3 /*break*/, 4];
274
143
  case 3:
275
- error_3 = _a.sent();
276
- console.error('Error fetching user owned bills data:', error_3);
144
+ error_2 = _a.sent();
145
+ console.error('Error fetching user owned bills data:', error_2);
277
146
  return [3 /*break*/, 4];
278
147
  case 4: return [2 /*return*/];
279
148
  }
@@ -314,7 +183,7 @@ var YourBonds = function (_a) {
314
183
  });
315
184
  return sortedBills.map(function (bill) {
316
185
  var _a, _b;
317
- return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill.bond); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")")] })), _jsxs(Flex, __assign({ className: "column column-pending" }, { children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")")] })), _jsx(Flex, __assign({ className: "column column-term" }, { children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Flex, __assign({ className: "column-claimall button" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
186
+ return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")")] })), _jsxs(Flex, __assign({ className: "column column-pending" }, { children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")")] })), _jsx(Flex, __assign({ className: "column column-term" }, { children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Flex, __assign({ className: "column-claimall button" }, { children: _jsx(Button, __assign({ disabled: !account, sx: {
318
187
  height: ['36px', '36px', '36px', '26px'],
319
188
  lineHeight: '12px',
320
189
  fontSize: '14px',
@@ -1,5 +1,6 @@
1
- import { BondsDataResponse, CleanedBondsState, UserBill } from '../../types/bonds';
2
1
  import { ChainId } from '../../enum/apeswaplists';
2
+ import { UserBill, UserOwnedBillsData } from '../../types/yourbonds';
3
+ import { BondsDataResponse } from '../../types/bonds';
3
4
  /**
4
5
  * Fetches user-owned bill NFT data for a given set of owned bills data, chain ID, and bills.
5
6
  * @param ownedBillsData An array of objects containing the ID, bill NFT address, and contract address of the owned bills.
@@ -12,4 +13,5 @@ export declare const fetchUserOwnedBillNftData: (ownedBillsData: {
12
13
  billNftAddress: string;
13
14
  contractAddress: string;
14
15
  }[], chainId: ChainId, bills: BondsDataResponse[]) => Promise<any[]>;
15
- export declare const fetchUserOwnedBills: (chainId: ChainId, account: string, bills: CleanedBondsState[]) => Promise<UserBill[]>;
16
+ export declare const fetchUserOwnedBillsDataAsync: (chainId: ChainId, account: string, bondData: BondsDataResponse[]) => Promise<UserOwnedBillsData[]>;
17
+ export declare const fetchUserOwnedBills: (chainId: ChainId, account: string, bonds: BondsDataResponse[]) => Promise<UserBill[]>;
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
13
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
14
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -39,6 +50,7 @@ import BigNumber from 'bignumber.js';
39
50
  import { getBillNftBatchData } from './getBillNftData';
40
51
  import multicall from '../../utils/multicall';
41
52
  import { BillVersion } from '../../enum/apeswaplists';
53
+ import { ACF_TO_ABOND } from '../../config/constants/addresses';
42
54
  /**
43
55
  * Fetches user-owned bill NFT data for a given set of owned bills data, chain ID, and bills.
44
56
  * @param ownedBillsData An array of objects containing the ID, bill NFT address, and contract address of the owned bills.
@@ -97,14 +109,67 @@ export var fetchUserOwnedBillNftData = function (ownedBillsData, chainId, bills)
97
109
  }
98
110
  });
99
111
  }); };
100
- export var fetchUserOwnedBills = function (chainId, account, bills) { return __awaiter(void 0, void 0, void 0, function () {
112
+ // MODIFIED FUNCTION FROM FRONTEND SPECIFICALLY FOR THE SDK
113
+ export var fetchUserOwnedBillsDataAsync = function (chainId, account, bondData) { return __awaiter(void 0, void 0, void 0, function () {
114
+ var bonds, userOwnedBills_1, mapUserOwnedBills_1, userOwnedBillsData, ownedBillsData, userBillNftData_1, combinedData, error_1;
115
+ return __generator(this, function (_a) {
116
+ switch (_a.label) {
117
+ case 0:
118
+ _a.trys.push([0, 3, , 4]);
119
+ bonds = bondData.filter(function (bond) {
120
+ return bond.billVersion !== BillVersion.FixedPrice &&
121
+ (bond === null || bond === void 0 ? void 0 : bond.chainId) === chainId &&
122
+ bond.type !== 'migration' &&
123
+ bond.billAddress.toLowerCase() !== ACF_TO_ABOND.toLowerCase();
124
+ });
125
+ return [4 /*yield*/, fetchUserOwnedBills(chainId, account, bonds)];
126
+ case 1:
127
+ userOwnedBills_1 = _a.sent();
128
+ mapUserOwnedBills_1 = bonds.map(function (bill) {
129
+ return userOwnedBills_1.filter(function (b) { return b.address.toLowerCase() === bill.billAddress.toLowerCase(); });
130
+ });
131
+ userOwnedBillsData = bonds.map(function (bill, i) { return ({
132
+ index: bill.index,
133
+ userOwnedBills: mapUserOwnedBills_1[i],
134
+ }); });
135
+ ownedBillsData = mapUserOwnedBills_1.flatMap(function (bs) {
136
+ return bs.map(function (b) {
137
+ return { id: b.id, billNftAddress: b.billNftAddress, contractAddress: b.address };
138
+ });
139
+ });
140
+ return [4 /*yield*/, fetchUserOwnedBillNftData(ownedBillsData, chainId, bonds)
141
+ // Merge userBillNftData into userOwnedBillsData
142
+ ];
143
+ case 2:
144
+ userBillNftData_1 = _a.sent();
145
+ combinedData = userOwnedBillsData.map(function (data) {
146
+ var enrichedUserBills = data.userOwnedBills.map(function (bill) {
147
+ var nftData = userBillNftData_1.find(function (nft) { return nft.id === parseInt(bill.id); });
148
+ return __assign(__assign({}, bill), { nftData: nftData ? nftData : undefined });
149
+ });
150
+ return __assign(__assign({}, data), { userOwnedBills: enrichedUserBills });
151
+ });
152
+ console.log("combinedData");
153
+ console.log(combinedData);
154
+ console.log("combinedData");
155
+ return [2 /*return*/, Promise.resolve(combinedData)];
156
+ case 3:
157
+ error_1 = _a.sent();
158
+ console.error('Error fetching user owned bills data:', error_1);
159
+ return [2 /*return*/, Promise.reject(error_1)];
160
+ case 4: return [2 /*return*/];
161
+ }
162
+ });
163
+ }); };
164
+ // MODIFIED FUNCTION FROM FRONTEND SPECIFICALLY FOR THE SDK
165
+ export var fetchUserOwnedBills = function (chainId, account, bonds) { return __awaiter(void 0, void 0, void 0, function () {
101
166
  var billIdCalls, billIds, billsPendingRewardCall, billDataCalls, billVersions, billData, pendingRewardsCall, result, i, billDataPos, data;
102
167
  var _a, _b, _c, _d, _e;
103
168
  return __generator(this, function (_f) {
104
169
  switch (_f.label) {
105
170
  case 0:
106
- billIdCalls = bills.map(function (b) { return ({
107
- address: b.contractAddress,
171
+ billIdCalls = bonds.map(function (b) { return ({
172
+ address: b.billAddress,
108
173
  name: 'getBillIds',
109
174
  params: [account],
110
175
  }); });
@@ -118,17 +183,19 @@ export var fetchUserOwnedBills = function (chainId, account, bills) { return __a
118
183
  return idArray[0].forEach(function (id) {
119
184
  return id.gt(0) &&
120
185
  (billDataCalls.push({
121
- address: bills[index].contractAddress,
122
- name: bills[index].billVersion !== BillVersion.V1 ? 'getBillInfo' : 'billInfo',
186
+ address: bonds[index].billAddress,
187
+ name: bonds[index].billVersion !== BillVersion.V1 ? 'getBillInfo' : 'billInfo',
123
188
  params: [id],
189
+ bond: bonds[index]
124
190
  }),
125
- billDataCalls.push({ address: bills[index].contractAddress, name: 'billNft' }),
191
+ billDataCalls.push({ address: bonds[index].billAddress, name: 'billNft' }),
126
192
  billsPendingRewardCall.push({
127
- address: bills[index].contractAddress,
128
- name: bills[index].billVersion !== BillVersion.V1 ? 'claimablePayout' : 'pendingPayoutFor',
193
+ address: bonds[index].billAddress,
194
+ name: bonds[index].billVersion !== BillVersion.V1 ? 'claimablePayout' : 'pendingPayoutFor',
129
195
  params: [id],
196
+ bond: bonds[index]
130
197
  }),
131
- billVersions.push(bills[index].billVersion));
198
+ billVersions.push(bonds[index].billVersion));
132
199
  });
133
200
  });
134
201
  return [4 /*yield*/, multicall(chainId, billAbi, billDataCalls, true, 150)];
@@ -152,6 +219,7 @@ export var fetchUserOwnedBills = function (chainId, account, bills) { return __a
152
219
  lastBlockTimestamp: (_d = billData[billDataPos][0]) === null || _d === void 0 ? void 0 : _d.lastClaimTimestamp.toString(),
153
220
  truePricePaid: (_e = billData[billDataPos][0]) === null || _e === void 0 ? void 0 : _e.truePricePaid.toString(),
154
221
  pendingRewards: pendingRewardsCall[i][0].toString(),
222
+ bond: billsPendingRewardCall[i].bond
155
223
  }
156
224
  : {
157
225
  address: billsPendingRewardCall[i].address,
@@ -162,6 +230,7 @@ export var fetchUserOwnedBills = function (chainId, account, bills) { return __a
162
230
  lastBlockTimestamp: billData[billDataPos][2].toString(),
163
231
  truePricePaid: billData[billDataPos][3].toString(),
164
232
  pendingRewards: pendingRewardsCall[i][0].toString(),
233
+ bond: billsPendingRewardCall[i].bond
165
234
  };
166
235
  result.push(data);
167
236
  }
@@ -57,16 +57,12 @@ import { BigNumber } from 'bignumber.js';
57
57
  import { getFirstNonZeroDigits } from '../../utils/roundNumber';
58
58
  import { TooltipBubble, Button, Svg, ListTag } from '../uikit-sdk';
59
59
  import { UserBillTooltipText } from '../../enum/tooltips';
60
- import billAbi from '../../config/abi/bond.json';
61
60
  import TokenImage from '../uikit-sdk/TokenImage';
62
61
  import { getBalanceNumber } from '../../utils/getBalanceNumber';
63
- import multicall from '../../utils/multicall';
64
- import { BillVersion } from '../../enum/apeswaplists';
65
- import { ACF_TO_ABOND } from '../../config/constants/addresses';
66
62
  import { MAINNET_CHAINS } from '../../config/constants/chains';
67
63
  import { getPendingVesting } from '../../hooks/usePendingVesting';
68
64
  import { formatNumberSI } from '../../utils/formatNumber';
69
- import { fetchUserOwnedBillNftData } from '../YourBonds/fetchBillsUser';
65
+ import { fetchUserOwnedBillsDataAsync } from '../YourBonds/fetchBillsUser';
70
66
  var YourBondsModal = function (_a) {
71
67
  var isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
72
68
  if (!isOpen)
@@ -82,136 +78,9 @@ var YourBondsModal = function (_a) {
82
78
  });
83
79
  }, [bondAddress]);
84
80
  var _d = useState([]), userOwnedBillsData = _d[0], setUserOwnedBillsData = _d[1];
85
- var fetchUserOwnedBillsDataAsync = function (chainId, account) { return __awaiter(void 0, void 0, void 0, function () {
86
- var bonds, userOwnedBills_1, mapUserOwnedBills_1, userOwnedBillsData_1, ownedBillsData, userBillNftData_1, combinedData, error_1;
87
- return __generator(this, function (_a) {
88
- switch (_a.label) {
89
- case 0:
90
- _a.trys.push([0, 3, , 4]);
91
- bonds = bondData.filter(function (bond) {
92
- return bond.billVersion !== BillVersion.FixedPrice &&
93
- (bond === null || bond === void 0 ? void 0 : bond.chainId) === chainId &&
94
- bond.type !== 'migration' &&
95
- bond.billAddress.toLowerCase() !== ACF_TO_ABOND.toLowerCase();
96
- });
97
- return [4 /*yield*/, fetchUserOwnedBills(chainId, account, bonds)];
98
- case 1:
99
- userOwnedBills_1 = _a.sent();
100
- mapUserOwnedBills_1 = bonds.map(function (bill) {
101
- return userOwnedBills_1.filter(function (b) { return b.address.toLowerCase() === bill.billAddress.toLowerCase(); });
102
- });
103
- userOwnedBillsData_1 = bonds.map(function (bill, i) { return ({
104
- index: bill.index,
105
- userOwnedBills: mapUserOwnedBills_1[i],
106
- }); });
107
- ownedBillsData = mapUserOwnedBills_1.flatMap(function (bs) {
108
- return bs.map(function (b) {
109
- return { id: b.id, billNftAddress: b.billNftAddress, contractAddress: b.address };
110
- });
111
- });
112
- return [4 /*yield*/, fetchUserOwnedBillNftData(ownedBillsData, chainId, bonds)
113
- // Merge userBillNftData into userOwnedBillsData
114
- ];
115
- case 2:
116
- userBillNftData_1 = _a.sent();
117
- combinedData = userOwnedBillsData_1.map(function (data) {
118
- var enrichedUserBills = data.userOwnedBills.map(function (bill) {
119
- var nftData = userBillNftData_1.find(function (nft) { return nft.id === parseInt(bill.id); });
120
- return __assign(__assign({}, bill), { nftData: nftData ? nftData : undefined });
121
- });
122
- return __assign(__assign({}, data), { userOwnedBills: enrichedUserBills });
123
- });
124
- console.log("combinedData");
125
- console.log(combinedData);
126
- console.log("combinedData");
127
- return [2 /*return*/, Promise.resolve(combinedData)];
128
- case 3:
129
- error_1 = _a.sent();
130
- console.error('Error fetching user owned bills data:', error_1);
131
- return [2 /*return*/, Promise.reject(error_1)];
132
- case 4: return [2 /*return*/];
133
- }
134
- });
135
- }); };
136
- var fetchUserOwnedBills = function (chainId, account, bonds) { return __awaiter(void 0, void 0, void 0, function () {
137
- var billIdCalls, billIds, billsPendingRewardCall, billDataCalls, billVersions, billData, pendingRewardsCall, result, i, billDataPos, data;
138
- var _a, _b, _c, _d, _e;
139
- return __generator(this, function (_f) {
140
- switch (_f.label) {
141
- case 0:
142
- billIdCalls = bonds.map(function (b) { return ({
143
- address: b.billAddress,
144
- name: 'getBillIds',
145
- params: [account],
146
- }); });
147
- return [4 /*yield*/, multicall(chainId, billAbi, billIdCalls, true, 15)];
148
- case 1:
149
- billIds = _f.sent();
150
- billsPendingRewardCall = [];
151
- billDataCalls = [];
152
- billVersions = [];
153
- billIds.forEach(function (idArray, index) {
154
- return idArray[0].forEach(function (id) {
155
- return id.gt(0) &&
156
- (billDataCalls.push({
157
- address: bonds[index].billAddress,
158
- name: bonds[index].billVersion !== BillVersion.V1 ? 'getBillInfo' : 'billInfo',
159
- params: [id],
160
- bond: bonds[index]
161
- }),
162
- billDataCalls.push({ address: bonds[index].billAddress, name: 'billNft' }),
163
- billsPendingRewardCall.push({
164
- address: bonds[index].billAddress,
165
- name: bonds[index].billVersion !== BillVersion.V1 ? 'claimablePayout' : 'pendingPayoutFor',
166
- params: [id],
167
- bond: bonds[index]
168
- }),
169
- billVersions.push(bonds[index].billVersion));
170
- });
171
- });
172
- return [4 /*yield*/, multicall(chainId, billAbi, billDataCalls, true, 150)];
173
- case 2:
174
- billData = _f.sent();
175
- return [4 /*yield*/, multicall(chainId, billAbi, billsPendingRewardCall)];
176
- case 3:
177
- pendingRewardsCall = _f.sent();
178
- result = [];
179
- for (i = 0; i < billsPendingRewardCall.length; i++) {
180
- billDataPos = i === 0 ? 0 : i * 2;
181
- data = billVersions[i] !== BillVersion.V1
182
- ? {
183
- address: billsPendingRewardCall[i].address,
184
- id: billsPendingRewardCall[i].params[0].toString(),
185
- payout: new BigNumber((_a = billData[billDataPos][0]) === null || _a === void 0 ? void 0 : _a.payout.toString())
186
- .minus((_b = billData[billDataPos][0]) === null || _b === void 0 ? void 0 : _b.payoutClaimed.toString())
187
- .toString(),
188
- billNftAddress: billData[billDataPos + 1][0].toString(),
189
- vesting: (_c = billData[billDataPos][0]) === null || _c === void 0 ? void 0 : _c.vesting.toString(),
190
- lastBlockTimestamp: (_d = billData[billDataPos][0]) === null || _d === void 0 ? void 0 : _d.lastClaimTimestamp.toString(),
191
- truePricePaid: (_e = billData[billDataPos][0]) === null || _e === void 0 ? void 0 : _e.truePricePaid.toString(),
192
- pendingRewards: pendingRewardsCall[i][0].toString(),
193
- bond: billsPendingRewardCall[i].bond
194
- }
195
- : {
196
- address: billsPendingRewardCall[i].address,
197
- id: billsPendingRewardCall[i].params[0].toString(),
198
- payout: billData[billDataPos][0].toString(),
199
- billNftAddress: billData[billDataPos + 1][0].toString(),
200
- vesting: billData[billDataPos][1].toString(),
201
- lastBlockTimestamp: billData[billDataPos][2].toString(),
202
- truePricePaid: billData[billDataPos][3].toString(),
203
- pendingRewards: pendingRewardsCall[i][0].toString(),
204
- bond: billsPendingRewardCall[i].bond
205
- };
206
- result.push(data);
207
- }
208
- return [2 /*return*/, result];
209
- }
210
- });
211
- }); };
212
81
  useEffect(function () {
213
82
  var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
214
- var results, error_2;
83
+ var results, error_1;
215
84
  return __generator(this, function (_a) {
216
85
  switch (_a.label) {
217
86
  case 0:
@@ -219,14 +88,14 @@ var YourBondsModal = function (_a) {
219
88
  _a.label = 1;
220
89
  case 1:
221
90
  _a.trys.push([1, 3, , 4]);
222
- return [4 /*yield*/, Promise.all(MAINNET_CHAINS.map(function (chain) { return fetchUserOwnedBillsDataAsync(chain, account); }))];
91
+ return [4 /*yield*/, Promise.all(MAINNET_CHAINS.map(function (chain) { return fetchUserOwnedBillsDataAsync(chain, account, bondData); }))];
223
92
  case 2:
224
93
  results = _a.sent();
225
94
  setUserOwnedBillsData(results);
226
95
  return [3 /*break*/, 4];
227
96
  case 3:
228
- error_2 = _a.sent();
229
- console.error('Error fetching user owned bills data:', error_2);
97
+ error_1 = _a.sent();
98
+ console.error('Error fetching user owned bills data:', error_1);
230
99
  return [3 /*break*/, 4];
231
100
  case 4: return [2 /*return*/];
232
101
  }
@@ -251,7 +120,7 @@ var YourBondsModal = function (_a) {
251
120
  var userBill = data.userOwnedBills.find(function (bill) { return bill.bond.billAddress.toLowerCase() === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
252
121
  console.log("USER BILL LOG");
253
122
  console.log(userBill);
254
- return userBill ? (_jsx(React.Fragment, { children: _jsx(Flex, __assign({ className: "yourbondsmodal backdrop" }, { children: _jsxs(Flex, __assign({ className: "yourbondsmodal content" }, { children: [_jsx(Flex, __assign({ className: "yourbondsmodal header" }, { children: _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) })) })), _jsxs(Flex, __assign({ className: "yourbondsmodal table-container" }, { children: [_jsx(Flex, __assign({ className: "yourbondsmodal bondimage" }, { children: _jsx("img", { src: (_a = userBill.nftData) === null || _a === void 0 ? void 0 : _a.data.image }) })), _jsxs(Flex, __assign({ className: "yourbondsmodal yourbondinfo" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bondicon" }, { children: _jsx(TokenImage, { symbol: (_b = userBill.bond.showcaseTokenName) !== null && _b !== void 0 ? _b : userBill.bond.payoutTokenName, size: 40 }) })), _jsx(Flex, __assign({ className: "title-container bondname" }, { children: (_c = userBill.bond) === null || _c === void 0 ? void 0 : _c.showcaseTokenName })), _jsx(Flex, __assign({ className: "title-container tokentags" }, { children: _jsx(ListTag, { text: (_e = (_d = userBill.bond) === null || _d === void 0 ? void 0 : _d.tags) === null || _e === void 0 ? void 0 : _e[0], variant: ((_g = (_f = userBill.bond) === null || _f === void 0 ? void 0 : _f.tags) === null || _g === void 0 ? void 0 : _g[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo blocks-container" }, { children: [_jsx(Flex, __assign({ className: "yourbondinfo-block row-traits" }, { children: _jsx(Flex, __assign({ className: "yourbondinfo-block header" }, { children: "Traits" })) })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-vested" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: ["Fully Vested", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, { className: "block-info icon" }), _jsx(Flex, __assign({ className: "block-info text" }, { children: getPendingVesting(userBill.lastBlockTimestamp, userBill.vesting) }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-pending" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: ["Pending", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, __assign({ className: "block-info icon" }, { children: _jsx(TokenImage, { symbol: (_h = userBill.bond.showcaseTokenName) !== null && _h !== void 0 ? _h : userBill.bond.payoutTokenName, size: 25 }) })), _jsxs(Flex, __assign({ className: "block-info text" }, { children: [formatNumberSI(parseFloat(totalPending(userBill).toFixed(4)), 4), "($".concat((totalPending(userBill) * ((_j = parseFloat(earnTokenPrice(userBill.bond))) !== null && _j !== void 0 ? _j : 0)).toFixed(2), ")")] }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-claimable" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: ["Claimable", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.Claimable }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, __assign({ className: "block-info icon" }, { children: _jsx(TokenImage, { symbol: (_k = userBill.bond.showcaseTokenName) !== null && _k !== void 0 ? _k : userBill.bond.payoutTokenName, size: 25 }) })), _jsxs(Flex, __assign({ className: "block-info text" }, { children: [formatNumberSI(parseFloat(claimable(userBill).toFixed(4)), 4), "($".concat((claimable(userBill) * ((_l = parseFloat(earnTokenPrice(userBill.bond))) !== null && _l !== void 0 ? _l : 0)).toFixed(2), ")")] }))] }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo button-container" }, { children: [_jsx(Flex, __assign({ className: "button-container claim" }, { children: _jsx(Button, { children: "CLAIM" }) })), _jsx(Flex, __assign({ className: "button-container transfer" }, { children: _jsx(Button, { children: "TRANSFER" }) }))] }))] }))] }))] })) })) }, userBill.bond.billAddress)) : null;
123
+ return userBill ? (_jsx(React.Fragment, { children: _jsx(Flex, __assign({ className: "yourbondsmodal backdrop" }, { children: _jsxs(Flex, __assign({ className: "yourbondsmodal content" }, { children: [_jsx(Flex, __assign({ className: "yourbondsmodal header" }, { children: _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) })) })), _jsxs(Flex, __assign({ className: "yourbondsmodal table-container" }, { children: [_jsx(Flex, __assign({ className: "yourbondsmodal bondimage" }, { children: _jsx("img", { src: (_a = userBill.nftData) === null || _a === void 0 ? void 0 : _a.data.image }) })), _jsxs(Flex, __assign({ className: "yourbondsmodal yourbondinfo" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bondicon" }, { children: _jsx(TokenImage, { symbol: (_b = userBill.bond.showcaseTokenName) !== null && _b !== void 0 ? _b : userBill.bond.payoutTokenName, size: 40 }) })), _jsx(Flex, __assign({ className: "title-container bondname" }, { children: (_c = userBill.bond) === null || _c === void 0 ? void 0 : _c.showcaseTokenName })), _jsx(Flex, __assign({ className: "title-container tokentags" }, { children: _jsx(ListTag, { text: (_e = (_d = userBill.bond) === null || _d === void 0 ? void 0 : _d.tags) === null || _e === void 0 ? void 0 : _e[0], variant: ((_g = (_f = userBill.bond) === null || _f === void 0 ? void 0 : _f.tags) === null || _g === void 0 ? void 0 : _g[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) })), "#", userBill.id] })), _jsxs(Flex, __assign({ className: "yourbondinfo blocks-container" }, { children: [_jsx(Flex, __assign({ className: "yourbondinfo-block row-traits" }, { children: _jsx(Flex, __assign({ className: "yourbondinfo-block header" }, { children: "Traits" })) })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-vested" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: ["Fully Vested", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, { className: "block-info icon" }), _jsx(Flex, __assign({ className: "block-info text" }, { children: getPendingVesting(userBill.lastBlockTimestamp, userBill.vesting) }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-pending" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: ["Pending", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, __assign({ className: "block-info icon" }, { children: _jsx(TokenImage, { symbol: (_h = userBill.bond.showcaseTokenName) !== null && _h !== void 0 ? _h : userBill.bond.payoutTokenName, size: 25 }) })), _jsxs(Flex, __assign({ className: "block-info text" }, { children: [formatNumberSI(parseFloat(totalPending(userBill).toFixed(4)), 4), "($".concat((totalPending(userBill) * ((_j = parseFloat(earnTokenPrice(userBill.bond))) !== null && _j !== void 0 ? _j : 0)).toFixed(2), ")")] }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-claimable" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: ["Claimable", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.Claimable }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, __assign({ className: "block-info icon" }, { children: _jsx(TokenImage, { symbol: (_k = userBill.bond.showcaseTokenName) !== null && _k !== void 0 ? _k : userBill.bond.payoutTokenName, size: 25 }) })), _jsxs(Flex, __assign({ className: "block-info text" }, { children: [formatNumberSI(parseFloat(claimable(userBill).toFixed(4)), 4), "($".concat((claimable(userBill) * ((_l = parseFloat(earnTokenPrice(userBill.bond))) !== null && _l !== void 0 ? _l : 0)).toFixed(2), ")")] }))] }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo button-container" }, { children: [_jsx(Flex, __assign({ className: "button-container claim" }, { children: _jsx(Button, { children: "CLAIM" }) })), _jsx(Flex, __assign({ className: "button-container transfer" }, { children: _jsx(Button, { children: "TRANSFER" }) }))] }))] }))] }))] })) })) }, userBill.bond.billAddress)) : null;
255
124
  }) })));
256
125
  };
257
126
  export default YourBondsModal;
@@ -1,4 +1,4 @@
1
- import { BillsConfig, BillVersion, Token, ChainId } from '../enum/apeswaplists';
1
+ import { ChainId } from '../enum/apeswaplists';
2
2
  export interface BondsDataResponse {
3
3
  index: number;
4
4
  cmcId?: number;
@@ -38,94 +38,6 @@ export interface BondsDataResponse {
38
38
  billVersion?: string;
39
39
  earnToken?: EarnToken;
40
40
  }
41
- export interface UserBillNft {
42
- image: string;
43
- tokenId: string;
44
- attributes: {
45
- trait_type: string;
46
- value: string;
47
- }[];
48
- }
49
- export interface UserBill {
50
- address: string;
51
- id: string;
52
- vesting: string;
53
- payout: string;
54
- totalPayout?: string;
55
- truePricePaid: string;
56
- lastBlockTimestamp: string;
57
- pendingRewards: string;
58
- billNftAddress: string;
59
- nftData?: UserBillNft;
60
- }
61
- export interface Bills extends BillsConfig {
62
- price?: string;
63
- priceUsd?: string;
64
- vestingTime?: string;
65
- discount?: string;
66
- currentDebt?: string;
67
- currentFee?: string;
68
- debtDecay?: string;
69
- debtRatio?: string;
70
- totalDebt?: string;
71
- totalPayoutGiven?: string;
72
- totalPrincipalBilled?: string;
73
- controlVariable?: string;
74
- minimumPrice?: string;
75
- maxPayout?: string;
76
- maxDebt?: string;
77
- lpPriceUsd?: number;
78
- earnTokenPrice?: number;
79
- billNftAddress?: string;
80
- userOwnedBillsData?: UserBill[];
81
- userOwnedBillsNftData?: UserBillNft[];
82
- maxTotalPayout?: string;
83
- lpPrice?: number;
84
- maxPayoutTokens?: string;
85
- startVestingTimestamp?: string;
86
- totalBonusRewards?: string;
87
- featuredURLS?: string[];
88
- partnersURLS?: string[];
89
- }
90
- export interface CleanedBondsState {
91
- index: number;
92
- cmcId: number | null;
93
- chainId: ChainId;
94
- vestingTerm?: number;
95
- principalTokenName: string;
96
- principalToken: string;
97
- principalTokenDecimals: number;
98
- payoutTokenName: string;
99
- payoutToken: string;
100
- payoutTokenDecimals: number;
101
- soldOut?: boolean;
102
- tags?: string[];
103
- contractAddress: string;
104
- billNftAddress: string;
105
- inactive?: boolean;
106
- showcaseTokenName?: string;
107
- twitter?: string;
108
- projectLink?: string;
109
- audit?: string;
110
- shortDescription?: string;
111
- fullDescription?: string;
112
- lpToken?: Token;
113
- billType?: string;
114
- billVersion?: BillVersion;
115
- featuredURLS?: string[];
116
- partnersURLS?: string[];
117
- discount?: number;
118
- principalTokenPrice?: string;
119
- payoutTokenPrice?: string;
120
- tokensRemaining?: string;
121
- maxTotalPayout?: string;
122
- trueBillPrice?: string;
123
- maxPayout?: string;
124
- totalPayoutGiven?: string;
125
- isHotBond?: boolean;
126
- userOwnedBillsData?: UserBill[];
127
- userOwnedBillsNftData?: UserBillNft[];
128
- }
129
41
  export interface EarnToken {
130
42
  symbol: string;
131
43
  address: {
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.361",
6
+ "version": "1.0.362",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",