@0dotxyz/p0-ts-sdk 1.2.4-alpha.3 → 1.2.4-alpha.4
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 +17 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -47
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -44868,63 +44868,33 @@ async function makeUpdateSwbFeedIx(props) {
|
|
|
44868
44868
|
console.log(
|
|
44869
44869
|
`[makeUpdateSwbFeedIx] ${uniqueOracles.length} unique oracles after dedup (removed ${props.swbPullOracles.length - uniqueOracles.length})`
|
|
44870
44870
|
);
|
|
44871
|
-
|
|
44872
|
-
|
|
44873
|
-
|
|
44874
|
-
|
|
44875
|
-
|
|
44876
|
-
const swbProgram = await onDemand.AnchorUtils.loadProgramFromConnection(props.connection
|
|
44871
|
+
uniqueOracles.forEach(
|
|
44872
|
+
(o) => console.log(
|
|
44873
|
+
`[makeUpdateSwbFeedIx] - ${o.key.toBase58()} (hasSwitchboardData: ${!!o.price?.switchboardData})`
|
|
44874
|
+
)
|
|
44875
|
+
);
|
|
44876
|
+
const swbProgram = await onDemand.AnchorUtils.loadProgramFromConnection(props.connection);
|
|
44877
44877
|
const pullFeedInstances = uniqueOracles.map((oracle) => {
|
|
44878
44878
|
const pullFeed = new onDemand.PullFeed(swbProgram, oracle.key);
|
|
44879
|
-
if (oracle.price?.switchboardData) {
|
|
44880
|
-
const swbData = oracle.price?.switchboardData;
|
|
44881
|
-
pullFeed.configs = {
|
|
44882
|
-
queue: new web3_js.PublicKey(swbData.queue),
|
|
44883
|
-
feedHash: Buffer.from(swbData.feedHash, "hex"),
|
|
44884
|
-
maxVariance: Number(swbData.maxVariance),
|
|
44885
|
-
minResponses: swbData.minResponses,
|
|
44886
|
-
minSampleSize: swbData.minResponses
|
|
44887
|
-
};
|
|
44888
|
-
}
|
|
44889
44879
|
return pullFeed;
|
|
44890
44880
|
});
|
|
44891
44881
|
if (pullFeedInstances.length === 0) {
|
|
44882
|
+
console.log(`[makeUpdateSwbFeedIx] No pull feed instances, returning early`);
|
|
44892
44883
|
return { instructions: [], luts: [] };
|
|
44893
44884
|
}
|
|
44894
44885
|
const crossbarClient = new common.CrossbarClient(
|
|
44895
44886
|
process.env.NEXT_PUBLIC_SWITCHBOARD_CROSSSBAR_API || "https://integrator-crossbar.prod.mrgn.app"
|
|
44896
44887
|
);
|
|
44897
|
-
const
|
|
44898
|
-
const
|
|
44899
|
-
|
|
44900
|
-
|
|
44901
|
-
|
|
44902
|
-
|
|
44903
|
-
|
|
44904
|
-
|
|
44905
|
-
|
|
44906
|
-
|
|
44907
|
-
console.log(
|
|
44908
|
-
`[makeUpdateSwbFeedIx] Feed ${feed.pubkey.toBase58().slice(0, 8)}... got ${ixs.length} ix, ${numSuccesses} successes`
|
|
44909
|
-
);
|
|
44910
|
-
allIxs.push(...ixs);
|
|
44911
|
-
allLuts.push(...luts);
|
|
44912
|
-
} else {
|
|
44913
|
-
console.warn(
|
|
44914
|
-
`[makeUpdateSwbFeedIx] Feed ${feed.pubkey.toBase58().slice(0, 8)}... returned no instructions`
|
|
44915
|
-
);
|
|
44916
|
-
}
|
|
44917
|
-
} catch (err) {
|
|
44918
|
-
console.warn(
|
|
44919
|
-
`[makeUpdateSwbFeedIx] Feed ${feed.pubkey.toBase58().slice(0, 8)}... fetchUpdateIx failed:`,
|
|
44920
|
-
err
|
|
44921
|
-
);
|
|
44922
|
-
}
|
|
44923
|
-
}
|
|
44924
|
-
console.log(
|
|
44925
|
-
`[makeUpdateSwbFeedIx] Got ${allIxs.length} instructions, ${allLuts.length} LUTs total`
|
|
44926
|
-
);
|
|
44927
|
-
return { instructions: allIxs, luts: allLuts };
|
|
44888
|
+
const gateway = await pullFeedInstances[0].fetchGatewayUrl(crossbarClient);
|
|
44889
|
+
const [pullIx, luts] = await onDemand.PullFeed.fetchUpdateManyIx(swbProgram, {
|
|
44890
|
+
feeds: pullFeedInstances,
|
|
44891
|
+
gateway,
|
|
44892
|
+
numSignatures: 1,
|
|
44893
|
+
payer: props.feePayer,
|
|
44894
|
+
crossbarClient
|
|
44895
|
+
});
|
|
44896
|
+
console.log(`[makeUpdateSwbFeedIx] Got ${pullIx.length} instructions, ${luts.length} LUTs`);
|
|
44897
|
+
return { instructions: pullIx, luts };
|
|
44928
44898
|
}
|
|
44929
44899
|
|
|
44930
44900
|
// src/services/price/actions/klend-reserve-refresh.ts
|