@carrot-protocol/boost-http-client 0.2.16-group-refactor1-dev-50c976e → 0.2.16-token22-dev-158437a

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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AnchorProvider, web3 } from "@coral-xyz/anchor";
2
- import { GetBankResponse, GetUserResponse, GetGroupResponse, GetUserRequest } from "./types";
2
+ import { GetBankResponse, GetUserResponse, GetGroupResponse, GetGroupsResponse } from "./types";
3
3
  export * from "./types";
4
4
  export * from "./utils";
5
5
  export * as Common from "@carrot-protocol/clend-common";
@@ -22,12 +22,13 @@ export declare class Client {
22
22
  * @returns Index details
23
23
  */
24
24
  index(): Promise<any>;
25
+ getUser(user: web3.PublicKey, groups: web3.PublicKey[], getClendAccountSummary: boolean): Promise<GetUserResponse>;
25
26
  /**
26
- * Get user details for a wallet
27
- * @param user wallet public key
28
- * @returns User details
27
+ * Get all groups
28
+ * @param includeBankData Whether to include bank data in the response, if not strictly necessary keep false
29
+ * @returns All groups
29
30
  */
30
- getUser(request: GetUserRequest): Promise<GetUserResponse>;
31
+ getGroups(includeBankData: boolean): Promise<GetGroupsResponse>;
31
32
  /**
32
33
  * Get market details
33
34
  * @param groupAddress group public key
@@ -40,22 +41,29 @@ export declare class Client {
40
41
  * @returns Bank details
41
42
  */
42
43
  getBank(bankAddress: web3.PublicKey): Promise<GetBankResponse>;
44
+ deposit(clendGroup: web3.PublicKey, clendAccount: web3.PublicKey | null, inputTokenMint: web3.PublicKey, uiAmount: number): Promise<string>;
45
+ withdraw(clendAccount: web3.PublicKey, outputTokenMint: web3.PublicKey, uiAmount: number, withdrawAll: boolean): Promise<string>;
43
46
  /**
44
47
  * Deposit collateral and create a leveraged position
45
48
  * @param request Deposit leverage request parameters
46
49
  * @returns Deposit leverage operation result
47
50
  */
48
- depositLeverage(inputMint: web3.PublicKey, assetMint: web3.PublicKey, liabilityMint: web3.PublicKey, uiAmount: number, leverage: number, slippageBps: number): Promise<string>;
51
+ depositLeverage(clendGroup: web3.PublicKey, clendAccount: web3.PublicKey | null, inputTokenMint: web3.PublicKey, assetTokenMint: web3.PublicKey, liabilityTokenMint: web3.PublicKey, uiAmount: number, leverage: number, slippageBps: number): Promise<string>;
49
52
  /**
50
53
  * Adjust the leverage of an existing position
51
54
  * @param request Adjust leverage request parameters
52
55
  * @returns Adjust leverage operation result
53
56
  */
54
- adjustLeverage(leverage: number, slippageBps: number): Promise<any>;
57
+ adjustLeverage(clendAccount: web3.PublicKey, assetTokenMint: web3.PublicKey, liabilityTokenMint: web3.PublicKey, leverage: number, slippageBps: number): Promise<string>;
55
58
  /**
56
59
  * Withdraw from or close a leveraged position
57
60
  * @param request Withdraw leverage request parameters
58
61
  * @returns Withdraw leverage operation result
59
62
  */
60
- withdrawLeverage(selectedTokenMint: web3.PublicKey, uiAmount: number, slippageBps: number, withdrawAll: boolean): Promise<any>;
63
+ withdrawLeverage(clendAccount: web3.PublicKey, outputTokenMint: web3.PublicKey, assetTokenMint: web3.PublicKey, liabilityTokenMint: web3.PublicKey, uiAmount: number, slippageBps: number, withdrawAll: boolean): Promise<string>;
64
+ /**
65
+ * Withdraw emissions from a bank
66
+ * @returns Withdraw emissions operation result
67
+ */
68
+ withdrawEmissions(): Promise<string>;
61
69
  }
