@carrot-protocol/boost-http-client 0.2.15-group-refactor1-dev-ef145c2 → 0.2.15-group-refactor1-dev-d9350a8

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
@@ -27,7 +27,7 @@ export declare class Client {
27
27
  * @param user wallet public key
28
28
  * @returns User details
29
29
  */
30
- getUser(group: web3.PublicKey, user: web3.PublicKey, getClendAccountSummary: boolean): Promise<GetUserResponse>;
30
+ getUser(groups: web3.PublicKey[], user: web3.PublicKey, getClendAccountSummary: boolean): Promise<GetUserResponse>;
31
31
  /**
32
32
  * Get market details
33
33
  * @param groupAddress group public key
package/dist/index.js CHANGED
@@ -104,8 +104,8 @@ class Client {
104
104
  * @param user wallet public key
105
105
  * @returns User details
106
106
  */
107
- async getUser(group, user, getClendAccountSummary) {
108
- const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}&group=${group.toString()}&getClendAccountSummary=${getClendAccountSummary}`));
107
+ async getUser(groups, user, getClendAccountSummary) {
108
+ const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}&groups=${groups.map((g) => g.toString()).join(",")}&getClendAccountSummary=${getClendAccountSummary}`));
109
109
  const jsonRawResponse = JSON.parse(body);
110
110
  // parse balances
111
111
  const walletBalances = [];
@@ -199,6 +199,8 @@ class Client {
199
199
  liabilityBalanceUi: Number(b.liabilityBalanceUi),
200
200
  liabilityValue: Number(b.liabilityValue),
201
201
  price: Number(b.price),
202
+ liquidationPrice: Number(b.liquidationPrice),
203
+ liquidationPriceChangePercentage: Number(b.liquidationPriceChangePercentage),
202
204
  });
203
205
  }
204
206
  // create clend account
@@ -213,8 +215,6 @@ class Client {
213
215
  healthFactorRiskAdjusted: Number(ca.healthFactorRiskAdjusted),
214
216
  notionalLeverage: Number(ca.notionalLeverage),
215
217
  riskAdjustedLeverage: Number(ca.riskAdjustedLeverage),
216
- liquidationPrice: Number(ca.liquidationPrice),
217
- liquidationPriceChangePercentage: Number(ca.liquidationPriceChangePercentage),
218
218
  notionalLtv: Number(ca.notionalLtv),
219
219
  riskAdjustedLtv: Number(ca.riskAdjustedLtv),
220
220
  };
package/dist/types.d.ts CHANGED
@@ -65,7 +65,7 @@ export interface GetGroupResponse {
65
65
  banks: Bank[];
66
66
  }
67
67
  export interface GetUserRequest {
68
- group: web3.PublicKey;
68
+ groups: web3.PublicKey[];
69
69
  user: web3.PublicKey;
70
70
  getClendAccountSummary: boolean;
71
71
  }
@@ -95,8 +95,6 @@ export interface ClendAccount {
95
95
  healthFactorRiskAdjusted: number;
96
96
  notionalLeverage: number;
97
97
  riskAdjustedLeverage: number;
98
- liquidationPrice: number;
99
- liquidationPriceChangePercentage: number;
100
98
  notionalLtv: number;
101
99
  riskAdjustedLtv: number;
102
100
  }
@@ -110,6 +108,8 @@ export interface ClendAccountBalance {
110
108
  liabilityBalanceUi: number;
111
109
  liabilityValue: number;
112
110
  price: number;
111
+ liquidationPrice: number;
112
+ liquidationPriceChangePercentage: number;
113
113
  }
114
114
  export interface GetBankResponse {
115
115
  bank: Bank;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/boost-http-client",
3
- "version": "0.2.15-group-refactor1-dev-ef145c2",
3
+ "version": "0.2.15-group-refactor1-dev-d9350a8",
4
4
  "description": "HTTP client for Carrot Boost",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@coral-xyz/anchor": "^0.29.0",
17
- "@carrot-protocol/clend-common": "0.1.7",
17
+ "@carrot-protocol/clend-common": "0.1.8-group-refactor1-dev-cb4b228",
18
18
  "axios": "^1.8.3",
19
19
  "bs58": "^6.0.0",
20
20
  "decimal.js": "^10.5.0"
package/src/index.ts CHANGED
@@ -105,13 +105,13 @@ export class Client {
105
105
  * @returns User details
106
106
  */
107
107
  async getUser(
108
- group: web3.PublicKey,
108
+ groups: web3.PublicKey[],
109
109
  user: web3.PublicKey,
110
110
  getClendAccountSummary: boolean,
111
111
  ): Promise<GetUserResponse> {
112
112
  const body = await handleApiCall(() =>
113
113
  this.http.get(
114
- `/user?user=${user.toString()}&group=${group.toString()}&getClendAccountSummary=${getClendAccountSummary}`,
114
+ `/user?user=${user.toString()}&groups=${groups.map((g) => g.toString()).join(",")}&getClendAccountSummary=${getClendAccountSummary}`,
115
115
  ),
116
116
  );
117
117
 
@@ -222,6 +222,10 @@ export class Client {
222
222
  liabilityBalanceUi: Number(b.liabilityBalanceUi),
223
223
  liabilityValue: Number(b.liabilityValue),
224
224
  price: Number(b.price),
225
+ liquidationPrice: Number(b.liquidationPrice),
226
+ liquidationPriceChangePercentage: Number(
227
+ b.liquidationPriceChangePercentage,
228
+ ),
225
229
  });
226
230
  }
227
231
 
@@ -239,10 +243,6 @@ export class Client {
239
243
  ),
240
244
  notionalLeverage: Number((ca as any).notionalLeverage),
241
245
  riskAdjustedLeverage: Number((ca as any).riskAdjustedLeverage),
242
- liquidationPrice: Number((ca as any).liquidationPrice),
243
- liquidationPriceChangePercentage: Number(
244
- (ca as any).liquidationPriceChangePercentage,
245
- ),
246
246
  notionalLtv: Number((ca as any).notionalLtv),
247
247
  riskAdjustedLtv: Number((ca as any).riskAdjustedLtv),
248
248
  };
package/src/types.ts CHANGED
@@ -75,7 +75,7 @@ export interface GetGroupResponse {
75
75
  }
76
76
 
77
77
  export interface GetUserRequest {
78
- group: web3.PublicKey;
78
+ groups: web3.PublicKey[];
79
79
  user: web3.PublicKey;
80
80
  getClendAccountSummary: boolean;
81
81
  }
@@ -109,8 +109,6 @@ export interface ClendAccount {
109
109
  healthFactorRiskAdjusted: number;
110
110
  notionalLeverage: number;
111
111
  riskAdjustedLeverage: number;
112
- liquidationPrice: number;
113
- liquidationPriceChangePercentage: number;
114
112
  notionalLtv: number;
115
113
  riskAdjustedLtv: number;
116
114
  }
@@ -125,6 +123,8 @@ export interface ClendAccountBalance {
125
123
  liabilityBalanceUi: number;
126
124
  liabilityValue: number;
127
125
  price: number;
126
+ liquidationPrice: number;
127
+ liquidationPriceChangePercentage: number;
128
128
  }
129
129
 
130
130
  export interface GetBankResponse {