@carrot-protocol/boost-http-client 0.2.15-group-refactor1-dev-6ecf454 → 0.2.15-group-refactor1-dev-04167fd

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.js CHANGED
@@ -107,6 +107,7 @@ class Client {
107
107
  async getUser(groups, user, getClendAccountSummary) {
108
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
+ console.log(JSON.stringify(jsonRawResponse, null, 2));
110
111
  // parse balances
111
112
  const walletBalances = [];
112
113
  for (const b of jsonRawResponse.wallet.balances) {
@@ -247,12 +248,13 @@ class Client {
247
248
  const groups = [];
248
249
  for (const groupJson of marketJson.groups) {
249
250
  const group = new anchor_1.web3.PublicKey(groupJson.group);
251
+ const groupName = groupJson.groupName;
250
252
  const banks = [];
251
253
  for (const bankJson of groupJson.banks) {
252
254
  const bank = parseBank(bankJson);
253
255
  banks.push(bank);
254
256
  }
255
- groups.push({ group, banks });
257
+ groups.push({ group, groupName, banks });
256
258
  }
257
259
  const response = {
258
260
  groups,
@@ -268,10 +270,11 @@ class Client {
268
270
  const body = await handleApiCall(() => this.http.get(`/group?group=${groupAddress.toString()}`));
269
271
  const marketJson = JSON.parse(body);
270
272
  const group = {
271
- group: new anchor_1.web3.PublicKey(marketJson.group),
273
+ group: new anchor_1.web3.PublicKey(marketJson.group.group),
274
+ groupName: marketJson.group.groupName,
272
275
  banks: [],
273
276
  };
274
- for (const bankJson of marketJson.banks) {
277
+ for (const bankJson of marketJson.group.banks) {
275
278
  const bank = parseBank(bankJson);
276
279
  group.banks.push(bank);
277
280
  }
package/dist/types.d.ts CHANGED
@@ -72,6 +72,7 @@ export interface GetGroupResponse {
72
72
  }
73
73
  export interface GroupAndBanks {
74
74
  group: web3.PublicKey;
75
+ groupName: string;
75
76
  banks: Bank[];
76
77
  }
77
78
  export interface GetUserRequest {
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-6ecf454",
3
+ "version": "0.2.15-group-refactor1-dev-04167fd",
4
4
  "description": "HTTP client for Carrot Boost",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -119,6 +119,7 @@ export class Client {
119
119
  );
120
120
 
121
121
  const jsonRawResponse: any = JSON.parse(body);
122
+ console.log(JSON.stringify(jsonRawResponse, null, 2));
122
123
 
123
124
  // parse balances
124
125
  const walletBalances: UserBalance[] = [];
@@ -282,12 +283,13 @@ export class Client {
282
283
  const groups: GroupAndBanks[] = [];
283
284
  for (const groupJson of marketJson.groups) {
284
285
  const group: web3.PublicKey = new web3.PublicKey(groupJson.group);
286
+ const groupName = groupJson.groupName;
285
287
  const banks: Bank[] = [];
286
288
  for (const bankJson of groupJson.banks) {
287
289
  const bank = parseBank(bankJson);
288
290
  banks.push(bank);
289
291
  }
290
- groups.push({ group, banks });
292
+ groups.push({ group, groupName, banks });
291
293
  }
292
294
 
293
295
  const response: GetGroupsResponse = {
@@ -309,10 +311,11 @@ export class Client {
309
311
 
310
312
  const marketJson: any = JSON.parse(body);
311
313
  const group: GroupAndBanks = {
312
- group: new web3.PublicKey(marketJson.group),
314
+ group: new web3.PublicKey(marketJson.group.group),
315
+ groupName: marketJson.group.groupName,
313
316
  banks: [],
314
317
  };
315
- for (const bankJson of marketJson.banks) {
318
+ for (const bankJson of marketJson.group.banks) {
316
319
  const bank = parseBank(bankJson);
317
320
  group.banks.push(bank);
318
321
  }
package/src/types.ts CHANGED
@@ -83,6 +83,7 @@ export interface GetGroupResponse {
83
83
 
84
84
  export interface GroupAndBanks {
85
85
  group: web3.PublicKey;
86
+ groupName: string;
86
87
  banks: Bank[];
87
88
  }
88
89