@0dotxyz/p0-ts-sdk 2.1.0-alpha.2 → 2.1.1
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 +8 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -14
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { deserialize } from 'borsh';
|
|
|
11
11
|
import * as borsh from '@coral-xyz/borsh';
|
|
12
12
|
import { struct as struct$1, bool as bool$1, publicKey as publicKey$1, array as array$1, u64 as u64$1, u8 as u8$1, u32 as u32$1, u128 } from '@coral-xyz/borsh';
|
|
13
13
|
import { SwapApi, Configuration, createJupiterApiClient } from '@jup-ag/api';
|
|
14
|
-
import { AnchorUtils, PullFeed
|
|
14
|
+
import { AnchorUtils, PullFeed } from '@switchboard-xyz/on-demand';
|
|
15
15
|
import { CrossbarClient } from '@switchboard-xyz/common';
|
|
16
16
|
|
|
17
17
|
// src/config.ts
|
|
@@ -49049,7 +49049,12 @@ async function makeUpdateSwbFeedIx(props) {
|
|
|
49049
49049
|
seen.add(key);
|
|
49050
49050
|
return true;
|
|
49051
49051
|
});
|
|
49052
|
-
const
|
|
49052
|
+
const dummyWallet = {
|
|
49053
|
+
publicKey: props.feePayer,
|
|
49054
|
+
signTransaction: async (tx) => tx,
|
|
49055
|
+
signAllTransactions: async (txs) => txs
|
|
49056
|
+
};
|
|
49057
|
+
const swbProgram = await AnchorUtils.loadProgramFromConnection(props.connection, dummyWallet);
|
|
49053
49058
|
const pullFeedInstances = uniqueOracles.map((oracle) => {
|
|
49054
49059
|
const pullFeed = new PullFeed(swbProgram, oracle.key);
|
|
49055
49060
|
return pullFeed;
|
|
@@ -49060,21 +49065,11 @@ async function makeUpdateSwbFeedIx(props) {
|
|
|
49060
49065
|
const crossbarClient = new CrossbarClient(
|
|
49061
49066
|
process.env.NEXT_PUBLIC_SWITCHBOARD_CROSSSBAR_API || "https://integrator-crossbar.prod.mrgn.app"
|
|
49062
49067
|
);
|
|
49063
|
-
const gatewayUrls = await crossbarClient.fetchGateways("mainnet");
|
|
49064
|
-
if (!gatewayUrls || gatewayUrls.length === 0) {
|
|
49065
|
-
throw new Error(`No gateways available for mainnet`);
|
|
49066
|
-
}
|
|
49067
|
-
const gatewayUrl = gatewayUrls[0];
|
|
49068
|
-
if (!gatewayUrl) {
|
|
49069
|
-
throw new Error(`Invalid gateway URL received formainnet`);
|
|
49070
|
-
}
|
|
49071
|
-
const gateway = new Gateway(swbProgram, gatewayUrl);
|
|
49072
49068
|
const [pullIx, luts] = await PullFeed.fetchUpdateManyIx(swbProgram, {
|
|
49073
49069
|
feeds: pullFeedInstances,
|
|
49074
|
-
gateway: gateway.gatewayUrl,
|
|
49075
49070
|
numSignatures: 1,
|
|
49076
|
-
|
|
49077
|
-
|
|
49071
|
+
crossbarClient,
|
|
49072
|
+
payer: props.feePayer
|
|
49078
49073
|
});
|
|
49079
49074
|
return { instructions: pullIx, luts };
|
|
49080
49075
|
}
|