@haven-fi/solauto-sdk 1.0.401 → 1.0.402
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 +1 -1
- package/dist/types/solauto.d.ts +2 -1
- package/dist/types/solauto.d.ts.map +1 -1
- package/dist/types/solauto.js +1 -0
- package/dist/utils/jitoUtils.d.ts +2 -2
- package/dist/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +6 -1
- package/dist/utils/jupiterUtils.js +1 -1
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +29 -30
- package/dist/utils/solauto/rebalanceUtils.js +1 -1
- package/package.json +1 -1
- package/src/transactions/transactionsManager.ts +1 -0
- package/src/types/solauto.ts +1 -0
- package/src/utils/jitoUtils.ts +9 -0
- package/src/utils/jupiterUtils.ts +1 -1
- package/src/utils/solanaUtils.ts +19 -18
- package/src/utils/solauto/rebalanceUtils.ts +1 -1
- package/tests/transactions/solautoMarginfi.ts +21 -153
@@ -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,EACL,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;AAW7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAMjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,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0B,CAAC;IA+FzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YA4BxB,6BAA6B;YAwH7B,qBAAqB;YA2CrB,cAAc;YAqCd,eAAe;CA0D9B"}
|
@@ -355,7 +355,7 @@ class TransactionsManager {
|
|
355
355
|
let txSigs;
|
356
356
|
let error;
|
357
357
|
try {
|
358
|
-
txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.signer, transactions, this.txType, this.getUpdatedPriorityFeeSetting(prevError, attemptNum), () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true));
|
358
|
+
txSigs = await (0, jitoUtils_1.sendJitoBundledTransactions)(this.txHandler.umi, this.txHandler.connection, this.txHandler.signer, transactions, this.txType, this.getUpdatedPriorityFeeSetting(prevError, attemptNum), () => this.updateStatusForSets(itemSets, TransactionStatus.Processing, attemptNum, undefined, true));
|
359
359
|
}
|
360
360
|
catch (e) {
|
361
361
|
error = e;
|
package/dist/types/solauto.d.ts
CHANGED
@@ -16,7 +16,8 @@ export declare enum PriorityFeeSetting {
|
|
16
16
|
Min = "Min",
|
17
17
|
Low = "Low",
|
18
18
|
Default = "Medium",
|
19
|
-
High = "High"
|
19
|
+
High = "High",
|
20
|
+
VeryHigh = "VeryHigh"
|
20
21
|
}
|
21
22
|
export declare const priorityFeeSettingValues: PriorityFeeSetting[];
|
22
23
|
export type RebalanceAction = "boost" | "repay" | "dca";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solauto.d.ts","sourceRoot":"","sources":["../../src/types/solauto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAA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AQ,CAAC;AAEhF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC"}
|
package/dist/types/solauto.js
CHANGED
@@ -8,5 +8,6 @@ var PriorityFeeSetting;
|
|
8
8
|
PriorityFeeSetting["Low"] = "Low";
|
9
9
|
PriorityFeeSetting["Default"] = "Medium";
|
10
10
|
PriorityFeeSetting["High"] = "High";
|
11
|
+
PriorityFeeSetting["VeryHigh"] = "VeryHigh";
|
11
12
|
})(PriorityFeeSetting || (exports.PriorityFeeSetting = PriorityFeeSetting = {}));
|
12
13
|
exports.priorityFeeSettingValues = Object.values(PriorityFeeSetting);
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { PublicKey } from "@solana/web3.js";
|
1
|
+
import { Connection, PublicKey } from "@solana/web3.js";
|
2
2
|
import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
|
3
3
|
import { PriorityFeeSetting, TransactionRunType } from "../types";
|
4
4
|
export declare function getRandomTipAccount(): Promise<PublicKey>;
|
5
|
-
export declare function sendJitoBundledTransactions(umi: Umi, signer: Signer, txs: TransactionBuilder[], txType?: TransactionRunType, priorityFeeSetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<string[] | undefined>;
|
5
|
+
export declare function sendJitoBundledTransactions(umi: Umi, connection: Connection, signer: Signer, txs: TransactionBuilder[], txType?: TransactionRunType, priorityFeeSetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<string[] | undefined>;
|
6
6
|
//# sourceMappingURL=jitoUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"jitoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jitoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAEJ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAiND,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,kBAAkB,EAAE,EACzB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CA6E/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -14,6 +14,7 @@ const types_1 = require("../types");
|
|
14
14
|
const axios_1 = __importDefault(require("axios"));
|
15
15
|
const bs58_1 = __importDefault(require("bs58"));
|
16
16
|
const transactions_1 = require("../types/transactions");
|
17
|
+
const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
17
18
|
async function getRandomTipAccount() {
|
18
19
|
const tipAccounts = [
|
19
20
|
"96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5",
|
@@ -172,7 +173,11 @@ async function sendJitoBundle(umi, transactions) {
|
|
172
173
|
(0, generalUtils_1.consoleLog)("Bundle ID:", bundleId);
|
173
174
|
return bundleId ? await pollBundleStatus(bundleId) : [];
|
174
175
|
}
|
175
|
-
async function sendJitoBundledTransactions(umi, signer, txs, txType, priorityFeeSetting = types_1.PriorityFeeSetting.Min, onAwaitingSign) {
|
176
|
+
async function sendJitoBundledTransactions(umi, connection, signer, txs, txType, priorityFeeSetting = types_1.PriorityFeeSetting.Min, onAwaitingSign) {
|
177
|
+
if (txs.length === 1) {
|
178
|
+
const resp = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(umi, connection, txs[0], txType, priorityFeeSetting, onAwaitingSign);
|
179
|
+
return resp ? [bytes_1.bs58.encode(resp)] : undefined;
|
180
|
+
}
|
176
181
|
(0, generalUtils_1.consoleLog)("Sending Jito bundle...");
|
177
182
|
(0, generalUtils_1.consoleLog)("Transactions: ", txs.length);
|
178
183
|
(0, generalUtils_1.consoleLog)("Transaction sizes: ", txs.map((x) => x.getTransactionSize(umi)));
|
@@ -35,7 +35,7 @@ async function getJupSwapTransaction(signer, swapDetails, attemptNum) {
|
|
35
35
|
? "ExactIn"
|
36
36
|
: undefined,
|
37
37
|
slippageBps: memecoinSwap ? 500 : 50,
|
38
|
-
maxAccounts: !swapDetails.exactOut ?
|
38
|
+
maxAccounts: !swapDetails.exactOut ? 60 : undefined,
|
39
39
|
}), 4, 200);
|
40
40
|
const priceImpactBps = Math.round((0, numberUtils_1.toBps)(parseFloat(quoteResponse.priceImpactPct))) + 1;
|
41
41
|
const finalPriceSlippageBps = Math.round(Math.max(50, quoteResponse.slippageBps, priceImpactBps) *
|
@@ -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;AAIlE,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,UAErD;AAED,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,M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async function getComputeUnitPriceEstimate(umi, tx, prioritySetting, useAccounts
|
|
156
156
|
.getInstructions()
|
157
157
|
.flatMap((x) => x.keys.flatMap((x) => x.pubkey.toString()));
|
158
158
|
let feeEstimate;
|
159
|
-
try {
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
},
|
159
|
+
// try {
|
160
|
+
const resp = await umi.rpc.call("getPriorityFeeEstimate", [
|
161
|
+
{
|
162
|
+
transaction: !useAccounts
|
163
|
+
? bs58_1.default.encode(web3Transaction.serialize())
|
164
|
+
: undefined,
|
165
|
+
accountKeys: useAccounts ? accountKeys : undefined,
|
166
|
+
options: {
|
167
|
+
priorityLevel: prioritySetting.toString(),
|
169
168
|
},
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
}
|
169
|
+
},
|
170
|
+
]);
|
171
|
+
feeEstimate = Math.round(resp.priorityFeeEstimate);
|
172
|
+
// }
|
173
|
+
// catch (e) {
|
174
|
+
// try {
|
175
|
+
// const resp = await umi.rpc.call("getPriorityFeeEstimate", [
|
176
|
+
// {
|
177
|
+
// accountKeys,
|
178
|
+
// options: {
|
179
|
+
// priorityLevel: prioritySetting.toString(),
|
180
|
+
// },
|
181
|
+
// },
|
182
|
+
// ]);
|
183
|
+
// feeEstimate = Math.round((resp as any).priorityFeeEstimate as number);
|
184
|
+
// } catch (e) {
|
185
|
+
// // console.error(e);
|
186
|
+
// }
|
187
|
+
// }
|
189
188
|
return feeEstimate;
|
190
189
|
}
|
191
190
|
async function spamSendTransactionUntilConfirmed(connection, transaction, blockhash, spamInterval = 1500) {
|
@@ -245,7 +244,7 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, txType, prior
|
|
245
244
|
if (!cuPrice) {
|
246
245
|
cuPrice = 1000000;
|
247
246
|
}
|
248
|
-
cuPrice = Math.min(cuPrice, 100 *
|
247
|
+
// cuPrice = Math.min(cuPrice, 100 * 1_000_000);
|
249
248
|
(0, generalUtils_1.consoleLog)("Compute unit price: ", cuPrice);
|
250
249
|
}
|
251
250
|
if (txType !== "only-simulate") {
|
@@ -170,7 +170,7 @@ function getJupSwapRebalanceDetails(client, values, targetLiqUtilizationRateBps,
|
|
170
170
|
inputMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(input.mint),
|
171
171
|
outputMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(output.mint),
|
172
172
|
destinationWallet: client.solautoPosition,
|
173
|
-
slippageIncFactor:
|
173
|
+
slippageIncFactor: 1 + (attemptNum ?? 0) * 0.2,
|
174
174
|
amount: exactOut ? outputAmount : inputAmount,
|
175
175
|
exactIn: exactIn,
|
176
176
|
exactOut: exactOut,
|
package/package.json
CHANGED
package/src/types/solauto.ts
CHANGED
package/src/utils/jitoUtils.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import {
|
2
|
+
Connection,
|
2
3
|
PublicKey,
|
3
4
|
SimulatedTransactionResponse,
|
4
5
|
TransactionExpiredBlockheightExceededError,
|
@@ -15,6 +16,7 @@ import {
|
|
15
16
|
import {
|
16
17
|
assembleFinalTransaction,
|
17
18
|
getComputeUnitPriceEstimate,
|
19
|
+
sendSingleOptimizedTransaction,
|
18
20
|
systemTransferUmiIx,
|
19
21
|
} from "./solanaUtils";
|
20
22
|
import { consoleLog, retryWithExponentialBackoff } from "./generalUtils";
|
@@ -22,6 +24,7 @@ import { PriorityFeeSetting, TransactionRunType } from "../types";
|
|
22
24
|
import axios from "axios";
|
23
25
|
import base58 from "bs58";
|
24
26
|
import { BundleSimulationError } from "../types/transactions";
|
27
|
+
import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";
|
25
28
|
|
26
29
|
export async function getRandomTipAccount(): Promise<PublicKey> {
|
27
30
|
const tipAccounts = [
|
@@ -247,12 +250,18 @@ async function sendJitoBundle(
|
|
247
250
|
|
248
251
|
export async function sendJitoBundledTransactions(
|
249
252
|
umi: Umi,
|
253
|
+
connection: Connection,
|
250
254
|
signer: Signer,
|
251
255
|
txs: TransactionBuilder[],
|
252
256
|
txType?: TransactionRunType,
|
253
257
|
priorityFeeSetting: PriorityFeeSetting = PriorityFeeSetting.Min,
|
254
258
|
onAwaitingSign?: () => void
|
255
259
|
): Promise<string[] | undefined> {
|
260
|
+
if (txs.length === 1) {
|
261
|
+
const resp = await sendSingleOptimizedTransaction(umi, connection, txs[0], txType, priorityFeeSetting, onAwaitingSign);
|
262
|
+
return resp ? [bs58.encode(resp)] : undefined;
|
263
|
+
}
|
264
|
+
|
256
265
|
consoleLog("Sending Jito bundle...");
|
257
266
|
consoleLog("Transactions: ", txs.length);
|
258
267
|
consoleLog(
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -301,7 +301,7 @@ export async function getComputeUnitPriceEstimate(
|
|
301
301
|
.flatMap((x) => x.keys.flatMap((x) => x.pubkey.toString()));
|
302
302
|
|
303
303
|
let feeEstimate: number | undefined;
|
304
|
-
try {
|
304
|
+
// try {
|
305
305
|
const resp = await umi.rpc.call("getPriorityFeeEstimate", [
|
306
306
|
{
|
307
307
|
transaction: !useAccounts
|
@@ -314,21 +314,22 @@ export async function getComputeUnitPriceEstimate(
|
|
314
314
|
},
|
315
315
|
]);
|
316
316
|
feeEstimate = Math.round((resp as any).priorityFeeEstimate as number);
|
317
|
-
}
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
}
|
317
|
+
// }
|
318
|
+
// catch (e) {
|
319
|
+
// try {
|
320
|
+
// const resp = await umi.rpc.call("getPriorityFeeEstimate", [
|
321
|
+
// {
|
322
|
+
// accountKeys,
|
323
|
+
// options: {
|
324
|
+
// priorityLevel: prioritySetting.toString(),
|
325
|
+
// },
|
326
|
+
// },
|
327
|
+
// ]);
|
328
|
+
// feeEstimate = Math.round((resp as any).priorityFeeEstimate as number);
|
329
|
+
// } catch (e) {
|
330
|
+
// // console.error(e);
|
331
|
+
// }
|
332
|
+
// }
|
332
333
|
|
333
334
|
return feeEstimate;
|
334
335
|
}
|
@@ -427,9 +428,9 @@ export async function sendSingleOptimizedTransaction(
|
|
427
428
|
if (prioritySetting !== PriorityFeeSetting.None) {
|
428
429
|
cuPrice = await getComputeUnitPriceEstimate(umi, tx, prioritySetting);
|
429
430
|
if (!cuPrice) {
|
430
|
-
cuPrice =
|
431
|
+
cuPrice = 1_000_000;
|
431
432
|
}
|
432
|
-
cuPrice = Math.min(cuPrice, 100 * 1_000_000);
|
433
|
+
// cuPrice = Math.min(cuPrice, 100 * 1_000_000);
|
433
434
|
consoleLog("Compute unit price: ", cuPrice);
|
434
435
|
}
|
435
436
|
|
@@ -361,7 +361,7 @@ export function getJupSwapRebalanceDetails(
|
|
361
361
|
inputMint: toWeb3JsPublicKey(input.mint),
|
362
362
|
outputMint: toWeb3JsPublicKey(output.mint),
|
363
363
|
destinationWallet: client.solautoPosition,
|
364
|
-
slippageIncFactor:
|
364
|
+
slippageIncFactor: 1 + (attemptNum ?? 0) * 0.2,
|
365
365
|
amount: exactOut ? outputAmount : inputAmount,
|
366
366
|
exactIn: exactIn,
|
367
367
|
exactOut: exactOut,
|
@@ -1,23 +1,22 @@
|
|
1
1
|
import { describe, it } from "mocha";
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
none,
|
4
|
+
publicKey,
|
5
|
+
some,
|
6
|
+
} from "@metaplex-foundation/umi";
|
3
7
|
import { setupTest } from "../shared";
|
4
8
|
import { SolautoMarginfiClient } from "../../src/clients/solautoMarginfiClient";
|
5
9
|
import {
|
6
|
-
PositionType,
|
7
10
|
safeFetchSolautoPosition,
|
8
11
|
solautoAction,
|
9
12
|
SolautoSettingsParametersInpArgs,
|
10
13
|
} from "../../src/generated";
|
11
14
|
import { buildSolautoRebalanceTransaction } from "../../src/transactions/transactionUtils";
|
12
15
|
import {
|
13
|
-
fromBaseUnit,
|
14
|
-
getDebtAdjustmentUsd,
|
15
|
-
getMaxLiqUtilizationRateBps,
|
16
16
|
maxBoostToBps,
|
17
17
|
maxRepayFromBps,
|
18
18
|
maxRepayToBps,
|
19
19
|
toBaseUnit,
|
20
|
-
toBps,
|
21
20
|
} from "../../src/utils/numberUtils";
|
22
21
|
import { NATIVE_MINT } from "@solana/spl-token";
|
23
22
|
import {
|
@@ -26,50 +25,28 @@ import {
|
|
26
25
|
} from "../../src/transactions/transactionsManager";
|
27
26
|
import { PublicKey } from "@solana/web3.js";
|
28
27
|
import {
|
29
|
-
B_SOL,
|
30
|
-
DEFAULT_MARGINFI_GROUP,
|
31
|
-
HMTR,
|
32
|
-
JITO_SOL,
|
33
|
-
JLP,
|
34
|
-
POPCAT,
|
35
|
-
RETARDIO,
|
36
28
|
SOLAUTO_PROD_PROGRAM,
|
37
29
|
SOLAUTO_TEST_PROGRAM,
|
38
|
-
USD_DECIMALS,
|
39
30
|
USDC,
|
40
|
-
WETH,
|
41
31
|
} from "../../src/constants";
|
42
|
-
import {
|
32
|
+
import {
|
33
|
+
buildHeliusApiUrl,
|
34
|
+
getSolautoManagedPositions,
|
35
|
+
} from "../../src/utils";
|
43
36
|
import { PriorityFeeSetting } from "../../src/types";
|
44
|
-
import { buildIronforgeApiUrl, MARGINFI_ACCOUNTS, TransactionManagerStatuses } from "../../dist";
|
45
|
-
import { connect } from "http2";
|
46
|
-
import CommonClient from "rpc-websockets/dist/lib/client";
|
47
|
-
import { safeFetchAllBank } from "../../src/marginfi-sdk";
|
48
|
-
|
49
|
-
export function getLeverageFactor(
|
50
|
-
strategyType: "Long" | "Short",
|
51
|
-
supplyUsd: number,
|
52
|
-
debtUsd: number
|
53
|
-
): number {
|
54
|
-
let levFactor =
|
55
|
-
(strategyType === 'Long' ? supplyUsd : debtUsd) / (supplyUsd - debtUsd);
|
56
|
-
if (strategyType === 'Short') {
|
57
|
-
levFactor += 1;
|
58
|
-
}
|
59
|
-
return levFactor;
|
60
|
-
}
|
61
37
|
|
62
38
|
describe("Solauto Marginfi tests", async () => {
|
63
|
-
const signer = setupTest();
|
64
|
-
|
39
|
+
// const signer = setupTest();
|
40
|
+
const signer = setupTest("solauto-manager");
|
65
41
|
|
66
42
|
const payForTransactions = true;
|
67
|
-
const testProgram =
|
43
|
+
const testProgram = false;
|
68
44
|
const positionId = 1;
|
69
45
|
|
70
46
|
it("open - deposit - borrow - rebalance to 0 - withdraw - close", async () => {
|
71
47
|
const client = new SolautoMarginfiClient(
|
72
|
-
|
48
|
+
// buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
|
49
|
+
"https://staked.helius-rpc.com?api-key=6a7423cf-35ef-44ce-b02b-02567f57d181",
|
73
50
|
true,
|
74
51
|
testProgram ? SOLAUTO_TEST_PROGRAM : SOLAUTO_PROD_PROGRAM
|
75
52
|
);
|
@@ -81,7 +58,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
81
58
|
await client.initialize({
|
82
59
|
signer,
|
83
60
|
positionId,
|
84
|
-
authority: new PublicKey("
|
61
|
+
authority: new PublicKey("5bFfSCsGUgEzYH8kwwRtFnWkKZ1by8uD8RHvKQPnQReB"),
|
85
62
|
// new: true,
|
86
63
|
// marginfiAccount: new PublicKey(
|
87
64
|
// "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
|
@@ -91,52 +68,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
91
68
|
// debtMint: new PublicKey(USDC),
|
92
69
|
});
|
93
70
|
|
94
|
-
// console.log(await
|
95
|
-
|
96
|
-
|
97
|
-
// console.log(JSON.stringify(await getJupPriceData([new PublicKey("7JhmUcZrrfhyt5nTSu3AfsrUq2L9992a7AhwdSDxdoL2")], true), null, 2));
|
98
|
-
// console.log(JSON.stringify(await getJupPriceData([new PublicKey(POPCAT)], true), null, 2));
|
99
|
-
|
100
|
-
// const tokenMint = NATIVE_MINT.toString();
|
101
|
-
// await fetchTokenPrices([new PublicKey(tokenMint)]);
|
102
|
-
|
103
|
-
// // const accounts = MARGINFI_ACCOUNTS["DESG67cExEcw7d6MmENLEzaocR8pLrhfiw9VrNtGWUKD"];
|
104
|
-
// const accounts = MARGINFI_ACCOUNTS[DEFAULT_MARGINFI_GROUP];
|
105
|
-
// const [supplyBank, debtBank] = await safeFetchAllBank(client.umi, [publicKey(accounts[tokenMint].bank), publicKey(accounts[USDC].bank)]);
|
106
|
-
|
107
|
-
// console.log(supplyBank, debtBank);
|
108
|
-
// const [maxLtv, liqThreshold] = calcMarginfiMaxLtvAndLiqThreshold(
|
109
|
-
// supplyBank,
|
110
|
-
// debtBank,
|
111
|
-
// safeGetPrice(new PublicKey(USDC)) ?? 0
|
112
|
-
// );
|
113
|
-
|
114
|
-
// console.log(maxLtv, liqThreshold);
|
115
|
-
|
116
|
-
// const supplyUsd = 100;
|
117
|
-
// const debtAdjustmentUsd = getDebtAdjustmentUsd(
|
118
|
-
// toBps(liqThreshold),
|
119
|
-
// supplyUsd,
|
120
|
-
// 0,
|
121
|
-
// maxBoostToBps(toBps(maxLtv), toBps(liqThreshold))
|
122
|
-
// // getMaxLiqUtilizationRateBps(toBps(maxLtv), toBps(liqThreshold), 0.005)
|
123
|
-
// );
|
124
|
-
// const maxLeverage = getLeverageFactor(
|
125
|
-
// "Long",
|
126
|
-
// supplyUsd + debtAdjustmentUsd,
|
127
|
-
// debtAdjustmentUsd
|
128
|
-
// );
|
129
|
-
// console.log(maxLeverage, supplyUsd + debtAdjustmentUsd, debtAdjustmentUsd);
|
130
|
-
|
131
|
-
// const state = await getMarginfiAccountPositionState(client.umi, { pk: new PublicKey("GSw9ewsUgmuzDRJGYvSzkPPZgXfDszuGx7y22zMWSQkS") });
|
132
|
-
// const stateKeverage = getLeverageFactor(
|
133
|
-
// "Short",
|
134
|
-
// fromBaseUnit(state.supply.amountUsed.baseAmountUsdValue, USD_DECIMALS),
|
135
|
-
// fromBaseUnit(state.debt.amountUsed.baseAmountUsdValue, USD_DECIMALS)
|
136
|
-
// );
|
137
|
-
// console.log(stateKeverage);
|
138
|
-
|
139
|
-
// console.log(await fetchTokenPrices([new PublicKey(HMTR)]));
|
71
|
+
// console.log(await getSolautoManagedPositions(client.umi));
|
140
72
|
|
141
73
|
const transactionItems: TransactionItem[] = [];
|
142
74
|
// const settingParams: SolautoSettingsParametersInpArgs = {
|
@@ -169,17 +101,7 @@ describe("Solauto Marginfi tests", async () => {
|
|
169
101
|
// // const [supplyPrice] = await fetchTokenPrices([supply]);
|
170
102
|
// return {
|
171
103
|
// tx: client.protocolInteraction(
|
172
|
-
// solautoAction("Deposit", [toBaseUnit(
|
173
|
-
// ),
|
174
|
-
// };
|
175
|
-
// }, "deposit")
|
176
|
-
// );
|
177
|
-
// transactionItems.push(
|
178
|
-
// new TransactionItem(async () => {
|
179
|
-
// // const [supplyPrice] = await fetchTokenPrices([supply]);
|
180
|
-
// return {
|
181
|
-
// tx: client.protocolInteraction(
|
182
|
-
// solautoAction("Deposit", [toBaseUnit(0.05, supplyDecimals)])
|
104
|
+
// solautoAction("Deposit", [toBaseUnit(300, supplyDecimals)])
|
183
105
|
// ),
|
184
106
|
// };
|
185
107
|
// }, "deposit")
|
@@ -222,66 +144,17 @@ describe("Solauto Marginfi tests", async () => {
|
|
222
144
|
// )
|
223
145
|
// );
|
224
146
|
|
225
|
-
transactionItems.push(
|
226
|
-
new TransactionItem(
|
227
|
-
async () => ({
|
228
|
-
tx: client.protocolInteraction(
|
229
|
-
solautoAction("Withdraw", [{ __kind: "Some", fields: [toBaseUnit(0.03, 9)] }])
|
230
|
-
),
|
231
|
-
}),
|
232
|
-
"withdraw"
|
233
|
-
)
|
234
|
-
);
|
235
147
|
// transactionItems.push(
|
236
148
|
// new TransactionItem(
|
237
149
|
// async () => ({
|
238
150
|
// tx: client.protocolInteraction(
|
239
|
-
// solautoAction("Withdraw", [{ __kind: "
|
151
|
+
// solautoAction("Withdraw", [{ __kind: "All" }])
|
240
152
|
// ),
|
241
153
|
// }),
|
242
154
|
// "withdraw"
|
243
155
|
// )
|
244
156
|
// );
|
245
157
|
|
246
|
-
// transactionItems.push(
|
247
|
-
// new TransactionItem(
|
248
|
-
// async () => ({
|
249
|
-
// tx: transactionBuilder()
|
250
|
-
// .add(
|
251
|
-
// client.protocolInteraction(
|
252
|
-
// solautoAction("Withdraw", [
|
253
|
-
// { __kind: "Some", fields: [toBaseUnit(0.01, 9)] },
|
254
|
-
// ])
|
255
|
-
// )
|
256
|
-
// )
|
257
|
-
// }),
|
258
|
-
// "withdraw"
|
259
|
-
// )
|
260
|
-
// );
|
261
|
-
|
262
|
-
// transactionItems.push(
|
263
|
-
// new TransactionItem(
|
264
|
-
// async () => ({
|
265
|
-
// tx: transactionBuilder()
|
266
|
-
// .add(
|
267
|
-
// client.protocolInteraction(
|
268
|
-
// solautoAction("Withdraw", [
|
269
|
-
// { __kind: "Some", fields: [toBaseUnit(0.01, 9)] },
|
270
|
-
// ])
|
271
|
-
// )
|
272
|
-
// )
|
273
|
-
// .add(
|
274
|
-
// client.protocolInteraction(
|
275
|
-
// solautoAction("Withdraw", [
|
276
|
-
// { __kind: "Some", fields: [toBaseUnit(300, 9)] },
|
277
|
-
// ])
|
278
|
-
// )
|
279
|
-
// )
|
280
|
-
// }),
|
281
|
-
// "withdraw"
|
282
|
-
// )
|
283
|
-
// );
|
284
|
-
|
285
158
|
// transactionItems.push(
|
286
159
|
// new TransactionItem(
|
287
160
|
// async () => ({
|
@@ -291,17 +164,12 @@ describe("Solauto Marginfi tests", async () => {
|
|
291
164
|
// )
|
292
165
|
// );
|
293
166
|
|
294
|
-
const temp = (statuses: TransactionManagerStatuses) =>
|
295
|
-
console.log(statuses);
|
296
|
-
|
297
167
|
const statuses = await new TransactionsManager(
|
298
168
|
client,
|
299
|
-
temp,
|
300
|
-
!payForTransactions ? "only-simulate" : "normal",
|
301
|
-
PriorityFeeSetting.Low,
|
302
|
-
true,
|
303
169
|
undefined,
|
304
|
-
|
170
|
+
!payForTransactions ? "only-simulate" : "normal",
|
171
|
+
PriorityFeeSetting.High,
|
172
|
+
true
|
305
173
|
).clientSend(transactionItems);
|
306
174
|
|
307
175
|
console.log(statuses);
|