@haven-fi/solauto-sdk 1.0.489 → 1.0.491
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/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +6 -2
- package/dist/utils/jupiterUtils.js +8 -3
- package/dist/utils/solanaUtils.d.ts +1 -0
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +13 -0
- package/package.json +1 -1
- package/src/transactions/transactionsManager.ts +9 -1
- package/src/utils/jupiterUtils.ts +8 -8
- package/src/utils/solanaUtils.ts +19 -0
- package/tests/transactions/solautoMarginfi.ts +12 -26
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAEL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAEL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAc7D,qBAAa,wBAAyB,SAAQ,KA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AAC,YAAY,CAAe;IACnC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,UAAU,CAAS;IAE3B,kBAAkB,SAAmB;gBAG3B,SAAS,EAAE,aAAa,GAAG,oBAAoB,EAC/C,cAAc,CAAC,GAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,UAAU,GAAE,OAAe,EAC3B,aAAa,CAAC,EAAE,aAAa,YAAA,EACrC,WAAW,CAAC,EAAE,WAAW;YAab,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,mBAAmB;YAoBb,SAAS;IAiBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA0GzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YAkCxB,6BAA6B;YAsI7B,qBAAqB;YAoDrB,eAAe;YA0Df,eAAe;CA4D9B"}
|
@@ -14,7 +14,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
14
14
|
const switchboardConstants_1 = require("../constants/switchboardConstants");
|
15
15
|
const utils_1 = require("../utils");
|
16
16
|
const jitoUtils_1 = require("../utils/jitoUtils");
|
17
|
-
const
|
17
|
+
const constants_1 = require("../constants");
|
18
18
|
const CHORES_TX_NAME = "account chores";
|
19
19
|
const MAX_SUPPORTED_ACCOUNT_LOCKS = 64;
|
20
20
|
class TransactionTooLargeError extends Error {
|
@@ -272,7 +272,10 @@ class TransactionsManager {
|
|
272
272
|
await item.initialize();
|
273
273
|
}
|
274
274
|
const allAccounts = items
|
275
|
-
.filter((x) => x.tx
|
275
|
+
.filter((x) => x.tx
|
276
|
+
?.getInstructions()
|
277
|
+
.find((x) => x.programId === constants_1.SOLAUTO_PROD_PROGRAM.toString() ||
|
278
|
+
x.programId === constants_1.SOLAUTO_TEST_PROGRAM.toString()))
|
276
279
|
.flatMap((x) => x.tx
|
277
280
|
?.getInstructions()
|
278
281
|
.flatMap((x) => x.keys.map((x) => x.pubkey.toString())));
|
@@ -283,6 +286,7 @@ class TransactionsManager {
|
|
283
286
|
.stale;
|
284
287
|
if (stale) {
|
285
288
|
this.txHandler.log("Requires oracle update...");
|
289
|
+
console.log(mint);
|
286
290
|
const swbTx = new TransactionItem(async () => (0, utils_1.buildSwbSubmitResponseTx)(client.connection, client.signer, mint), this.updateOracleTxName);
|
287
291
|
await swbTx.initialize();
|
288
292
|
items.unshift(swbTx);
|
@@ -27,8 +27,14 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
|
|
27
27
|
constants_1.TOKEN_INFO[swapDetails.outputMint.toString()].isMeme;
|
28
28
|
const tokensWithLowAccounts = [constants_1.PYTH, constants_1.INF];
|
29
29
|
// TEMP REVERT ME
|
30
|
-
const useLowAccounts =
|
31
|
-
|
30
|
+
// const useLowAccounts =
|
31
|
+
// tokensWithLowAccounts.find((x) =>
|
32
|
+
// swapDetails.inputMint.equals(new PublicKey(x))
|
33
|
+
// ) ||
|
34
|
+
// tokensWithLowAccounts.find((x) =>
|
35
|
+
// swapDetails.outputMint.equals(new PublicKey(x))
|
36
|
+
// );
|
37
|
+
const useLowAccounts = true;
|
32
38
|
const quoteResponse = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await jupApi.quoteGet({
|
33
39
|
amount: Number(swapDetails.amount),
|
34
40
|
inputMint: swapDetails.inputMint.toString(),
|
@@ -79,7 +85,6 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
|
|
79
85
|
quoteResponse.inAmount = Math.round(parseInt(quoteResponse.inAmount) + parseInt(quoteResponse.inAmount) * inc).toString();
|
80
86
|
(0, generalUtils_1.consoleLog)("Increased inAmount:", quoteResponse.inAmount);
|
81
87
|
}
|
82
|
-
(0, generalUtils_1.consoleLog)(instructions);
|
83
88
|
return {
|
84
89
|
jupQuote: quoteResponse,
|
85
90
|
priceImpactBps: finalPriceImpactBps,
|
@@ -14,6 +14,7 @@ export declare function splTokenTransferUmiIx(signer: Signer, fromTa: PublicKey,
|
|
14
14
|
export declare function getAddressLookupInputs(umi: Umi, lookupTableAddresses: string[]): Promise<AddressLookupTableInput[]>;
|
15
15
|
export declare function addTxOptimizations(signer: Signer, transaction: TransactionBuilder, computeUnitPrice?: number, computeUnitLimit?: number): TransactionBuilder;
|
16
16
|
export declare function assembleFinalTransaction(signer: Signer, transaction: TransactionBuilder, computeUnitPrice?: number, computeUnitLimit?: number): TransactionBuilder;
|
17
|
+
export declare function getQnComputeUnitPriceEstimate(umi: Umi, programId: PublicKey, blockheight?: number): Promise<any>;
|
17
18
|
export declare function getComputeUnitPriceEstimate(umi: Umi, tx: TransactionBuilder, prioritySetting: PriorityFeeSetting, useAccounts?: boolean): Promise<number | undefined>;
|
18
19
|
export declare function sendSingleOptimizedTransaction(umi: Umi, connection: Connection, tx: TransactionBuilder, txType?: TransactionRunType, prioritySetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<Uint8Array | undefined>;
|
19
20
|
//# sourceMappingURL=solanaUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAIL,UAAU,EACV,SAAS,EAKT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
1
|
+
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings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BAAkB,CAKpB;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,GAAG,EACR,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAmBpC;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBAa1B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBA2D1B;AAuBD,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,WAAW,GAAE,MAAW,GACvB,OAAO,CAAC,GAAG,CAAC,CAYd;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,EACnC,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAwC7B;AA+CD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,eAAe,GAAE,kBAA2C,EAC5D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAmEjC"}
|
@@ -16,6 +16,7 @@ exports.splTokenTransferUmiIx = splTokenTransferUmiIx;
|
|
16
16
|
exports.getAddressLookupInputs = getAddressLookupInputs;
|
17
17
|
exports.addTxOptimizations = addTxOptimizations;
|
18
18
|
exports.assembleFinalTransaction = assembleFinalTransaction;
|
19
|
+
exports.getQnComputeUnitPriceEstimate = getQnComputeUnitPriceEstimate;
|
19
20
|
exports.getComputeUnitPriceEstimate = getComputeUnitPriceEstimate;
|
20
21
|
exports.sendSingleOptimizedTransaction = sendSingleOptimizedTransaction;
|
21
22
|
const bs58_1 = __importDefault(require("bs58"));
|
@@ -30,6 +31,7 @@ const marginfi_sdk_1 = require("../marginfi-sdk");
|
|
30
31
|
const types_1 = require("../types");
|
31
32
|
const solauto_1 = require("./solauto");
|
32
33
|
const constants_1 = require("../constants");
|
34
|
+
const axios_1 = __importDefault(require("axios"));
|
33
35
|
function buildHeliusApiUrl(heliusApiKey) {
|
34
36
|
return `https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`;
|
35
37
|
}
|
@@ -150,6 +152,17 @@ async function simulateTransaction(umi, connection, transaction) {
|
|
150
152
|
}
|
151
153
|
return simulationResult;
|
152
154
|
}
|
155
|
+
async function getQnComputeUnitPriceEstimate(umi, programId, blockheight = 50) {
|
156
|
+
return (await axios_1.default.post(umi.rpc.getEndpoint(), {
|
157
|
+
method: "qn_estimatePriorityFees",
|
158
|
+
jsonrpc: "2.0",
|
159
|
+
id: 1,
|
160
|
+
params: {
|
161
|
+
last_n_blocks: blockheight,
|
162
|
+
account: programId.toString(),
|
163
|
+
},
|
164
|
+
})).data;
|
165
|
+
}
|
153
166
|
async function getComputeUnitPriceEstimate(umi, tx, prioritySetting, useAccounts) {
|
154
167
|
const web3Transaction = (0, umi_web3js_adapters_1.toWeb3JsTransaction)((await tx.setLatestBlockhash(umi, { commitment: "finalized" })).build(umi));
|
155
168
|
const accountKeys = tx
|
package/package.json
CHANGED
@@ -32,6 +32,7 @@ import { SWITCHBOARD_PRICE_FEED_IDS } from "../constants/switchboardConstants";
|
|
32
32
|
import { buildSwbSubmitResponseTx, getSwitchboardFeedData } from "../utils";
|
33
33
|
import { sendJitoBundledTransactions } from "../utils/jitoUtils";
|
34
34
|
import { JUPITER_PROGRAM_ID } from "../jupiter-sdk";
|
35
|
+
import { SOLAUTO_PROD_PROGRAM, SOLAUTO_TEST_PROGRAM } from "../constants";
|
35
36
|
|
36
37
|
const CHORES_TX_NAME = "account chores";
|
37
38
|
const MAX_SUPPORTED_ACCOUNT_LOCKS = 64;
|
@@ -436,7 +437,13 @@ export class TransactionsManager {
|
|
436
437
|
|
437
438
|
const allAccounts = items
|
438
439
|
.filter((x) =>
|
439
|
-
x.tx
|
440
|
+
x.tx
|
441
|
+
?.getInstructions()
|
442
|
+
.find(
|
443
|
+
(x) =>
|
444
|
+
x.programId === SOLAUTO_PROD_PROGRAM.toString() ||
|
445
|
+
x.programId === SOLAUTO_TEST_PROGRAM.toString()
|
446
|
+
)
|
440
447
|
)
|
441
448
|
.flatMap((x) =>
|
442
449
|
x.tx
|
@@ -457,6 +464,7 @@ export class TransactionsManager {
|
|
457
464
|
|
458
465
|
if (stale) {
|
459
466
|
this.txHandler.log("Requires oracle update...");
|
467
|
+
console.log(mint);
|
460
468
|
const swbTx = new TransactionItem(
|
461
469
|
async () =>
|
462
470
|
buildSwbSubmitResponseTx(client.connection, client.signer, mint),
|
@@ -62,13 +62,14 @@ export async function getJupSwapTransaction(
|
|
62
62
|
|
63
63
|
const tokensWithLowAccounts = [PYTH, INF];
|
64
64
|
// TEMP REVERT ME
|
65
|
-
const useLowAccounts =
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
// const useLowAccounts =
|
66
|
+
// tokensWithLowAccounts.find((x) =>
|
67
|
+
// swapDetails.inputMint.equals(new PublicKey(x))
|
68
|
+
// ) ||
|
69
|
+
// tokensWithLowAccounts.find((x) =>
|
70
|
+
// swapDetails.outputMint.equals(new PublicKey(x))
|
71
|
+
// );
|
72
|
+
const useLowAccounts = true;
|
72
73
|
|
73
74
|
const quoteResponse = await retryWithExponentialBackoff(
|
74
75
|
async () =>
|
@@ -147,7 +148,6 @@ export async function getJupSwapTransaction(
|
|
147
148
|
consoleLog("Increased inAmount:", quoteResponse.inAmount);
|
148
149
|
}
|
149
150
|
|
150
|
-
consoleLog(instructions);
|
151
151
|
return {
|
152
152
|
jupQuote: quoteResponse,
|
153
153
|
priceImpactBps: finalPriceImpactBps,
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -45,6 +45,7 @@ import {
|
|
45
45
|
import { PriorityFeeSetting, TransactionRunType } from "../types";
|
46
46
|
import { createDynamicSolautoProgram } from "./solauto";
|
47
47
|
import { SOLAUTO_PROD_PROGRAM } from "../constants";
|
48
|
+
import axios from "axios";
|
48
49
|
|
49
50
|
export function buildHeliusApiUrl(heliusApiKey: string) {
|
50
51
|
return `https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`;
|
@@ -286,6 +287,24 @@ async function simulateTransaction(
|
|
286
287
|
return simulationResult;
|
287
288
|
}
|
288
289
|
|
290
|
+
export async function getQnComputeUnitPriceEstimate(
|
291
|
+
umi: Umi,
|
292
|
+
programId: PublicKey,
|
293
|
+
blockheight: number = 50
|
294
|
+
): Promise<any> {
|
295
|
+
return (
|
296
|
+
await axios.post(umi.rpc.getEndpoint(), {
|
297
|
+
method: "qn_estimatePriorityFees",
|
298
|
+
jsonrpc: "2.0",
|
299
|
+
id: 1,
|
300
|
+
params: {
|
301
|
+
last_n_blocks: blockheight,
|
302
|
+
account: programId.toString(),
|
303
|
+
},
|
304
|
+
})
|
305
|
+
).data;
|
306
|
+
}
|
307
|
+
|
289
308
|
export async function getComputeUnitPriceEstimate(
|
290
309
|
umi: Umi,
|
291
310
|
tx: TransactionBuilder,
|
@@ -33,22 +33,13 @@ import {
|
|
33
33
|
} from "../../src/constants";
|
34
34
|
import {
|
35
35
|
buildHeliusApiUrl,
|
36
|
-
|
36
|
+
getQnComputeUnitPriceEstimate,
|
37
37
|
getSolautoManagedPositions,
|
38
38
|
retryWithExponentialBackoff,
|
39
39
|
} from "../../src/utils";
|
40
40
|
import { PriorityFeeSetting } from "../../src/types";
|
41
|
-
import { buildIronforgeApiUrl
|
42
|
-
import {
|
43
|
-
|
44
|
-
export function getFlooredTimestampByMinute(
|
45
|
-
unixSeconds: number,
|
46
|
-
intervalInMinutes: number = 1
|
47
|
-
): number {
|
48
|
-
const unixTime = Math.floor(new Date(unixSeconds * 1000).getTime() / 1000);
|
49
|
-
const interval = intervalInMinutes * 60;
|
50
|
-
return Math.floor(unixTime / interval) * interval;
|
51
|
-
}
|
41
|
+
import { buildIronforgeApiUrl } from "../../dist";
|
42
|
+
import { JUPITER_PROGRAM_ID } from "../../src/jupiter-sdk";
|
52
43
|
|
53
44
|
describe("Solauto Marginfi tests", async () => {
|
54
45
|
// const signer = setupTest();
|
@@ -72,7 +63,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
72
63
|
await client.initialize({
|
73
64
|
signer,
|
74
65
|
positionId,
|
75
|
-
authority: new PublicKey("
|
66
|
+
authority: new PublicKey("GAFLx1PRLc8UVc6tBbKH3KuGf3hPYahQ3SnnavpZQkQG"),
|
76
67
|
// new: true,
|
77
68
|
// marginfiAccount: new PublicKey(
|
78
69
|
// ""
|
@@ -82,21 +73,16 @@ describe("Solauto Marginfi tests", async () => {
|
|
82
73
|
// debtMint: new PublicKey(USDC),
|
83
74
|
});
|
84
75
|
|
85
|
-
// console.log(await client.getFreshPositionStat\e());
|
86
|
-
|
87
|
-
// const debtBank = await safeFetchBank(
|
88
|
-
// client.umi,
|
89
|
-
// publicKey(MARGINFI_ACCOUNTS[DEFAULT_MARGINFI_GROUP][USDC].bank)
|
90
|
-
// );
|
91
|
-
// const state = await getMarginfiAccountPositionState(client.umi, {
|
92
|
-
// pk: new PublicKey("85YaXXB1uyDMLYf4ob6jfV1kr29muVNm7mpmM8qjbVq6"),
|
93
|
-
// });
|
94
|
-
// console.log(state);
|
95
|
-
// console.log(maxBoostToBps(state.maxLtvBps, state.liqThresholdBps));
|
96
76
|
// console.log(
|
97
|
-
//
|
77
|
+
// JSON.stringify(
|
78
|
+
// await getQnComputeUnitPriceEstimate(
|
79
|
+
// client.umi,
|
80
|
+
// new PublicKey(JUPITER_PROGRAM_ID)
|
81
|
+
// ),
|
82
|
+
// null,
|
83
|
+
// 2
|
84
|
+
// )
|
98
85
|
// );
|
99
|
-
// console.log(getLiqUtilzationRateBps(18.78, 7.47, state.liqThresholdBps));
|
100
86
|
// return;
|
101
87
|
|
102
88
|
const transactionItems: TransactionItem[] = [];
|