@carrot-protocol/boost-http-client 0.3.3-feat-historical-bank-balances-dev-df97a5f → 0.3.3

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, GetGroupsResponse, GetAccountResponse, GetAccountRequest, GetHistoricalBankBalancesRequest, GetHistoricalBankBalancesResponse } from "./types";
2
+ import { GetBankResponse, GetUserResponse, GetGroupResponse, GetGroupsResponse, GetAccountResponse, GetAccountRequest } from "./types";
3
3
  export * from "./types";
4
4
  export * from "./utils";
5
5
  export * as Common from "@carrot-protocol/clend-common";
@@ -51,7 +51,6 @@ export declare class Client {
51
51
  * @returns Bank details
52
52
  */
53
53
  getBank(bankAddress: web3.PublicKey): Promise<GetBankResponse>;
54
- getHistoricalBankBalances({ bank, resolution, startDate, endDate, }: GetHistoricalBankBalancesRequest): Promise<GetHistoricalBankBalancesResponse>;
55
54
  deposit(clendGroup: web3.PublicKey, clendAccount: web3.PublicKey | null, inputTokenMint: web3.PublicKey, uiAmount: number): Promise<string>;
56
55
  withdraw(clendAccount: web3.PublicKey, outputTokenMint: web3.PublicKey, uiAmount: number, withdrawAll: boolean): Promise<string>;
57
56
  /**
@@ -76,5 +75,5 @@ export declare class Client {
76
75
  * Withdraw emissions from a bank
77
76
  * @returns Withdraw emissions operation result
78
77
  */
79
- withdrawEmissions(): Promise<string>;
78
+ withdrawEmissions(clendAccount: web3.PublicKey): Promise<string>;
80
79
  }
package/dist/index.js CHANGED
@@ -305,24 +305,6 @@ class Client {
305
305
  };
306
306
  return response;
307
307
  }
