@haven-fi/solauto-sdk 1.0.755 → 1.0.756

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAgCrB,qBAAa,kBAAkB;IAQ3B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,2BAA2B,CAAC;IACpC,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,wBAAwB,CAAC;IAVnC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAC,CAAwB;IAC/C,OAAO,CAAC,SAAS,CAAiC;gBAGxC,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,YAAA,EACpC,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,wBAAwB,CAAC,EAAE,MAAM,YAAA;IAG3C,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,oBAAoB;IAyC5B,OAAO,CAAC,iCAAiC;YAgC3B,qBAAqB;IA4CnC,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,yBAAyB;YAqBnB,mBAAmB;YAyBnB,sBAAsB;YAyBtB,mBAAmB;IAsFpB,gBAAgB,CAC3B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;CAe9C"}
1
+ {"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAgCrB,qBAAa,kBAAkB;IAQ3B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,2BAA2B,CAAC;IACpC,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,wBAAwB,CAAC;IAVnC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAC,CAAwB;IAC/C,OAAO,CAAC,SAAS,CAAiC;gBAGxC,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,YAAA,EACpC,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,wBAAwB,CAAC,EAAE,MAAM,YAAA;IAG3C,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,oBAAoB;IAyC5B,OAAO,CAAC,iCAAiC;YAgC3B,qBAAqB;IAmDnC,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,yBAAyB;YAqBnB,mBAAmB;YAyBnB,sBAAsB;YAyBtB,mBAAmB;IAsFpB,gBAAgB,CAC3B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;CAe9C"}
@@ -71,9 +71,12 @@ class RebalanceTxBuilder {
71
71
  return undefined;
72
72
  }
73
73
  const stdFlLiquiditySource = this.getFlLiquiditySource(attemptNum, this.client.flProvider.liquidityAvailable(generated_1.TokenType.Supply), this.client.flProvider.liquidityAvailable(generated_1.TokenType.Debt));
