@carrot-protocol/http-client 0.2.70-carrot-boost-jit-dev-7ea56ad → 0.2.70-carrot-boost-jit-dev-ff57d74
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 +3 -2
- package/dist/index.js +34 -5
- package/dist/types.d.ts +10 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as anchor from "@coral-xyz/anchor";
|
|
2
2
|
import { Vault, VaultPerformance } from "@carrot-protocol/common";
|
|
3
|
-
import { CheckWalletResponse, ClaimReferralCodeResponse,
|
|
3
|
+
import { CheckWalletResponse, ClaimReferralCodeResponse, GetCarrotBoostJitDepositIxnsRequest, GetCarrotBoostJitDepositIxnsResponse, GetCarrotBoostJitWithdrawIxnsRequest, GetCarrotBoostJitWithdrawIxnsResponse, GetReferralCodesResponse, HistoricalVaultApyResponse, HistoricalVaultNavResponse, UserPerformanceResponse, UserResponse, VaultHistoricalInterval, VaultOhlcResponse } from "./types";
|
|
4
4
|
export * as Common from "@carrot-protocol/common";
|
|
5
5
|
export * from "./types";
|
|
6
6
|
export declare class Client {
|
|
@@ -21,7 +21,8 @@ export declare class Client {
|
|
|
21
21
|
checkWallet(wallet: anchor.web3.PublicKey): Promise<CheckWalletResponse>;
|
|
22
22
|
claimReferralCode(wallet: anchor.web3.PublicKey, code: string): Promise<ClaimReferralCodeResponse>;
|
|
23
23
|
getReferralCodes(wallet: anchor.web3.PublicKey): Promise<GetReferralCodesResponse>;
|
|
24
|
-
|
|
24
|
+
getCarrotBoostJitDepositIxns(request: GetCarrotBoostJitDepositIxnsRequest): Promise<GetCarrotBoostJitDepositIxnsResponse>;
|
|
25
|
+
getCarrotBoostJitWithdrawIxns(request: GetCarrotBoostJitWithdrawIxnsRequest): Promise<GetCarrotBoostJitWithdrawIxnsResponse>;
|
|
25
26
|
private send;
|
|
26
27
|
}
|
|
27
28
|
export declare function prepareUnsignedTx(connection: anchor.web3.Connection, payer: anchor.web3.PublicKey, ixns: anchor.web3.TransactionInstruction[], lutAddr?: anchor.web3.PublicKey, additionalSigner?: anchor.AnchorProvider): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -308,16 +308,45 @@ class Client {
|
|
|
308
308
|
const body = JSON.parse(JSON.stringify(responseBody));
|
|
309
309
|
return body;
|
|
310
310
|
}
|
|
311
|
-
async
|
|
312
|
-
const url = new URL(`${this.baseUrl}/
|
|
311
|
+
async getCarrotBoostJitDepositIxns(request) {
|
|
312
|
+
const url = new URL(`${this.baseUrl}/carrotBoostJitDepositIxns?vault=${request.vault.toString()}&carrotBoostStrategy=${request.carrotBoostStrategy.toString()}&amount=${request.amount.toString()}`);
|
|
313
313
|
const response = await (0, cross_fetch_1.default)(url, {
|
|
314
314
|
method: "GET",
|
|
315
315
|
headers: this.headers,
|
|
316
316
|
});
|
|
317
317
|
checkResponse(response);
|
|
318
318
|
const responseBody = await response.json();
|
|
319
|
+
// intermediate parse
|
|
320
|
+
const body = JSON.parse(JSON.stringify(responseBody));
|
|
321
|
+
// Convert the JSON instructions back to TransactionInstruction objects
|
|
322
|
+
const instructions = body.instructions.map((ix) => {
|
|
323
|
+
return new anchor_1.web3.TransactionInstruction({
|
|
324
|
+
programId: new anchor_1.web3.PublicKey(ix.programId),
|
|
325
|
+
keys: ix.keys.map((key) => ({
|
|
326
|
+
pubkey: new anchor_1.web3.PublicKey(key.pubkey),
|
|
327
|
+
isSigner: Boolean(key.isSigner),
|
|
328
|
+
isWritable: Boolean(key.isWritable),
|
|
329
|
+
})),
|
|
330
|
+
data: Buffer.from(ix.data),
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
const getCarrotBoostJitDepositIxnsResponse = {
|
|
334
|
+
instructions,
|
|
335
|
+
};
|
|
336
|
+
return getCarrotBoostJitDepositIxnsResponse;
|
|
337
|
+
}
|
|
338
|
+
async getCarrotBoostJitWithdrawIxns(request) {
|
|
339
|
+
const url = new URL(`${this.baseUrl}/carrotBoostJitWithdrawIxns?vault=${request.vault.toString()}&carrotBoostStrategy=${request.carrotBoostStrategy.toString()}&amount=${request.amount.toString()}`);
|
|
340
|
+
const response = await (0, cross_fetch_1.default)(url, {
|
|
341
|
+
method: "GET",
|
|
342
|
+
headers: this.headers,
|
|
343
|
+
});
|
|
344
|
+
checkResponse(response);
|
|
345
|
+
const responseBody = await response.json();
|
|
346
|
+
// intermediate parse
|
|
347
|
+
const body = JSON.parse(JSON.stringify(responseBody));
|
|
319
348
|
// Convert the JSON instructions back to TransactionInstruction objects
|
|
320
|
-
const instructions =
|
|
349
|
+
const instructions = body.instructions.map((ix) => {
|
|
321
350
|
return new anchor_1.web3.TransactionInstruction({
|
|
322
351
|
programId: new anchor_1.web3.PublicKey(ix.programId),
|
|
323
352
|
keys: ix.keys.map((key) => ({
|
|
@@ -328,10 +357,10 @@ class Client {
|
|
|
328
357
|
data: Buffer.from(ix.data),
|
|
329
358
|
});
|
|
330
359
|
});
|
|
331
|
-
const
|
|
360
|
+
const getCarrotBoostJitWithdrawIxnsResponse = {
|
|
332
361
|
instructions,
|
|
333
362
|
};
|
|
334
|
-
return
|
|
363
|
+
return getCarrotBoostJitWithdrawIxnsResponse;
|
|
335
364
|
}
|
|
336
365
|
// Sends a signed transaction to the network
|
|
337
366
|
async send(base64Tx) {
|
package/dist/types.d.ts
CHANGED
|
@@ -110,13 +110,20 @@ export interface OhlcEntry {
|
|
|
110
110
|
low: number;
|
|
111
111
|
close: number;
|
|
112
112
|
}
|
|
113
|
-
export interface
|
|
113
|
+
export interface GetCarrotBoostJitDepositIxnsRequest {
|
|
114
|
+
vault: anchor.web3.PublicKey;
|
|
115
|
+
carrotBoostStrategy: anchor.web3.PublicKey;
|
|
116
|
+
amount: anchor.BN;
|
|
117
|
+
}
|
|
118
|
+
export interface GetCarrotBoostJitDepositIxnsResponse {
|
|
119
|
+
instructions: anchor.web3.TransactionInstruction[];
|
|
120
|
+
}
|
|
121
|
+
export interface GetCarrotBoostJitWithdrawIxnsRequest {
|
|
114
122
|
vault: anchor.web3.PublicKey;
|
|
115
123
|
carrotBoostStrategy: anchor.web3.PublicKey;
|
|
116
|
-
assetMint: anchor.web3.PublicKey;
|
|
117
124
|
amount: anchor.BN;
|
|
118
125
|
}
|
|
119
|
-
export interface
|
|
126
|
+
export interface GetCarrotBoostJitWithdrawIxnsResponse {
|
|
120
127
|
instructions: anchor.web3.TransactionInstruction[];
|
|
121
128
|
}
|
|
122
129
|
export {};
|
package/package.json
CHANGED