@carrot-protocol/http-client 0.2.70-carrot-boost-jit-dev-bdc4d5d → 0.2.70-carrot-boost-jit-dev-7ea56ad
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 +18 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44,6 +44,7 @@ exports.prepareUnsignedTx = prepareUnsignedTx;
|
|
|
44
44
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
45
45
|
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
46
46
|
const bs58_1 = require("bs58");
|
|
47
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
47
48
|
// when pulling in http-client you will have access to Common as intended
|
|
48
49
|
exports.Common = __importStar(require("@carrot-protocol/common"));
|
|
49
50
|
// export http types
|
|
@@ -308,15 +309,29 @@ class Client {
|
|
|
308
309
|
return body;
|
|
309
310
|
}
|
|
310
311
|
async getCarrotBoostJitIxns(request) {
|
|
311
|
-
const url = new URL(`${this.baseUrl}/
|
|
312
|
+
const url = new URL(`${this.baseUrl}/carrotBoostJitIxns?vault=${request.vault.toString()}&carrotBoostStrategy=${request.carrotBoostStrategy.toString()}&assetMint=${request.assetMint.toString()}&amount=${request.amount.toString()}`);
|
|
312
313
|
const response = await (0, cross_fetch_1.default)(url, {
|
|
313
314
|
method: "GET",
|
|
314
315
|
headers: this.headers,
|
|
315
316
|
});
|
|
316
317
|
checkResponse(response);
|
|
317
318
|
const responseBody = await response.json();
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
// Convert the JSON instructions back to TransactionInstruction objects
|
|
320
|
+
const instructions = responseBody.map((ix) => {
|
|
321
|
+
return new anchor_1.web3.TransactionInstruction({
|
|
322
|
+
programId: new anchor_1.web3.PublicKey(ix.programId),
|
|
323
|
+
keys: ix.keys.map((key) => ({
|
|
324
|
+
pubkey: new anchor_1.web3.PublicKey(key.pubkey),
|
|
325
|
+
isSigner: Boolean(key.isSigner),
|
|
326
|
+
isWritable: Boolean(key.isWritable),
|
|
327
|
+
})),
|
|
328
|
+
data: Buffer.from(ix.data),
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
const getCarrotBoostJitIxnsResponse = {
|
|
332
|
+
instructions,
|
|
333
|
+
};
|
|
334
|
+
return getCarrotBoostJitIxnsResponse;
|
|
320
335
|
}
|
|
321
336
|
// Sends a signed transaction to the network
|
|
322
337
|
async send(base64Tx) {
|
package/package.json
CHANGED