308
- async getHistoricalBankBalances({ bank, resolution, startDate, endDate, }) {
309
- const queryParams = new URLSearchParams();
310
- queryParams.append("bank", bank.toString());
311
- if (resolution) {
312
- queryParams.append("resolution", resolution);
313
- }
314
- if (startDate) {
315
- queryParams.append("startDate", startDate.toISOString());
316
- }
317
- if (endDate) {
318
- queryParams.append("endDate", endDate.toISOString());
319
- }
320
- const body = await handleApiCall(() => this.http.get(`/bank/historicalBalances?${queryParams.toString()}`));
321
- const response = JSON.parse(body);
322
- return {
323
- historicalBalances: response,
324
- };
325
- }
326
308
  async deposit(clendGroup, clendAccount, inputTokenMint, uiAmount) {
327
309
  const req = {
328
310
  owner: this.address(),
@@ -416,9 +398,9 @@ class Client {
416
398
  * Withdraw emissions from a bank
417
399
  * @returns Withdraw emissions operation result
418
400
  */
419
- async withdrawEmissions() {
401
+ async withdrawEmissions(clendAccount) {
420
402
  const req = {
421
- owner: this.address(),
403
+ clendAccount,
422
404
  };
423
405
  const body = await handleApiCall(() => this.http.post("emissions/withdraw", JSON.stringify(req)));
424
406
  const withdrawEmissionsResponse = JSON.parse(body);
package/dist/types.d.ts CHANGED
@@ -91,7 +91,7 @@ export interface WithdrawLeverageResponse {
91
91
  * Request to withdraw emissions from a bank
92
92
  */
93
93
  export interface WithdrawEmissionsRequest {
94
- owner: web3.PublicKey;
94
+ clendAccount: web3.PublicKey;
95
95
  }
96
96
  /**
97
97
  * Response for withdraw emissions operation
@@ -247,19 +247,3 @@ export interface UserRequest {
247
247
  openPosition: boolean | null;
248
248
  closePosition: boolean | null;
249
249
  }
250
- export interface GetHistoricalBankBalancesRequest {
251
- bank: web3.PublicKey;
252
- resolution?: "24h" | "6h" | "3h";
253
- startDate?: Date;
254
- endDate?: Date;
255
- }
256
- export interface GetHistoricalBankBalancesResponse {
257
- historicalBalances: HistoricalBankBalance[];
258
- }
259
- export interface HistoricalBankBalance {
260
- timestamp: string;
261
- assetAmount: string | null;
262
- liabilityAmount: string | null;
263
- assetValue: string | null;
264
- liabilityValue: string | null;
265
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/boost-http-client",
3
- "version": "0.3.3-feat-historical-bank-balances-dev-df97a5f",
3
+ "version": "0.3.3",
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
@@ -33,8 +33,6 @@ import {
33
33
  WithdrawResponse,
34
34
  GetAccountResponse,
35
35
  GetAccountRequest,
36
- GetHistoricalBankBalancesRequest,
37
- GetHistoricalBankBalancesResponse,
38
36
  } from "./types";
39
37
  import encode from "bs58";
40
38
 
@@ -393,34 +391,6 @@ export class Client {
393
391
  return response;
394
392
  }
395
393
 
396
- async getHistoricalBankBalances({
397
- bank,
398
- resolution,
399
- startDate,
400
- endDate,
401
- }: GetHistoricalBankBalancesRequest): Promise<GetHistoricalBankBalancesResponse> {
402
- const queryParams = new URLSearchParams();
403
- queryParams.append("bank", bank.toString());
404
- if (resolution) {
405
- queryParams.append("resolution", resolution);
406
- }
407
- if (startDate) {
408
- queryParams.append("startDate", startDate.toISOString());
409
- }
410
- if (endDate) {
411
- queryParams.append("endDate", endDate.toISOString());
412
- }
413
-
414
- const body = await handleApiCall(() =>
415
- this.http.get(`/bank/historicalBalances?${queryParams.toString()}`),
416
- );
417
-
418
- const response = JSON.parse(body);
419
- return {
420
- historicalBalances: response,
421
- } as GetHistoricalBankBalancesResponse;
422
- }
423
-
424
394
  async deposit(
425
395
  clendGroup: web3.PublicKey,
426
396
  clendAccount: web3.PublicKey | null,
@@ -599,9 +569,9 @@ export class Client {
599
569
  * Withdraw emissions from a bank
600
570
  * @returns Withdraw emissions operation result
601
571
  */
602
- async withdrawEmissions(): Promise<string> {
572
+ async withdrawEmissions(clendAccount: web3.PublicKey): Promise<string> {
603
573
  const req: WithdrawEmissionsRequest = {
604
- owner: this.address(),
574
+ clendAccount,
605
575
  };
606
576
 
607
577
  const body = await handleApiCall(() =>
package/src/types.ts CHANGED
@@ -104,7 +104,7 @@ export interface WithdrawLeverageResponse {
104
104
  * Request to withdraw emissions from a bank
105
105
  */
106
106
  export interface WithdrawEmissionsRequest {
107
- owner: web3.PublicKey;
107
+ clendAccount: web3.PublicKey;
108
108
  }
109
109
 
110
110
  /**
@@ -283,22 +283,3 @@ export interface UserRequest {
283
283
  openPosition: boolean | null;
284
284
  closePosition: boolean | null;
285
285
  }
286
-
287
- export interface GetHistoricalBankBalancesRequest {
288
- bank: web3.PublicKey;
289
- resolution?: "24h" | "6h" | "3h";
290
- startDate?: Date;
291
- endDate?: Date;
292
- }
293
-
294
- export interface GetHistoricalBankBalancesResponse {
295
- historicalBalances: HistoricalBankBalance[];
296
- }
297
-
298
- export interface HistoricalBankBalance {
299
- timestamp: string;
300
- assetAmount: string | null;
301
- liabilityAmount: string | null;
302
- assetValue: string | null;
303
- liabilityValue: string | null;
304
- }