@carrot-protocol/boost-http-client 0.2.14 → 0.2.15-group-refactor1-dev-04f0b0e

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, GetGroupRequest } from "./types";
2
+ import { GetBankResponse, GetUserResponse, GetGroupResponse, GetUserRequest } from "./types";
3
3
  export * from "./types";
4
4
  export * from "./utils";
5
5
  export * as Common from "@carrot-protocol/clend-common";
@@ -30,16 +30,16 @@ export declare class Client {
30
30
  getUser(request: GetUserRequest): Promise<GetUserResponse>;
31
31
  /**
32
32
  * Get market details
33
- * @returns Group Details
33
+ * @param groupAddress group public key
34
+ * @returns Group Details, which is really just all the bank data for that group
34
35
  */
35
- getGroup(request: GetGroupRequest): Promise<GetGroupResponse>;
36
+ getGroup(groupAddress: web3.PublicKey): Promise<GetGroupResponse>;
36
37
  /**
37
38
  * Get bank details
38
- * @param addr token mint or bank public key
39
- * @param addrType "mint" or "bank"
39
+ * @param bankAddress bank public key
40
40
  * @returns Bank details
41
41
  */
42
- getBank(addr: web3.PublicKey, addrType: "mint" | "bank"): Promise<GetBankResponse>;
42
+ getBank(bankAddress: web3.PublicKey): Promise<GetBankResponse>;
43
43
  /**
44
44
  * Deposit collateral and create a leveraged position
45
45
  * @param request Deposit leverage request parameters
package/dist/index.js CHANGED
@@ -223,10 +223,11 @@ class Client {
223
223
  }
224
224
  /**
225
225
  * Get market details
226
- * @returns Group Details
226
+ * @param groupAddress group public key
227
+ * @returns Group Details, which is really just all the bank data for that group
227
228
  */
228
- async getGroup(request) {
229
- const body = await handleApiCall(() => this.http.get(`/group?group=${request.group.toString()}`));
229
+ async getGroup(groupAddress) {
230
+ const body = await handleApiCall(() => this.http.get(`/group?group=${groupAddress.toString()}`));
230
231
  const marketJson = JSON.parse(body);
231
232
  const banks = [];
232
233
  for (const bankJson of marketJson.banks) {
@@ -240,12 +241,11 @@ class Client {
240
241
  }
241
242
  /**
242
243
  * Get bank details
243
- * @param addr token mint or bank public key
244
- * @param addrType "mint" or "bank"
244
+ * @param bankAddress bank public key
245
245
  * @returns Bank details
246
246
  */
247
- async getBank(addr, addrType) {
248
- const body = await handleApiCall(() => this.http.get(`/bank?${addrType}=${addr.toString()}`));
247
+ async getBank(bankAddress) {
248
+ const body = await handleApiCall(() => this.http.get(`/bank?bank=${bankAddress.toString()}`));
249
249
  const bankJson = JSON.parse(body);
250
250
  const bank = parseBank(bankJson.bank);
251
251
  const response = {
package/dist/types.d.ts CHANGED
@@ -52,9 +52,6 @@ export interface WithdrawLeverageResponse {
52
52
  userRequestId: string;
53
53
  unsignedBase64Tx: string;
54
54
  }
55
- export interface GetGroupRequest {
56
- group: web3.PublicKey;
57
- }
58
55
  export interface GetGroupResponse {
59
56
  banks: Bank[];
60
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/boost-http-client",
3
- "version": "0.2.14",
3
+ "version": "0.2.15-group-refactor1-dev-04f0b0e",
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
@@ -19,7 +19,6 @@ import {
19
19
  GetUserRequest,
20
20
  ClendAccountTxSummary,
21
21
  UserRequest,
22
- GetGroupRequest,
23
22
  } from "./types";
24
23
  import encode from "bs58";
25
24
 
@@ -249,11 +248,12 @@ export class Client {
249
248
 
250
249
  /**
251
250
  * Get market details
252
- * @returns Group Details
251
+ * @param groupAddress group public key
252
+ * @returns Group Details, which is really just all the bank data for that group
253
253
  */
254
- async getGroup(request: GetGroupRequest): Promise<GetGroupResponse> {
254
+ async getGroup(groupAddress: web3.PublicKey): Promise<GetGroupResponse> {
255
255
  const body = await handleApiCall(() =>
256
- this.http.get(`/group?group=${request.group.toString()}`),
256
+ this.http.get(`/group?group=${groupAddress.toString()}`),
257
257
  );
258
258
 
259
259
  const marketJson: any = JSON.parse(body);
@@ -272,16 +272,12 @@ export class Client {
272
272
 
273
273
  /**
274
274
  * Get bank details
275
- * @param addr token mint or bank public key
276
- * @param addrType "mint" or "bank"
275
+ * @param bankAddress bank public key
277
276
  * @returns Bank details
278
277
  */
279
- async getBank(
280
- addr: web3.PublicKey,
281
- addrType: "mint" | "bank",
282
- ): Promise<GetBankResponse> {
278
+ async getBank(bankAddress: web3.PublicKey): Promise<GetBankResponse> {
283
279
  const body = await handleApiCall(() =>
284
- this.http.get(`/bank?${addrType}=${addr.toString()}`),
280
+ this.http.get(`/bank?bank=${bankAddress.toString()}`),
285
281
  );
286
282
 
287
283
  const bankJson: any = JSON.parse(body);
package/src/types.ts CHANGED
@@ -61,10 +61,6 @@ export interface WithdrawLeverageResponse {
61
61
  unsignedBase64Tx: string;
62
62
  }
63
63
 
64
- export interface GetGroupRequest {
65
- group: web3.PublicKey;
66
- }
67
-
68
64
  export interface GetGroupResponse {
69
65
  banks: Bank[];
70
66
  }