@carrot-protocol/boost-http-client 0.2.12 → 0.2.13-inputs-dev-b6557d8
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.js +20 -1
- package/dist/types.d.ts +10 -1
- package/package.json +1 -1
- package/src/index.ts +22 -1
- package/src/types.ts +11 -1
package/dist/index.js
CHANGED
|
@@ -170,9 +170,28 @@ class Client {
|
|
|
170
170
|
clendAccount: new anchor_1.web3.PublicKey(s.clendAccount),
|
|
171
171
|
clendAccountAuthority: new anchor_1.web3.PublicKey(s.clendAccountAuthority),
|
|
172
172
|
clendGroup: new anchor_1.web3.PublicKey(s.clendGroup),
|
|
173
|
-
|
|
173
|
+
input: undefined,
|
|
174
174
|
events: [],
|
|
175
175
|
};
|
|
176
|
+
// parse inputs if they exist
|
|
177
|
+
if (s.input) {
|
|
178
|
+
const input = {
|
|
179
|
+
apiPath: s.input.apiPath,
|
|
180
|
+
selectedTokenMint: s.input.selectedTokenMint
|
|
181
|
+
? new anchor_1.web3.PublicKey(s.input.selectedTokenMint)
|
|
182
|
+
: null,
|
|
183
|
+
amountUi: s.input.amountUi ? Number(s.input.amountUi) : null,
|
|
184
|
+
leverage: s.input.leverage ? Number(s.input.leverage) : null,
|
|
185
|
+
slippageBps: s.input.slippageBps ? Number(s.input.slippageBps) : null,
|
|
186
|
+
openPosition: s.input.openPosition
|
|
187
|
+
? Boolean(s.input.openPosition)
|
|
188
|
+
: null,
|
|
189
|
+
closePosition: s.input.closePosition
|
|
190
|
+
? Boolean(s.input.closePosition)
|
|
191
|
+
: null,
|
|
192
|
+
};
|
|
193
|
+
txSummary.input = input;
|
|
194
|
+
}
|
|
176
195
|
// get events for each summary
|
|
177
196
|
for (const event of s.events) {
|
|
178
197
|
let closeBalance = null;
|
package/dist/types.d.ts
CHANGED
|
@@ -133,8 +133,8 @@ export interface ClendAccountTxSummary {
|
|
|
133
133
|
clendAccount: web3.PublicKey;
|
|
134
134
|
clendAccountAuthority: web3.PublicKey;
|
|
135
135
|
clendGroup: web3.PublicKey;
|
|
136
|
-
action: string;
|
|
137
136
|
events: ClendAccountEvent[];
|
|
137
|
+
input?: UserRequest;
|
|
138
138
|
}
|
|
139
139
|
export interface ClendAccountEvent {
|
|
140
140
|
eventIndex: number;
|
|
@@ -147,3 +147,12 @@ export interface ClendAccountEvent {
|
|
|
147
147
|
price: number | null;
|
|
148
148
|
closeBalance: boolean | null;
|
|
149
149
|
}
|
|
150
|
+
export interface UserRequest {
|
|
151
|
+
apiPath: string;
|
|
152
|
+
selectedTokenMint: web3.PublicKey | null;
|
|
153
|
+
amountUi: number | null;
|
|
154
|
+
leverage: number | null;
|
|
155
|
+
slippageBps: number | null;
|
|
156
|
+
openPosition: boolean | null;
|
|
157
|
+
closePosition: boolean | null;
|
|
158
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ClendAccountEvent,
|
|
19
19
|
GetUserRequest,
|
|
20
20
|
ClendAccountTxSummary,
|
|
21
|
+
UserRequest,
|
|
21
22
|
} from "./types";
|
|
22
23
|
import encode from "bs58";
|
|
23
24
|
|
|
@@ -189,10 +190,30 @@ export class Client {
|
|
|
189
190
|
clendAccount: new web3.PublicKey(s.clendAccount),
|
|
190
191
|
clendAccountAuthority: new web3.PublicKey(s.clendAccountAuthority),
|
|
191
192
|
clendGroup: new web3.PublicKey(s.clendGroup),
|
|
192
|
-
|
|
193
|
+
input: undefined,
|
|
193
194
|
events: [],
|
|
194
195
|
};
|
|
195
196
|
|
|
197
|
+
// parse inputs if they exist
|
|
198
|
+
if (s.input) {
|
|
199
|
+
const input: UserRequest = {
|
|
200
|
+
apiPath: s.input.apiPath,
|
|
201
|
+
selectedTokenMint: s.input.selectedTokenMint
|
|
202
|
+
? new web3.PublicKey(s.input.selectedTokenMint)
|
|
203
|
+
: null,
|
|
204
|
+
amountUi: s.input.amountUi ? Number(s.input.amountUi) : null,
|
|
205
|
+
leverage: s.input.leverage ? Number(s.input.leverage) : null,
|
|
206
|
+
slippageBps: s.input.slippageBps ? Number(s.input.slippageBps) : null,
|
|
207
|
+
openPosition: s.input.openPosition
|
|
208
|
+
? Boolean(s.input.openPosition)
|
|
209
|
+
: null,
|
|
210
|
+
closePosition: s.input.closePosition
|
|
211
|
+
? Boolean(s.input.closePosition)
|
|
212
|
+
: null,
|
|
213
|
+
};
|
|
214
|
+
txSummary.input = input;
|
|
215
|
+
}
|
|
216
|
+
|
|
196
217
|
// get events for each summary
|
|
197
218
|
for (const event of s.events) {
|
|
198
219
|
let closeBalance: boolean | null = null;
|
package/src/types.ts
CHANGED
|
@@ -150,8 +150,8 @@ export interface ClendAccountTxSummary {
|
|
|
150
150
|
clendAccount: web3.PublicKey;
|
|
151
151
|
clendAccountAuthority: web3.PublicKey;
|
|
152
152
|
clendGroup: web3.PublicKey;
|
|
153
|
-
action: string;
|
|
154
153
|
events: ClendAccountEvent[];
|
|
154
|
+
input?: UserRequest;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export interface ClendAccountEvent {
|
|
@@ -165,3 +165,13 @@ export interface ClendAccountEvent {
|
|
|
165
165
|
price: number | null;
|
|
166
166
|
closeBalance: boolean | null;
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
export interface UserRequest {
|
|
170
|
+
apiPath: string;
|
|
171
|
+
selectedTokenMint: web3.PublicKey | null;
|
|
172
|
+
amountUi: number | null;
|
|
173
|
+
leverage: number | null;
|
|
174
|
+
slippageBps: number | null;
|
|
175
|
+
openPosition: boolean | null;
|
|
176
|
+
closePosition: boolean | null;
|
|
177
|
+
}
|