@carrot-protocol/boost-http-client 0.2.12 → 0.2.13-inputs-dev-88a7a7e
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 +22 -1
- package/dist/types.d.ts +10 -1
- package/package.json +1 -1
- package/src/index.ts +24 -1
- package/src/types.ts +11 -1
package/dist/index.js
CHANGED
|
@@ -170,9 +170,30 @@ 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
|
+
inputs: undefined,
|
|
174
174
|
events: [],
|
|
175
175
|
};
|
|
176
|
+
// parse inputs if they exist
|
|
177
|
+
if (s.inputs) {
|
|
178
|
+
const inputs = {
|
|
179
|
+
apiPath: s.inputs.apiPath,
|
|
180
|
+
selectedTokenMint: s.inputs.selectedTokenMint
|
|
181
|
+
? new anchor_1.web3.PublicKey(s.inputs.selectedTokenMint)
|
|
182
|
+
: null,
|
|
183
|
+
amountUi: s.inputs.amountUi ? Number(s.inputs.amountUi) : null,
|
|
184
|
+
leverage: s.inputs.leverage ? Number(s.inputs.leverage) : null,
|
|
185
|
+
slippageBps: s.inputs.slippageBps
|
|
186
|
+
? Number(s.inputs.slippageBps)
|
|
187
|
+
: null,
|
|
188
|
+
openPosition: s.inputs.openPosition
|
|
189
|
+
? Boolean(s.inputs.openPosition)
|
|
190
|
+
: null,
|
|
191
|
+
closePosition: s.inputs.closePosition
|
|
192
|
+
? Boolean(s.inputs.closePosition)
|
|
193
|
+
: null,
|
|
194
|
+
};
|
|
195
|
+
txSummary.inputs = inputs;
|
|
196
|
+
}
|
|
176
197
|
// get events for each summary
|
|
177
198
|
for (const event of s.events) {
|
|
178
199
|
let closeBalance = null;
|
package/dist/types.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export interface ClendAccountTxSummary {
|
|
|
133
133
|
clendAccount: web3.PublicKey;
|
|
134
134
|
clendAccountAuthority: web3.PublicKey;
|
|
135
135
|
clendGroup: web3.PublicKey;
|
|
136
|
-
|
|
136
|
+
inputs?: UserRequest;
|
|
137
137
|
events: ClendAccountEvent[];
|
|
138
138
|
}
|
|
139
139
|
export interface ClendAccountEvent {
|
|
@@ -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,32 @@ 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
|
+
inputs: undefined,
|
|
193
194
|
events: [],
|
|
194
195
|
};
|
|
195
196
|
|
|
197
|
+
// parse inputs if they exist
|
|
198
|
+
if (s.inputs) {
|
|
199
|
+
const inputs: UserRequest = {
|
|
200
|
+
apiPath: s.inputs.apiPath,
|
|
201
|
+
selectedTokenMint: s.inputs.selectedTokenMint
|
|
202
|
+
? new web3.PublicKey(s.inputs.selectedTokenMint)
|
|
203
|
+
: null,
|
|
204
|
+
amountUi: s.inputs.amountUi ? Number(s.inputs.amountUi) : null,
|
|
205
|
+
leverage: s.inputs.leverage ? Number(s.inputs.leverage) : null,
|
|
206
|
+
slippageBps: s.inputs.slippageBps
|
|
207
|
+
? Number(s.inputs.slippageBps)
|
|
208
|
+
: null,
|
|
209
|
+
openPosition: s.inputs.openPosition
|
|
210
|
+
? Boolean(s.inputs.openPosition)
|
|
211
|
+
: null,
|
|
212
|
+
closePosition: s.inputs.closePosition
|
|
213
|
+
? Boolean(s.inputs.closePosition)
|
|
214
|
+
: null,
|
|
215
|
+
};
|
|
216
|
+
txSummary.inputs = inputs;
|
|
217
|
+
}
|
|
218
|
+
|
|
196
219
|
// get events for each summary
|
|
197
220
|
for (const event of s.events) {
|
|
198
221
|
let closeBalance: boolean | null = null;
|
package/src/types.ts
CHANGED
|
@@ -150,7 +150,7 @@ export interface ClendAccountTxSummary {
|
|
|
150
150
|
clendAccount: web3.PublicKey;
|
|
151
151
|
clendAccountAuthority: web3.PublicKey;
|
|
152
152
|
clendGroup: web3.PublicKey;
|
|
153
|
-
|
|
153
|
+
inputs?: UserRequest;
|
|
154
154
|
events: ClendAccountEvent[];
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -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
|
+
}
|