74
+ console.log(this.client.flProvider.liquidityAvailable(generated_1.TokenType.Supply), this.client.flProvider.liquidityAvailable(generated_1.TokenType.Debt));
75
+ console.log("std", stdFlLiquiditySource);
74
76
  if (stdFlLiquiditySource === undefined || this.optimizeSize) {
75
77
  const { supplyBalance, debtBalance } = await this.client.signerBalances();
76
78
  const signerFlLiquiditySource = this.getFlLiquiditySource(attemptNum, supplyBalance, debtBalance);
79
+ console.log("signer", signerFlLiquiditySource);
77
80
  if (signerFlLiquiditySource) {
78
81
  return {
79
82
  liquiditySource: signerFlLiquiditySource,
@@ -64,7 +64,7 @@ class TransactionsManager {
64
64
  ]);
65
65
  for (let j = i; j >= 0; j--) {
66
66
  const tx = txItems[j];
67
- if ((await newSet.fitsWith(tx)) && !tx.name?.includes("rebalance")) {
67
+ if ((await newSet.fitsWith(tx))) {
68
68
  newSet.prepend(tx);
69
69
  i--;
70
70
  }
@@ -10,6 +10,8 @@ import {
10
10
  getPositionExBulk,
11
11
  getSolanaRpcConnection,
12
12
  getSolautoManagedPositions,
13
+ getTokenAccount,
14
+ JUP,
13
15
  LendingPlatform,
14
16
  LOCAL_IRONFORGE_API_URL,
15
17
  PriceType,
@@ -20,6 +22,7 @@ import {
20
22
  SOLAUTO_TEST_PROGRAM,
21
23
  SolautoClient,
22
24
  TransactionItem,
25
+ USDT,
23
26
  } from "../src";
24
27
  import { getSecretKey } from "./shared";
25
28
 
@@ -47,24 +50,27 @@ export async function main() {
47
50
  lpEnv,
48
51
  });
49
52
 
50
- await client.initializeExistingSolautoPosition({
51
- positionId: 1,
52
- authority: new PublicKey("HqpPtE5WbBh3xU9C1Tzz125iYDQyoyodvFCRpwHwQpNc"),
53
- // lpUserAccount: new PublicKey(
54
- // "GEokw9jqbh6d1xUNA3qaeYFFetbSR5Y1nt7C3chwwgSz"
55
- // ),
56
- });
53
+ // await client.initializeExistingSolautoPosition({
54
+ // positionId: 1,
55
+ // authority: new PublicKey("HqpPtE5WbBh3xU9C1Tzz125iYDQyoyodvFCRpwHwQpNc"),
56
+ // // lpUserAccount: new PublicKey(
57
+ // // "GEokw9jqbh6d1xUNA3qaeYFFetbSR5Y1nt7C3chwwgSz"
58
+ // // ),
59
+ // });
57
60
 
58
- const transactionItems = [rebalance(client, undefined, 150)];
61
+ // const transactionItems = [rebalance(client, undefined, 150)];
59
62
 
60
- const txManager = new ClientTransactionsManager({
61
- txHandler: client,
62
- txRunType: payForTransaction ? "normal" : "only-simulate",
63
- priorityFeeSetting: PriorityFeeSetting.Default,
64
- retryConfig: { totalRetries: 2 },
65
- });
66
- const statuses = await txManager.send(transactionItems);
67
- consoleLog(statuses);
63
+ // const txManager = new ClientTransactionsManager({
64
+ // txHandler: client,
65
+ // txRunType: payForTransaction ? "normal" : "only-simulate",
66
+ // priorityFeeSetting: PriorityFeeSetting.Default,
67
+ // retryConfig: { totalRetries: 2 },
68
+ // });
69
+ // const statuses = await txManager.send(transactionItems);
70
+ // consoleLog(statuses);
71
+
72
+ console.log(getTokenAccount(new PublicKey("Gex8CJNhmRFYGkMZJRUAy6Qs7vo57RkX2ejYqD2kanTo"), new PublicKey(JUP)));
73
+ console.log(getTokenAccount(new PublicKey("Gex8CJNhmRFYGkMZJRUAy6Qs7vo57RkX2ejYqD2kanTo"), new PublicKey(USDT)));
68
74
  }
69
75
 
70
76
  async function refreshAll() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.755",
3
+ "version": "1.0.756",
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",
@@ -174,6 +174,12 @@ export class RebalanceTxBuilder {
174
174
  this.client.flProvider.liquidityAvailable(TokenType.Debt)
175
175
  );
176
176
 
177
+ console.log(
178
+ this.client.flProvider.liquidityAvailable(TokenType.Supply),
179
+ this.client.flProvider.liquidityAvailable(TokenType.Debt)
180
+ );
181
+ console.log("std", stdFlLiquiditySource);
182
+
177
183
  if (stdFlLiquiditySource === undefined || this.optimizeSize) {
178
184
  const { supplyBalance, debtBalance } = await this.client.signerBalances();
179
185
  const signerFlLiquiditySource = this.getFlLiquiditySource(
@@ -182,6 +188,7 @@ export class RebalanceTxBuilder {
182
188
  debtBalance
183
189
  );
184
190
 
191
+ console.log("signer", signerFlLiquiditySource)
185
192
  if (signerFlLiquiditySource) {
186
193
  return {
187
194
  liquiditySource: signerFlLiquiditySource,
@@ -126,7 +126,7 @@ export class TransactionsManager<T extends TxHandler> {
126
126
  ]);
127
127
  for (let j = i; j >= 0; j--) {
128
128
  const tx = txItems[j];
129
- if ((await newSet.fitsWith(tx)) && !tx.name?.includes("rebalance")) {
129
+ if ((await newSet.fitsWith(tx))) {
130
130
  newSet.prepend(tx);
131
131
  i--;
132
132
  } else {