@haven-fi/solauto-sdk 1.0.796 → 1.0.798

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":"clientTransactionsManager.d.ts","sourceRoot":"","sources":["../../../../src/services/transactions/manager/clientTransactionsManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAO5D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI3C,qBAAa,yBAA0B,SAAQ,mBAAmB,CAAC,aAAa,CAAC;YACjE,SAAS;YAmBT,mBAAmB;YAuCnB,WAAW;IA4CZ,IAAI,CAAC,YAAY,EAAE,eAAe,EAAE;CAmClD"}
1
+ {"version":3,"file":"clientTransactionsManager.d.ts","sourceRoot":"","sources":["../../../../src/services/transactions/manager/clientTransactionsManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAO5D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI3C,qBAAa,yBAA0B,SAAQ,mBAAmB,CAAC,aAAa,CAAC;YACjE,SAAS;YAmBT,mBAAmB;YAwCnB,WAAW;IA4CZ,IAAI,CAAC,YAAY,EAAE,eAAe,EAAE;CAmClD"}
@@ -29,6 +29,7 @@ class ClientTransactionsManager extends transactionsManager_1.TransactionsManage
29
29
  if (staleOracles) {
30
30
  this.txHandler.log("Requires oracle update(s)...");
31
31
  const oracleTxs = switchboardMints.map((x) => new types_1.TransactionItem(async () => await (0, utils_1.buildSwbSubmitResponseTx)(this.txHandler.connection, this.txHandler.signer, x), this.updateOracleTxName));
32
+ this.txHandler.log("Set crank IXs in TX");
32
33
  txs.unshift(...oracleTxs);
33
34
  }
34
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"switchboardUtils.d.ts","sourceRoot":"","sources":["../../src/utils/switchboardUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAsB,MAAM,0BAA0B,CAAC;AAGtE,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAQjD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS,8BA0BnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA0C5C;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,SAAS,EAAE,GACjB,OAAO,CAAC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,CAAC,CAuB/D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,WAEzD"}
1
+ {"version":3,"file":"switchboardUtils.d.ts","sourceRoot":"","sources":["../../src/utils/switchboardUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAsB,MAAM,0BAA0B,CAAC;AAGtE,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAQjD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS,8BA0BnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA6C5C;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,SAAS,EAAE,GACjB,OAAO,CAAC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,CAAC,CAuB/D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,WAEzD"}
@@ -75,7 +75,9 @@ async function buildSwbSubmitResponseTx(conn, signer, mint) {
75
75
  if (!pullIxs || !pullIxs.length) {
76
76
  throw new Error("Unable to fetch SWB crank IX");
77
77
  }
78
+ (0, generalUtils_1.consoleLog)("Setting price locally...");
78
79
  const price = responses[0].value.toNumber();
80
+ (0, generalUtils_1.consoleLog)(price);
79
81
  constants_1.PRICES[mint.toString()] = {
80
82
  realtimePrice: price,
81
83
  confInterval: 0,
@@ -83,6 +85,7 @@ async function buildSwbSubmitResponseTx(conn, signer, mint) {
83
85
  emaConfInterval: 0,
84
86
  time: (0, generalUtils_1.currentUnixSeconds)(),
85
87
  };
88
+ (0, generalUtils_1.consoleLog)("Returning SWB transaction data...");
86
89
  return {
87
90
  tx: (0, umi_1.transactionBuilder)(pullIxs.map((x) => (0, solanaUtils_1.getWrappedInstruction)(signer, x))),
88
91
  lookupTableAddresses: responses
@@ -12,6 +12,7 @@ import {
12
12
  getPositionExBulk,
13
13
  getSolanaRpcConnection,
14
14
  getSolautoManagedPositions,
15
+ JITO_SOL,
15
16
  LendingPlatform,
16
17
  LOCAL_IRONFORGE_API_URL,
17
18
  openSolautoPosition,
@@ -29,7 +30,7 @@ import {
29
30
  import { getSecretKey } from "./shared";
30
31
  import { NATIVE_MINT } from "@solana/spl-token";
31
32
 
32
- const payForTransaction = true;
33
+ const payForTransaction = false;
33
34
  const testProgram = false;
34
35
  const lpEnv: ProgramEnv = "Prod";
35
36
 
@@ -53,32 +54,33 @@ export async function main() {
53
54
  lpEnv,
54
55
  });
55
56
 
56
- await client.initializeNewSolautoPosition({
57
+ await client.initializeExistingSolautoPosition({
57
58
  positionId: 1,
58
- supplyMint: NATIVE_MINT,
59
- debtMint: new PublicKey(USDC),
60
- lpPoolAccount: getMarginfiAccounts("Prod").defaultGroup,
59
+ authority: new PublicKey("EvAzkzFa7bu4vWpgu8Wyng8LLeCNmteP8jDme5gWSQWL")
60
+ // supplyMint: NATIVE_MINT,
61
+ // debtMint: new PublicKey(USDC),
62
+ // lpPoolAccount: getMarginfiAccounts("Prod").defaultGroup,
61
63
  });
62
64
 
63
- const transactionItems = [
64
- openSolautoPosition(client, {
65
- boostToBps: 2000,
66
- boostGap: 50,
67
- repayToBps: 5000,
68
- repayGap: 50,
69
- }),
70
- deposit(client, toBaseUnit(0.5, 9)),
71
- rebalance(client),
72
- ];
73
65
  // const transactionItems = [
74
- // new TransactionItem(
75
- // async () => await buildSwbSubmitResponseTx(conn, signer, NATIVE_MINT)
76
- // ),
66
+ // openSolautoPosition(client, {
67
+ // boostToBps: 2000,
68
+ // boostGap: 50,
69
+ // repayToBps: 5000,
70
+ // repayGap: 50,
71
+ // }),
72
+ // deposit(client, toBaseUnit(0.5, 9)),
73
+ // rebalance(client),
77
74
  // ];
75
+ const transactionItems = [
76
+ new TransactionItem(
77
+ async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JITO_SOL))
78
+ ),
79
+ ];
78
80
 
79
81
  const txManager = new ClientTransactionsManager({
80
82
  txHandler: client,
81
- txRunType: "skip-simulation",
83
+ txRunType: payForTransaction ? "normal" : "only-simulate",
82
84
  priorityFeeSetting: PriorityFeeSetting.Default,
83
85
  retryConfig: { totalRetries: 2 },
84
86
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.796",
3
+ "version": "1.0.798",
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",
@@ -68,6 +68,7 @@ export class ClientTransactionsManager extends TransactionsManager<SolautoClient
68
68
  this.updateOracleTxName
69
69
  )
70
70
  );
71
+ this.txHandler.log("Set crank IXs in TX");
71
72
  txs.unshift(...oracleTxs);
72
73
  }
73
74
  }
@@ -78,7 +78,9 @@ export async function buildSwbSubmitResponseTx(
78
78
  throw new Error("Unable to fetch SWB crank IX");
79
79
  }
80
80
 
81
+ consoleLog("Setting price locally...");
81
82
  const price = (responses[0].value as Big).toNumber();
83
+ consoleLog(price);
82
84
  PRICES[mint.toString()] = {
83
85
  realtimePrice: price,
84
86
  confInterval: 0,
@@ -87,6 +89,7 @@ export async function buildSwbSubmitResponseTx(
87
89
  time: currentUnixSeconds(),
88
90
  };
89
91
 
92
+ consoleLog("Returning SWB transaction data...");
90
93
  return {
91
94
  tx: transactionBuilder(
92
95
  pullIxs.map((x) => getWrappedInstruction(signer, x))