|
|
@@ -70,15 +70,15 @@ import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";
|
|
|
export async function loadHotWalletOrLedger(
|
|
|
wallet: string,
|
|
|
lda: number,
|
|
|
- ldc: number
|
|
|
+ ldc: number,
|
|
|
): Promise<Wallet> {
|
|
|
if (wallet === "ledger") {
|
|
|
return await LedgerNodeWallet.createWallet(lda, ldc);
|
|
|
} else {
|
|
|
return new NodeWallet(
|
|
|
Keypair.fromSecretKey(
|
|
|
- Uint8Array.from(JSON.parse(fs.readFileSync(wallet, "ascii")))
|
|
|
- )
|
|
|
+ Uint8Array.from(JSON.parse(fs.readFileSync(wallet, "ascii"))),
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -87,7 +87,7 @@ async function loadVaultFromOptions(options: any): Promise<MultisigVault> {
|
|
|
const wallet = await loadHotWalletOrLedger(
|
|
|
options.wallet,
|
|
|
options.ledgerDerivationAccount,
|
|
|
- options.ledgerDerivationChange
|
|
|
+ options.ledgerDerivationChange,
|
|
|
);
|
|
|
// This is the cluster where we want to perform the action
|
|
|
const cluster: PythCluster = options.cluster;
|
|
|
@@ -97,7 +97,7 @@ async function loadVaultFromOptions(options: any): Promise<MultisigVault> {
|
|
|
|
|
|
const squad = SquadsMesh.endpoint(
|
|
|
options.rpcUrlOverride ?? getPythClusterApiUrl(multisigCluster),
|
|
|
- wallet
|
|
|
+ wallet,
|
|
|
);
|
|
|
|
|
|
return new MultisigVault(wallet, multisigCluster, squad, vault);
|
|
|
@@ -110,23 +110,23 @@ const multisigCommand = (name: string, description: string) =>
|
|
|
.requiredOption("-c, --cluster <network>", "solana cluster to use")
|
|
|
.requiredOption(
|
|
|
"-w, --wallet <filepath>",
|
|
|
- 'path to the operations key or "ledger"'
|
|
|
+ 'path to the operations key or "ledger"',
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-v, --vault <pubkey>",
|
|
|
- "multisig address, all the addresses can be found in xc_admin_common/src/multisig.ts"
|
|
|
+ "multisig address, all the addresses can be found in xc_admin_common/src/multisig.ts",
|
|
|
)
|
|
|
.option(
|
|
|
"-lda, --ledger-derivation-account <number>",
|
|
|
- "ledger derivation account to use"
|
|
|
+ "ledger derivation account to use",
|
|
|
)
|
|
|
.option(
|
|
|
"-ldc, --ledger-derivation-change <number>",
|
|
|
- "ledger derivation change to use"
|
|
|
+ "ledger derivation change to use",
|
|
|
)
|
|
|
.option(
|
|
|
"-u, --rpc-url-override <string>",
|
|
|
- "RPC URL to override the default for the cluster. Make sure this is an RPC URL of the cluster where the multisig lives. For Pythnet proposals it should be a Solana Mainnet RPC URL."
|
|
|
+ "RPC URL to override the default for the cluster. Make sure this is an RPC URL of the cluster where the multisig lives. For Pythnet proposals it should be a Solana Mainnet RPC URL.",
|
|
|
);
|
|
|
|
|
|
program
|
|
|
@@ -136,15 +136,15 @@ program
|
|
|
|
|
|
multisigCommand(
|
|
|
"escrow-program-accept-authority",
|
|
|
- "Accept authority from the program authority escrow"
|
|
|
+ "Accept authority from the program authority escrow",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-p, --program-id <pubkey>",
|
|
|
- "program whose authority we want to transfer"
|
|
|
+ "program whose authority we want to transfer",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-a, --current <pubkey>",
|
|
|
- "current authority (before the transfer)"
|
|
|
+ "current authority (before the transfer)",
|
|
|
)
|
|
|
|
|
|
.action(async (options: any) => {
|
|
|
@@ -156,17 +156,17 @@ multisigCommand(
|
|
|
|
|
|
const programAuthorityEscrowIdl = await Program.fetchIdl(
|
|
|
PROGRAM_AUTHORITY_ESCROW,
|
|
|
- vault.getAnchorProvider()
|
|
|
+ vault.getAnchorProvider(),
|
|
|
);
|
|
|
|
|
|
const programAuthorityEscrow = new Program(
|
|
|
programAuthorityEscrowIdl!,
|
|
|
PROGRAM_AUTHORITY_ESCROW,
|
|
|
- vault.getAnchorProvider()
|
|
|
+ vault.getAnchorProvider(),
|
|
|
);
|
|
|
const programDataAccount = PublicKey.findProgramAddressSync(
|
|
|
[programId.toBuffer()],
|
|
|
- BPF_UPGRADABLE_LOADER
|
|
|
+ BPF_UPGRADABLE_LOADER,
|
|
|
)[0];
|
|
|
|
|
|
const proposalInstruction = await programAuthorityEscrow.methods
|
|
|
@@ -183,13 +183,13 @@ multisigCommand(
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
targetCluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand(
|
|
|
"solana-receiver-program-accept-governance-authority-transfer",
|
|
|
- "Accept governance authority transfer for the solana receiver program"
|
|
|
+ "Accept governance authority transfer for the solana receiver program",
|
|
|
).action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
const targetCluster: PythCluster = options.cluster;
|
|
|
@@ -197,7 +197,7 @@ multisigCommand(
|
|
|
const programSolanaReceiver = new Program(
|
|
|
pythSolanaReceiverIdl,
|
|
|
DEFAULT_RECEIVER_PROGRAM_ID,
|
|
|
- vault.getAnchorProvider()
|
|
|
+ vault.getAnchorProvider(),
|
|
|
);
|
|
|
|
|
|
const proposalInstruction = await programSolanaReceiver.methods
|
|
|
@@ -211,18 +211,18 @@ multisigCommand(
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
targetCluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand(
|
|
|
"solana-receiver-program-request-governance-authority-transfer",
|
|
|
- "Request governance authority transfer for the solana receiver program"
|
|
|
+ "Request governance authority transfer for the solana receiver program",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-t, --target <pubkey>",
|
|
|
"The new governance authority to take over. " +
|
|
|
- "If the target is another multisig, it will be the multisig's vault authority PDA."
|
|
|
+ "If the target is another multisig, it will be the multisig's vault authority PDA.",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
@@ -232,7 +232,7 @@ multisigCommand(
|
|
|
const programSolanaReceiver = new Program(
|
|
|
pythSolanaReceiverIdl,
|
|
|
DEFAULT_RECEIVER_PROGRAM_ID,
|
|
|
- vault.getAnchorProvider()
|
|
|
+ vault.getAnchorProvider(),
|
|
|
);
|
|
|
|
|
|
const proposalInstruction = await programSolanaReceiver.methods
|
|
|
@@ -246,14 +246,14 @@ multisigCommand(
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
targetCluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand("upgrade-program", "Upgrade a program from a buffer")
|
|
|
.requiredOption(
|
|
|
"-p, --program-id <pubkey>",
|
|
|
- "program that you want to upgrade"
|
|
|
+ "program that you want to upgrade",
|
|
|
)
|
|
|
.requiredOption("-b, --buffer <pubkey>", "buffer account")
|
|
|
|
|
|
@@ -265,7 +265,7 @@ multisigCommand("upgrade-program", "Upgrade a program from a buffer")
|
|
|
|
|
|
const programDataAccount = PublicKey.findProgramAddressSync(
|
|
|
[programId.toBuffer()],
|
|
|
- BPF_UPGRADABLE_LOADER
|
|
|
+ BPF_UPGRADABLE_LOADER,
|
|
|
)[0];
|
|
|
|
|
|
// This is intruction is not in @solana/web3.js, source : https://docs.rs/solana-program/latest/src/solana_program/bpf_loader_upgradeable.rs.html#200
|
|
|
@@ -291,14 +291,14 @@ multisigCommand("upgrade-program", "Upgrade a program from a buffer")
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand("upgrade-idl", "Upgrade an Anchor Idl from a bufffer")
|
|
|
.requiredOption(
|
|
|
"-p, --program-id <pubkey>",
|
|
|
- "program whose idl you want to upgrade"
|
|
|
+ "program whose idl you want to upgrade",
|
|
|
)
|
|
|
.requiredOption("-b, --buffer <pubkey>", "buffer account")
|
|
|
.action(async (options: any) => {
|
|
|
@@ -310,13 +310,13 @@ multisigCommand("upgrade-idl", "Upgrade an Anchor Idl from a bufffer")
|
|
|
const proposalInstruction: TransactionInstruction = await idlSetBuffer(
|
|
|
programId,
|
|
|
buffer,
|
|
|
- await vault.getVaultAuthorityPDA(cluster)
|
|
|
+ await vault.getVaultAuthorityPDA(cluster),
|
|
|
);
|
|
|
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
async function closeProgramOrBuffer(
|
|
|
@@ -324,7 +324,7 @@ async function closeProgramOrBuffer(
|
|
|
cluster: PythCluster,
|
|
|
programDataOrBufferAccount: PublicKey,
|
|
|
spill: PublicKey,
|
|
|
- programId?: PublicKey
|
|
|
+ programId?: PublicKey,
|
|
|
) {
|
|
|
let accounts = [
|
|
|
{ pubkey: programDataOrBufferAccount, isSigner: false, isWritable: true },
|
|
|
@@ -349,13 +349,13 @@ async function closeProgramOrBuffer(
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
}
|
|
|
|
|
|
multisigCommand(
|
|
|
"close-program",
|
|
|
- "Close a program, retrieve the funds. WARNING : THIS WILL BRICK THE PROGRAM AND THE ACCOUNTS IT OWNS FOREVER"
|
|
|
+ "Close a program, retrieve the funds. WARNING : THIS WILL BRICK THE PROGRAM AND THE ACCOUNTS IT OWNS FOREVER",
|
|
|
)
|
|
|
.requiredOption("-p, --program-id <pubkey>", "program that you want to close")
|
|
|
.requiredOption("-s, --spill <pubkey>", "address to receive the funds")
|
|
|
@@ -367,7 +367,7 @@ multisigCommand(
|
|
|
|
|
|
const programDataAccount = PublicKey.findProgramAddressSync(
|
|
|
[programId.toBuffer()],
|
|
|
- BPF_UPGRADABLE_LOADER
|
|
|
+ BPF_UPGRADABLE_LOADER,
|
|
|
)[0];
|
|
|
|
|
|
await closeProgramOrBuffer(
|
|
|
@@ -375,7 +375,7 @@ multisigCommand(
|
|
|
cluster,
|
|
|
programDataAccount,
|
|
|
spill,
|
|
|
- programId
|
|
|
+ programId,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
@@ -393,18 +393,17 @@ multisigCommand("close-buffer", "Close a buffer, retrieve the funds.")
|
|
|
|
|
|
multisigCommand(
|
|
|
"deactivate-stake",
|
|
|
- "Deactivate the delegated stake from the account"
|
|
|
+ "Deactivate the delegated stake from the account",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-d, --vote-pubkeys <comma_separated_voter_pubkeys>",
|
|
|
- "vote account unstake from"
|
|
|
+ "vote account unstake from",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
const cluster: PythCluster = options.cluster;
|
|
|
- const authorizedPubkey: PublicKey = await vault.getVaultAuthorityPDA(
|
|
|
- cluster
|
|
|
- );
|
|
|
+ const authorizedPubkey: PublicKey =
|
|
|
+ await vault.getVaultAuthorityPDA(cluster);
|
|
|
|
|
|
const voteAccounts: PublicKey[] = options.votePubkeys
|
|
|
? options.votePubkeys.split(",").map((m: string) => new PublicKey(m))
|
|
|
@@ -415,42 +414,41 @@ multisigCommand(
|
|
|
voteAccounts.map((voteAccount: PublicKey) =>
|
|
|
fetchStakeAccounts(
|
|
|
new Connection(getPythClusterApiUrl(cluster)),
|
|
|
- voteAccount
|
|
|
- )
|
|
|
- )
|
|
|
+ voteAccount,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
)
|
|
|
).flat();
|
|
|
|
|
|
const instructions = stakeAccounts.flatMap(
|
|
|
(stakeAccount) =>
|
|
|
StakeProgram.deactivate({ stakePubkey: stakeAccount, authorizedPubkey })
|
|
|
- .instructions
|
|
|
+ .instructions,
|
|
|
);
|
|
|
|
|
|
const proposalAddresses = await vault.proposeInstructions(
|
|
|
instructions,
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
|
|
|
console.log(
|
|
|
"Successfully proposed at: https://proposals.pyth.network/?tab=proposals&proposal=" +
|
|
|
- proposalAddresses[0].toBase58()
|
|
|
+ proposalAddresses[0].toBase58(),
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand(
|
|
|
"delegate-stake",
|
|
|
- "Delegate a stake account to the given vote account"
|
|
|
+ "Delegate a stake account to the given vote account",
|
|
|
)
|
|
|
.requiredOption("-s, --stake-account <pubkey>", "stake account to delegate")
|
|
|
.requiredOption("-d, --vote-account <pubkey>", "vote account to delegate to")
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
const cluster: PythCluster = options.cluster;
|
|
|
- const authorizedPubkey: PublicKey = await vault.getVaultAuthorityPDA(
|
|
|
- cluster
|
|
|
- );
|
|
|
+ const authorizedPubkey: PublicKey =
|
|
|
+ await vault.getVaultAuthorityPDA(cluster);
|
|
|
|
|
|
const stakeAccount: PublicKey = new PublicKey(options.stakeAccount);
|
|
|
const voteAccount: PublicKey = new PublicKey(options.voteAccount);
|
|
|
@@ -464,13 +462,13 @@ multisigCommand(
|
|
|
await vault.proposeInstructions(
|
|
|
instructions,
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
async function accountExists(
|
|
|
cluster: PythCluster,
|
|
|
- accountPubkey: PublicKey
|
|
|
+ accountPubkey: PublicKey,
|
|
|
): Promise<boolean> {
|
|
|
const connection = new Connection(getPythClusterApiUrl(cluster));
|
|
|
const account = await connection.getAccountInfo(accountPubkey);
|
|
|
@@ -479,18 +477,17 @@ async function accountExists(
|
|
|
|
|
|
multisigCommand(
|
|
|
"initialize-stake-accounts",
|
|
|
- "Initialize stake accounts and assign them to the given vote accounts"
|
|
|
+ "Initialize stake accounts and assign them to the given vote accounts",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-d, --vote-pubkeys <comma_separated_voter_pubkeys>",
|
|
|
- "vote account to delegate to"
|
|
|
+ "vote account to delegate to",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
const cluster: PythCluster = options.cluster;
|
|
|
- const authorizedPubkey: PublicKey = await vault.getVaultAuthorityPDA(
|
|
|
- cluster
|
|
|
- );
|
|
|
+ const authorizedPubkey: PublicKey =
|
|
|
+ await vault.getVaultAuthorityPDA(cluster);
|
|
|
|
|
|
const votePubkeys: PublicKey[] = options.votePubkeys
|
|
|
? options.votePubkeys.split(",").map((m: string) => new PublicKey(m))
|
|
|
@@ -501,14 +498,14 @@ multisigCommand(
|
|
|
for (const votePubkey of votePubkeys) {
|
|
|
const [stakePubkey, seed] = await findDetermisticStakeAccountAddress(
|
|
|
authorizedPubkey,
|
|
|
- votePubkey
|
|
|
+ votePubkey,
|
|
|
);
|
|
|
|
|
|
if (await accountExists(cluster, stakePubkey)) {
|
|
|
throw new Error(
|
|
|
"Stake account for validator " +
|
|
|
votePubkey.toBase58() +
|
|
|
- " already exists, it may be already permissioned"
|
|
|
+ " already exists, it may be already permissioned",
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@@ -521,7 +518,7 @@ multisigCommand(
|
|
|
lamports: 100000 * LAMPORTS_PER_SOL,
|
|
|
space: StakeProgram.space,
|
|
|
programId: StakeProgram.programId,
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
instructions.push(
|
|
|
StakeProgram.initialize({
|
|
|
@@ -530,33 +527,33 @@ multisigCommand(
|
|
|
staker: authorizedPubkey,
|
|
|
withdrawer: authorizedPubkey,
|
|
|
},
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
instructions.push(
|
|
|
StakeProgram.delegate({
|
|
|
stakePubkey,
|
|
|
authorizedPubkey,
|
|
|
votePubkey,
|
|
|
- }).instructions[0]
|
|
|
+ }).instructions[0],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
const proposalAddresses = await vault.proposeInstructions(
|
|
|
instructions,
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
|
|
|
// This should be a single proposal normally
|
|
|
console.log(
|
|
|
"Successfully proposed at: https://proposals.pyth.network/?tab=proposals&proposal=" +
|
|
|
- proposalAddresses[0].toBase58()
|
|
|
+ proposalAddresses[0].toBase58(),
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand(
|
|
|
"init-price",
|
|
|
- "Init price (useful for changing the exponent), only to be used on unused price feeds"
|
|
|
+ "Init price (useful for changing the exponent), only to be used on unused price feeds",
|
|
|
)
|
|
|
.requiredOption("-p, --price <pubkey>", "Price account to modify")
|
|
|
.requiredOption("-e, --exponent <number>", "New exponent")
|
|
|
@@ -568,7 +565,7 @@ multisigCommand(
|
|
|
|
|
|
const proposalInstruction: TransactionInstruction = await pythOracleProgram(
|
|
|
getPythProgramKeyForCluster(cluster),
|
|
|
- vault.getAnchorProvider()
|
|
|
+ vault.getAnchorProvider(),
|
|
|
)
|
|
|
.methods.setExponent(exponent, 1)
|
|
|
.accounts({
|
|
|
@@ -579,13 +576,13 @@ multisigCommand(
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand(
|
|
|
"init-price-feed-index",
|
|
|
- "Init price feed indexes to migrate old price feed accounts to the new index"
|
|
|
+ "Init price feed indexes to migrate old price feed accounts to the new index",
|
|
|
).action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
|
|
|
@@ -613,7 +610,7 @@ multisigCommand(
|
|
|
// Create instructions to initialize the price feed indexes
|
|
|
const oracleProgram = pythOracleProgram(
|
|
|
oracleProgramId,
|
|
|
- vault.getAnchorProvider()
|
|
|
+ vault.getAnchorProvider(),
|
|
|
);
|
|
|
|
|
|
const instructions: TransactionInstruction[] = [];
|
|
|
@@ -625,14 +622,14 @@ multisigCommand(
|
|
|
fundingAccount: await vault.getVaultAuthorityPDA(cluster),
|
|
|
priceAccount: pubkey,
|
|
|
})
|
|
|
- .instruction()
|
|
|
+ .instruction(),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
await vault.proposeInstructions(
|
|
|
instructions,
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
@@ -651,9 +648,9 @@ multisigCommand("init-price-store", "Init price store program").action(
|
|
|
await vault.proposeInstructions(
|
|
|
[instruction],
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
- }
|
|
|
+ },
|
|
|
);
|
|
|
|
|
|
multisigCommand("init-price-store-buffers", "Init price store buffers").action(
|
|
|
@@ -664,9 +661,8 @@ multisigCommand("init-price-store-buffers", "Init price store buffers").action(
|
|
|
const connection = new Connection(getPythClusterApiUrl(cluster));
|
|
|
const authorityKey = await vault.getVaultAuthorityPDA(cluster);
|
|
|
|
|
|
- const allPythAccounts = await connection.getProgramAccounts(
|
|
|
- oracleProgramId
|
|
|
- );
|
|
|
+ const allPythAccounts =
|
|
|
+ await connection.getProgramAccounts(oracleProgramId);
|
|
|
|
|
|
// Storing them as string to make sure equal comparison works (for the Set)
|
|
|
const allPublishers: Set<string> = new Set();
|
|
|
@@ -678,7 +674,7 @@ multisigCommand("init-price-store-buffers", "Init price store buffers").action(
|
|
|
const parsed = parsePriceData(data);
|
|
|
for (const component of parsed.priceComponents.slice(
|
|
|
0,
|
|
|
- parsed.numComponentPrices
|
|
|
+ parsed.numComponentPrices,
|
|
|
)) {
|
|
|
allPublishers.add(component.publisher.toBase58());
|
|
|
}
|
|
|
@@ -695,16 +691,16 @@ multisigCommand("init-price-store-buffers", "Init price store buffers").action(
|
|
|
instructions.push(
|
|
|
await createDetermisticPriceStoreInitializePublisherInstruction(
|
|
|
authorityKey,
|
|
|
- publisherKey
|
|
|
- )
|
|
|
+ publisherKey,
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
await vault.proposeInstructions(
|
|
|
instructions,
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
- }
|
|
|
+ },
|
|
|
);
|
|
|
|
|
|
program
|
|
|
@@ -713,18 +709,18 @@ program
|
|
|
.requiredOption("-c, --cluster <network>", "solana cluster to use")
|
|
|
.requiredOption(
|
|
|
"-t, --transaction <pubkey>",
|
|
|
- "address of the outstanding transaction"
|
|
|
+ "address of the outstanding transaction",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const cluster = options.cluster;
|
|
|
const transaction: PublicKey = new PublicKey(options.transaction);
|
|
|
const squad = SquadsMesh.endpoint(
|
|
|
getPythClusterApiUrl(cluster),
|
|
|
- new NodeWallet(new Keypair())
|
|
|
+ new NodeWallet(new Keypair()),
|
|
|
);
|
|
|
const onChainInstructions = await getProposalInstructions(
|
|
|
squad,
|
|
|
- await squad.getTransaction(new PublicKey(transaction))
|
|
|
+ await squad.getTransaction(new PublicKey(transaction)),
|
|
|
);
|
|
|
const parser = MultisigParser.fromCluster(cluster);
|
|
|
const parsed = onChainInstructions.map((ix) =>
|
|
|
@@ -732,21 +728,21 @@ program
|
|
|
programId: ix.programId,
|
|
|
data: ix.data as Buffer,
|
|
|
keys: ix.keys as AccountMeta[],
|
|
|
- })
|
|
|
+ }),
|
|
|
);
|
|
|
console.log(
|
|
|
JSON.stringify(
|
|
|
parsed,
|
|
|
(key, value) => (typeof value === "bigint" ? value.toString() : value), // return everything else unchanged
|
|
|
- 2
|
|
|
- )
|
|
|
+ 2,
|
|
|
+ ),
|
|
|
);
|
|
|
});
|
|
|
|
|
|
multisigCommand("approve", "Approve a transaction sitting in the multisig")
|
|
|
.requiredOption(
|
|
|
"-t, --transaction <pubkey>",
|
|
|
- "address of the outstanding transaction"
|
|
|
+ "address of the outstanding transaction",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
@@ -755,7 +751,7 @@ multisigCommand("approve", "Approve a transaction sitting in the multisig")
|
|
|
|
|
|
const txToSend = TransactionBuilder.batchIntoLegacyTransactions(
|
|
|
[instruction],
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
|
|
|
await vault.sendAllTransactions(txToSend);
|
|
|
@@ -767,7 +763,7 @@ multisigCommand("propose-token-transfer", "Propose token transfer")
|
|
|
.option(
|
|
|
"-m --mint <pubkey>",
|
|
|
"mint to transfer",
|
|
|
- "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" // default value is solana mainnet USDC SPL
|
|
|
+ "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // default value is solana mainnet USDC SPL
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
@@ -782,16 +778,16 @@ multisigCommand("propose-token-transfer", "Propose token transfer")
|
|
|
connection,
|
|
|
mint,
|
|
|
undefined,
|
|
|
- TOKEN_PROGRAM_ID
|
|
|
+ TOKEN_PROGRAM_ID,
|
|
|
);
|
|
|
const sourceTokenAccount = await getAssociatedTokenAddress(
|
|
|
mint,
|
|
|
await vault.getVaultAuthorityPDA(cluster),
|
|
|
- true
|
|
|
+ true,
|
|
|
);
|
|
|
const destinationTokenAccount = await getAssociatedTokenAddress(
|
|
|
mint,
|
|
|
- destination
|
|
|
+ destination,
|
|
|
);
|
|
|
|
|
|
const proposalInstruction: TransactionInstruction =
|
|
|
@@ -799,13 +795,13 @@ multisigCommand("propose-token-transfer", "Propose token transfer")
|
|
|
sourceTokenAccount,
|
|
|
destinationTokenAccount,
|
|
|
await vault.getVaultAuthorityPDA(cluster),
|
|
|
- BigInt(amount) * BigInt(10) ** BigInt(mintAccount.decimals)
|
|
|
+ BigInt(amount) * BigInt(10) ** BigInt(mintAccount.decimals),
|
|
|
);
|
|
|
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
@@ -828,7 +824,7 @@ multisigCommand("propose-sol-transfer", "Propose sol transfer")
|
|
|
await vault.proposeInstructions(
|
|
|
[proposalInstruction],
|
|
|
cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
@@ -851,7 +847,7 @@ multisigCommand("propose-arbitrary-payload", "Propose arbitrary payload")
|
|
|
multisigCommand("activate", "Activate a transaction sitting in the multisig")
|
|
|
.requiredOption(
|
|
|
"-t, --transaction <pubkey>",
|
|
|
- "address of the draft transaction"
|
|
|
+ "address of the draft transaction",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
@@ -860,7 +856,7 @@ multisigCommand("activate", "Activate a transaction sitting in the multisig")
|
|
|
|
|
|
const txToSend = TransactionBuilder.batchIntoLegacyTransactions(
|
|
|
[instruction],
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
|
|
|
await vault.sendAllTransactions(txToSend);
|
|
|
@@ -869,15 +865,15 @@ multisigCommand("activate", "Activate a transaction sitting in the multisig")
|
|
|
multisigCommand("add-and-delete", "Change the roster of the multisig")
|
|
|
.option(
|
|
|
"-a, --add <comma_separated_members>",
|
|
|
- "addresses to add to the multisig"
|
|
|
+ "addresses to add to the multisig",
|
|
|
)
|
|
|
.option(
|
|
|
"-r, --remove <comma_separated_members>",
|
|
|
- "addresses to remove from the multisig"
|
|
|
+ "addresses to remove from the multisig",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-t, --target-vaults <comma_separated_vaults>",
|
|
|
- "the vault whose roster we want to change"
|
|
|
+ "the vault whose roster we want to change",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault: MultisigVault = await loadVaultFromOptions(options);
|
|
|
@@ -905,7 +901,7 @@ multisigCommand("add-and-delete", "Change the roster of the multisig")
|
|
|
for (const member of membersToRemove) {
|
|
|
for (const targetVault of targetVaults) {
|
|
|
proposalInstructions.push(
|
|
|
- await vault.removeMemberIx(member, targetVault)
|
|
|
+ await vault.removeMemberIx(member, targetVault),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -913,7 +909,7 @@ multisigCommand("add-and-delete", "Change the roster of the multisig")
|
|
|
vault.proposeInstructions(
|
|
|
proposalInstructions,
|
|
|
options.cluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|
|
|
@@ -936,15 +932,15 @@ multisigCommand("execute-add-and-delete", "Execute a roster change proposal")
|
|
|
|
|
|
multisigCommand(
|
|
|
"set-trusted-signer",
|
|
|
- "Set a trusted signer for the Lazer program"
|
|
|
+ "Set a trusted signer for the Lazer program",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-s, --signer <pubkey>",
|
|
|
- "public key of the trusted signer to add/update"
|
|
|
+ "public key of the trusted signer to add/update",
|
|
|
)
|
|
|
.requiredOption(
|
|
|
"-e, --expiry-time <seconds>",
|
|
|
- "expiry time in seconds since Unix epoch. Set to 0 to remove the signer."
|
|
|
+ "expiry time in seconds since Unix epoch. Set to 0 to remove the signer.",
|
|
|
)
|
|
|
.action(async (options: any) => {
|
|
|
const vault = await loadVaultFromOptions(options);
|
|
|
@@ -957,7 +953,7 @@ multisigCommand(
|
|
|
const lazerProgram = new Program(
|
|
|
lazerIdl as Idl,
|
|
|
SOLANA_LAZER_PROGRAM_ID,
|
|
|
- vault.getAnchorProvider()
|
|
|
+ vault.getAnchorProvider(),
|
|
|
);
|
|
|
|
|
|
// Use Anchor to create the instruction
|
|
|
@@ -972,7 +968,7 @@ multisigCommand(
|
|
|
await vault.proposeInstructions(
|
|
|
[updateInstruction],
|
|
|
targetCluster,
|
|
|
- DEFAULT_PRIORITY_FEE_CONFIG
|
|
|
+ DEFAULT_PRIORITY_FEE_CONFIG,
|
|
|
);
|
|
|
});
|
|
|
|