@carrot-protocol/boost-http-client 0.4.0-stub-position-endpoints-dev-32fcd57 → 0.4.1-feat-user-pnl-aggregate-dev-834d3f3

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.
@@ -1,9 +1,9 @@
1
1
  import { web3 } from "@coral-xyz/anchor";
2
2
  import { PerformanceResponse } from "./types";
3
3
  import { ApiClient } from "../../api";
4
- import { DateRangeOptions } from "../../types";
4
+ import { ChartingOptions } from "../../types";
5
5
  export declare class WalletChartingExtension extends ApiClient {
6
6
  private readonly address;
7
7
  constructor(baseUrl: string, address: web3.PublicKey);
8
- getPerformance(options?: DateRangeOptions): Promise<PerformanceResponse[]>;
8
+ getPerformance(options?: ChartingOptions): Promise<PerformanceResponse[]>;
9
9
  }
@@ -8,12 +8,13 @@ class WalletChartingExtension extends api_1.ApiClient {
8
8
  this.address = address;
9
9
  }
10
10
  async getPerformance(options = {}) {
11
- const { fromTime, toTime } = options;
11
+ const { fromTime, toTime, aggregationMethod } = options;
12
12
  const body = await this.handleApiCall(() => this.http.get(`/user/pnls`, {
13
13
  params: {
14
14
  authority: this.address.toString(),
15
15
  fromTime: fromTime?.toISOString(),
16
16
  toTime: toTime?.toISOString(),
17
+ aggregationMethod,
17
18
  },
18
19
  }));
19
20
  const response = JSON.parse(body).map((performance) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-protocol/boost-http-client",
3
- "version": "0.4.0-stub-position-endpoints-dev-32fcd57",
3
+ "version": "0.4.1-feat-user-pnl-aggregate-dev-834d3f3",
4
4
  "description": "HTTP client for Carrot Boost",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  import { web3 } from "@coral-xyz/anchor";
2
2
  import { PerformanceResponse } from "./types";
3
3
  import { ApiClient } from "../../api";
4
- import { DateRangeOptions } from "../../types";
4
+ import { ChartingOptions, DateRangeOptions } from "../../types";
5
5
 
6
6
  export class WalletChartingExtension extends ApiClient {
7
7
  private readonly address: web3.PublicKey;
@@ -12,15 +12,16 @@ export class WalletChartingExtension extends ApiClient {
12
12
  }
13
13
 
14
14
  public async getPerformance(
15
- options: DateRangeOptions = {},
15
+ options: ChartingOptions = {},
16
16
  ): Promise<PerformanceResponse[]> {
17
- const { fromTime, toTime } = options;
17
+ const { fromTime, toTime, aggregationMethod } = options;
18
18
  const body = await this.handleApiCall(() =>
19
19
  this.http.get(`/user/pnls`, {
20
20
  params: {
21
21
  authority: this.address.toString(),
22
22
  fromTime: fromTime?.toISOString(),
23
23
  toTime: toTime?.toISOString(),
24
+ aggregationMethod,
24
25
  },
25
26
  }),
26
27
  );