@carrot-protocol/boost-http-client 0.2.15-group-refactor1-dev-a038045 → 0.2.15-group-refactor1-dev-ea8a618

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, GetGroupResponse, GetGroupsResponse } from "./types";
2
+ import { GetBankResponse, GetUserResponse, GetGroupResponse, GetGroupsResponse } from "./types";
3
3
  export * from "./types";
4
4
  export * from "./utils";
5
5
  export * as Common from "@carrot-protocol/clend-common";
@@ -22,7 +22,7 @@ export declare class Client {
22
22
  * @returns Index details
23
23
  */
24
24
  index(): Promise<any>;
25
- getUser(user: web3.PublicKey, groups: web3.PublicKey[], getClendAccountSummary: boolean): Promise<any>;
25
+ getUser(user: web3.PublicKey, groups: web3.PublicKey[], getClendAccountSummary: boolean): Promise<GetUserResponse>;
26
26
  /**
27
27
  * Get all groups
28
28
  * @param includeBankData Whether to include bank data in the response, if not strictly necessary keep false
@@ -52,17 +52,17 @@ export declare class Client {
52
52
  * @param request Adjust leverage request parameters
53
53
  * @returns Adjust leverage operation result
54
54
  */
55
- adjustLeverage(clendGroup: web3.PublicKey, clendAccount: web3.PublicKey, assetTokenMint: web3.PublicKey, liabilityTokenMint: web3.PublicKey, leverage: number, slippageBps: number): Promise<any>;
55
+ adjustLeverage(clendGroup: web3.PublicKey, clendAccount: web3.PublicKey, assetTokenMint: web3.PublicKey, liabilityTokenMint: web3.PublicKey, leverage: number, slippageBps: number): Promise<string>;
56
56
  /**
57
57
  * Withdraw from or close a leveraged position
58
58
  * @param request Withdraw leverage request parameters
59
59
  * @returns Withdraw leverage operation result
60
60
  */
61
- withdrawLeverage(clendGroup: web3.PublicKey, clendAccount: web3.PublicKey, outputTokenMint: web3.PublicKey, assetTokenMint: web3.PublicKey, liabilityTokenMint: web3.PublicKey, uiAmount: number, slippageBps: number, withdrawAll: boolean): Promise<any>;
61
+ withdrawLeverage(clendGroup: web3.PublicKey, clendAccount: web3.PublicKey, outputTokenMint: web3.PublicKey, assetTokenMint: web3.PublicKey, liabilityTokenMint: web3.PublicKey, uiAmount: number, slippageBps: number, withdrawAll: boolean): Promise<string>;
62
62
  /**
63
63
  * Withdraw emissions from a bank
64
64
  * @param banks Banks to withdraw emissions, if empty, will withdraw from all banks
65
65
  * @returns Withdraw emissions operation result
66
66
  */
67
- withdrawEmissions(banks: web3.PublicKey[]): Promise<any>;
67
+ withdrawEmissions(): Promise<string>;
68
68
  }
