@carrot-protocol/boost-http-client 0.4.0-stub-position-endpoints-dev-f996c8b → 0.4.0
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.
|
@@ -5,10 +5,7 @@ import { ApiClient } from "../../api";
|
|
|
5
5
|
export declare class PositionChartingExtension extends ApiClient {
|
|
6
6
|
private readonly clendAccount;
|
|
7
7
|
constructor(baseUrl: string, clendAccount: web3.PublicKey);
|
|
8
|
-
getLoanBalance(options?:
|
|
9
|
-
fromTime?: Date;
|
|
10
|
-
toTime?: Date;
|
|
11
|
-
}): Promise<LoanBalanceResponse[]>;
|
|
8
|
+
getLoanBalance(options?: ChartingOptions): Promise<LoanBalanceResponse[]>;
|
|
12
9
|
getPerformance(options?: ChartingOptions): Promise<PerformanceResponse[]>;
|
|
13
10
|
getApy(options?: ChartingOptions): Promise<ApyResponse[]>;
|
|
14
11
|
}
|
|
@@ -8,11 +8,13 @@ class PositionChartingExtension extends api_1.ApiClient {
|
|
|
8
8
|
this.clendAccount = clendAccount;
|
|
9
9
|
}
|
|
10
10
|
async getLoanBalance(options = {}) {
|
|
11
|
+
const { fromTime, toTime, aggregationMethod } = options;
|
|
11
12
|
const body = await this.handleApiCall(() => this.http.get(`/account/balances`, {
|
|
12
13
|
params: {
|
|
13
14
|
account: this.clendAccount.toString(),
|
|
14
|
-
fromTime:
|
|
15
|
-
toTime:
|
|
15
|
+
fromTime: fromTime?.toISOString(),
|
|
16
|
+
toTime: toTime?.toISOString(),
|
|
17
|
+
aggregationMethod,
|
|
16
18
|
},
|
|
17
19
|
}));
|
|
18
20
|
const response = JSON.parse(body).map((balance) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrot-protocol/boost-http-client",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "HTTP client for Carrot Boost",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
"@carrot-protocol/clend-common": "^0.1.0",
|
|
29
29
|
"@coral-xyz/anchor": "^0.29.0"
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
}
|
|
@@ -12,14 +12,16 @@ export class PositionChartingExtension extends ApiClient {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
public async getLoanBalance(
|
|
15
|
-
options:
|
|
15
|
+
options: ChartingOptions = {},
|
|
16
16
|
): Promise<LoanBalanceResponse[]> {
|
|
17
|
+
const { fromTime, toTime, aggregationMethod } = options;
|
|
17
18
|
const body = await this.handleApiCall(() =>
|
|
18
19
|
this.http.get(`/account/balances`, {
|
|
19
20
|
params: {
|
|
20
21
|
account: this.clendAccount.toString(),
|
|
21
|
-
fromTime:
|
|
22
|
-
toTime:
|
|
22
|
+
fromTime: fromTime?.toISOString(),
|
|
23
|
+
toTime: toTime?.toISOString(),
|
|
24
|
+
aggregationMethod,
|
|
23
25
|
},
|
|
24
26
|
}),
|
|
25
27
|
);
|