diff --git a/contract_manager/scripts/common.ts b/contract_manager/scripts/common.ts index 2e4f74ab57..fcb2b72edc 100644 --- a/contract_manager/scripts/common.ts +++ b/contract_manager/scripts/common.ts @@ -14,7 +14,7 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs"; import path from "node:path"; import Web3 from "web3"; -import { Contract } from "web3-eth-contract"; +import type { Contract } from "web3-eth-contract"; import type { InferredOptionType } from "yargs"; import type { PrivateKey } from "../src/core/base"; @@ -175,7 +175,7 @@ export const COMMON_UPGRADE_OPTIONS = { }, "std-output": { type: "string", - demandOption: true, + demandOption: false, desc: "Path to the standard JSON output of the pyth contract (build artifact)", }, } as const; diff --git a/contract_manager/scripts/upgrade_evm_entropy_contracts.ts b/contract_manager/scripts/upgrade_evm_entropy_contracts.ts index 807bb08a42..8853d65c2a 100644 --- a/contract_manager/scripts/upgrade_evm_entropy_contracts.ts +++ b/contract_manager/scripts/upgrade_evm_entropy_contracts.ts @@ -50,6 +50,9 @@ function registry(cluster: PythCluster): string { async function main() { const argv = await parser.argv; + if (!argv["std-output"]) { + throw new Error("std-output is required"); + } const cacheFile = argv["contract-type"] === "executor" ? EXECUTOR_CACHE_FILE diff --git a/contract_manager/scripts/upgrade_evm_lazer_contracts.ts b/contract_manager/scripts/upgrade_evm_lazer_contracts.ts index e5a17f98a5..2cc1423796 100644 --- a/contract_manager/scripts/upgrade_evm_lazer_contracts.ts +++ b/contract_manager/scripts/upgrade_evm_lazer_contracts.ts @@ -141,7 +141,9 @@ async function main() { const payloads: Buffer[] = []; const failures: string[] = []; for (const contract of Object.values(DefaultStore.lazer_contracts)) { - if (selectedChains.includes(contract.chain)) { + if ( + selectedChains.some((chain) => chain.getId() === contract.chain.getId()) + ) { console.log("Deploying implementation to", contract.chain.getId()); try { const address = await runIfNotCached( diff --git a/contract_manager/src/node/utils/governance.ts b/contract_manager/src/node/utils/governance.ts index c6447cf115..c2793374ba 100644 --- a/contract_manager/src/node/utils/governance.ts +++ b/contract_manager/src/node/utils/governance.ts @@ -12,7 +12,6 @@ import { deriveWormholeBridgeDataKey, } from "@certusone/wormhole-sdk/lib/cjs/solana/wormhole/index.js"; import { AnchorProvider, Wallet } from "@coral-xyz/anchor"; -import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet.js"; import type { PythCluster } from "@pythnetwork/client"; import { getPythClusterApiUrl } from "@pythnetwork/client"; import type { PriorityFeeConfig } from "@pythnetwork/solana-utils"; @@ -35,7 +34,7 @@ import { SYSVAR_RENT_PUBKEY, Transaction, } from "@solana/web3.js"; -import SquadsMesh from "@sqds/mesh"; +import SquadsMeshClass from "@sqds/mesh"; import * as bs58 from "bs58"; import type { KeyValueConfig } from "../../core/base.js"; @@ -231,7 +230,7 @@ export class WormholeEmitter { export class WormholeMultisigProposal { constructor( public address: PublicKey, - public squad: SquadsMesh, + public squad: SquadsMeshInstance, public cluster: PythCluster, ) {} @@ -267,7 +266,7 @@ export class WormholeMultisigProposal { this.cluster, ), ); - } catch (error) { + } catch (error: unknown) { if (!(error instanceof InvalidTransactionError)) throw error; } } @@ -280,10 +279,16 @@ export class WormholeMultisigProposal { * A vault represents a pyth multisig governance realm which exists in solana mainnet or testnet. * It can be used for proposals to send wormhole messages to the wormhole bridge. */ +type SquadsMeshInstance = InstanceType; + +function getSquadsMesh() { + return SquadsMeshClass; +} + export class Vault extends Storable { static type = "vault"; key: PublicKey; - squad?: SquadsMesh; + squad?: SquadsMeshInstance; cluster: PythCluster; constructor(key: string, cluster: string) { @@ -327,10 +332,11 @@ export class Vault extends Storable { wallet: Wallet, registry: SolanaRpcRegistry = getPythClusterApiUrl, ): void { - this.squad = SquadsMesh.endpoint(registry(this.cluster), wallet); + const mesh = getSquadsMesh(); + this.squad = mesh.endpoint(registry(this.cluster), wallet); } - getSquadOrThrow(): SquadsMesh { + getSquadOrThrow(): SquadsMeshInstance { if (!this.squad) throw new Error("Please connect a wallet to the vault"); return this.squad; } @@ -341,9 +347,10 @@ export class Vault extends Storable { */ // eslint-disable-next-line @typescript-eslint/require-await public async getEmitter(registry: SolanaRpcRegistry = getPythClusterApiUrl) { - const squad = SquadsMesh.endpoint( + const mesh = getSquadsMesh(); + const squad = mesh.endpoint( registry(this.cluster), - new NodeWallet(Keypair.generate()), // dummy wallet + new Wallet(Keypair.generate()), // dummy wallet ); return squad.getAuthorityPDA(this.key, 1); } @@ -401,7 +408,7 @@ export class Vault extends Storable { */ // eslint-disable-next-line @typescript-eslint/require-await export async function loadHotWallet(walletPath: string): Promise { - return new NodeWallet( + return new Wallet( Keypair.fromSecretKey( Uint8Array.from(JSON.parse(readFileSync(walletPath, "ascii"))), ),