@haven-fi/solauto-sdk 1.0.373 → 1.0.375
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/utils/jitoUtils.d.ts.map +1 -1
- package/dist/utils/jitoUtils.js +16 -16
- package/dist/utils/marginfiUtils.d.ts.map +1 -1
- package/dist/utils/marginfiUtils.js +7 -3
- package/local/logPositions.ts +21 -0
- package/package.json +2 -6
- package/src/utils/jitoUtils.ts +30 -24
- package/src/utils/marginfiUtils.ts +14 -4
- package/tests/transactions/solautoMarginfi.ts +65 -34
@@ -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;AAOlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;
|
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;AAOlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC,CAa9D;AAmKD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,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,CAuE/B"}
|
package/dist/utils/jitoUtils.js
CHANGED
@@ -32,18 +32,6 @@ async function getTipInstruction(signer, tipLamports) {
|
|
32
32
|
}
|
33
33
|
async function simulateJitoBundle(umi, txs) {
|
34
34
|
const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
|
35
|
-
// const resp = await umi.rpc.call("simulateBundle", [
|
36
|
-
// {
|
37
|
-
// encodedTransactions: txs.map((x) =>
|
38
|
-
// Buffer.from(x.serialize()).toString("base64")
|
39
|
-
// ),
|
40
|
-
// },
|
41
|
-
// {
|
42
|
-
// preExecutionAccountsConfigs: txs.map((_) => ""),
|
43
|
-
// postExecutionAccountsConfigs: txs.map((_) => ""),
|
44
|
-
// skipSigVerify: true,
|
45
|
-
// },
|
46
|
-
// ]);
|
47
35
|
const resp = await axios_1.default.post(umi.rpc.getEndpoint(), {
|
48
36
|
jsonrpc: "2.0",
|
49
37
|
id: 1,
|
@@ -113,7 +101,12 @@ async function pollBundleStatus(bundleId, interval = 1000, timeout = 40000) {
|
|
113
101
|
(0, generalUtils_1.consoleLog)("Statuses:", statuses);
|
114
102
|
const status = statuses.value[0].confirmation_status;
|
115
103
|
if (status === "confirmed") {
|
116
|
-
return statuses
|
104
|
+
return statuses.value[0].transactions;
|
105
|
+
}
|
106
|
+
const err = statuses.value[0].err;
|
107
|
+
if (err) {
|
108
|
+
(0, generalUtils_1.consoleLog)("Jito bundle err:", JSON.stringify(err, null, 2));
|
109
|
+
throw new Error(err);
|
117
110
|
}
|
118
111
|
}
|
119
112
|
}
|
@@ -152,10 +145,17 @@ async function sendJitoBundledTransactions(umi, signer, txs, txType, priorityFee
|
|
152
145
|
1000000))
|
153
146
|
: undefined;
|
154
147
|
const latestBlockhash = (await umi.rpc.getLatestBlockhash({ commitment: "confirmed" })).blockhash;
|
155
|
-
let builtTxs
|
156
|
-
|
148
|
+
let builtTxs;
|
149
|
+
let simulationResults;
|
150
|
+
if (txType !== "skip-simulation") {
|
151
|
+
builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, false, feeEstimates);
|
152
|
+
(0, generalUtils_1.consoleLog)(builtTxs.map((x) => x.message.compiledInstructions.map((y) => x.message.staticAccountKeys[y.programIdIndex].toString())));
|
153
|
+
simulationResults = await simulateJitoBundle(umi, builtTxs);
|
154
|
+
}
|
157
155
|
if (txType !== "only-simulate") {
|
158
|
-
builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, true, feeEstimates, simulationResults
|
156
|
+
builtTxs = await umiToVersionedTransactions(umi, latestBlockhash, signer, txs, true, feeEstimates, simulationResults
|
157
|
+
? simulationResults.map((x) => x.unitsConsumed * 1.15)
|
158
|
+
: undefined);
|
159
159
|
const serializedTxs = builtTxs.map((x) => x.serialize());
|
160
160
|
if (serializedTxs.find((x) => x.length > 1232)) {
|
161
161
|
throw new Error("A transaction is too large");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAGJ,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAazB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAI7D,UAAU,wBAAyB,SAAQ,qBAAqB;IAC9D,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,SAAS,GACd,wBAAwB,CAY1B;AAED,wBAAgB,iCAAiC,CAC/C,UAAU,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AE,IAAI,oBAU7C;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBnE;AAED,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,eAAe,WASpE"}
|
@@ -229,9 +229,13 @@ async function getMarginfiAccountPositionState(umi, protocolAccount, marginfiGro
|
|
229
229
|
if (!supplyUsage) {
|
230
230
|
supplyUsage = await getTokenUsage(supplyBank, true, 0, livePositionUpdates?.supplyAdjustment);
|
231
231
|
}
|
232
|
-
if (debtBank === null
|
233
|
-
|
234
|
-
|
232
|
+
if (debtBank === null) {
|
233
|
+
return undefined;
|
234
|
+
}
|
235
|
+
const supplyMint = constants_1.TOKEN_INFO[supplyBank.mint.toString()];
|
236
|
+
const debtMint = constants_1.TOKEN_INFO[debtBank.mint.toString()];
|
237
|
+
if ((!supplyMint.isStableCoin && !debtMint.isStableCoin) ||
|
238
|
+
(supplyMint.isStableCoin && debtMint.isStableCoin)) {
|
235
239
|
return undefined;
|
236
240
|
}
|
237
241
|
if (!debtUsage) {
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import {
|
2
|
+
buildHeliusApiUrl,
|
3
|
+
getSolanaRpcConnection,
|
4
|
+
getSolautoManagedPositions,
|
5
|
+
SOLAUTO_PROD_PROGRAM,
|
6
|
+
} from "../src";
|
7
|
+
|
8
|
+
async function main() {
|
9
|
+
const [_, umi] = getSolanaRpcConnection(
|
10
|
+
buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
|
11
|
+
SOLAUTO_PROD_PROGRAM
|
12
|
+
);
|
13
|
+
const positions = await getSolautoManagedPositions(umi);
|
14
|
+
// TODO: filter out certain wallet authorities using an env variable
|
15
|
+
|
16
|
+
console.log(positions);
|
17
|
+
console.log("Total positions:", positions.length);
|
18
|
+
// TODO: log net worth / balances
|
19
|
+
}
|
20
|
+
|
21
|
+
main().then((x) => x);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@haven-fi/solauto-sdk",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.375",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"types": "dist/index.d.ts",
|
6
6
|
"description": "Typescript SDK for the Solauto program on the Solana blockchain",
|
@@ -10,11 +10,7 @@
|
|
10
10
|
"build": "rm -rf dist && npx tsc",
|
11
11
|
"test:txs": "ts-mocha -p ./tsconfig.json -t 1000000 tests/transactions/**/*.ts",
|
12
12
|
"test:unit": "ts-mocha -p ./tsconfig.json -t 1000000 tests/unit/**/*.ts",
|
13
|
-
"test:all": "pnpm test:unit && pnpm test:txs"
|
14
|
-
"update-lut:solauto": "npx ts-node local/updateSolautoLUT.ts",
|
15
|
-
"update-lut:marginfi": "npx ts-node local/updateMarginfiLUT.ts",
|
16
|
-
"create-ism-accounts": "npx ts-node local/createISMAccounts.ts",
|
17
|
-
"create-token-accounts": "npx ts-node local/createTokenAccounts.ts"
|
13
|
+
"test:all": "pnpm test:unit && pnpm test:txs"
|
18
14
|
},
|
19
15
|
"dependencies": {
|
20
16
|
"@coral-xyz/anchor": "^0.30.1",
|
package/src/utils/jitoUtils.ts
CHANGED
@@ -50,19 +50,6 @@ async function getTipInstruction(
|
|
50
50
|
|
51
51
|
async function simulateJitoBundle(umi: Umi, txs: VersionedTransaction[]) {
|
52
52
|
const simulationResult = await retryWithExponentialBackoff(async () => {
|
53
|
-
// const resp = await umi.rpc.call("simulateBundle", [
|
54
|
-
// {
|
55
|
-
// encodedTransactions: txs.map((x) =>
|
56
|
-
// Buffer.from(x.serialize()).toString("base64")
|
57
|
-
// ),
|
58
|
-
// },
|
59
|
-
// {
|
60
|
-
// preExecutionAccountsConfigs: txs.map((_) => ""),
|
61
|
-
// postExecutionAccountsConfigs: txs.map((_) => ""),
|
62
|
-
// skipSigVerify: true,
|
63
|
-
// },
|
64
|
-
// ]);
|
65
|
-
|
66
53
|
const resp = await axios.post(
|
67
54
|
umi.rpc.getEndpoint(),
|
68
55
|
{
|
@@ -171,7 +158,12 @@ async function pollBundleStatus(
|
|
171
158
|
consoleLog("Statuses:", statuses);
|
172
159
|
const status = statuses.value[0].confirmation_status;
|
173
160
|
if (status === "confirmed") {
|
174
|
-
return statuses
|
161
|
+
return statuses.value[0].transactions as string[];
|
162
|
+
}
|
163
|
+
const err = statuses.value[0].err;
|
164
|
+
if (err) {
|
165
|
+
consoleLog("Jito bundle err:", JSON.stringify(err, null, 2));
|
166
|
+
throw new Error(err);
|
175
167
|
}
|
176
168
|
}
|
177
169
|
}
|
@@ -236,15 +228,27 @@ export async function sendJitoBundledTransactions(
|
|
236
228
|
const latestBlockhash = (
|
237
229
|
await umi.rpc.getLatestBlockhash({ commitment: "confirmed" })
|
238
230
|
).blockhash;
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
231
|
+
|
232
|
+
let builtTxs: VersionedTransaction[];
|
233
|
+
let simulationResults: SimulatedTransactionResponse[] | undefined;
|
234
|
+
if (txType !== "skip-simulation") {
|
235
|
+
builtTxs = await umiToVersionedTransactions(
|
236
|
+
umi,
|
237
|
+
latestBlockhash,
|
238
|
+
signer,
|
239
|
+
txs,
|
240
|
+
false,
|
241
|
+
feeEstimates
|
242
|
+
);
|
243
|
+
consoleLog(
|
244
|
+
builtTxs.map((x) =>
|
245
|
+
x.message.compiledInstructions.map((y) =>
|
246
|
+
x.message.staticAccountKeys[y.programIdIndex].toString()
|
247
|
+
)
|
248
|
+
)
|
249
|
+
);
|
250
|
+
simulationResults = await simulateJitoBundle(umi, builtTxs);
|
251
|
+
}
|
248
252
|
|
249
253
|
if (txType !== "only-simulate") {
|
250
254
|
builtTxs = await umiToVersionedTransactions(
|
@@ -254,7 +258,9 @@ export async function sendJitoBundledTransactions(
|
|
254
258
|
txs,
|
255
259
|
true,
|
256
260
|
feeEstimates,
|
257
|
-
simulationResults
|
261
|
+
simulationResults
|
262
|
+
? simulationResults.map((x) => x.unitsConsumed! * 1.15)
|
263
|
+
: undefined
|
258
264
|
);
|
259
265
|
|
260
266
|
const serializedTxs = builtTxs.map((x) => x.serialize());
|
@@ -134,7 +134,11 @@ export async function getMarginfiMaxLtvAndLiqThreshold(
|
|
134
134
|
return [0, 0];
|
135
135
|
}
|
136
136
|
|
137
|
-
return calcMarginfiMaxLtvAndLiqThreshold(
|
137
|
+
return calcMarginfiMaxLtvAndLiqThreshold(
|
138
|
+
supply.bank!,
|
139
|
+
debt.bank,
|
140
|
+
supplyPrice
|
141
|
+
);
|
138
142
|
}
|
139
143
|
|
140
144
|
export async function getAllMarginfiAccountsByAuthority(
|
@@ -412,10 +416,16 @@ export async function getMarginfiAccountPositionState(
|
|
412
416
|
);
|
413
417
|
}
|
414
418
|
|
419
|
+
if (debtBank === null) {
|
420
|
+
return undefined;
|
421
|
+
}
|
422
|
+
|
423
|
+
const supplyMint = TOKEN_INFO[supplyBank.mint.toString()];
|
424
|
+
const debtMint = TOKEN_INFO[debtBank.mint.toString()];
|
425
|
+
|
415
426
|
if (
|
416
|
-
|
417
|
-
(
|
418
|
-
!TOKEN_INFO[debtBank.mint.toString()].isStableCoin)
|
427
|
+
(!supplyMint.isStableCoin && !debtMint.isStableCoin) ||
|
428
|
+
(supplyMint.isStableCoin && debtMint.isStableCoin)
|
419
429
|
) {
|
420
430
|
return undefined;
|
421
431
|
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { describe, it } from "mocha";
|
2
|
-
import { none, publicKey, some } from "@metaplex-foundation/umi";
|
2
|
+
import { none, publicKey, some, transactionBuilder } from "@metaplex-foundation/umi";
|
3
3
|
import { setupTest } from "../shared";
|
4
4
|
import { SolautoMarginfiClient } from "../../src/clients/solautoMarginfiClient";
|
5
5
|
import {
|
6
|
+
PositionType,
|
6
7
|
safeFetchSolautoPosition,
|
7
8
|
solautoAction,
|
8
9
|
SolautoSettingsParametersInpArgs,
|
@@ -25,7 +26,7 @@ import {
|
|
25
26
|
SOLAUTO_TEST_PROGRAM,
|
26
27
|
USDC,
|
27
28
|
} from "../../src/constants";
|
28
|
-
import { buildHeliusApiUrl, getSolautoManagedPositions } from "../../src/utils";
|
29
|
+
import { buildHeliusApiUrl, getAllPositionsByAuthority, getSolautoManagedPositions } from "../../src/utils";
|
29
30
|
import { PriorityFeeSetting } from "../../src/types";
|
30
31
|
import { buildIronforgeApiUrl, TransactionManagerStatuses } from "../../dist";
|
31
32
|
|
@@ -48,20 +49,20 @@ describe("Solauto Marginfi tests", async () => {
|
|
48
49
|
const supplyDecimals = 6;
|
49
50
|
const debtDecimals = 6;
|
50
51
|
|
51
|
-
await client.initialize({
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
});
|
63
|
-
|
64
|
-
|
52
|
+
// await client.initialize({
|
53
|
+
// signer,
|
54
|
+
// positionId,
|
55
|
+
// authority: new PublicKey("rC5dMP5dmSsfQ66rynzfFzuc122Eex9h1RJHVDkeH6D"),
|
56
|
+
// // new: true,
|
57
|
+
// // marginfiAccount: new PublicKey(
|
58
|
+
// // "4nNvUXF5YqHFcH2nGweSiuvy1ct7V5FXfoCLKFYUN36z"
|
59
|
+
// // ),
|
60
|
+
// // marginfiGroup: new PublicKey("G1rt3EpQ43K3bY457rhukQGRAo2QxydFAGRKqnjKzyr5"),
|
61
|
+
// // supplyMint: new PublicKey("3B5wuUrMEi5yATD7on46hKfej3pfmd7t1RKgrsN3pump"),
|
62
|
+
// // debtMint: new PublicKey(USDC),
|
63
|
+
// });
|
64
|
+
|
65
|
+
console.log(await getSolautoManagedPositions(client.umi, new PublicKey("5UqsR2PGzbP8pGPbXEeXx86Gjz2N2UFBAuFZUSVydAEe"), PositionType.Leverage));
|
65
66
|
|
66
67
|
const transactionItems: TransactionItem[] = [];
|
67
68
|
// const settingParams: SolautoSettingsParametersInpArgs = {
|
@@ -169,15 +170,43 @@ describe("Solauto Marginfi tests", async () => {
|
|
169
170
|
// );
|
170
171
|
|
171
172
|
transactionItems.push(
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
173
|
+
new TransactionItem(
|
174
|
+
async () => ({
|
175
|
+
tx: transactionBuilder()
|
176
|
+
.add(
|
177
|
+
client.protocolInteraction(
|
178
|
+
solautoAction("Withdraw", [
|
179
|
+
{ __kind: "Some", fields: [toBaseUnit(0.01, 9)] },
|
180
|
+
])
|
181
|
+
)
|
182
|
+
)
|
183
|
+
}),
|
184
|
+
"withdraw"
|
185
|
+
)
|
186
|
+
);
|
187
|
+
|
188
|
+
transactionItems.push(
|
189
|
+
new TransactionItem(
|
190
|
+
async () => ({
|
191
|
+
tx: transactionBuilder()
|
192
|
+
.add(
|
193
|
+
client.protocolInteraction(
|
194
|
+
solautoAction("Withdraw", [
|
195
|
+
{ __kind: "Some", fields: [toBaseUnit(0.01, 9)] },
|
196
|
+
])
|
197
|
+
)
|
198
|
+
)
|
199
|
+
.add(
|
200
|
+
client.protocolInteraction(
|
201
|
+
solautoAction("Withdraw", [
|
202
|
+
{ __kind: "Some", fields: [toBaseUnit(300, 9)] },
|
203
|
+
])
|
204
|
+
)
|
205
|
+
)
|
206
|
+
}),
|
207
|
+
"withdraw"
|
208
|
+
)
|
209
|
+
);
|
181
210
|
|
182
211
|
// transactionItems.push(
|
183
212
|
// new TransactionItem(
|
@@ -188,16 +217,18 @@ describe("Solauto Marginfi tests", async () => {
|
|
188
217
|
// )
|
189
218
|
// );
|
190
219
|
|
191
|
-
const temp = (statuses: TransactionManagerStatuses) =>
|
220
|
+
// const temp = (statuses: TransactionManagerStatuses) =>
|
221
|
+
// console.log(statuses);
|
192
222
|
|
193
|
-
const statuses = await new TransactionsManager(
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
223
|
+
// const statuses = await new TransactionsManager(
|
224
|
+
// client,
|
225
|
+
// // temp,
|
226
|
+
// undefined,
|
227
|
+
// !payForTransactions ? "only-simulate" : "normal",
|
228
|
+
// PriorityFeeSetting.Low,
|
229
|
+
// true
|
230
|
+
// ).clientSend(transactionItems);
|
200
231
|
|
201
|
-
console.log(statuses);
|
232
|
+
// console.log(statuses);
|
202
233
|
});
|
203
234
|
});
|