@0dotxyz/p0-ts-sdk 1.2.5 → 1.2.6
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 +22 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -15
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -44873,14 +44873,18 @@ async function makeUpdateSwbFeedIx(props) {
|
|
|
44873
44873
|
`[makeUpdateSwbFeedIx] - ${o.key.toBase58()} (hasSwitchboardData: ${!!o.price?.switchboardData})`
|
|
44874
44874
|
)
|
|
44875
44875
|
);
|
|
44876
|
-
const
|
|
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);
|
|
44876
|
+
const swbProgram = await onDemand.AnchorUtils.loadProgramFromConnection(props.connection);
|
|
44882
44877
|
const pullFeedInstances = uniqueOracles.map((oracle) => {
|
|
44883
44878
|
const pullFeed = new onDemand.PullFeed(swbProgram, oracle.key);
|
|
44879
|
+
if (oracle.price?.switchboardData) {
|
|
44880
|
+
const swbData = oracle.price?.switchboardData;
|
|
44881
|
+
pullFeed.data = {
|
|
44882
|
+
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
|
|
44886
|
+
};
|
|
44887
|
+
}
|
|
44884
44888
|
return pullFeed;
|
|
44885
44889
|
});
|
|
44886
44890
|
if (pullFeedInstances.length === 0) {
|
|
@@ -44890,16 +44894,21 @@ async function makeUpdateSwbFeedIx(props) {
|
|
|
44890
44894
|
const crossbarClient = new common.CrossbarClient(
|
|
44891
44895
|
process.env.NEXT_PUBLIC_SWITCHBOARD_CROSSSBAR_API || "https://integrator-crossbar.prod.mrgn.app"
|
|
44892
44896
|
);
|
|
44893
|
-
|
|
44894
|
-
|
|
44895
|
-
`
|
|
44896
|
-
|
|
44897
|
-
|
|
44897
|
+
const gatewayUrls = await crossbarClient.fetchGateways("mainnet");
|
|
44898
|
+
if (!gatewayUrls || gatewayUrls.length === 0) {
|
|
44899
|
+
throw new Error(`No gateways available for mainnet`);
|
|
44900
|
+
}
|
|
44901
|
+
const gatewayUrl = gatewayUrls[0];
|
|
44902
|
+
if (!gatewayUrl) {
|
|
44903
|
+
throw new Error(`Invalid gateway URL received formainnet`);
|
|
44904
|
+
}
|
|
44905
|
+
const gateway = new onDemand.Gateway(swbProgram, gatewayUrl);
|
|
44898
44906
|
const [pullIx, luts] = await onDemand.PullFeed.fetchUpdateManyIx(swbProgram, {
|
|
44899
44907
|
feeds: pullFeedInstances,
|
|
44908
|
+
gateway: gateway.gatewayUrl,
|
|
44900
44909
|
numSignatures: 1,
|
|
44901
|
-
|
|
44902
|
-
|
|
44910
|
+
payer: props.feePayer,
|
|
44911
|
+
crossbarClient
|
|
44903
44912
|
});
|
|
44904
44913
|
console.log(`[makeUpdateSwbFeedIx] Got ${pullIx.length} instructions, ${luts.length} LUTs`);
|
|
44905
44914
|
return { instructions: pullIx, luts };
|