@carrot-protocol/boost-http-client 0.2.13 → 0.2.14-get-groups1-dev-93e0b6d

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, GetUserRequest, GetGroupRequest } from "./types";
3
3
  export * from "./types";
4
4
  export * from "./utils";
5
5
  export * as Common from "@carrot-protocol/clend-common";
@@ -32,7 +32,7 @@ export declare class Client {
32
32
  * Get market details
33
33
  * @returns Group Details
34
34
  */
35
- getGroup(): Promise<GetGroupResponse>;
35
+ getGroup(request: GetGroupRequest): Promise<GetGroupResponse>;
36
36
  /**
37
37
  * Get bank details
38
38
  * @param addr token mint or bank public key
package/dist/index.js CHANGED
@@ -225,8 +225,8 @@ class Client {
225
225
  * Get market details
226
226
  * @returns Group Details
227
227
  */
228
- async getGroup() {
229
- const body = await handleApiCall(() => this.http.get(`/group`));
228
+ async getGroup(request) {
229
+ const body = await handleApiCall(() => this.http.get(`/group?group=${request.group.toString()}`));
230
230
  const marketJson = JSON.parse(body);
231
231
  const banks = [];
232
232
  for (const bankJson of marketJson.banks) {
package/dist/types.d.ts CHANGED
@@ -52,6 +52,9 @@ export interface WithdrawLeverageResponse {
52
52
  userRequestId: string;
53
53
  unsignedBase64Tx: string;
54
54
  }
55
+ export interface GetGroupRequest {
56
+ group: web3.PublicKey;
57
+ }
55
58
  export interface GetGroupResponse {
56
59
  banks: Bank[];
57
60
  }
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  import { web3 } from "@coral-xyz/anchor";
2
2
  import { ClendAccount } from "./types";
3
3
  export declare function netValueInToken(clendAccount: ClendAccount, tokenMint: web3.PublicKey): number;
4
+ export declare function getProductionGroups(): web3.PublicKey[];
5
+ export declare function getStagingGroups(): web3.PublicKey[];
package/dist/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.netValueInToken = netValueInToken;
4
+ exports.getProductionGroups = getProductionGroups;
5
+ exports.getStagingGroups = getStagingGroups;
6
+ const anchor_1 = require("@coral-xyz/anchor");
4
7
  // returns the net value of the clend account in a given tokens price
5
8
  function netValueInToken(clendAccount, tokenMint) {
6
9
  const clendAccountTokenBalance = clendAccount.balances.find((balance) => balance.mint.equals(tokenMint));
@@ -9,3 +12,9 @@ function netValueInToken(clendAccount, tokenMint) {
9
12
  }
10
13
  return clendAccount.netValue / clendAccountTokenBalance.price;
11
14
  }
15
+ function getProductionGroups() {
16
+ return [new anchor_1.web3.PublicKey("9bCWxAXFdWQ9GcZTSU3G636T6EyGXYMgaWR74yc7QZz8")];
17
+ }
18
+ function getStagingGroups() {
19
+ return [new anchor_1.web3.PublicKey("HKMDWLBK7yUmorSx9argg2rYcro6KoWf41N57FccKRP5")];
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/boost-http-client",
3
- "version": "0.2.13",
3
+ "version": "0.2.14-get-groups1-dev-93e0b6d",
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.1-cg1-dev-067ee1d",
17
+ "@carrot-protocol/clend-common": "0.1.7",
18
18
  "axios": "^1.8.3",
19
19
  "bs58": "^6.0.0",
20
20
  "decimal.js": "^10.5.0"
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ import {
19
19
  GetUserRequest,
20
20
  ClendAccountTxSummary,
21
21
  UserRequest,
22
+ GetGroupRequest,
22
23
  } from "./types";
23
24
  import encode from "bs58";
24
25
 
@@ -250,8 +251,10 @@ export class Client {
250
251
  * Get market details
251
252
  * @returns Group Details
252
253
  */
253
- async getGroup(): Promise<GetGroupResponse> {
254
- const body = await handleApiCall(() => this.http.get(`/group`));
254
+ async getGroup(request: GetGroupRequest): Promise<GetGroupResponse> {
255
+ const body = await handleApiCall(() =>
256
+ this.http.get(`/group?group=${request.group.toString()}`),
257
+ );
255
258
 
256
259
  const marketJson: any = JSON.parse(body);
257
260
  const banks: Bank[] = [];
package/src/types.ts CHANGED
@@ -61,6 +61,10 @@ export interface WithdrawLeverageResponse {
61
61
  unsignedBase64Tx: string;
62
62
  }
63
63
 
64
+ export interface GetGroupRequest {
65
+ group: web3.PublicKey;
66
+ }
67
+
64
68
  export interface GetGroupResponse {
65
69
  banks: Bank[];
66
70
  }
package/src/utils.ts CHANGED
@@ -15,3 +15,11 @@ export function netValueInToken(
15
15
 
16
16
  return clendAccount.netValue / clendAccountTokenBalance.price;
17
17
  }
18
+
19
+ export function getProductionGroups(): web3.PublicKey[] {
20
+ return [new web3.PublicKey("9bCWxAXFdWQ9GcZTSU3G636T6EyGXYMgaWR74yc7QZz8")];
21
+ }
22
+
23
+ export function getStagingGroups(): web3.PublicKey[] {
24
+ return [new web3.PublicKey("HKMDWLBK7yUmorSx9argg2rYcro6KoWf41N57FccKRP5")];
25
+ }