package/dist/index.js CHANGED
@@ -359,10 +359,9 @@ class Client {
359
359
  * @param banks Banks to withdraw emissions, if empty, will withdraw from all banks
360
360
  * @returns Withdraw emissions operation result
361
361
  */
362
- async withdrawEmissions(banks) {
362
+ async withdrawEmissions() {
363
363
  const req = {
364
364
  owner: this.address(),
365
- banks,
366
365
  };
367
366
  const body = await handleApiCall(() => this.http.post("emissions/withdraw", JSON.stringify(req)));
368
367
  const withdrawEmissionsResponse = JSON.parse(body);
@@ -402,7 +401,7 @@ function parseBank(bankJson) {
402
401
  emissionsApy: Number(bankJson.emissions.emissionsApy),
403
402
  emissionsMint: new anchor_1.web3.PublicKey(bankJson.emissions.emissionsMint),
404
403
  emissionsTokenPrice: Number(bankJson.emissions.emissionsTokenPrice),
405
- emissionsRateUi: Number(bankJson.emissions.emissionsRateUi),
404
+ emissionsRate: new anchor_1.BN(bankJson.emissions.emissionsRate, "hex"),
406
405
  emissionsRemainingUi: Number(bankJson.emissions.emissionsRemainingUi),
407
406
  };
408
407
  }
package/dist/types.d.ts CHANGED
@@ -69,7 +69,6 @@ export interface WithdrawLeverageResponse {
69
69
  */
70
70
  export interface WithdrawEmissionsRequest {
71
71
  owner: web3.PublicKey;
72
- banks: web3.PublicKey[];
73
72
  }
74
73
  /**
75
74
  * Response for withdraw emissions operation
@@ -181,7 +180,7 @@ export interface BankEmissions {
181
180
  emissionsApy: number;
182
181
  emissionsMint: web3.PublicKey;
183
182
  emissionsTokenPrice: number;
184
- emissionsRateUi: number;
183
+ emissionsRate: BN;
185
184
  emissionsRemainingUi: number;
186
185
  }
187
186
  export type BankEmissionsMode = "LENDING_ONLY" | "BORROW_ONLY" | "LENDING_AND_BORROWING";
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-a038045",
3
+ "version": "0.2.15-group-refactor1-dev-ea8a618",
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
@@ -110,7 +110,7 @@ export class Client {
110
110
  user: web3.PublicKey,
111
111
  groups: web3.PublicKey[],
112
112
  getClendAccountSummary: boolean,
113
- ): Promise<any> {
113
+ ): Promise<GetUserResponse> {
114
114
  // Make the API call to fetch the raw user data as a string.
115
115
  const body = await handleApiCall(() =>
116
116
  this.http.get(
@@ -408,7 +408,7 @@ export class Client {
408
408
  liabilityTokenMint: web3.PublicKey,
409
409
  leverage: number,
410
410
  slippageBps: number,
411
- ): Promise<any> {
411
+ ): Promise<string> {
412
412
  const req: AdjustLeverageRequest = {
413
413
  owner: this.address(),
414
414
  clendGroup,
@@ -446,7 +446,7 @@ export class Client {
446
446
  uiAmount: number,
447
447
  slippageBps: number,
448
448
  withdrawAll: boolean,
449
- ): Promise<any> {
449
+ ): Promise<string> {
450
450
  const req: WithdrawLeverageRequest = {
451
451
  owner: this.address(),
452
452
  clendGroup,
@@ -477,11 +477,11 @@ export class Client {
477
477
  * @param banks Banks to withdraw emissions, if empty, will withdraw from all banks
478
478
  * @returns Withdraw emissions operation result
479
479
  */
480
- async withdrawEmissions(banks: web3.PublicKey[]): Promise<any> {
480
+ async withdrawEmissions(): Promise<string> {
481
481
  const req: WithdrawEmissionsRequest = {
482
482
  owner: this.address(),
483
- banks,
484
483
  };
484
+
485
485
  const body = await handleApiCall(() =>
486
486
  this.http.post("emissions/withdraw", JSON.stringify(req)),
487
487
  );
@@ -545,7 +545,7 @@ function parseBank(bankJson: any): Bank {
545
545
  emissionsApy: Number(bankJson.emissions.emissionsApy),
546
546
  emissionsMint: new web3.PublicKey(bankJson.emissions.emissionsMint),
547
547
  emissionsTokenPrice: Number(bankJson.emissions.emissionsTokenPrice),
548
- emissionsRateUi: Number(bankJson.emissions.emissionsRateUi),
548
+ emissionsRate: new BN(bankJson.emissions.emissionsRate, "hex"),
549
549
  emissionsRemainingUi: Number(bankJson.emissions.emissionsRemainingUi),
550
550
  };
551
551
  }
package/src/types.ts CHANGED
@@ -78,7 +78,6 @@ export interface WithdrawLeverageResponse {
78
78
  */
79
79
  export interface WithdrawEmissionsRequest {
80
80
  owner: web3.PublicKey;
81
- banks: web3.PublicKey[];
82
81
  }
83
82
 
84
83
  /**
@@ -204,7 +203,7 @@ export interface BankEmissions {
204
203
  emissionsApy: number;
205
204
  emissionsMint: web3.PublicKey;
206
205
  emissionsTokenPrice: number;
207
- emissionsRateUi: number;
206
+ emissionsRate: BN;
208
207
  emissionsRemainingUi: number;
209
208
  }
210
209