@haven-fi/solauto-sdk 1.0.807 → 1.0.809

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":"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,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AASjD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS;;;GAiCnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAmD5C;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,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AASjD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS;;;GAkCnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAoD5C;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"}
@@ -25,6 +25,7 @@ async function getPullFeed(conn, mint, wallet) {
25
25
  const crossbar = new common_1.CrossbarClient("https://integrator-crossbar.mrgn.app/");
26
26
  const queue = await on_demand_1.Queue.loadDefault(sbProgram);
27
27
  const gateway = await queue.fetchGatewayFromCrossbar(crossbar);
28
+ (0, generalUtils_1.consoleLog)("Gateway: ", gateway);
28
29
  (0, generalUtils_1.consoleLog)("Pulled SWB program!");
29
30
  (0, generalUtils_1.consoleLog)("Feed id:", constants_1.SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId);
30
31
  return {
@@ -34,14 +35,13 @@ async function getPullFeed(conn, mint, wallet) {
34
35
  }
35
36
  async function buildSwbSubmitResponseTx(conn, signer, mint) {
36
37
  const { feed, gateway } = await getPullFeed(conn, mint, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(signer.publicKey));
37
- // Try to replicate locally in the lambda docker container
38
38
  (0, generalUtils_1.consoleLog)("Fetching crank IX...");
39
39
  const [pullIxs, responses] = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
40
40
  const res = await feed.fetchUpdateIx({
41
41
  gateway: gateway.endpoint(),
42
42
  chain: "solana",
43
43
  network: "mainnet-beta",
44
- });
44
+ }, true);
45
45
  if (!res[1] || !res[1][0].value) {
46
46
  throw new Error("Unable to fetch Switchboard pull IX");
47
47
  }
@@ -32,7 +32,7 @@ import {
32
32
  import { getSecretKey } from "./shared";
33
33
  import { NATIVE_MINT } from "@solana/spl-token";
34
34
 
35
- const payForTransaction = false;
35
+ const payForTransaction = true;
36
36
  const testProgram = false;
37
37
  const lpEnv: ProgramEnv = "Prod";
38
38
 
@@ -58,23 +58,23 @@ export async function main() {
58
58
 
59
59
  await client.initializeExistingSolautoPosition({
60
60
  positionId: 1,
61
- authority: new PublicKey("EvAzkzFa7bu4vWpgu8Wyng8LLeCNmteP8jDme5gWSQWL")
61
+ authority: new PublicKey("8zYDnyACnJeHsG3fAiXUAa4EHitDu1G6ztjso6mruYVS")
62
62
  // supplyMint: NATIVE_MINT,
63
63
  // debtMint: new PublicKey(USDC),
64
64
  // lpPoolAccount: getMarginfiAccounts("Prod").defaultGroup,
65
65
  });
66
66
 
67
- const transactionItems = [
68
- rebalance(client, 3000),
69
- ];
70
67
  // const transactionItems = [
71
- // new TransactionItem(
72
- // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(NATIVE_MINT)),
73
- // // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JUP_SOL)),
74
- // // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JITO_SOL))
75
- // // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(H_SOL))
76
- // ),
68
+ // rebalance(client, 3000),
77
69
  // ];
70
+ const transactionItems = [
71
+ new TransactionItem(
72
+ async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(NATIVE_MINT)),
73
+ // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JUP_SOL)),
74
+ // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(JITO_SOL))
75
+ // async () => await buildSwbSubmitResponseTx(conn, signer, new PublicKey(H_SOL))
76
+ ),
77
+ ];
78
78
 
79
79
  const txManager = new ClientTransactionsManager({
80
80
  txHandler: client,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.807",
3
+ "version": "1.0.809",
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",
@@ -50,6 +50,7 @@ export async function getPullFeed(
50
50
  const queue = await Queue.loadDefault(sbProgram);
51
51
  const gateway = await queue.fetchGatewayFromCrossbar(crossbar as any);
52
52
 
53
+ consoleLog("Gateway: ", gateway);
53
54
  consoleLog("Pulled SWB program!");
54
55
  consoleLog("Feed id:", SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId);
55
56
  return {
@@ -72,16 +73,17 @@ export async function buildSwbSubmitResponseTx(
72
73
  toWeb3JsPublicKey(signer.publicKey)
73
74
  );
74
75
 
75
- // Try to replicate locally in the lambda docker container
76
-
77
76
  consoleLog("Fetching crank IX...");
78
77
  const [pullIxs, responses] = await retryWithExponentialBackoff(
79
78
  async () => {
80
- const res = await feed.fetchUpdateIx({
81
- gateway: gateway.endpoint(),
82
- chain: "solana",
83
- network: "mainnet-beta",
84
- });
79
+ const res = await feed.fetchUpdateIx(
80
+ {
81
+ gateway: gateway.endpoint(),
82
+ chain: "solana",
83
+ network: "mainnet-beta",
84
+ },
85
+ true
86
+ );
85
87
  if (!res[1] || !res[1][0].value) {
86
88
  throw new Error("Unable to fetch Switchboard pull IX");
87
89
  }