Skip to content

Commit 3ffcf12

Browse files
authored
Encapsulate parameters to proposeX methods (#870)
* refactor * stuff * i think this works * cleanup * fix
1 parent 29dad7a commit 3ffcf12

File tree

6 files changed

+337
-353
lines changed

6 files changed

+337
-353
lines changed

governance/xc_admin/packages/proposer_server/src/index.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ import {
1010
import {
1111
envOrErr,
1212
getMultisigCluster,
13-
isRemoteCluster,
13+
MultisigVault,
1414
PRICE_FEED_MULTISIG,
15-
proposeInstructions,
16-
WORMHOLE_ADDRESS,
1715
} from "xc_admin_common";
1816
import * as fs from "fs";
1917
import { getPythClusterApiUrl, PythCluster } from "@pythnetwork/client";
@@ -65,19 +63,24 @@ app.post("/api/propose", async (req: Request, res: Response) => {
6563

6664
const cluster: PythCluster = req.body.cluster;
6765

66+
const wallet = new NodeWallet(KEYPAIR);
6867
const proposeSquads: SquadsMesh = new SquadsMesh({
6968
connection: new Connection(RPC_URLS[getMultisigCluster(cluster)]),
70-
wallet: new NodeWallet(KEYPAIR),
69+
wallet,
7170
});
7271

73-
const proposalPubkey = await proposeInstructions(
72+
const vault = new MultisigVault(
73+
wallet,
74+
getMultisigCluster(cluster),
7475
proposeSquads,
75-
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
76-
instructions,
77-
isRemoteCluster(cluster),
78-
WORMHOLE_ADDRESS[getMultisigCluster(cluster)]
76+
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)]
7977
);
80-
res.status(200).json({ proposalPubkey });
78+
79+
// preserve the existing API by returning only the first pubkey
80+
const proposalPubkey = (
81+
await vault.proposeInstructions(instructions, cluster)
82+
)[0];
83+
res.status(200).json({ proposalPubkey: proposalPubkey });
8184
} catch (error) {
8285
if (error instanceof Error) {
8386
res.status(500).json(error.message);

0 commit comments

Comments
 (0)