@carrot-protocol/boost-http-client 0.3.3-feat-historical-bank-balances-dev-df72015 → 0.3.3-test-emissions-dist-dev-541a938
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 +2 -3
- package/dist/index.js +2 -18
- package/dist/types.d.ts +1 -18
- package/package.json +1 -1
- package/src/index.ts +2 -30
- package/src/types.ts +1 -21
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
|
|
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,22 +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 response;
|
|
323
|
-
}
|
|
324
308
|
async deposit(clendGroup, clendAccount, inputTokenMint, uiAmount) {
|
|
325
309
|
const req = {
|
|
326
310
|
owner: this.address(),
|
|
@@ -414,9 +398,9 @@ class Client {
|
|
|
414
398
|
* Withdraw emissions from a bank
|
|
415
399
|
* @returns Withdraw emissions operation result
|
|
416
400
|
*/
|
|
417
|
-
async withdrawEmissions() {
|
|
401
|
+
async withdrawEmissions(clendAccount) {
|
|
418
402
|
const req = {
|
|
419
|
-
|
|
403
|
+
clendAccount,
|
|
420
404
|
};
|
|
421
405
|
const body = await handleApiCall(() => this.http.post("emissions/withdraw", JSON.stringify(req)));
|
|
422
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
|
-
|
|
94
|
+
clendAccount: web3.PublicKey;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Response for withdraw emissions operation
|
|
@@ -247,20 +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
|
-
bank: Bank;
|
|
258
|
-
historicalBalances: HistoricalBankBalance[];
|
|
259
|
-
}
|
|
260
|
-
export interface HistoricalBankBalance {
|
|
261
|
-
timestamp: string;
|
|
262
|
-
assetAmount: string | null;
|
|
263
|
-
liabilityAmount: string | null;
|
|
264
|
-
assetValue: string | null;
|
|
265
|
-
liabilityValue: string | null;
|
|
266
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrot-protocol/boost-http-client",
|
|
3
|
-
"version": "0.3.3-
|
|
3
|
+
"version": "0.3.3-test-emissions-dist-dev-541a938",
|
|
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,32 +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: GetHistoricalBankBalancesResponse = JSON.parse(body);
|
|
419
|
-
return response;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
394
|
async deposit(
|
|
423
395
|
clendGroup: web3.PublicKey,
|
|
424
396
|
clendAccount: web3.PublicKey | null,
|
|
@@ -597,9 +569,9 @@ export class Client {
|
|
|
597
569
|
* Withdraw emissions from a bank
|
|
598
570
|
* @returns Withdraw emissions operation result
|
|
599
571
|
*/
|
|
600
|
-
async withdrawEmissions(): Promise<string> {
|
|
572
|
+
async withdrawEmissions(clendAccount: web3.PublicKey): Promise<string> {
|
|
601
573
|
const req: WithdrawEmissionsRequest = {
|
|
602
|
-
|
|
574
|
+
clendAccount,
|
|
603
575
|
};
|
|
604
576
|
|
|
605
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
|
-
|
|
107
|
+
clendAccount: web3.PublicKey;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
@@ -283,23 +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
|
-
bank: Bank;
|
|
296
|
-
historicalBalances: HistoricalBankBalance[];
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export interface HistoricalBankBalance {
|
|
300
|
-
timestamp: string;
|
|
301
|
-
assetAmount: string | null;
|
|
302
|
-
liabilityAmount: string | null;
|
|
303
|
-
assetValue: string | null;
|
|
304
|
-
liabilityValue: string | null;
|
|
305
|
-
}
|