@carrot-protocol/boost-http-client 0.2.3-withdraw-jlp-dev-e591dae → 0.2.3-withdraw-jlp-dev-4ead85f
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 -2
- package/dist/index.js +3 -2
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/index.ts +6 -2
- package/src/types.ts +5 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnchorProvider, web3 } from "@coral-xyz/anchor";
|
|
2
|
-
import { GetBankResponse, GetUserResponse, GetGroupResponse } from "./types";
|
|
2
|
+
import { GetBankResponse, GetUserResponse, GetGroupResponse, GetUserRequest } from "./types";
|
|
3
3
|
export * from "./types";
|
|
4
4
|
export * from "./utils";
|
|
5
5
|
/**
|
|
@@ -26,7 +26,7 @@ export declare class Client {
|
|
|
26
26
|
* @param user wallet public key
|
|
27
27
|
* @returns User details
|
|
28
28
|
*/
|
|
29
|
-
getUser(
|
|
29
|
+
getUser(request: GetUserRequest): Promise<GetUserResponse>;
|
|
30
30
|
/**
|
|
31
31
|
* Get market details
|
|
32
32
|
* @returns Group Details
|
package/dist/index.js
CHANGED
|
@@ -79,12 +79,13 @@ class Client {
|
|
|
79
79
|
* @param user wallet public key
|
|
80
80
|
* @returns User details
|
|
81
81
|
*/
|
|
82
|
-
async getUser(
|
|
82
|
+
async getUser(request) {
|
|
83
83
|
// use loaded wallet if not provided
|
|
84
|
+
let user = request.user;
|
|
84
85
|
if (!user) {
|
|
85
86
|
user = this.address();
|
|
86
87
|
}
|
|
87
|
-
const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}`));
|
|
88
|
+
const body = await handleApiCall(() => this.http.get(`/user?user=${user.toString()}&getClendEvents=${request.getClendEvents}`));
|
|
88
89
|
const jsonRawResponse = JSON.parse(body);
|
|
89
90
|
// get tokens still in user wallet
|
|
90
91
|
const wallet = {
|
package/dist/types.d.ts
CHANGED
|
@@ -51,6 +51,10 @@ export interface WithdrawLeverageResponse {
|
|
|
51
51
|
export interface GetGroupResponse {
|
|
52
52
|
banks: Bank[];
|
|
53
53
|
}
|
|
54
|
+
export interface GetUserRequest {
|
|
55
|
+
user?: web3.PublicKey;
|
|
56
|
+
getClendEvents?: boolean;
|
|
57
|
+
}
|
|
54
58
|
export interface GetUserResponse {
|
|
55
59
|
wallet: UserWallet;
|
|
56
60
|
clendAccount: ClendAccount | undefined;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
Bank,
|
|
17
17
|
GetGroupResponse,
|
|
18
18
|
ClendAccountEvent,
|
|
19
|
+
GetUserRequest,
|
|
19
20
|
} from "./types";
|
|
20
21
|
import encode from "bs58";
|
|
21
22
|
|
|
@@ -93,14 +94,17 @@ export class Client {
|
|
|
93
94
|
* @param user wallet public key
|
|
94
95
|
* @returns User details
|
|
95
96
|
*/
|
|
96
|
-
async getUser(
|
|
97
|
+
async getUser(request: GetUserRequest): Promise<GetUserResponse> {
|
|
97
98
|
// use loaded wallet if not provided
|
|
99
|
+
let user = request.user;
|
|
98
100
|
if (!user) {
|
|
99
101
|
user = this.address();
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
const body = await handleApiCall(() =>
|
|
103
|
-
this.http.get(
|
|
105
|
+
this.http.get(
|
|
106
|
+
`/user?user=${user.toString()}&getClendEvents=${request.getClendEvents}`,
|
|
107
|
+
),
|
|
104
108
|
);
|
|
105
109
|
|
|
106
110
|
const jsonRawResponse: any = JSON.parse(body);
|
package/src/types.ts
CHANGED
|
@@ -62,6 +62,11 @@ export interface GetGroupResponse {
|
|
|
62
62
|
banks: Bank[];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
export interface GetUserRequest {
|
|
66
|
+
user?: web3.PublicKey;
|
|
67
|
+
getClendEvents?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
export interface GetUserResponse {
|
|
66
71
|
wallet: UserWallet;
|
|
67
72
|
clendAccount: ClendAccount | undefined;
|