package/dist/index.js CHANGED
@@ -99,128 +99,160 @@ class Client {
99
99
  async index() {
100
100
  return handleApiCall(() => this.http.get(""));
101
101
  }
102
- /**
103
- * Get user details for a wallet
104
- * @param user wallet public key
105
- * @returns User details
106
- */
107
- async getUser(request) {
108
- // use loaded wallet if not provided
109
- let user = request.user;
110
- if (!user) {
111
- user = this.address();
112
- }
113
- const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}&getClendAccountSummary=${request.getClendAccountSummary}`));
102
+ async getUser(user, groups, getClendAccountSummary) {
103
+ // Make the API call to fetch the raw user data as a string.
104
+ const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}&groups=${groups.map((g) => g.toString()).join(",")}&getClendAccountSummary=${getClendAccountSummary}`));
105
+ // Parse the raw string body into a JSON object.
114
106
  const jsonRawResponse = JSON.parse(body);
115
- // get tokens still in user wallet
107
+ // 1. Parse Wallet Balances
108
+ // This section correctly iterates through the wallet balances and creates typed objects.
109
+ const walletBalances = (jsonRawResponse.wallet.balances || []).map((b) => ({
110
+ mint: new anchor_1.web3.PublicKey(b.mint),
111
+ balance: new anchor_1.BN(b.balance, "hex"),
112
+ balanceUi: Number(b.balanceUi),
113
+ }));
116
114
  const wallet = {
117
- usdcBalance: new anchor_1.BN(jsonRawResponse.wallet.usdcBalance, "hex"),
118
- usdcBalanceUi: Number(jsonRawResponse.wallet.usdcBalanceUi),
119
- jlpBalance: new anchor_1.BN(jsonRawResponse.wallet.jlpBalance, "hex"),
120
- jlpBalanceUi: Number(jsonRawResponse.wallet.jlpBalanceUi),
121
- solBalance: new anchor_1.BN(jsonRawResponse.wallet.solBalance, "hex"),
122
- solBalanceUi: Number(jsonRawResponse.wallet.solBalanceUi),
115
+ balances: walletBalances,
123
116
  };
