@haven-fi/solauto-sdk 1.0.693 → 1.0.694

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.
@@ -348,7 +348,7 @@ function getErrorInfo(umi, txs, error, simulationSuccessful) {
348
348
  let errCode;
349
349
  let errName;
350
350
  // sub ixs to account for computeUnitLimit and computeUnitPrice that get added
351
- const getComputeIxs = (txIdx) => (0, utils_1.addTxOptimizations)(umi, txs[txIdx], 1, !simulationSuccessful ? 1 : undefined).getInstructions().length - txs[txIdx].getInstructions().length;
351
+ const getComputeIxs = (txIdx) => (0, utils_1.addTxOptimizations)(umi, txs[txIdx], 1, simulationSuccessful ? 1 : undefined).getInstructions().length - txs[txIdx].getInstructions().length;
352
352
  try {
353
353
  if (error instanceof types_1.BundleSimulationError) {
354
354
  errTxIdx = error.details.transactionIdx;
package/local/shared.ts CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  getSolanaRpcConnection,
13
13
  getBatches,
14
- buildIronforgeApiUrl,
14
+ LOCAL_IRONFORGE_API_URL,
15
15
  } from "../src";
16
16
 
17
17
  function loadSecretKey(keypairPath: string) {
@@ -26,9 +26,7 @@ export function getSecretKey(keypairFilename: string = "id"): Uint8Array {
26
26
  }
27
27
 
28
28
  const keypair = Keypair.fromSecretKey(getSecretKey("solauto-fees"));
29
- const [connection, _] = getSolanaRpcConnection(
30
- buildIronforgeApiUrl(process.env.IRONFORGE_API_KEY ?? "")
31
- );
29
+ const [connection, _] = getSolanaRpcConnection(LOCAL_IRONFORGE_API_URL);
32
30
 
33
31
  export async function createAndSendV0Tx(
34
32
  txInstructions: TransactionInstruction[],
@@ -29,7 +29,7 @@ import {
29
29
  import { getSecretKey } from "./shared";
30
30
 
31
31
  const payForTransaction = false;
32
- const testProgram = true;
32
+ const testProgram = false;
33
33
  const lpEnv: ProgramEnv = "Prod";
34
34
 
35
35
  let [, umi] = getSolanaRpcConnection(
@@ -53,82 +53,23 @@ export async function main() {
53
53
  });
54
54
 
55
55
  await client.initializeExistingSolautoPosition({
56
- positionId: 2,
57
- authority: new PublicKey("rC5dMP5dmSsfQ66rynzfFzuc122Eex9h1RJHVDkeH6D"),
56
+ positionId: 1,
57
+ authority: new PublicKey("R8Nnj1UqK1BRPnfJYj7MvfPUK3GmEzmgh1CwFFtUNsF"),
58
58
  // lpUserAccount: new PublicKey(
59
59
  // "GEokw9jqbh6d1xUNA3qaeYFFetbSR5Y1nt7C3chwwgSz"
60
60
  // ),
61
61
  });
62
62
 
63
- const supplyBank = await fetchBank(
64
- umi,
65
- publicKey("6cgYhBFWCc5sNHxkvSRhd5H9AdAHR41zKwuF37HmLry5")
66
- );
67
- const debtBank = await fetchBank(
68
- umi,
69
- publicKey("3J5rKmCi7JXG6qmiobFJyAidVTnnNAMGj4jomfBxKGRM")
70
- );
71
- const supplyWeight = bytesToI80F48(supplyBank.config.assetWeightInit.value);
72
- const debtWeight = bytesToI80F48(debtBank.config.liabilityWeightInit.value);
73
-
74
- console.log(
75
- getLiqUtilzationRateBps(
76
- 34.36833665228071,
77
- 23.61750715267401,
78
- client.pos.state.liqThresholdBps
79
- ),
80
- 34.36833665228071 * supplyWeight,
81
- 23.61750715267401 * debtWeight
82
- );
83
- console.log(
84
- getLiqUtilzationRateBps(
85
- 34.328721976,
86
- 23.575158311,
87
- client.pos.state.liqThresholdBps
88
- ),
89
- 34.328721976 * supplyWeight,
90
- 23.575158311 * debtWeight
91
- );
92
- console.log(
93
- getLiqUtilzationRateBps(
94
- 34.265152701,
95
- 23.530695876,
96
- client.pos.state.liqThresholdBps
97
- ),
98
- 34.265152701 * supplyWeight,
99
- 23.530695876 * debtWeight
100
- );
101
- console.log(client.pos.maxBoostToBps);
102
- console.log(getMaxLiqUtilizationRateBps(client.pos.state.maxLtvBps, client.pos.state.liqThresholdBps, 0));
103
-
104
- // const debtBank = await fetchBank(
105
- // umi,
106
- // publicKey("3J5rKmCi7JXG6qmiobFJyAidVTnnNAMGj4jomfBxKGRM")
107
- // );
108
- // const supplyBank = await fetchBank(
109
- // umi,
110
- // publicKey("6cgYhBFWCc5sNHxkvSRhd5H9AdAHR41zKwuF37HmLry5")
111
- // );
112
-
113
- // console.log(
114
- // bytesToI80F48(supplyBank.config.assetWeightInit.value),
115
- // bytesToI80F48(debtBank.config.liabilityWeightInit.value)
116
- // );
117
-
118
- // await client.pos.refreshPositionState();
63
+ const transactionItems = [rebalance(client)];
119
64
 
120
- // console.log(await client.pos.utilizationRateBpsDrift());
121
-
122
- // const transactionItems = [rebalance(client)];
123
-
124
- // const txManager = new ClientTransactionsManager({
125
- // txHandler: client,
126
- // txRunType: payForTransaction ? "normal" : "only-simulate",
127
- // priorityFeeSetting: PriorityFeeSetting.Default,
128
- // retryConfig: { totalRetries: 5 },
129
- // });
130
- // const statuses = await txManager.send(transactionItems);
131
- // consoleLog(statuses);
65
+ const txManager = new ClientTransactionsManager({
66
+ txHandler: client,
67
+ txRunType: payForTransaction ? "normal" : "only-simulate",
68
+ priorityFeeSetting: PriorityFeeSetting.Default,
69
+ retryConfig: { totalRetries: 1 },
70
+ });
71
+ const statuses = await txManager.send(transactionItems);
72
+ consoleLog(statuses);
132
73
  }
133
74
 
134
75
  async function refreshAll() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.693",
3
+ "version": "1.0.694",
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",
@@ -621,7 +621,7 @@ export function getErrorInfo(
621
621
  umi,
622
622
  txs[txIdx],
623
623
  1,
624
- !simulationSuccessful ? 1 : undefined
624
+ simulationSuccessful ? 1 : undefined
625
625
  ).getInstructions().length - txs[txIdx].getInstructions().length;
626
626
 
627
627
  try {