@carrot-protocol/http-client 0.2.70-carrot-boost-jit-dev-073d4de → 0.2.70-carrot-boost-jit-dev-bfcb716
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 +31 -4
- 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,8 +308,8 @@ 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,
|
|
@@ -330,10 +330,37 @@ class Client {
|
|
|
330
330
|
data: Buffer.from(ix.data),
|
|
331
331
|
});
|
|
332
332
|
});
|
|
333
|
-
const
|
|
333
|
+
const getCarrotBoostJitDepositIxnsResponse = {
|
|
334
334
|
instructions,
|
|
335
335
|
};
|
|
336
|
-
return
|
|
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));
|
|
348
|
+
// Convert the JSON instructions back to TransactionInstruction objects
|
|
349
|
+
const instructions = body.instructions.map((ix) => {
|
|
350
|
+
return new anchor_1.web3.TransactionInstruction({
|
|
351
|
+
programId: new anchor_1.web3.PublicKey(ix.programId),
|
|
352
|
+
keys: ix.keys.map((key) => ({
|
|
353
|
+
pubkey: new anchor_1.web3.PublicKey(key.pubkey),
|
|
354
|
+
isSigner: Boolean(key.isSigner),
|
|
355
|
+
isWritable: Boolean(key.isWritable),
|
|
356
|
+
})),
|
|
357
|
+
data: Buffer.from(ix.data),
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
const getCarrotBoostJitWithdrawIxnsResponse = {
|
|
361
|
+
instructions,
|
|
362
|
+
};
|
|
363
|
+
return getCarrotBoostJitWithdrawIxnsResponse;
|
|
337
364
|
}
|
|
338
365
|
// Sends a signed transaction to the network
|
|
339
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