@haven-fi/solauto-sdk 1.0.783 → 1.0.784

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,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAOjD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS,8BAuBnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAwC5C;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;AAGvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAOjD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,SAAS,8BAwBnB;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,GACd,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA4C5C;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"}
@@ -32,7 +32,6 @@ const umi_1 = require("@metaplex-foundation/umi");
32
32
  const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
33
33
  const anchor_1 = require("@coral-xyz/anchor");
34
34
  const OnDemand = __importStar(require("@switchboard-xyz/on-demand"));
35
- const SwbCommon = __importStar(require("@switchboard-xyz/common"));
36
35
  const constants_1 = require("../constants");
37
36
  const generalUtils_1 = require("./generalUtils");
38
37
  const solanaUtils_1 = require("./solanaUtils");
@@ -45,15 +44,15 @@ async function getPullFeed(conn, mint, wallet) {
45
44
  const provider = new anchor_1.AnchorProvider(conn, dummyWallet, anchor_1.AnchorProvider.defaultOptions());
46
45
  const { PullFeed, ON_DEMAND_MAINNET_PID } = OnDemand;
47
46
  const sbProgram = await anchor_1.Program.at(ON_DEMAND_MAINNET_PID, provider);
47
+ console.log(new web3_js_1.PublicKey(constants_1.SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId).toString());
48
48
  return new PullFeed(sbProgram, new web3_js_1.PublicKey(constants_1.SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId));
49
49
  }
50
50
  async function buildSwbSubmitResponseTx(conn, signer, mint) {
51
- const { CrossbarClient } = SwbCommon;
52
- const crossbar = CrossbarClient.default();
53
51
  const feed = await getPullFeed(conn, mint, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(signer.publicKey));
52
+ const gateway = await feed.fetchGatewayUrl();
54
53
  const [pullIxs, responses] = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
55
54
  const res = await feed.fetchUpdateIx({
56
- gateway: crossbar.crossbarUrl,
55
+ gateway: gateway,
57
56
  chain: "solana",
58
57
  network: "mainnet",
59
58
  });
@@ -74,7 +73,7 @@ async function buildSwbSubmitResponseTx(conn, signer, mint) {
74
73
  time: (0, generalUtils_1.currentUnixSeconds)(),
75
74
  };
76
75
  return {
77
- tx: (0, umi_1.transactionBuilder)([(0, solanaUtils_1.getWrappedInstruction)(signer, pullIxs[0])]),
76
+ tx: (0, umi_1.transactionBuilder)(pullIxs.map((x) => (0, solanaUtils_1.getWrappedInstruction)(signer, x))),
78
77
  lookupTableAddresses: responses
79
78
  .filter((x) => Boolean(x.oracle.lut?.key))
80
79
  .map((x) => x.oracle.lut.key.toString()),
@@ -22,7 +22,7 @@ import {
22
22
  } from "../src";
23
23
  import { getSecretKey } from "./shared";
24
24
 
25
- const payForTransaction = true;
25
+ const payForTransaction = false;
26
26
  const testProgram = false;
27
27
  const lpEnv: ProgramEnv = "Prod";
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.783",
3
+ "version": "1.0.784",
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",
@@ -12,16 +12,16 @@
12
12
  "test:unit": "ts-mocha -p ./tsconfig.json -t 1000000 tests/unit/**/*.ts"
13
13
  },
14
14
  "dependencies": {
15
- "@coral-xyz/anchor": "^0.30.1",
15
+ "@coral-xyz/anchor": "=0.31.1",
16
16
  "@jup-ag/api": "=6.0.24",
17
17
  "@metaplex-foundation/umi": "^0.9.1",
18
18
  "@metaplex-foundation/umi-bundle-defaults": "^0.9.1",
19
19
  "@metaplex-foundation/umi-signer-wallet-adapters": "^0.9.1",
20
20
  "@metaplex-foundation/umi-web3js-adapters": "^0.9.1",
21
21
  "@solana/spl-token": "^0.4.0",
22
- "@solana/web3.js": "=1.95.8",
23
- "@switchboard-xyz/common": "=3.0.12",
24
- "@switchboard-xyz/on-demand": "=2.4.1",
22
+ "@solana/web3.js": "=1.98.2",
23
+ "@switchboard-xyz/common": "=3.4.1",
24
+ "@switchboard-xyz/on-demand": "=2.11.0",
25
25
  "axios": "^1.7.8",
26
26
  "big.js": "^6.2.2",
27
27
  "bs58": "^5.0.0",
@@ -8,7 +8,6 @@ import { Signer, transactionBuilder } from "@metaplex-foundation/umi";
8
8
  import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
9
9
  import { AnchorProvider, Program } from "@coral-xyz/anchor";
10
10
  import * as OnDemand from "@switchboard-xyz/on-demand";
11
- import * as SwbCommon from "@switchboard-xyz/common";
12
11
  import Big from "big.js";
13
12
  import { PRICES, SWITCHBOARD_PRICE_FEED_IDS } from "../constants";
14
13
  import { TransactionItemInputs } from "../types";
@@ -40,6 +39,7 @@ export async function getPullFeed(
40
39
  const { PullFeed, ON_DEMAND_MAINNET_PID } = OnDemand;
41
40
  const sbProgram = await Program.at(ON_DEMAND_MAINNET_PID, provider);
42
41
 
42
+ console.log(new PublicKey(SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId).toString())
43
43
  return new PullFeed(
44
44
  sbProgram,
45
45
  new PublicKey(SWITCHBOARD_PRICE_FEED_IDS[mint.toString()].feedId)
@@ -51,14 +51,16 @@ export async function buildSwbSubmitResponseTx(
51
51
  signer: Signer,
52
52
  mint: PublicKey
53
53
  ): Promise<TransactionItemInputs | undefined> {
54
- const { CrossbarClient } = SwbCommon;
55
- const crossbar = CrossbarClient.default();
56
-
57
- const feed = await getPullFeed(conn, mint, toWeb3JsPublicKey(signer.publicKey));
54
+ const feed = await getPullFeed(
55
+ conn,
56
+ mint,
57
+ toWeb3JsPublicKey(signer.publicKey)
58
+ );
59
+ const gateway = await feed.fetchGatewayUrl();
58
60
  const [pullIxs, responses] = await retryWithExponentialBackoff(
59
61
  async () => {
60
62
  const res = await feed.fetchUpdateIx({
61
- gateway: crossbar.crossbarUrl,
63
+ gateway: gateway,
62
64
  chain: "solana",
63
65
  network: "mainnet",
64
66
  });
@@ -85,7 +87,9 @@ export async function buildSwbSubmitResponseTx(
85
87
  };
86
88
 
87
89
  return {
88
- tx: transactionBuilder([getWrappedInstruction(signer, pullIxs[0])]),
90
+ tx: transactionBuilder(
91
+ pullIxs.map((x) => getWrappedInstruction(signer, x))
92
+ ),
89
93
  lookupTableAddresses: responses
90
94
  .filter((x) => Boolean(x.oracle.lut?.key))
91
95
  .map((x) => x.oracle.lut!.key.toString()),