@gearbox-protocol/sdk 3.0.0-next.145 → 3.0.0-next.146

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.
@@ -84,6 +84,7 @@ export declare class ChartsCreditManagerData {
84
84
  readonly totalBorrowed: bigint;
85
85
  readonly totalBorrowedOld: bigint;
86
86
  readonly totalBorrowedChange: number;
87
+ readonly totalDebtLimit: bigint;
87
88
  readonly totalRepaid: bigint;
88
89
  readonly totalProfit: bigint;
89
90
  readonly totalProfitOld: bigint;
@@ -267,6 +267,7 @@ class ChartsCreditManagerData {
267
267
  totalBorrowed;
268
268
  totalBorrowedOld;
269
269
  totalBorrowedChange;
270
+ totalDebtLimit;
270
271
  totalRepaid;
271
272
  totalProfit;
272
273
  totalProfitOld;
@@ -316,6 +317,7 @@ class ChartsCreditManagerData {
316
317
  this.totalBorrowedOld = (0, sdk_gov_1.toBigInt)(payload.totalBorrowedBIOld || 0);
317
318
  this.totalBorrowedInUSD = payload.totalBorrowedInUSD || 0;
318
319
  this.totalBorrowedChange = Number((0, sdk_gov_1.toBigInt)(payload.totalBorrowedBI10kBasis || 0) * sdk_gov_1.PERCENTAGE_DECIMALS);
320
+ this.totalDebtLimit = (0, sdk_gov_1.toBigInt)(payload.totalDebtLimit || 0);
319
321
  this.totalLosses = (0, sdk_gov_1.toBigInt)(payload.totalLosses || 0);
320
322
  this.totalLossesOld = (0, sdk_gov_1.toBigInt)(payload.totalLossesOld || 0);
321
323
  this.totalLossesInUSD = payload.totalLossesInUSD || 0;
@@ -1,5 +1,16 @@
1
1
  import { CreditSessionFilteredPayload, CreditSessionPayload, CreditSessionsAggregatedStatsPayload, SecondaryStatus, UserCreditSessionsAggregatedStatsPayload } from "../payload/creditSession";
2
2
  import { AssetWithView } from "./assets";
3
+ export interface CreditSessionAsset extends AssetWithView {
4
+ ind: number;
5
+ isForbidden: boolean;
6
+ isEnabled: boolean;
7
+ quota: bigint;
8
+ quotaIndexLU: bigint;
9
+ isQuoted: boolean;
10
+ }
11
+ export interface CreditSessionReward extends AssetWithView {
12
+ pool: string;
13
+ }
3
14
  export type CreditSessionStatus = "active" | "closed" | "repaid" | "liquidated" | "liquidateExpired" | "liquidatePaused";
4
15
  export declare const CREDIT_SESSION_STATUS_BY_ID: Record<number, CreditSessionStatus>;
5
16
  export declare const CREDIT_SESSION_ID_BY_STATUS: Record<CreditSessionStatus, number>;
@@ -47,8 +58,8 @@ export declare class CreditSession {
47
58
  readonly spotDebt: bigint;
48
59
  readonly spotTotalValue: bigint;
49
60
  readonly spotUserFunds: bigint;
50
- readonly cvxUnclaimedRewards: Array<AssetWithView>;
51
- readonly balances: Array<AssetWithView>;
61
+ readonly cvxUnclaimedRewards: Array<CreditSessionReward>;
62
+ readonly balances: Array<CreditSessionAsset>;
52
63
  readonly forbiddenTokens: Record<string, true>;
53
64
  readonly disabledTokens: Record<string, true>;
54
65
  readonly teritaryStatus: SecondaryStatus;
@@ -110,11 +110,12 @@ class CreditSession {
110
110
  this.spotDebt = (0, sdk_gov_1.toBigInt)(payload.spotDebt || 0);
111
111
  this.spotTotalValue = (0, sdk_gov_1.toBigInt)(payload.spotTotalValue || 0);
112
112
  this.spotUserFunds = (0, sdk_gov_1.toBigInt)(payload.spotUserFunds || 0);
113
- this.cvxUnclaimedRewards = Object.entries(payload.cvxUnclaimedRewards || {}).map(([token, balance]) => {
113
+ this.cvxUnclaimedRewards = Object.entries(payload.cvxUnclaimedRewards || {}).map(([t, b]) => {
114
114
  return {
115
- token: token.toLowerCase(),
116
- balance: (0, sdk_gov_1.toBigInt)(balance.bi || 0),
117
- balanceView: balance.f.toString(),
115
+ token: t.toLowerCase(),
116
+ balance: (0, sdk_gov_1.toBigInt)(b.bi || 0),
117
+ balanceView: b.f.toString(),
118
+ pool: b.pool.toLowerCase(),
118
119
  };
119
120
  });
120
121
  Object.entries(payload.balances || {}).forEach(([t, b]) => {
@@ -122,13 +123,19 @@ class CreditSession {
122
123
  if (!b.isEnabled) {
123
124
  this.disabledTokens[token] = true;
124
125
  }
125
- if (!b.isAllowed) {
126
+ if (b.isForbidden) {
126
127
  this.forbiddenTokens[token] = true;
127
128
  }
128
129
  this.balances.push({
129
130
  token: token.toLowerCase(),
130
131
  balance: (0, sdk_gov_1.toBigInt)(b.BI || 0),
131
132
  balanceView: b.F.toString(),
133
+ ind: b.ind,
134
+ isEnabled: b.isEnabled,
135
+ isForbidden: b.isForbidden,
136
+ quota: (0, sdk_gov_1.toBigInt)(b.quota || 0),
137
+ quotaIndexLU: (0, sdk_gov_1.toBigInt)(b.quotaIndexLU || 0),
138
+ isQuoted: b.isQuoted || false,
132
139
  });
133
140
  });
134
141
  }
@@ -56,4 +56,5 @@ export interface ChartsCreditManagerPayload {
56
56
  totalClosedAccountsChange: number;
57
57
  totalRepaidAccounts: number;
58
58
  liquidityThresholds: Record<string, number>;
59
+ totalDebtLimit: BigNumberish;
59
60
  }
@@ -3,8 +3,11 @@ export interface CreditSessionBalancePayload {
3
3
  BI: string;
4
4
  F: number;
5
5
  ind: number;
6
- isAllowed: boolean;
6
+ isForbidden: boolean;
7
7
  isEnabled: boolean;
8
+ quota?: BigNumberish;
9
+ quotaIndexLU?: BigNumberish;
10
+ isQuoted?: boolean;
8
11
  }
9
12
  interface CreditSessionReward {
10
13
  bi: BigNumberish;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.145",
3
+ "version": "3.0.0-next.146",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",