@haven-fi/solauto-sdk 1.0.677 → 1.0.678
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.
@@ -149,7 +149,7 @@ class SolautoPositionEx {
|
|
149
149
|
return ((0, utils_1.currentUnixSeconds)() - Number(this.state.lastRefreshed) > 60 * 60 * 24 * 7);
|
150
150
|
}
|
151
151
|
canRefreshPositionState() {
|
152
|
-
if ((0, utils_1.currentUnixSeconds)() - Number(this.state.lastRefreshed) >
|
152
|
+
if ((0, utils_1.currentUnixSeconds)() - Number(this.state.lastRefreshed) > 5 ||
|
153
153
|
this.contextUpdates?.positionUpdates()) {
|
154
154
|
return true;
|
155
155
|
}
|
package/local/txSandbox.ts
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
import { Keypair, PublicKey } from "@solana/web3.js";
|
2
|
-
import { createSignerFromKeypair
|
2
|
+
import { createSignerFromKeypair } from "@metaplex-foundation/umi";
|
3
3
|
import { fromWeb3JsKeypair } from "@metaplex-foundation/umi-web3js-adapters";
|
4
4
|
import {
|
5
5
|
consoleLog,
|
6
|
-
fetchBank,
|
7
6
|
getBatches,
|
8
7
|
getClient,
|
9
8
|
getPositionExBulk,
|
10
9
|
getSolanaRpcConnection,
|
11
10
|
getSolautoManagedPositions,
|
12
|
-
isMarginfiPosition,
|
13
11
|
LendingPlatform,
|
14
12
|
LOCAL_IRONFORGE_API_URL,
|
15
13
|
PriceType,
|
16
14
|
PriorityFeeSetting,
|
17
15
|
ProgramEnv,
|
18
16
|
rebalance,
|
19
|
-
safeFetchBank,
|
20
17
|
SOLAUTO_PROD_PROGRAM,
|
21
18
|
SOLAUTO_TEST_PROGRAM,
|
22
19
|
SolautoClient,
|
@@ -25,7 +22,7 @@ import {
|
|
25
22
|
} from "../src";
|
26
23
|
import { getSecretKey } from "./shared";
|
27
24
|
|
28
|
-
const payForTransaction =
|
25
|
+
const payForTransaction = false;
|
29
26
|
const testProgram = false;
|
30
27
|
const lpEnv: ProgramEnv = "Prod";
|
31
28
|
|
@@ -50,53 +47,26 @@ export async function main() {
|
|
50
47
|
});
|
51
48
|
|
52
49
|
await client.initialize({
|
53
|
-
positionId:
|
54
|
-
authority: new PublicKey("
|
50
|
+
positionId: 1,
|
51
|
+
authority: new PublicKey("5UqsR2PGzbP8pGPbXEeXx86Gjz2N2UFBAuFZUSVydAEe"),
|
55
52
|
// lpUserAccount: new PublicKey(
|
56
53
|
// "GEokw9jqbh6d1xUNA3qaeYFFetbSR5Y1nt7C3chwwgSz"
|
57
54
|
// ),
|
58
55
|
});
|
59
56
|
|
60
|
-
const transactionItems = [
|
61
|
-
new TransactionItem(
|
62
|
-
async () => ({ tx: client.refreshIx(PriceType.Realtime) }),
|
63
|
-
`refresh`
|
64
|
-
),
|
65
|
-
];
|
57
|
+
const transactionItems = [rebalance(client)];
|
66
58
|
|
67
|
-
const
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
59
|
+
const txManager = new TransactionsManager(
|
60
|
+
client,
|
61
|
+
undefined,
|
62
|
+
payForTransaction ? "normal" : "only-simulate",
|
63
|
+
PriorityFeeSetting.High,
|
64
|
+
true,
|
65
|
+
undefined,
|
66
|
+
{ totalRetries: 5 }
|
75
67
|
);
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if (isMarginfiPosition(client.pos)) {
|
80
|
-
client.pos.updateSupplyLiquidityDepositable([bank]);
|
81
|
-
}
|
82
|
-
console.log(
|
83
|
-
client.pos.supplyLiquidityDepositable,
|
84
|
-
client.pos.supplyLiquidityUsdDepositable
|
85
|
-
);
|
86
|
-
console.log(client.pos.eligibleForRebalance());
|
87
|
-
console.log(client.pos.state.supply.amountCanBeUsed);
|
88
|
-
|
89
|
-
// const txManager = new TransactionsManager(
|
90
|
-
// client,
|
91
|
-
// undefined,
|
92
|
-
// payForTransaction ? "normal" : "only-simulate",
|
93
|
-
// PriorityFeeSetting.High,
|
94
|
-
// true,
|
95
|
-
// undefined,
|
96
|
-
// { totalRetries: 5 }
|
97
|
-
// );
|
98
|
-
// const statuses = await txManager.clientSend(transactionItems);
|
99
|
-
// consoleLog(statuses);
|
68
|
+
const statuses = await txManager.clientSend(transactionItems);
|
69
|
+
consoleLog(statuses);
|
100
70
|
}
|
101
71
|
|
102
72
|
async function refreshAll() {
|
package/package.json
CHANGED
@@ -304,7 +304,7 @@ export abstract class SolautoPositionEx {
|
|
304
304
|
|
305
305
|
protected canRefreshPositionState() {
|
306
306
|
if (
|
307
|
-
currentUnixSeconds() - Number(this.state.lastRefreshed) >
|
307
|
+
currentUnixSeconds() - Number(this.state.lastRefreshed) > 5 ||
|
308
308
|
this.contextUpdates?.positionUpdates()
|
309
309
|
) {
|
310
310
|
return true;
|