@carrot-protocol/boost-http-client 0.1.5 → 0.1.6-app-api-dev-963030f
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 +5 -5
- package/dist/index.js +5 -5
- package/dist/types.d.ts +11 -2
- package/package.json +1 -1
- package/src/index.ts +7 -7
- package/src/types.ts +10 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnchorProvider, web3 } from "@coral-xyz/anchor";
|
|
2
|
-
import { DepositLeverageRequest, GetMarketResponse,
|
|
2
|
+
import { DepositLeverageRequest, GetMarketResponse, GetUserResponse, ModifyLeverageRequest, WithdrawLeverageRequest } from "./types";
|
|
3
3
|
export * from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* HTTP Client for Carrot Boost API
|
|
@@ -21,11 +21,11 @@ export declare class Client {
|
|
|
21
21
|
*/
|
|
22
22
|
index(): Promise<any>;
|
|
23
23
|
/**
|
|
24
|
-
* Get
|
|
25
|
-
* @param
|
|
26
|
-
* @returns
|
|
24
|
+
* Get user details for a wallet
|
|
25
|
+
* @param user wallet public key
|
|
26
|
+
* @returns User details
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
getUser(user: web3.PublicKey): Promise<GetUserResponse>;
|
|
29
29
|
/**
|
|
30
30
|
* Get market details for the carrot boost market
|
|
31
31
|
* @returns Market details
|
package/dist/index.js
CHANGED
|
@@ -96,12 +96,12 @@ class Client {
|
|
|
96
96
|
return handleApiCall(() => this.http.get(""));
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Get
|
|
100
|
-
* @param
|
|
101
|
-
* @returns
|
|
99
|
+
* Get user details for a wallet
|
|
100
|
+
* @param user wallet public key
|
|
101
|
+
* @returns User details
|
|
102
102
|
*/
|
|
103
|
-
async
|
|
104
|
-
const body = await handleApiCall(() => this.http.get(`/
|
|
103
|
+
async getUser(user) {
|
|
104
|
+
const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}`));
|
|
105
105
|
const response = JSON.parse(body);
|
|
106
106
|
return response;
|
|
107
107
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { web3 } from "@coral-xyz/anchor";
|
|
1
|
+
import { BN, web3 } from "@coral-xyz/anchor";
|
|
2
2
|
import Decimal from "decimal.js";
|
|
3
3
|
export interface SendRequest {
|
|
4
4
|
txns: string[];
|
|
@@ -58,7 +58,7 @@ export interface WithdrawLeverageResponse {
|
|
|
58
58
|
unsignedBase64Tx: string;
|
|
59
59
|
signedSetBorrowRateBase64Tx: string;
|
|
60
60
|
}
|
|
61
|
-
export interface
|
|
61
|
+
export interface GetUserResponse {
|
|
62
62
|
netValue: number;
|
|
63
63
|
pnl: number;
|
|
64
64
|
netAPY: number;
|
|
@@ -67,6 +67,13 @@ export interface GetObligationResponse {
|
|
|
67
67
|
totalDebt: number;
|
|
68
68
|
ltv: number;
|
|
69
69
|
liquidationLtv: number;
|
|
70
|
+
usdcBalance: BN;
|
|
71
|
+
usdcBalanceUi: number;
|
|
72
|
+
jlpBalance: BN;
|
|
73
|
+
jlpBalanceUi: number;
|
|
74
|
+
solBalance: BN;
|
|
75
|
+
solBalanceUi: number;
|
|
76
|
+
obligation: any | null;
|
|
70
77
|
}
|
|
71
78
|
export interface GetMarketResponse {
|
|
72
79
|
totalBorrowTVL: number;
|
|
@@ -75,4 +82,6 @@ export interface GetMarketResponse {
|
|
|
75
82
|
usdcBorrowApy: number;
|
|
76
83
|
usdcSupplyAmount: number;
|
|
77
84
|
usdcBorrowAmount: number;
|
|
85
|
+
usdcPrice: number;
|
|
86
|
+
jlpPrice: number;
|
|
78
87
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
DepositLeverageRequest,
|
|
6
6
|
DepositLeverageResponse,
|
|
7
7
|
GetMarketResponse,
|
|
8
|
-
|
|
8
|
+
GetUserResponse,
|
|
9
9
|
ModifyLeverageRequest,
|
|
10
10
|
ModifyLeverageResponse,
|
|
11
11
|
SendRequest,
|
|
@@ -86,16 +86,16 @@ export class Client {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* Get
|
|
90
|
-
* @param
|
|
91
|
-
* @returns
|
|
89
|
+
* Get user details for a wallet
|
|
90
|
+
* @param user wallet public key
|
|
91
|
+
* @returns User details
|
|
92
92
|
*/
|
|
93
|
-
async
|
|
93
|
+
async getUser(user: web3.PublicKey): Promise<GetUserResponse> {
|
|
94
94
|
const body = await handleApiCall(() =>
|
|
95
|
-
this.http.get(`/
|
|
95
|
+
this.http.get(`/user?user=${user.toString()}`),
|
|
96
96
|
);
|
|
97
97
|
|
|
98
|
-
const response:
|
|
98
|
+
const response: GetUserResponse = JSON.parse(body);
|
|
99
99
|
|
|
100
100
|
return response;
|
|
101
101
|
}
|
package/src/types.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface WithdrawLeverageResponse {
|
|
|
69
69
|
signedSetBorrowRateBase64Tx: string;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export interface
|
|
72
|
+
export interface GetUserResponse {
|
|
73
73
|
netValue: number;
|
|
74
74
|
pnl: number;
|
|
75
75
|
netAPY: number;
|
|
@@ -78,6 +78,13 @@ export interface GetObligationResponse {
|
|
|
78
78
|
totalDebt: number;
|
|
79
79
|
ltv: number;
|
|
80
80
|
liquidationLtv: number;
|
|
81
|
+
usdcBalance: BN;
|
|
82
|
+
usdcBalanceUi: number;
|
|
83
|
+
jlpBalance: BN;
|
|
84
|
+
jlpBalanceUi: number;
|
|
85
|
+
solBalance: BN;
|
|
86
|
+
solBalanceUi: number;
|
|
87
|
+
obligation: any | null;
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
export interface GetMarketResponse {
|
|
@@ -87,4 +94,6 @@ export interface GetMarketResponse {
|
|
|
87
94
|
usdcBorrowApy: number;
|
|
88
95
|
usdcSupplyAmount: number;
|
|
89
96
|
usdcBorrowAmount: number;
|
|
97
|
+
usdcPrice: number;
|
|
98
|
+
jlpPrice: number;
|
|
90
99
|
}
|