124
- // if no clend account, return undefined for clend
125
- if (!jsonRawResponse.clendAccount) {
126
- return {
127
- wallet,
128
- clendAccount: undefined,
129
- summary: [],
130
- };
131
- }
132
- // parse lending account balances
133
- const balances = [];
134
- for (const b of jsonRawResponse.clendAccount.balances) {
135
- balances.push({
136
- mint: new anchor_1.web3.PublicKey(b.mint),
137
- bank: new anchor_1.web3.PublicKey(b.bank),
138
- assetBalance: new anchor_1.BN(b.assetBalance, "hex"),
139
- assetBalanceUi: Number(b.assetBalanceUi),
140
- assetValue: Number(b.assetValue),
141
- liabilityBalance: new anchor_1.BN(b.liabilityBalance, "hex"),
142
- liabilityBalanceUi: Number(b.liabilityBalanceUi),
143
- liabilityValue: Number(b.liabilityValue),
144
- price: Number(b.price),
117
+ // 2. Parse Clend Accounts and their Summaries
118
+ // This is the main refactored section. It iterates through the clendAccounts array
119
+ // from the response, which contains both the account data and its summary.
120
+ const clendAccounts = (jsonRawResponse.clendAccounts || []).map((accountData) => {
121
+ // A. Parse the main ClendAccount object
122
+ const rawClendAccount = accountData.clendAccount;
123
+ const clendAccountBalances = (rawClendAccount.balances || []).map((b) => {
124
+ const liquidation = b.liquidation
125
+ ? {
126
+ price: Number(b.liquidation.price),
127
+ changePercentage: Number(b.liquidation.changePercentage),
128
+ }
129
+ : null;
130
+ const emissionsOutstandingAndUnclaimed = new anchor_1.BN(b.emissionsOutstandingAndUnclaimed, "hex");
131
+ return {
132
+ mint: new anchor_1.web3.PublicKey(b.mint),
133
+ bank: new anchor_1.web3.PublicKey(b.bank),
134
+ tokenYieldApy: Number(b.tokenYieldApy),
135
+ assetBalance: new anchor_1.BN(b.assetBalance, "hex"),
136
+ assetBalanceUi: Number(b.assetBalanceUi),
137
+ assetValue: Number(b.assetValue),
138
+ assetEmissionsApy: Number(b.assetEmissionsApy),
139
+ liabilityBalance: new anchor_1.BN(b.liabilityBalance, "hex"),
140
+ liabilityBalanceUi: Number(b.liabilityBalanceUi),
141
+ liabilityValue: Number(b.liabilityValue),
142
+ liabilityBorrowCostApy: Number(b.liabilityBorrowCostApy),
143
+ liabilityEmissionsApy: Number(b.liabilityEmissionsApy),
144
+ emissionsOutstandingAndUnclaimed,
145
+ emissionsOutstandingAndUnclaimedUi: Number(b.emissionsOutstandingAndUnclaimedUi),
146
+ price: Number(b.price),
147
+ liquidation,
148
+ };
145
149
  });
146
- }
147
- // create clend account
148
- const clendAccount = {
149
- balances,
150
- netValue: Number(jsonRawResponse.clendAccount.netValue),
151
- netApy: Number(jsonRawResponse.clendAccount.netApy),
152
- pnl: Number(jsonRawResponse.clendAccount.pnl),
153
- totalAssetValue: Number(jsonRawResponse.clendAccount.totalAssetValue),
154
- totalLiabilityValue: Number(jsonRawResponse.clendAccount.totalLiabilityValue),
155
- healthFactorNotional: Number(jsonRawResponse.clendAccount.healthFactorNotional),
156
- healthFactorRiskAdjusted: Number(jsonRawResponse.clendAccount.healthFactorRiskAdjusted),
157
- notionalLeverage: Number(jsonRawResponse.clendAccount.notionalLeverage),
158
- riskAdjustedLeverage: Number(jsonRawResponse.clendAccount.riskAdjustedLeverage),
159
- liquidationPrice: Number(jsonRawResponse.clendAccount.liquidationPrice),
160
- liquidationPriceChangePercentage: Number(jsonRawResponse.clendAccount.liquidationPriceChangePercentage),
161
- notionalLtv: Number(jsonRawResponse.clendAccount.notionalLtv),
162
- riskAdjustedLtv: Number(jsonRawResponse.clendAccount.riskAdjustedLtv),
163
- };
164
- // get tx summary for each account
165
- const summary = [];
166
- for (const s of jsonRawResponse.summary) {
167
- const txSummary = {
168
- txSig: s.txSig,
169
- time: s.time,
170
- clendAccount: new anchor_1.web3.PublicKey(s.clendAccount),
171
- clendAccountAuthority: new anchor_1.web3.PublicKey(s.clendAccountAuthority),
172
- clendGroup: new anchor_1.web3.PublicKey(s.clendGroup),
173
- action: s.action,
174
- input: undefined,
175
- events: [],
150
+ const clendAccount = {
151
+ key: new anchor_1.web3.PublicKey(rawClendAccount.key),
152
+ group: new anchor_1.web3.PublicKey(rawClendAccount.group),
153
+ balances: clendAccountBalances,
154
+ netValue: Number(rawClendAccount.netValue),
155
+ netApy: Number(rawClendAccount.netApy),
156
+ pnl: Number(rawClendAccount.pnl),
157
+ totalEmissionsApy: Number(rawClendAccount.totalEmissionsApy),
158
+ totalAssetValue: Number(rawClendAccount.totalAssetValue),
159
+ totalLiabilityValue: Number(rawClendAccount.totalLiabilityValue),
160
+ healthFactorNotional: Number(rawClendAccount.healthFactorNotional),
161
+ healthFactorRiskAdjusted: Number(rawClendAccount.healthFactorRiskAdjusted),
162
+ notionalLeverage: Number(rawClendAccount.notionalLeverage),
163
+ riskAdjustedLeverage: Number(rawClendAccount.riskAdjustedLeverage),
164
+ notionalLtv: Number(rawClendAccount.notionalLtv),
165
+ riskAdjustedLtv: Number(rawClendAccount.riskAdjustedLtv),
176
166
  };
177
- // parse inputs if they exist
178
- if (s.input) {
179
- const input = {
180
- apiPath: s.input.apiPath,
181
- selectedTokenMint: s.input.selectedTokenMint
182
- ? new anchor_1.web3.PublicKey(s.input.selectedTokenMint)
183
- : null,
184
- amountUi: s.input.amountUi ? Number(s.input.amountUi) : null,
185
- leverage: s.input.leverage ? Number(s.input.leverage) : null,
186
- slippageBps: s.input.slippageBps ? Number(s.input.slippageBps) : null,
187
- openPosition: s.input.openPosition
188
- ? Boolean(s.input.openPosition)
189
- : null,
190
- closePosition: s.input.closePosition
191
- ? Boolean(s.input.closePosition)
192
- : null,
193
- };
194
- txSummary.input = input;
195
- }
196
- // get events for each summary
197
- for (const event of s.events) {
198
- let closeBalance = null;
199
- if (event.closeBalance !== null) {
200
- closeBalance = Boolean(event.closeBalance);
201
- }
202
- // parse amount
203
- const clendAccountEvent = {
204
- eventIndex: event.eventIndex,
205
- eventName: event.eventName,
206
- bank: event.bank ? new anchor_1.web3.PublicKey(event.bank) : null,
207
- mint: event.mint ? new anchor_1.web3.PublicKey(event.mint) : null,
208
- amount: event.amount ? new anchor_1.BN(event.amount, "hex") : null,
209
- amountUi: event.amountUi ? Number(event.amountUi) : null,
210
- value: event.value ? Number(event.value) : null,
211
- price: event.price ? Number(event.price) : null,
212
- closeBalance,
213
- };
214
- txSummary.events.push(clendAccountEvent);
167
+ // B. Parse the associated Summary array for the account
168
+ let summary = [];
169
+ if (getClendAccountSummary && accountData.summary) {
170
+ summary = accountData.summary.map((s) => {
171
+ let input = undefined;
172
+ if (s.input) {
173
+ input = {
174
+ apiPath: s.input.apiPath,
175
+ selectedTokenMint: s.input.selectedTokenMint
176
+ ? new anchor_1.web3.PublicKey(s.input.selectedTokenMint)
177
+ : null,
178
+ amountUi: s.input.amountUi ? Number(s.input.amountUi) : null,
179
+ leverage: s.input.leverage ? Number(s.input.leverage) : null,
180
+ slippageBps: s.input.slippageBps
181
+ ? Number(s.input.slippageBps)
182
+ : null,
183
+ openPosition: s.input.openPosition != null
184
+ ? Boolean(s.input.openPosition)
185
+ : null,
186
+ closePosition: s.input.closePosition != null
187
+ ? Boolean(s.input.closePosition)
188
+ : null,
189
+ };
190
+ }
191
+ const events = (s.events || []).map((event) => {
192
+ let closeBalance = null;
193
+ // Only convert to boolean if the value is not null/undefined to preserve the null state.
194
+ if (event.closeBalance !== null &&
195
+ event.closeBalance !== undefined) {
196
+ closeBalance = Boolean(event.closeBalance);
197
+ }
198
+ return {
199
+ eventIndex: event.eventIndex,
200
+ eventName: event.eventName,
201
+ bank: event.bank ? new anchor_1.web3.PublicKey(event.bank) : null,
202
+ mint: event.mint ? new anchor_1.web3.PublicKey(event.mint) : null,
203
+ amount: event.amount ? new anchor_1.BN(event.amount, "hex") : null,
204
+ amountUi: event.amountUi ? Number(event.amountUi) : null,
205
+ value: event.value ? Number(event.value) : null,
206
+ price: event.price ? Number(event.price) : null,
207
+ closeBalance,
208
+ };
209
+ });
210
+ const txSummary = {
211
+ txSig: s.txSig,
212
+ time: s.time,
213
+ clendAccount: new anchor_1.web3.PublicKey(s.clendAccount),
214
+ clendAccountAuthority: new anchor_1.web3.PublicKey(s.clendAccountAuthority),
215
+ clendGroup: new anchor_1.web3.PublicKey(s.clendGroup),
216
+ action: s.action,
217
+ input,
218
+ events,
219
+ };
220
+ return txSummary;
221
+ });
215
222
  }
216
- summary.push(txSummary);
217
- }
223
+ // C. Combine the parsed account and its summary
224
+ return { clendAccount, summary };
225
+ });
226
+ // 3. Return the final, correctly structured response object.
218
227
  return {
219
228
  wallet,
220
- clendAccount,
221
- summary,
229
+ clendAccounts,
222
230
  };
223
231
  }
232
+ /**
233
+ * Get all groups
234
+ * @param includeBankData Whether to include bank data in the response, if not strictly necessary keep false
235
+ * @returns All groups
236
+ */
237
+ async getGroups(includeBankData) {
238
+ const body = await handleApiCall(() => this.http.get(`/groups?includeBankData=${includeBankData}`));
239
+ const marketJson = JSON.parse(body);
240
+ const groups = [];
241
+ for (const groupJson of marketJson.groups) {
242
+ const group = new anchor_1.web3.PublicKey(groupJson.group);
243
+ const groupName = groupJson.groupName;
244
+ const banks = [];
245
+ for (const bankJson of groupJson.banks) {
246
+ const bank = parseBank(bankJson);
247
+ banks.push(bank);
248
+ }
249
+ groups.push({ group, groupName, banks });
250
+ }
251
+ const response = {
252
+ groups,
253
+ };
254
+ return response;
255
+ }
224
256
  /**
225
257
  * Get market details
226
258
  * @param groupAddress group public key
@@ -229,13 +261,17 @@ class Client {
229
261
  async getGroup(groupAddress) {
230
262
  const body = await handleApiCall(() => this.http.get(`/group?group=${groupAddress.toString()}`));
231
263
  const marketJson = JSON.parse(body);
232
- const banks = [];
233
- for (const bankJson of marketJson.banks) {
264
+ const group = {
265
+ group: new anchor_1.web3.PublicKey(marketJson.group.group),
266
+ groupName: marketJson.group.groupName,
267
+ banks: [],
268
+ };
269
+ for (const bankJson of marketJson.group.banks) {
234
270
  const bank = parseBank(bankJson);
235
- banks.push(bank);
271
+ group.banks.push(bank);
236
272
  }
237
273
  const response = {
238
- banks,
274
+ group,
239
275
  };
240
276
  return response;
241
277
  }
@@ -253,20 +289,48 @@ class Client {
253
289
  };
254
290
  return response;
255
291
  }
292
+ async deposit(clendGroup, clendAccount, inputTokenMint, uiAmount) {
293
+ const req = {
294
+ owner: this.address(),
295
+ clendGroup,
296
+ clendAccount,
297
+ inputTokenMint,
298
+ depositAmountUi: uiAmount,
299
+ };
300
+ const body = await handleApiCall(() => this.http.post("deposit", JSON.stringify(req)));
301
+ const depositResponse = JSON.parse(body);
302
+ const txSig = await this.send(depositResponse.unsignedBase64Tx, depositResponse.userRequestId);
303
+ return txSig;
304
+ }
305
+ async withdraw(clendAccount, outputTokenMint, uiAmount, withdrawAll) {
306
+ const req = {
307
+ clendAccount,
308
+ outputTokenMint,
309
+ withdrawAmountUi: uiAmount,
310
+ withdrawAll,
311
+ };
312
+ const body = await handleApiCall(() => this.http.post("withdraw", JSON.stringify(req)));
313
+ const withdrawResponse = JSON.parse(body);
314
+ const txSig = await this.send(withdrawResponse.unsignedBase64Tx, withdrawResponse.userRequestId);
315
+ return txSig;
316
+ }
256
317
  /**
257
318
  * Deposit collateral and create a leveraged position
258
319
  * @param request Deposit leverage request parameters
259
320
  * @returns Deposit leverage operation result
260
321
  */
261
- async depositLeverage(inputMint, assetMint, liabilityMint, uiAmount, leverage, slippageBps) {
262
- if (!inputMint.equals(assetMint) || !inputMint.equals(liabilityMint)) {
322
+ async depositLeverage(clendGroup, clendAccount, inputTokenMint, assetTokenMint, liabilityTokenMint, uiAmount, leverage, slippageBps) {
323
+ if (!inputTokenMint.equals(assetTokenMint) &&
324
+ !inputTokenMint.equals(liabilityTokenMint)) {
263
325
  throw new Error("Input mint must be the same as the asset or liability mint");
264
326
  }
265
327
  const req = {
266
328
  owner: this.address(),
267
- inputMint,
268
- assetMint,
269
- liabilityMint,
329
+ clendGroup,
330
+ clendAccount,
331
+ inputTokenMint,
332
+ assetTokenMint,
333
+ liabilityTokenMint,
270
334
  depositAmountUi: uiAmount,
271
335
  leverage,
272
336
  slippageBps,
@@ -281,9 +345,11 @@ class Client {
281
345
  * @param request Adjust leverage request parameters
282
346
  * @returns Adjust leverage operation result
283
347
  */
284
- async adjustLeverage(leverage, slippageBps) {
348
+ async adjustLeverage(clendAccount, assetTokenMint, liabilityTokenMint, leverage, slippageBps) {
285
349
  const req = {
286
- owner: this.address(),
350
+ clendAccount,
351
+ assetTokenMint,
352
+ liabilityTokenMint,
287
353
  leverage,
288
354
  slippageBps,
289
355
  };
@@ -297,10 +363,12 @@ class Client {
297
363
  * @param request Withdraw leverage request parameters
298
364
  * @returns Withdraw leverage operation result
299
365
  */
300
- async withdrawLeverage(selectedTokenMint, uiAmount, slippageBps, withdrawAll) {
366
+ async withdrawLeverage(clendAccount, outputTokenMint, assetTokenMint, liabilityTokenMint, uiAmount, slippageBps, withdrawAll) {
301
367
  const req = {
302
- owner: this.address(),
303
- selectedTokenMint,
368
+ clendAccount,
369
+ outputTokenMint,
370
+ assetTokenMint,
371
+ liabilityTokenMint,
304
372
  withdrawAmountUi: uiAmount,
305
373
  slippageBps,
306
374
  withdrawAll,
@@ -310,16 +378,21 @@ class Client {
310
378
  const txSig = await this.send(withdrawLeverageResponse.unsignedBase64Tx, withdrawLeverageResponse.userRequestId);
311
379
  return txSig;
312
380
  }
313
- }
314
- exports.Client = Client;
315
- function handleStatusCode(statusCode) {
316
- switch (statusCode) {
317
- case 200:
318
- break;
319
- default:
320
- throw new Error(`unexpected status code: ${statusCode}`);
381
+ /**
382
+ * Withdraw emissions from a bank
383
+ * @returns Withdraw emissions operation result
384
+ */
385
+ async withdrawEmissions() {
386
+ const req = {
387
+ owner: this.address(),
388
+ };
389
+ const body = await handleApiCall(() => this.http.post("emissions/withdraw", JSON.stringify(req)));
390
+ const withdrawEmissionsResponse = JSON.parse(body);
391
+ const txSig = await this.send(withdrawEmissionsResponse.unsignedBase64Tx, withdrawEmissionsResponse.userRequestId);
392
+ return txSig;
321
393
  }
322
394
  }
395
+ exports.Client = Client;
323
396
  // Helper function to handle API calls
324
397
  async function handleApiCall(call) {
325
398
  try {
@@ -344,6 +417,17 @@ function getDummyProvider() {
344
417
  });
345
418
  }
346
419
  function parseBank(bankJson) {
420
+ let bankEmissions = null;
421
+ if (bankJson.emissions) {
422
+ bankEmissions = {
423
+ emissionsMode: bankJson.emissions.emissionsMode,
424
+ emissionsApy: Number(bankJson.emissions.emissionsApy),
425
+ emissionsMint: new anchor_1.web3.PublicKey(bankJson.emissions.emissionsMint),
426
+ emissionsTokenPrice: Number(bankJson.emissions.emissionsTokenPrice),
427
+ emissionsRate: new anchor_1.BN(bankJson.emissions.emissionsRate, "hex"),
428
+ emissionsRemainingUi: Number(bankJson.emissions.emissionsRemainingUi),
429
+ };
430
+ }
347
431
  return {
348
432
  mint: new anchor_1.web3.PublicKey(bankJson.mint),
349
433
  key: new anchor_1.web3.PublicKey(bankJson.key),
@@ -357,6 +441,7 @@ function parseBank(bankJson) {
357
441
  assetMaintWeight: Number(bankJson.assetMaintWeight),
358
442
  totalAssetShares: Number(bankJson.totalAssetShares),
359
443
  assetShareValue: Number(bankJson.assetShareValue),
444
+ tokenYieldApy: Number(bankJson.tokenYieldApy),
360
445
  liabilityAmount: new anchor_1.BN(bankJson.liabilityAmount, "hex"),
361
446
  liabilityAmountUi: Number(bankJson.liabilityAmountUi),
362
447
  liabilityInitWeight: Number(bankJson.liabilityInitWeight),
@@ -368,5 +453,6 @@ function parseBank(bankJson) {
368
453
  depositLimitUi: Number(bankJson.depositLimitUi),
369
454
  borrowLimit: new anchor_1.BN(bankJson.borrowLimit, "hex"),
370
455
  borrowLimitUi: Number(bankJson.borrowLimitUi),
456
+ emissions: bankEmissions,
371
457
  };
372
458
  }