@0dotxyz/p0-ts-sdk 1.2.2 → 1.2.3

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.
package/dist/index.cjs CHANGED
@@ -44873,16 +44873,22 @@ async function makeUpdateSwbFeedIx(props) {
44873
44873
  `[makeUpdateSwbFeedIx] - ${o.key.toBase58()} (hasSwitchboardData: ${!!o.price?.switchboardData})`
44874
44874
  )
44875
44875
  );
44876
- const swbProgram = await onDemand.AnchorUtils.loadProgramFromConnection(props.connection);
44876
+ const dummyWallet = {
44877
+ publicKey: props.feePayer,
44878
+ signTransaction: async (tx) => tx,
44879
+ signAllTransactions: async (txs) => txs
44880
+ };
44881
+ const swbProgram = await onDemand.AnchorUtils.loadProgramFromConnection(props.connection, dummyWallet);
44877
44882
  const pullFeedInstances = uniqueOracles.map((oracle) => {
44878
44883
  const pullFeed = new onDemand.PullFeed(swbProgram, oracle.key);
44879
44884
  if (oracle.price?.switchboardData) {
44880
44885
  const swbData = oracle.price?.switchboardData;
44881
- pullFeed.data = {
44886
+ pullFeed.configs = {
44882
44887
  queue: new web3_js.PublicKey(swbData.queue),
44883
- feedHash: new Uint8Array(Buffer.from(swbData.feedHash, "hex")),
44884
- maxVariance: new BN11.BN(swbData.maxVariance),
44885
- minResponses: swbData.minResponses
44888
+ feedHash: Buffer.from(swbData.feedHash, "hex"),
44889
+ maxVariance: Number(swbData.maxVariance),
44890
+ minResponses: swbData.minResponses,
44891
+ minSampleSize: swbData.minResponses
44886
44892
  };
44887
44893
  }
44888
44894
  return pullFeed;
@@ -44894,28 +44900,14 @@ async function makeUpdateSwbFeedIx(props) {
44894
44900
  const crossbarClient = new common.CrossbarClient(
44895
44901
  process.env.NEXT_PUBLIC_SWITCHBOARD_CROSSSBAR_API || "https://integrator-crossbar.prod.mrgn.app"
44896
44902
  );
44897
- const gatewayUrls = await crossbarClient.fetchGateways("mainnet");
44898
- if (!gatewayUrls || gatewayUrls.length === 0) {
44899
- throw new Error(`No gateways available for mainnet`);
44900
- }
44901
- console.log(`[makeUpdateSwbFeedIx] Fetched ${gatewayUrls.length} gateways`);
44902
- const gatewayUrl = gatewayUrls[0];
44903
- if (!gatewayUrl) {
44904
- throw new Error(`Invalid gateway URL received formainnet`);
44905
- }
44906
- const gateway = new onDemand.Gateway(swbProgram, gatewayUrl);
44907
- console.log(
44908
- `[makeUpdateSwbFeedIx] Fetching update ix for ${pullFeedInstances.length} feeds via gateway: ${gateway.gatewayUrl}`
44909
- );
44903
+ console.log(`[makeUpdateSwbFeedIx] Fetching update ix for ${pullFeedInstances.length} feeds`);
44910
44904
  console.log(
44911
44905
  `[makeUpdateSwbFeedIx] pullFeedInstances:`,
44912
- pullFeedInstances.map((f) => ({ key: f.pubkey.toBase58(), hasData: !!f.data }))
44906
+ pullFeedInstances.map((f) => ({ key: f.pubkey.toBase58(), hasConfigs: !!f.configs }))
44913
44907
  );
44914
44908
  const [pullIx, luts] = await onDemand.PullFeed.fetchUpdateManyIx(swbProgram, {
44915
44909
  feeds: pullFeedInstances,
44916
- gateway: gateway.gatewayUrl,
44917
44910
  numSignatures: 1,
44918
- payer: props.feePayer,
44919
44911
  crossbarClient
44920
44912
  });
44921
44913
  console.log(`[makeUpdateSwbFeedIx] Got ${pullIx.length} instructions, ${luts.length} LUTs`);