Переглянути джерело

fix(xc-admin-common): fixed typing issues to unblock build

benduran 3 тижнів тому
батько
коміт
a353f369d3
44 змінених файлів з 597 додано та 427 видалено
  1. 167 2
      governance/xc_admin/packages/xc_admin_common/package.json
  2. 11 9
      governance/xc_admin/packages/xc_admin_common/src/__tests__/BpfUpgradableLoaderInstruction.test.ts
  3. 19 15
      governance/xc_admin/packages/xc_admin_common/src/__tests__/GovernancePayload.test.ts
  4. 59 59
      governance/xc_admin/packages/xc_admin_common/src/__tests__/MessageBufferMultisigInstruction.test.ts
  5. 1 1
      governance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts
  6. 43 43
      governance/xc_admin/packages/xc_admin_common/src/__tests__/PythMultisigInstruction.test.ts
  7. 1 1
      governance/xc_admin/packages/xc_admin_common/src/__tests__/SystemProgramInstruction.test.ts
  8. 1 1
      governance/xc_admin/packages/xc_admin_common/src/__tests__/TransactionSize.test.ts
  9. 118 118
      governance/xc_admin/packages/xc_admin_common/src/__tests__/WormholeMultisigInstruction.test.ts
  10. 2 2
      governance/xc_admin/packages/xc_admin_common/src/cluster.ts
  11. 1 1
      governance/xc_admin/packages/xc_admin_common/src/deterministic_oracle_accounts.ts
  12. 8 15
      governance/xc_admin/packages/xc_admin_common/src/executor.ts
  13. 1 1
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/ExecuteAction.ts
  14. 4 4
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/ExecutePostedVaa.ts
  15. 3 3
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/GovernanceDataSourceTransfer.ts
  16. 6 1
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/PythGovernanceAction.ts
  17. 3 4
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetDataSources.ts
  18. 1 1
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetFee.ts
  19. 1 1
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetTransactionFee.ts
  20. 2 5
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetValidPeriod.ts
  21. 1 1
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetWormholeAddress.ts
  22. 1 1
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/UpgradeContract.ts
  23. 2 5
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/WithdrawFee.ts
  24. 1 1
      governance/xc_admin/packages/xc_admin_common/src/governance_payload/index.ts
  25. 11 11
      governance/xc_admin/packages/xc_admin_common/src/index.ts
  26. 1 1
      governance/xc_admin/packages/xc_admin_common/src/message_buffer.ts
  27. 3 3
      governance/xc_admin/packages/xc_admin_common/src/multisig.ts
  28. 17 13
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/BpfUpgradableLoaderMultisigInstruction.ts
  29. 4 4
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/LazerMultisigInstruction.ts
  30. 10 15
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/MessageBufferMultisigInstruction.ts
  31. 3 3
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/PythMultisigInstruction.ts
  32. 2 2
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/SolanaStakingMultisigInstruction.ts
  33. 2 2
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/SystemProgramInstruction.ts
  34. 3 3
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/WormholeMultisigInstruction.ts
  35. 3 3
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/anchor.ts
  36. 2 2
      governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/index.ts
  37. 7 7
      governance/xc_admin/packages/xc_admin_common/src/price_store.ts
  38. 22 24
      governance/xc_admin/packages/xc_admin_common/src/programs/core/core_functions.ts
  39. 10 10
      governance/xc_admin/packages/xc_admin_common/src/programs/lazer/lazer_functions.ts
  40. 12 9
      governance/xc_admin/packages/xc_admin_common/src/programs/program_registry.ts
  41. 6 3
      governance/xc_admin/packages/xc_admin_common/src/programs/types.ts
  42. 16 15
      governance/xc_admin/packages/xc_admin_common/src/propose.ts
  43. 1 1
      governance/xc_admin/packages/xc_admin_common/src/wormhole.ts
  44. 5 1
      governance/xc_admin/packages/xc_admin_common/tsconfig.json

+ 167 - 2
governance/xc_admin/packages/xc_admin_common/package.json

@@ -6,7 +6,8 @@
   "author": "",
   "homepage": "https://github.com/pyth-network/pyth-crosschain",
   "license": "ISC",
-  "main": "lib/index.js",
+  "main": "./dist/index.js",
+  "type": "module",
   "repository": {
     "type": "git",
     "url": "git+https://github.com/pyth-network/pyth-crosschain.git"
@@ -57,5 +58,169 @@
     "node": ">=22.16.0",
     "pnpm": ">=10.19.0"
   },
-  "packageManager": "pnpm@10.19.0"
+  "packageManager": "pnpm@10.19.0",
+  "exports": {
+    "./bpf_upgradable_loader": {
+      "default": "./dist/bpf_upgradable_loader.js",
+      "types": "./dist/bpf_upgradable_loader.d.ts"
+    },
+    "./chains": {
+      "default": "./dist/chains.js",
+      "types": "./dist/chains.d.ts"
+    },
+    "./cluster": {
+      "default": "./dist/cluster.js",
+      "types": "./dist/cluster.d.ts"
+    },
+    "./cranks": {
+      "default": "./dist/cranks.js",
+      "types": "./dist/cranks.d.ts"
+    },
+    "./deterministic_oracle_accounts": {
+      "default": "./dist/deterministic_oracle_accounts.js",
+      "types": "./dist/deterministic_oracle_accounts.d.ts"
+    },
+    "./deterministic_stake_accounts": {
+      "default": "./dist/deterministic_stake_accounts.js",
+      "types": "./dist/deterministic_stake_accounts.d.ts"
+    },
+    "./executor": {
+      "default": "./dist/executor.js",
+      "types": "./dist/executor.d.ts"
+    },
+    "./governance_payload/BufferLayoutExt": {
+      "default": "./dist/governance_payload/BufferLayoutExt.js",
+      "types": "./dist/governance_payload/BufferLayoutExt.d.ts"
+    },
+    "./governance_payload/ExecuteAction": {
+      "default": "./dist/governance_payload/ExecuteAction.js",
+      "types": "./dist/governance_payload/ExecuteAction.d.ts"
+    },
+    "./governance_payload/ExecutePostedVaa": {
+      "default": "./dist/governance_payload/ExecutePostedVaa.js",
+      "types": "./dist/governance_payload/ExecutePostedVaa.d.ts"
+    },
+    "./governance_payload/GovernanceDataSourceTransfer": {
+      "default": "./dist/governance_payload/GovernanceDataSourceTransfer.js",
+      "types": "./dist/governance_payload/GovernanceDataSourceTransfer.d.ts"
+    },
+    "./governance_payload/PythGovernanceAction": {
+      "default": "./dist/governance_payload/PythGovernanceAction.js",
+      "types": "./dist/governance_payload/PythGovernanceAction.d.ts"
+    },
+    "./governance_payload/SetDataSources": {
+      "default": "./dist/governance_payload/SetDataSources.js",
+      "types": "./dist/governance_payload/SetDataSources.d.ts"
+    },
+    "./governance_payload/SetFee": {
+      "default": "./dist/governance_payload/SetFee.js",
+      "types": "./dist/governance_payload/SetFee.d.ts"
+    },
+    "./governance_payload/SetTransactionFee": {
+      "default": "./dist/governance_payload/SetTransactionFee.js",
+      "types": "./dist/governance_payload/SetTransactionFee.d.ts"
+    },
+    "./governance_payload/SetValidPeriod": {
+      "default": "./dist/governance_payload/SetValidPeriod.js",
+      "types": "./dist/governance_payload/SetValidPeriod.d.ts"
+    },
+    "./governance_payload/SetWormholeAddress": {
+      "default": "./dist/governance_payload/SetWormholeAddress.js",
+      "types": "./dist/governance_payload/SetWormholeAddress.d.ts"
+    },
+    "./governance_payload/UpgradeContract": {
+      "default": "./dist/governance_payload/UpgradeContract.js",
+      "types": "./dist/governance_payload/UpgradeContract.d.ts"
+    },
+    "./governance_payload/WithdrawFee": {
+      "default": "./dist/governance_payload/WithdrawFee.js",
+      "types": "./dist/governance_payload/WithdrawFee.d.ts"
+    },
+    "./governance_payload": {
+      "default": "./dist/governance_payload/index.js",
+      "types": "./dist/governance_payload/index.d.ts"
+    },
+    ".": {
+      "default": "./dist/index.js",
+      "types": "./dist/index.d.ts"
+    },
+    "./message_buffer": {
+      "default": "./dist/message_buffer.js",
+      "types": "./dist/message_buffer.d.ts"
+    },
+    "./multisig": {
+      "default": "./dist/multisig.js",
+      "types": "./dist/multisig.d.ts"
+    },
+    "./multisig_transaction/BpfUpgradableLoaderMultisigInstruction": {
+      "default": "./dist/multisig_transaction/BpfUpgradableLoaderMultisigInstruction.js",
+      "types": "./dist/multisig_transaction/BpfUpgradableLoaderMultisigInstruction.d.ts"
+    },
+    "./multisig_transaction/LazerMultisigInstruction": {
+      "default": "./dist/multisig_transaction/LazerMultisigInstruction.js",
+      "types": "./dist/multisig_transaction/LazerMultisigInstruction.d.ts"
+    },
+    "./multisig_transaction/MessageBufferMultisigInstruction": {
+      "default": "./dist/multisig_transaction/MessageBufferMultisigInstruction.js",
+      "types": "./dist/multisig_transaction/MessageBufferMultisigInstruction.d.ts"
+    },
+    "./multisig_transaction/PythMultisigInstruction": {
+      "default": "./dist/multisig_transaction/PythMultisigInstruction.js",
+      "types": "./dist/multisig_transaction/PythMultisigInstruction.d.ts"
+    },
+    "./multisig_transaction/SolanaStakingMultisigInstruction": {
+      "default": "./dist/multisig_transaction/SolanaStakingMultisigInstruction.js",
+      "types": "./dist/multisig_transaction/SolanaStakingMultisigInstruction.d.ts"
+    },
+    "./multisig_transaction/SystemProgramInstruction": {
+      "default": "./dist/multisig_transaction/SystemProgramInstruction.js",
+      "types": "./dist/multisig_transaction/SystemProgramInstruction.d.ts"
+    },
+    "./multisig_transaction/WormholeMultisigInstruction": {
+      "default": "./dist/multisig_transaction/WormholeMultisigInstruction.js",
+      "types": "./dist/multisig_transaction/WormholeMultisigInstruction.d.ts"
+    },
+    "./multisig_transaction/anchor": {
+      "default": "./dist/multisig_transaction/anchor.js",
+      "types": "./dist/multisig_transaction/anchor.d.ts"
+    },
+    "./multisig_transaction": {
+      "default": "./dist/multisig_transaction/index.js",
+      "types": "./dist/multisig_transaction/index.d.ts"
+    },
+    "./price_store": {
+      "default": "./dist/price_store.js",
+      "types": "./dist/price_store.d.ts"
+    },
+    "./programs/core/core_functions": {
+      "default": "./dist/programs/core/core_functions.js",
+      "types": "./dist/programs/core/core_functions.d.ts"
+    },
+    "./programs/lazer/lazer_functions": {
+      "default": "./dist/programs/lazer/lazer_functions.js",
+      "types": "./dist/programs/lazer/lazer_functions.d.ts"
+    },
+    "./programs/program_registry": {
+      "default": "./dist/programs/program_registry.js",
+      "types": "./dist/programs/program_registry.d.ts"
+    },
+    "./programs/types": {
+      "default": "./dist/programs/types.js",
+      "types": "./dist/programs/types.d.ts"
+    },
+    "./propose": {
+      "default": "./dist/propose.js",
+      "types": "./dist/propose.d.ts"
+    },
+    "./remote_executor": {
+      "default": "./dist/remote_executor.js",
+      "types": "./dist/remote_executor.d.ts"
+    },
+    "./wormhole": {
+      "default": "./dist/wormhole.js",
+      "types": "./dist/wormhole.d.ts"
+    },
+    "./package.json": "./package.json"
+  },
+  "types": "./dist/index.d.ts"
 }

+ 11 - 9
governance/xc_admin/packages/xc_admin_common/src/__tests__/BpfUpgradableLoaderInstruction.test.ts

@@ -1,4 +1,4 @@
-import { PythCluster } from "@pythnetwork/client";
+import type { PythCluster } from "@pythnetwork/client";
 import {
   BpfUpgradableLoaderInstruction,
   MultisigInstructionProgram,
@@ -50,33 +50,35 @@ test("Bpf Upgradable Loader multisig instruction parse", (done) => {
     );
     expect(parsedInstruction.name).toBe("Upgrade");
     expect(
-      parsedInstruction.accounts.named.programData.pubkey.equals(
+      parsedInstruction.accounts.named.programData!.pubkey.equals(
         new PublicKey(0),
       ),
     ).toBeTruthy();
     expect(
-      parsedInstruction.accounts.named.program.pubkey.equals(new PublicKey(1)),
+      parsedInstruction.accounts.named.program!.pubkey.equals(new PublicKey(1)),
     ).toBeTruthy();
     expect(
-      parsedInstruction.accounts.named.buffer.pubkey.equals(new PublicKey(2)),
+      parsedInstruction.accounts.named.buffer!.pubkey.equals(new PublicKey(2)),
     ).toBeTruthy();
     expect(
-      parsedInstruction.accounts.named.spill.pubkey.equals(new PublicKey(3)),
+      parsedInstruction.accounts.named.spill!.pubkey.equals(new PublicKey(3)),
     ).toBeTruthy();
     expect(
-      parsedInstruction.accounts.named.rent.pubkey.equals(SYSVAR_RENT_PUBKEY),
+      parsedInstruction.accounts.named.rent!.pubkey.equals(SYSVAR_RENT_PUBKEY),
     ).toBeTruthy();
     expect(
-      parsedInstruction.accounts.named.clock.pubkey.equals(SYSVAR_CLOCK_PUBKEY),
+      parsedInstruction.accounts.named.clock!.pubkey.equals(
+        SYSVAR_CLOCK_PUBKEY,
+      ),
     ).toBeTruthy();
     expect(
-      parsedInstruction.accounts.named.upgradeAuthority.pubkey.equals(
+      parsedInstruction.accounts.named.upgradeAuthority!.pubkey.equals(
         new PublicKey(4),
       ),
     ).toBeTruthy();
     expect(parsedInstruction.accounts.remaining.length).toBe(1);
     expect(
-      parsedInstruction.accounts.remaining[0].pubkey.equals(new PublicKey(5)),
+      parsedInstruction.accounts.remaining[0]!.pubkey.equals(new PublicKey(5)),
     ).toBeTruthy();
     expect(parsedInstruction.args).toEqual({});
   } else {

+ 19 - 15
governance/xc_admin/packages/xc_admin_common/src/__tests__/GovernancePayload.test.ts

@@ -2,12 +2,10 @@ import { PublicKey, SystemProgram } from "@solana/web3.js";
 import {
   PythGovernanceHeader,
   ExecutePostedVaa,
-  MODULES,
-  MODULE_EXECUTOR,
   TargetAction,
   ExecutorAction,
-  ActionName,
-  PythGovernanceAction,
+  type ActionName,
+  type PythGovernanceAction,
   decodeGovernancePayload,
   EvmSetWormholeAddress,
   EvmExecutorAction,
@@ -15,8 +13,8 @@ import {
   StarknetSetWormholeAddress,
 } from "..";
 import * as fc from "fast-check";
-import { ChainName, CHAINS } from "../chains";
-import { Arbitrary, IntArrayConstraints } from "fast-check";
+import { type ChainName, CHAINS } from "../chains";
+import { Arbitrary, type IntArrayConstraints } from "fast-check";
 import {
   CosmosUpgradeContract,
   EvmUpgradeContract,
@@ -29,7 +27,7 @@ import {
 import { SetFee, SetFeeInToken } from "../governance_payload/SetFee";
 import { SetValidPeriod } from "../governance_payload/SetValidPeriod";
 import {
-  DataSource,
+  type DataSource,
   SetDataSources,
 } from "../governance_payload/SetDataSources";
 import { SetTransactionFee } from "../governance_payload/SetTransactionFee";
@@ -137,26 +135,32 @@ test("GovernancePayload ser/de", (done) => {
   expect(executePostedVaaArgs?.targetChainId).toBe("pythnet");
   expect(executePostedVaaArgs?.instructions.length).toBe(1);
   expect(
-    executePostedVaaArgs?.instructions[0].programId.equals(
+    executePostedVaaArgs?.instructions[0]!.programId.equals(
       SystemProgram.programId,
     ),
   ).toBeTruthy();
   expect(
-    executePostedVaaArgs?.instructions[0].keys[0].pubkey.equals(
+    executePostedVaaArgs?.instructions[0]?.keys[0]?.pubkey.equals(
       new PublicKey("AWQ18oKzd187aM2oMB4YirBcdgX1FgWfukmqEX91BRES"),
     ),
   ).toBeTruthy();
-  expect(executePostedVaaArgs?.instructions[0].keys[0].isSigner).toBeTruthy();
-  expect(executePostedVaaArgs?.instructions[0].keys[0].isWritable).toBeTruthy();
+  expect(executePostedVaaArgs?.instructions[0]?.keys[0]?.isSigner).toBeTruthy();
   expect(
-    executePostedVaaArgs?.instructions[0].keys[1].pubkey.equals(
+    executePostedVaaArgs?.instructions[0]?.keys[0]?.isWritable,
+  ).toBeTruthy();
+  expect(
+    executePostedVaaArgs?.instructions[0]?.keys[1]?.pubkey.equals(
       new PublicKey("J25GT2knN8V2Wvg9jNrYBuj9SZdsLnU6bK7WCGrL7daj"),
     ),
   ).toBeTruthy();
-  expect(!executePostedVaaArgs?.instructions[0].keys[1].isSigner).toBeTruthy();
-  expect(executePostedVaaArgs?.instructions[0].keys[1].isWritable).toBeTruthy();
   expect(
-    executePostedVaaArgs?.instructions[0].data.equals(
+    !executePostedVaaArgs?.instructions[0]?.keys[1]?.isSigner,
+  ).toBeTruthy();
+  expect(
+    executePostedVaaArgs?.instructions[0]?.keys[1]?.isWritable,
+  ).toBeTruthy();
+  expect(
+    executePostedVaaArgs?.instructions[0]?.data.equals(
       Buffer.from([2, 0, 0, 0, 0, 152, 13, 0, 0, 0, 0, 0]),
     ),
   );

+ 59 - 59
governance/xc_admin/packages/xc_admin_common/src/__tests__/MessageBufferMultisigInstruction.test.ts

@@ -2,10 +2,10 @@ import crypto from "crypto";
 // @ts-expect-error
 globalThis.crypto = crypto;
 
-import { AnchorProvider, Wallet, Program, Idl } from "@coral-xyz/anchor";
+import { AnchorProvider, Wallet, Program, type Idl } from "@coral-xyz/anchor";
 import {
   getPythClusterApiUrl,
-  PythCluster,
+  type PythCluster,
 } from "@pythnetwork/client/lib/cluster";
 import { Connection, Keypair, PublicKey } from "@solana/web3.js";
 import {
@@ -15,7 +15,7 @@ import {
   MultisigParser,
 } from "..";
 import messageBuffer from "message_buffer/idl/message_buffer.json";
-import { MessageBuffer } from "message_buffer/idl/message_buffer";
+import type { MessageBuffer } from "message_buffer/idl/message_buffer";
 
 test("Message buffer multisig instruction parse: create buffer", (done) => {
   jest.setTimeout(60000);
@@ -61,65 +61,65 @@ test("Message buffer multisig instruction parse: create buffer", (done) => {
         expect(parsedInstruction.name).toBe("createBuffer");
 
         expect(
-          parsedInstruction.accounts.named["whitelist"].pubkey.equals(
-            instruction.keys[0].pubkey,
+          parsedInstruction.accounts.named["whitelist"]?.pubkey.equals(
+            instruction.keys[0]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["whitelist"].isSigner).toBe(
-          instruction.keys[0].isSigner,
+        expect(parsedInstruction.accounts.named["whitelist"]?.isSigner).toBe(
+          instruction.keys[0]!.isSigner,
         );
-        expect(parsedInstruction.accounts.named["whitelist"].isWritable).toBe(
-          instruction.keys[0].isWritable,
+        expect(parsedInstruction.accounts.named["whitelist"]?.isWritable).toBe(
+          instruction.keys[0]!.isWritable,
         );
 
         expect(
-          parsedInstruction.accounts.named["admin"].pubkey.equals(
-            instruction.keys[1].pubkey,
+          parsedInstruction.accounts.named["admin"]?.pubkey.equals(
+            instruction.keys[1]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["admin"].isSigner).toBe(
-          instruction.keys[1].isSigner,
+        expect(parsedInstruction.accounts.named["admin"]?.isSigner).toBe(
+          instruction.keys[1]!.isSigner,
         );
-        expect(parsedInstruction.accounts.named["admin"].isWritable).toBe(
-          instruction.keys[1].isWritable,
+        expect(parsedInstruction.accounts.named["admin"]?.isWritable).toBe(
+          instruction.keys[1]!.isWritable,
         );
 
         expect(
-          parsedInstruction.accounts.named["payer"].pubkey.equals(
-            instruction.keys[2].pubkey,
+          parsedInstruction.accounts.named["payer"]?.pubkey.equals(
+            instruction.keys[2]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["payer"].isSigner).toBe(
-          instruction.keys[2].isSigner,
+        expect(parsedInstruction.accounts.named["payer"]?.isSigner).toBe(
+          instruction.keys[2]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["payer"].isWritable).toBe(
-          instruction.keys[2].isWritable,
+        expect(parsedInstruction.accounts.named["payer"]?.isWritable).toBe(
+          instruction.keys[2]?.isWritable,
         );
 
         expect(
-          parsedInstruction.accounts.named["systemProgram"].pubkey.equals(
-            instruction.keys[3].pubkey,
+          parsedInstruction.accounts.named["systemProgram"]?.pubkey.equals(
+            instruction.keys[3]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["systemProgram"].isSigner).toBe(
-          instruction.keys[3].isSigner,
-        );
         expect(
-          parsedInstruction.accounts.named["systemProgram"].isWritable,
-        ).toBe(instruction.keys[3].isWritable);
+          parsedInstruction.accounts.named["systemProgram"]?.isSigner,
+        ).toBe(instruction.keys[3]?.isSigner);
+        expect(
+          parsedInstruction.accounts.named["systemProgram"]?.isWritable,
+        ).toBe(instruction.keys[3]?.isWritable);
 
         expect(parsedInstruction.accounts.remaining.length).toBe(1);
 
         expect(
-          parsedInstruction.accounts.remaining[0].pubkey.equals(
-            instruction.keys[4].pubkey,
+          parsedInstruction.accounts.remaining[0]?.pubkey.equals(
+            instruction.keys[4]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.remaining[0].isSigner).toBe(
-          instruction.keys[4].isSigner,
+        expect(parsedInstruction.accounts.remaining[0]?.isSigner).toBe(
+          instruction.keys[4]?.isSigner,
         );
-        expect(parsedInstruction.accounts.remaining[0].isWritable).toBe(
-          instruction.keys[4].isWritable,
+        expect(parsedInstruction.accounts.remaining[0]?.isWritable).toBe(
+          instruction.keys[4]?.isWritable,
         );
 
         expect(
@@ -175,52 +175,52 @@ test("Message buffer multisig instruction parse: delete buffer", (done) => {
         expect(parsedInstruction.name).toBe("deleteBuffer");
 
         expect(
-          parsedInstruction.accounts.named["whitelist"].pubkey.equals(
-            instruction.keys[0].pubkey,
+          parsedInstruction.accounts.named["whitelist"]?.pubkey.equals(
+            instruction.keys[0]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["whitelist"].isSigner).toBe(
-          instruction.keys[0].isSigner,
+        expect(parsedInstruction.accounts.named["whitelist"]?.isSigner).toBe(
+          instruction.keys[0]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["whitelist"].isWritable).toBe(
-          instruction.keys[0].isWritable,
+        expect(parsedInstruction.accounts.named["whitelist"]?.isWritable).toBe(
+          instruction.keys[0]?.isWritable,
         );
 
         expect(
-          parsedInstruction.accounts.named["admin"].pubkey.equals(
-            instruction.keys[1].pubkey,
+          parsedInstruction.accounts.named["admin"]?.pubkey.equals(
+            instruction.keys[1]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["admin"].isSigner).toBe(
-          instruction.keys[1].isSigner,
+        expect(parsedInstruction.accounts.named["admin"]?.isSigner).toBe(
+          instruction.keys[1]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["admin"].isWritable).toBe(
-          instruction.keys[1].isWritable,
+        expect(parsedInstruction.accounts.named["admin"]?.isWritable).toBe(
+          instruction.keys[1]?.isWritable,
         );
 
         expect(
-          parsedInstruction.accounts.named["payer"].pubkey.equals(
-            instruction.keys[2].pubkey,
+          parsedInstruction.accounts.named["payer"]?.pubkey.equals(
+            instruction.keys[2]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["payer"].isSigner).toBe(
-          instruction.keys[2].isSigner,
+        expect(parsedInstruction.accounts.named["payer"]?.isSigner).toBe(
+          instruction.keys[2]!.isSigner,
         );
-        expect(parsedInstruction.accounts.named["payer"].isWritable).toBe(
-          instruction.keys[2].isWritable,
+        expect(parsedInstruction.accounts.named["payer"]?.isWritable).toBe(
+          instruction.keys[2]?.isWritable,
         );
 
         expect(
-          parsedInstruction.accounts.named["messageBuffer"].pubkey.equals(
-            instruction.keys[3].pubkey,
+          parsedInstruction.accounts.named["messageBuffer"]?.pubkey.equals(
+            instruction.keys[3]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["messageBuffer"].isSigner).toBe(
-          instruction.keys[3].isSigner,
-        );
         expect(
-          parsedInstruction.accounts.named["messageBuffer"].isWritable,
-        ).toBe(instruction.keys[3].isWritable);
+          parsedInstruction.accounts.named["messageBuffer"]?.isSigner,
+        ).toBe(instruction.keys[3]?.isSigner);
+        expect(
+          parsedInstruction.accounts.named["messageBuffer"]?.isWritable,
+        ).toBe(instruction.keys[3]?.isWritable);
 
         expect(parsedInstruction.accounts.remaining.length).toBe(0);
 

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts

@@ -2,7 +2,7 @@ import { PublicKey } from "@solana/web3.js";
 import {
   createPriceStoreInstruction,
   parsePriceStoreInstruction,
-  PriceStoreInstruction,
+  type PriceStoreInstruction,
 } from "../price_store";
 
 test("Price store instruction parse: roundtrip", (done) => {

+ 43 - 43
governance/xc_admin/packages/xc_admin_common/src/__tests__/PythMultisigInstruction.test.ts

@@ -7,7 +7,7 @@ import { pythOracleProgram } from "@pythnetwork/client";
 import {
   getPythClusterApiUrl,
   getPythProgramKeyForCluster,
-  PythCluster,
+  type PythCluster,
 } from "@pythnetwork/client/lib/cluster";
 import { Connection, Keypair, PublicKey } from "@solana/web3.js";
 import { MultisigInstructionProgram, MultisigParser } from "..";
@@ -44,50 +44,50 @@ test("Pyth multisig instruction parse: create price account", (done) => {
         );
         expect(parsedInstruction.name).toBe("addPrice");
         expect(
-          parsedInstruction.accounts.named["fundingAccount"].pubkey.equals(
-            instruction.keys[0].pubkey,
+          parsedInstruction.accounts.named["fundingAccount"]?.pubkey.equals(
+            instruction.keys[0]!.pubkey,
           ),
         ).toBeTruthy();
         expect(
-          parsedInstruction.accounts.named["fundingAccount"].isSigner,
-        ).toBe(instruction.keys[0].isSigner);
+          parsedInstruction.accounts.named["fundingAccount"]?.isSigner,
+        ).toBe(instruction.keys[0]!.isSigner);
         expect(
-          parsedInstruction.accounts.named["fundingAccount"].isWritable,
-        ).toBe(instruction.keys[0].isWritable);
+          parsedInstruction.accounts.named["fundingAccount"]?.isWritable,
+        ).toBe(instruction.keys[0]?.isWritable);
         console.log(parsedInstruction.accounts.named["productAccount"]);
         expect(
-          parsedInstruction.accounts.named["productAccount"].pubkey.equals(
-            instruction.keys[1].pubkey,
+          parsedInstruction.accounts.named["productAccount"]?.pubkey.equals(
+            instruction.keys[1]!.pubkey,
           ),
         ).toBeTruthy();
         expect(
-          parsedInstruction.accounts.named["productAccount"].isSigner,
-        ).toBe(instruction.keys[1].isSigner);
+          parsedInstruction.accounts.named["productAccount"]?.isSigner,
+        ).toBe(instruction.keys[1]?.isSigner);
         expect(
-          parsedInstruction.accounts.named["productAccount"].isWritable,
-        ).toBe(instruction.keys[1].isWritable);
+          parsedInstruction.accounts.named["productAccount"]?.isWritable,
+        ).toBe(instruction.keys[1]?.isWritable);
         expect(
-          parsedInstruction.accounts.named["priceAccount"].pubkey.equals(
-            instruction.keys[2].pubkey,
+          parsedInstruction.accounts.named["priceAccount"]?.pubkey.equals(
+            instruction.keys[2]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["priceAccount"].isSigner).toBe(
-          instruction.keys[2].isSigner,
+        expect(parsedInstruction.accounts.named["priceAccount"]?.isSigner).toBe(
+          instruction.keys[2]?.isSigner,
         );
         expect(
-          parsedInstruction.accounts.named["priceAccount"].isWritable,
-        ).toBe(instruction.keys[2].isWritable);
+          parsedInstruction.accounts.named["priceAccount"]?.isWritable,
+        ).toBe(instruction.keys[2]?.isWritable);
         expect(
-          parsedInstruction.accounts.named["permissionsAccount"].pubkey.equals(
-            instruction.keys[3].pubkey,
+          parsedInstruction.accounts.named["permissionsAccount"]?.pubkey.equals(
+            instruction.keys[3]!.pubkey,
           ),
         ).toBeTruthy();
         expect(
-          parsedInstruction.accounts.named["permissionsAccount"].isSigner,
-        ).toBe(instruction.keys[3].isSigner);
+          parsedInstruction.accounts.named["permissionsAccount"]?.isSigner,
+        ).toBe(instruction.keys[3]?.isSigner);
         expect(
-          parsedInstruction.accounts.named["permissionsAccount"].isWritable,
-        ).toBe(instruction.keys[3].isWritable);
+          parsedInstruction.accounts.named["permissionsAccount"]?.isWritable,
+        ).toBe(instruction.keys[3]?.isWritable);
         expect(parsedInstruction.accounts.remaining.length).toBe(0);
 
         expect(parsedInstruction.args.expo).toBe(-8);
@@ -129,38 +129,38 @@ test("Pyth multisig instruction parse: set minimum publishers", (done) => {
         );
         expect(parsedInstruction.name).toBe("setMinPub");
         expect(
-          parsedInstruction.accounts.named["fundingAccount"].pubkey.equals(
-            instruction.keys[0].pubkey,
+          parsedInstruction.accounts.named["fundingAccount"]?.pubkey.equals(
+            instruction.keys[0]!.pubkey,
           ),
         ).toBeTruthy();
         expect(
-          parsedInstruction.accounts.named["fundingAccount"].isSigner,
-        ).toBe(instruction.keys[0].isSigner);
+          parsedInstruction.accounts.named["fundingAccount"]?.isSigner,
+        ).toBe(instruction.keys[0]?.isSigner);
         expect(
-          parsedInstruction.accounts.named["fundingAccount"].isWritable,
-        ).toBe(instruction.keys[0].isWritable);
+          parsedInstruction.accounts.named["fundingAccount"]?.isWritable,
+        ).toBe(instruction.keys[0]?.isWritable);
         expect(
-          parsedInstruction.accounts.named["priceAccount"].pubkey.equals(
-            instruction.keys[1].pubkey,
+          parsedInstruction.accounts.named["priceAccount"]?.pubkey.equals(
+            instruction.keys[1]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["priceAccount"].isSigner).toBe(
-          instruction.keys[1].isSigner,
+        expect(parsedInstruction.accounts.named["priceAccount"]?.isSigner).toBe(
+          instruction.keys[1]?.isSigner,
         );
         expect(
-          parsedInstruction.accounts.named["priceAccount"].isWritable,
-        ).toBe(instruction.keys[1].isWritable);
+          parsedInstruction.accounts.named["priceAccount"]?.isWritable,
+        ).toBe(instruction.keys[1]?.isWritable);
         expect(
-          parsedInstruction.accounts.named["permissionsAccount"].pubkey.equals(
-            instruction.keys[2].pubkey,
+          parsedInstruction.accounts.named["permissionsAccount"]?.pubkey.equals(
+            instruction.keys[2]!.pubkey,
           ),
         ).toBeTruthy();
         expect(
-          parsedInstruction.accounts.named["permissionsAccount"].isSigner,
-        ).toBe(instruction.keys[2].isSigner);
+          parsedInstruction.accounts.named["permissionsAccount"]?.isSigner,
+        ).toBe(instruction.keys[2]?.isSigner);
         expect(
-          parsedInstruction.accounts.named["permissionsAccount"].isWritable,
-        ).toBe(instruction.keys[2].isWritable);
+          parsedInstruction.accounts.named["permissionsAccount"]?.isWritable,
+        ).toBe(instruction.keys[2]?.isWritable);
         expect(parsedInstruction.accounts.remaining.length).toBe(0);
         expect(parsedInstruction.args.minPub).toBe(25);
         done();

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/__tests__/SystemProgramInstruction.test.ts

@@ -1,4 +1,4 @@
-import { PythCluster } from "@pythnetwork/client";
+import type { PythCluster } from "@pythnetwork/client";
 import {
   MultisigInstructionProgram,
   MultisigParser,

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/__tests__/TransactionSize.test.ts

@@ -7,7 +7,7 @@ import { pythOracleProgram } from "@pythnetwork/client";
 import {
   getPythClusterApiUrl,
   getPythProgramKeyForCluster,
-  PythCluster,
+  type PythCluster,
 } from "@pythnetwork/client/lib/cluster";
 import {
   Connection,

+ 118 - 118
governance/xc_admin/packages/xc_admin_common/src/__tests__/WormholeMultisigInstruction.test.ts

@@ -6,7 +6,7 @@ import { createWormholeProgramInterface } from "@certusone/wormhole-sdk/lib/cjs/
 import { AnchorProvider, Wallet } from "@coral-xyz/anchor";
 import {
   getPythClusterApiUrl,
-  PythCluster,
+  type PythCluster,
 } from "@pythnetwork/client/lib/cluster";
 import {
   Connection,
@@ -56,104 +56,104 @@ test("Wormhole multisig instruction parse: send message without governance paylo
         );
         expect(parsedInstruction.name).toBe("postMessage");
         expect(
-          parsedInstruction.accounts.named["bridge"].pubkey.equals(
-            instruction.keys[0].pubkey,
+          parsedInstruction.accounts.named["bridge"]?.pubkey.equals(
+            instruction.keys[0]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["bridge"].isSigner).toBe(
-          instruction.keys[0].isSigner,
+        expect(parsedInstruction.accounts.named["bridge"]?.isSigner).toBe(
+          instruction.keys[0]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["bridge"].isWritable).toBe(
-          instruction.keys[0].isWritable,
+        expect(parsedInstruction.accounts.named["bridge"]?.isWritable).toBe(
+          instruction.keys[0]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["message"].pubkey.equals(
-            instruction.keys[1].pubkey,
+          parsedInstruction.accounts.named["message"]?.pubkey.equals(
+            instruction.keys[1]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["message"].isSigner).toBe(
-          instruction.keys[1].isSigner,
+        expect(parsedInstruction.accounts.named["message"]?.isSigner).toBe(
+          instruction.keys[1]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["message"].isWritable).toBe(
-          instruction.keys[1].isWritable,
+        expect(parsedInstruction.accounts.named["message"]?.isWritable).toBe(
+          instruction.keys[1]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["emitter"].pubkey.equals(
-            instruction.keys[2].pubkey,
+          parsedInstruction.accounts.named["emitter"]?.pubkey.equals(
+            instruction.keys[2]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["emitter"].isSigner).toBe(
-          instruction.keys[2].isSigner,
+        expect(parsedInstruction.accounts.named["emitter"]?.isSigner).toBe(
+          instruction.keys[2]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["emitter"].isWritable).toBe(
-          instruction.keys[2].isWritable,
+        expect(parsedInstruction.accounts.named["emitter"]?.isWritable).toBe(
+          instruction.keys[2]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["sequence"].pubkey.equals(
-            instruction.keys[3].pubkey,
+          parsedInstruction.accounts.named["sequence"]?.pubkey.equals(
+            instruction.keys[3]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["sequence"].isSigner).toBe(
-          instruction.keys[3].isSigner,
+        expect(parsedInstruction.accounts.named["sequence"]?.isSigner).toBe(
+          instruction.keys[3]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["sequence"].isWritable).toBe(
-          instruction.keys[3].isWritable,
+        expect(parsedInstruction.accounts.named["sequence"]?.isWritable).toBe(
+          instruction.keys[3]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["payer"].pubkey.equals(
-            instruction.keys[4].pubkey,
+          parsedInstruction.accounts.named["payer"]?.pubkey.equals(
+            instruction.keys[4]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["payer"].isSigner).toBe(
-          instruction.keys[4].isSigner,
+        expect(parsedInstruction.accounts.named["payer"]?.isSigner).toBe(
+          instruction.keys[4]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["payer"].isWritable).toBe(
-          instruction.keys[4].isWritable,
+        expect(parsedInstruction.accounts.named["payer"]?.isWritable).toBe(
+          instruction.keys[4]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["feeCollector"].pubkey.equals(
-            instruction.keys[5].pubkey,
+          parsedInstruction.accounts.named["feeCollector"]?.pubkey.equals(
+            instruction.keys[5]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["feeCollector"].isSigner).toBe(
-          instruction.keys[5].isSigner,
+        expect(parsedInstruction.accounts.named["feeCollector"]?.isSigner).toBe(
+          instruction.keys[5]?.isSigner,
         );
         expect(
-          parsedInstruction.accounts.named["feeCollector"].isWritable,
-        ).toBe(instruction.keys[5].isWritable);
+          parsedInstruction.accounts.named["feeCollector"]?.isWritable,
+        ).toBe(instruction.keys[5]?.isWritable);
         expect(
-          parsedInstruction.accounts.named["clock"].pubkey.equals(
-            instruction.keys[6].pubkey,
+          parsedInstruction.accounts.named["clock"]?.pubkey.equals(
+            instruction.keys[6]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["clock"].isSigner).toBe(
-          instruction.keys[6].isSigner,
+        expect(parsedInstruction.accounts.named["clock"]?.isSigner).toBe(
+          instruction.keys[6]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["clock"].isWritable).toBe(
-          instruction.keys[6].isWritable,
+        expect(parsedInstruction.accounts.named["clock"]?.isWritable).toBe(
+          instruction.keys[6]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["rent"].pubkey.equals(
-            instruction.keys[7].pubkey,
+          parsedInstruction.accounts.named["rent"]?.pubkey.equals(
+            instruction.keys[7]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["rent"].isSigner).toBe(
-          instruction.keys[7].isSigner,
+        expect(parsedInstruction.accounts.named["rent"]?.isSigner).toBe(
+          instruction.keys[7]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["rent"].isWritable).toBe(
-          instruction.keys[7].isWritable,
+        expect(parsedInstruction.accounts.named["rent"]?.isWritable).toBe(
+          instruction.keys[7]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["systemProgram"].pubkey.equals(
-            instruction.keys[8].pubkey,
+          parsedInstruction.accounts.named["systemProgram"]?.pubkey.equals(
+            instruction.keys[8]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["systemProgram"].isSigner).toBe(
-          instruction.keys[8].isSigner,
-        );
         expect(
-          parsedInstruction.accounts.named["systemProgram"].isWritable,
-        ).toBe(instruction.keys[8].isWritable);
+          parsedInstruction.accounts.named["systemProgram"]?.isSigner,
+        ).toBe(instruction.keys[8]?.isSigner);
+        expect(
+          parsedInstruction.accounts.named["systemProgram"]?.isWritable,
+        ).toBe(instruction.keys[8]?.isWritable);
         expect(parsedInstruction.accounts.remaining.length).toBe(0);
 
         expect(parsedInstruction.args.nonce).toBe(1);
@@ -208,104 +208,104 @@ test("Wormhole multisig instruction parse: send message with governance payload"
         );
         expect(parsedInstruction.name).toBe("postMessage");
         expect(
-          parsedInstruction.accounts.named["bridge"].pubkey.equals(
-            instruction.keys[0].pubkey,
+          parsedInstruction.accounts.named["bridge"]?.pubkey.equals(
+            instruction.keys[0]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["bridge"].isSigner).toBe(
-          instruction.keys[0].isSigner,
+        expect(parsedInstruction.accounts.named["bridge"]?.isSigner).toBe(
+          instruction.keys[0]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["bridge"].isWritable).toBe(
-          instruction.keys[0].isWritable,
+        expect(parsedInstruction.accounts.named["bridge"]?.isWritable).toBe(
+          instruction.keys[0]!.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["message"].pubkey.equals(
-            instruction.keys[1].pubkey,
+          parsedInstruction.accounts.named["message"]?.pubkey.equals(
+            instruction.keys[1]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["message"].isSigner).toBe(
-          instruction.keys[1].isSigner,
+        expect(parsedInstruction.accounts.named["message"]?.isSigner).toBe(
+          instruction.keys[1]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["message"].isWritable).toBe(
-          instruction.keys[1].isWritable,
+        expect(parsedInstruction.accounts.named["message"]?.isWritable).toBe(
+          instruction.keys[1]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["emitter"].pubkey.equals(
-            instruction.keys[2].pubkey,
+          parsedInstruction.accounts.named["emitter"]?.pubkey.equals(
+            instruction.keys[2]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["emitter"].isSigner).toBe(
-          instruction.keys[2].isSigner,
+        expect(parsedInstruction.accounts.named["emitter"]?.isSigner).toBe(
+          instruction.keys[2]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["emitter"].isWritable).toBe(
-          instruction.keys[2].isWritable,
+        expect(parsedInstruction.accounts.named["emitter"]?.isWritable).toBe(
+          instruction.keys[2]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["sequence"].pubkey.equals(
-            instruction.keys[3].pubkey,
+          parsedInstruction.accounts.named["sequence"]?.pubkey.equals(
+            instruction.keys[3]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["sequence"].isSigner).toBe(
-          instruction.keys[3].isSigner,
+        expect(parsedInstruction.accounts.named["sequence"]?.isSigner).toBe(
+          instruction.keys[3]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["sequence"].isWritable).toBe(
-          instruction.keys[3].isWritable,
+        expect(parsedInstruction.accounts.named["sequence"]?.isWritable).toBe(
+          instruction.keys[3]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["payer"].pubkey.equals(
-            instruction.keys[4].pubkey,
+          parsedInstruction.accounts.named["payer"]?.pubkey.equals(
+            instruction.keys[4]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["payer"].isSigner).toBe(
-          instruction.keys[4].isSigner,
+        expect(parsedInstruction.accounts.named["payer"]?.isSigner).toBe(
+          instruction.keys[4]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["payer"].isWritable).toBe(
-          instruction.keys[4].isWritable,
+        expect(parsedInstruction.accounts.named["payer"]?.isWritable).toBe(
+          instruction.keys[4]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["feeCollector"].pubkey.equals(
-            instruction.keys[5].pubkey,
+          parsedInstruction.accounts.named["feeCollector"]?.pubkey.equals(
+            instruction.keys[5]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["feeCollector"].isSigner).toBe(
-          instruction.keys[5].isSigner,
+        expect(parsedInstruction.accounts.named["feeCollector"]?.isSigner).toBe(
+          instruction.keys[5]?.isSigner,
         );
         expect(
-          parsedInstruction.accounts.named["feeCollector"].isWritable,
-        ).toBe(instruction.keys[5].isWritable);
+          parsedInstruction.accounts.named["feeCollector"]?.isWritable,
+        ).toBe(instruction.keys[5]?.isWritable);
         expect(
-          parsedInstruction.accounts.named["clock"].pubkey.equals(
-            instruction.keys[6].pubkey,
+          parsedInstruction.accounts.named["clock"]?.pubkey.equals(
+            instruction.keys[6]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["clock"].isSigner).toBe(
-          instruction.keys[6].isSigner,
+        expect(parsedInstruction.accounts.named["clock"]?.isSigner).toBe(
+          instruction.keys[6]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["clock"].isWritable).toBe(
-          instruction.keys[6].isWritable,
+        expect(parsedInstruction.accounts.named["clock"]?.isWritable).toBe(
+          instruction.keys[6]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["rent"].pubkey.equals(
-            instruction.keys[7].pubkey,
+          parsedInstruction.accounts.named["rent"]?.pubkey.equals(
+            instruction.keys[7]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["rent"].isSigner).toBe(
-          instruction.keys[7].isSigner,
+        expect(parsedInstruction.accounts.named["rent"]?.isSigner).toBe(
+          instruction.keys[7]?.isSigner,
         );
-        expect(parsedInstruction.accounts.named["rent"].isWritable).toBe(
-          instruction.keys[7].isWritable,
+        expect(parsedInstruction.accounts.named["rent"]?.isWritable).toBe(
+          instruction.keys[7]?.isWritable,
         );
         expect(
-          parsedInstruction.accounts.named["systemProgram"].pubkey.equals(
-            instruction.keys[8].pubkey,
+          parsedInstruction.accounts.named["systemProgram"]?.pubkey.equals(
+            instruction.keys[8]!.pubkey,
           ),
         ).toBeTruthy();
-        expect(parsedInstruction.accounts.named["systemProgram"].isSigner).toBe(
-          instruction.keys[8].isSigner,
-        );
         expect(
-          parsedInstruction.accounts.named["systemProgram"].isWritable,
-        ).toBe(instruction.keys[8].isWritable);
+          parsedInstruction.accounts.named["systemProgram"]?.isSigner,
+        ).toBe(instruction.keys[8]?.isSigner);
+        expect(
+          parsedInstruction.accounts.named["systemProgram"]?.isWritable,
+        ).toBe(instruction.keys[8]?.isWritable);
         expect(parsedInstruction.accounts.remaining.length).toBe(0);
 
         expect(parsedInstruction.args.nonce).toBe(0);
@@ -325,23 +325,23 @@ test("Wormhole multisig instruction parse: send message with governance payload"
           ).forEach((instruction, i) => {
             expect(
               instruction.programId.equals(
-                executePostedVaa.instructions[i].programId,
+                executePostedVaa.instructions[i]!.programId,
               ),
-            );
+            ).toBeTruthy();
             expect(
-              instruction.data.equals(executePostedVaa.instructions[i].data),
-            );
+              instruction.data.equals(executePostedVaa.instructions[i]!.data),
+            ).toBeTruthy();
             instruction.keys.forEach((account, j) => {
               expect(
                 account.pubkey.equals(
-                  executePostedVaa.instructions[i].keys[j].pubkey,
+                  executePostedVaa.instructions[i]!.keys[j]!.pubkey,
                 ),
               ).toBeTruthy();
               expect(account.isSigner).toBe(
-                executePostedVaa.instructions[i].keys[j].isSigner,
+                executePostedVaa.instructions[i]!.keys[j]!.isSigner,
               );
               expect(account.isWritable).toBe(
-                executePostedVaa.instructions[i].keys[j].isWritable,
+                executePostedVaa.instructions[i]!.keys[j]!.isWritable,
               );
             });
           });

+ 2 - 2
governance/xc_admin/packages/xc_admin_common/src/cluster.ts

@@ -1,5 +1,5 @@
-import { PythCluster } from "@pythnetwork/client/lib/cluster";
-import { Cluster } from "@solana/web3.js";
+import { type PythCluster } from "@pythnetwork/client/lib/cluster";
+import { type Cluster } from "@solana/web3.js";
 
 /**
  * Return whether the cluster is governed remotely or not. For example Pythnet is governed remotely by a mainnet multisig.

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/deterministic_oracle_accounts.ts

@@ -1,7 +1,7 @@
 import {
   AccountType,
   getPythProgramKeyForCluster,
-  PythCluster,
+  type PythCluster,
 } from "@pythnetwork/client";
 import {
   Connection,

+ 8 - 15
governance/xc_admin/packages/xc_admin_common/src/executor.ts

@@ -1,9 +1,9 @@
-import { TransactionAccount } from "@sqds/mesh/lib/types";
+import { type TransactionAccount } from "@sqds/mesh/lib/types";
 import SquadsMesh, { getIxPDA } from "@sqds/mesh";
-import { PythCluster } from "@pythnetwork/client/lib/cluster";
+import { type PythCluster } from "@pythnetwork/client/lib/cluster";
 import {
-  AccountMeta,
-  Commitment,
+  type AccountMeta,
+  type Commitment,
   PublicKey,
   SystemProgram,
   Transaction,
@@ -20,18 +20,11 @@ import {
 } from "@certusone/wormhole-sdk/lib/cjs/solana/wormhole";
 import { getCreateAccountWithSeedInstruction } from "./deterministic_oracle_accounts";
 import { AccountType, parseProductData } from "@pythnetwork/client";
-import { AnchorProvider } from "@project-serum/anchor";
 import {
   TransactionBuilder,
-  PriorityFeeConfig,
+  type PriorityFeeConfig,
   sendTransactions,
 } from "@pythnetwork/solana-utils";
-import {
-  findDetermisticPublisherBufferAddress,
-  PRICE_STORE_BUFFER_SPACE,
-  PRICE_STORE_PROGRAM_ID,
-  PriceStoreMultisigInstruction,
-} from "./price_store";
 import { Wallet } from "@coral-xyz/anchor";
 
 /**
@@ -74,7 +67,7 @@ export async function executeProposal(
   proposal: TransactionAccount,
   squad: SquadsMesh,
   cluster: PythCluster,
-  commitment: Commitment = "confirmed",
+  _: Commitment = "confirmed",
   priorityFeeConfig: PriorityFeeConfig,
 ) {
   const multisigParser = MultisigParser.fromCluster(cluster);
@@ -127,7 +120,7 @@ export async function executeProposal(
     ) {
       /// Add price, fetch the symbol from the product account
       const productAccount = await squad.connection.getAccountInfo(
-        parsedInstruction.accounts.named.productAccount.pubkey,
+        parsedInstruction.accounts.named.productAccount!.pubkey,
       );
       if (productAccount) {
         transaction.add(
@@ -135,7 +128,7 @@ export async function executeProposal(
             squad.connection,
             cluster,
             squad.wallet.publicKey,
-            parseProductData(productAccount.data).product.symbol,
+            parseProductData(productAccount.data).product.symbol!,
             AccountType.Price,
           ),
         );

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/governance_payload/ExecuteAction.ts

@@ -1,7 +1,7 @@
 import { PythGovernanceActionImpl } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 
 /** Executes an action from the executor contract via the specified executorAddress, callAddress, value, and calldata */
 export class EvmExecute extends PythGovernanceActionImpl {

+ 4 - 4
governance/xc_admin/packages/xc_admin_common/src/governance_payload/ExecutePostedVaa.ts

@@ -1,13 +1,13 @@
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 import * as BufferLayout from "@solana/buffer-layout";
 import {
-  PythGovernanceAction,
+  type PythGovernanceAction,
   PythGovernanceHeader,
   safeLayoutDecode,
 } from ".";
 import { Layout } from "@solana/buffer-layout";
 import {
-  AccountMeta,
+  type AccountMeta,
   PACKET_DATA_SIZE,
   PublicKey,
   TransactionInstruction,
@@ -32,7 +32,7 @@ class Vector<T> extends Layout<T[]> {
     ]).encode({ length: src.length, elements: src }, b, offset);
   }
 
-  getSpan(b: Buffer, offset?: number): number {
+  override getSpan(b: Buffer, offset?: number): number {
     const length = BufferLayout.u32().decode(b, offset);
     return 4 + this.element.span * length;
   }

+ 3 - 3
governance/xc_admin/packages/xc_admin_common/src/governance_payload/GovernanceDataSourceTransfer.ts

@@ -1,11 +1,11 @@
 import {
-  ActionName,
-  PythGovernanceAction,
+  type ActionName,
+  type PythGovernanceAction,
   PythGovernanceActionImpl,
   PythGovernanceHeader,
 } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 
 /**
  * Authorize transferring the governance data source from the sender's emitter address to another emitter.

+ 6 - 1
governance/xc_admin/packages/xc_admin_common/src/governance_payload/PythGovernanceAction.ts

@@ -1,4 +1,9 @@
-import { ChainId, ChainName, toChainId, toChainName } from "../chains";
+import {
+  type ChainId,
+  type ChainName,
+  toChainId,
+  toChainName,
+} from "../chains";
 import * as BufferLayout from "@solana/buffer-layout";
 import { PACKET_DATA_SIZE } from "@solana/web3.js";
 

+ 3 - 4
governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetDataSources.ts

@@ -1,10 +1,9 @@
 import {
-  ActionName,
-  PythGovernanceAction,
-  PythGovernanceActionImpl,
+  type ActionName,
+  type PythGovernanceAction,
   PythGovernanceHeader,
 } from "./PythGovernanceAction";
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";
 

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetFee.ts

@@ -4,7 +4,7 @@ import {
 } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 
 /** Set the fee on the target chain to newFeeValue * 10^newFeeExpo */
 export class SetFee extends PythGovernanceActionImpl {

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetTransactionFee.ts

@@ -1,7 +1,7 @@
 import { PythGovernanceActionImpl } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 
 /** Set the transaction fee on the target chain to newFeeValue * 10^newFeeExpo */
 export class SetTransactionFee extends PythGovernanceActionImpl {

+ 2 - 5
governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetValidPeriod.ts

@@ -1,10 +1,7 @@
-import {
-  PythGovernanceActionImpl,
-  PythGovernanceHeader,
-} from "./PythGovernanceAction";
+import { PythGovernanceActionImpl } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 
 /** Set the valid period (the default amount of time in which prices are considered fresh) to the provided value */
 export class SetValidPeriod extends PythGovernanceActionImpl {

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/governance_payload/SetWormholeAddress.ts

@@ -1,4 +1,4 @@
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 import { PythGovernanceActionImpl } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/governance_payload/UpgradeContract.ts

@@ -1,4 +1,4 @@
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 import { PythGovernanceActionImpl } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";

+ 2 - 5
governance/xc_admin/packages/xc_admin_common/src/governance_payload/WithdrawFee.ts

@@ -1,10 +1,7 @@
-import {
-  PythGovernanceActionImpl,
-  PythGovernanceHeader,
-} from "./PythGovernanceAction";
+import { PythGovernanceActionImpl } from "./PythGovernanceAction";
 import * as BufferLayout from "@solana/buffer-layout";
 import * as BufferLayoutExt from "./BufferLayoutExt";
-import { ChainName } from "../chains";
+import type { ChainName } from "../chains";
 
 /** Withdraw fees from the target chain to the specified address */
 export class WithdrawFee extends PythGovernanceActionImpl {

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/governance_payload/index.ts

@@ -5,7 +5,7 @@ import {
   UpgradeContract256Bit,
 } from "./UpgradeContract";
 import {
-  PythGovernanceAction,
+  type PythGovernanceAction,
   PythGovernanceHeader,
 } from "./PythGovernanceAction";
 import {

+ 11 - 11
governance/xc_admin/packages/xc_admin_common/src/index.ts

@@ -18,17 +18,17 @@ export { default as lazerIdl } from "./multisig_transaction/idl/lazer.json";
 export {
   ProgramType,
   PROGRAM_TYPE_NAMES,
-  PriceRawConfig,
-  ProductRawConfig,
-  MappingRawConfig,
-  RawConfig,
-  DownloadablePriceAccount,
-  DownloadableProduct,
-  DownloadableConfig,
-  ProgramConfig,
-  ProgramInstructionAccounts,
-  InstructionAccountsTypeMap,
-  ValidationResult,
+  type PriceRawConfig,
+  type ProductRawConfig,
+  type MappingRawConfig,
+  type RawConfig,
+  type DownloadablePriceAccount,
+  type DownloadableProduct,
+  type DownloadableConfig,
+  type ProgramConfig,
+  type ProgramInstructionAccounts,
+  type InstructionAccountsTypeMap,
+  type ValidationResult,
 } from "./programs/types";
 export {
   getProgramAddress,

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/message_buffer.ts

@@ -1,4 +1,4 @@
-import { getPythProgramKeyForCluster, PythCluster } from "@pythnetwork/client";
+import { getPythProgramKeyForCluster, type PythCluster } from "@pythnetwork/client";
 import { PublicKey } from "@solana/web3.js";
 
 /**

+ 3 - 3
governance/xc_admin/packages/xc_admin_common/src/multisig.ts

@@ -1,10 +1,10 @@
-import { Cluster, PublicKey } from "@solana/web3.js";
+import { type Cluster, PublicKey } from "@solana/web3.js";
 import Squads, {
   DEFAULT_MULTISIG_PROGRAM_ID,
   getIxPDA,
   getTxPDA,
 } from "@sqds/mesh";
-import { InstructionAccount, TransactionAccount } from "@sqds/mesh/lib/types";
+import { type InstructionAccount, type TransactionAccount } from "@sqds/mesh/lib/types";
 import BN from "bn.js";
 import lodash from "lodash";
 
@@ -121,7 +121,7 @@ export async function getManyProposalsInstructions(
   for (let i = 0; i < allTxIxsAccounts.length; i++) {
     const toAdd = allTxIxsAccounts[i];
     if (toAdd) {
-      ixAccountsByTx[ownerTransaction[i]].push(toAdd);
+      ixAccountsByTx[ownerTransaction[i]!]?.push(toAdd);
     }
   }
   return ixAccountsByTx;

+ 17 - 13
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/BpfUpgradableLoaderMultisigInstruction.ts

@@ -1,10 +1,10 @@
 import { TransactionInstruction } from "@solana/web3.js";
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
 } from ".";
-import { AnchorAccounts } from "./anchor";
+import type { AnchorAccounts } from "./anchor";
 import * as BufferLayout from "@solana/buffer-layout";
 
 // Source: https://docs.rs/solana-program/latest/src/solana_program/loader_upgradeable_instruction.rs.html
@@ -37,13 +37,13 @@ export class BpfUpgradableLoaderInstruction implements MultisigInstruction {
             {},
             {
               named: {
-                programData: instruction.keys[0],
-                program: instruction.keys[1],
-                buffer: instruction.keys[2],
-                spill: instruction.keys[3],
-                rent: instruction.keys[4],
-                clock: instruction.keys[5],
-                upgradeAuthority: instruction.keys[6],
+                programData: instruction.keys[0]!,
+                program: instruction.keys[1]!,
+                buffer: instruction.keys[2]!,
+                spill: instruction.keys[3]!,
+                rent: instruction.keys[4]!,
+                clock: instruction.keys[5]!,
+                upgradeAuthority: instruction.keys[6]!,
               },
               remaining: instruction.keys.slice(7),
             },
@@ -54,9 +54,9 @@ export class BpfUpgradableLoaderInstruction implements MultisigInstruction {
             {},
             {
               named: {
-                programData: instruction.keys[0],
-                currentAuthority: instruction.keys[1],
-                newAuthority: instruction.keys[2],
+                programData: instruction.keys[0]!,
+                currentAuthority: instruction.keys[1]!,
+                newAuthority: instruction.keys[2]!,
               },
               remaining: instruction.keys.slice(3),
             },
@@ -87,7 +87,11 @@ export class BpfUpgradableLoaderInstruction implements MultisigInstruction {
             };
           }
 
-          return new BpfUpgradableLoaderInstruction("Close", {}, args);
+          return new BpfUpgradableLoaderInstruction(
+            "Close",
+            {},
+            args as AnchorAccounts,
+          );
         default: // Many more cases are not supported
           throw Error("Not implemented");
       }

+ 4 - 4
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/LazerMultisigInstruction.ts

@@ -1,11 +1,11 @@
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
 } from "./index";
-import { AnchorAccounts, resolveAccountNames } from "./anchor";
-import { PublicKey, TransactionInstruction } from "@solana/web3.js";
-import { Idl, BorshInstructionCoder } from "@coral-xyz/anchor";
+import { type AnchorAccounts, resolveAccountNames } from "./anchor";
+import { TransactionInstruction } from "@solana/web3.js";
+import { type Idl, BorshInstructionCoder } from "@coral-xyz/anchor";
 import lazerIdl from "./idl/lazer.json";
 
 export class LazerMultisigInstruction implements MultisigInstruction {

+ 10 - 15
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/MessageBufferMultisigInstruction.ts

@@ -1,17 +1,17 @@
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
   UnrecognizedProgram,
 } from ".";
 import {
-  AnchorAccounts,
+  type AnchorAccounts,
   IDL_SET_BUFFER_DISCRIMINATOR,
   resolveAccountNames,
 } from "./anchor";
 import messageBufferIdl from "message_buffer/idl/message_buffer.json";
 import { PublicKey, TransactionInstruction } from "@solana/web3.js";
-import { Idl, BorshCoder } from "@coral-xyz/anchor";
+import { type Idl, BorshCoder } from "@coral-xyz/anchor";
 import { MESSAGE_BUFFER_PROGRAM_ID } from "../message_buffer";
 import meshIdl from "@sqds/mesh/lib/mesh-idl/mesh.json";
 import stakingIdl from "./idl/staking.json";
@@ -73,19 +73,14 @@ export class AnchorMultisigInstruction implements MultisigInstruction {
 
     /// Special case for IDL instructions that all programs have
     if (instruction.data.equals(IDL_SET_BUFFER_DISCRIMINATOR)) {
-      return new AnchorMultisigInstruction(
-        program,
-        "IdlSetBuffer",
-        {},
-        {
-          named: {
-            buffer: instruction.keys[0],
-            idlAccount: instruction.keys[1],
-            idlAuthority: instruction.keys[2],
-          },
-          remaining: instruction.keys.slice(3),
+      return new AnchorMultisigInstruction(program, "IdlSetBuffer", {}, {
+        named: {
+          buffer: instruction.keys[0],
+          idlAccount: instruction.keys[1],
+          idlAuthority: instruction.keys[2],
         },
-      );
+        remaining: instruction.keys.slice(3),
+      } as AnchorAccounts);
     }
     const instructionCoder = new BorshCoder(idl).instruction;
 

+ 3 - 3
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/PythMultisigInstruction.ts

@@ -1,12 +1,12 @@
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
 } from ".";
-import { AnchorAccounts, resolveAccountNames } from "./anchor";
+import { type AnchorAccounts, resolveAccountNames } from "./anchor";
 import { pythIdl, pythOracleCoder } from "@pythnetwork/client";
 import { TransactionInstruction } from "@solana/web3.js";
-import { Idl } from "@coral-xyz/anchor";
+import type { Idl } from "@coral-xyz/anchor";
 
 export class PythMultisigInstruction implements MultisigInstruction {
   readonly program = MultisigInstructionProgram.PythOracle;

+ 2 - 2
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/SolanaStakingMultisigInstruction.ts

@@ -5,11 +5,11 @@ import {
   TransactionInstruction,
 } from "@solana/web3.js";
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
 } from ".";
-import { AnchorAccounts } from "./anchor";
+import type { AnchorAccounts } from "./anchor";
 import { StakeInstruction } from "@solana/web3.js";
 import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";
 

+ 2 - 2
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/SystemProgramInstruction.ts

@@ -1,10 +1,10 @@
 import { SystemInstruction, TransactionInstruction } from "@solana/web3.js";
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
 } from ".";
-import { AnchorAccounts } from "./anchor";
+import type { AnchorAccounts } from "./anchor";
 
 export class SystemProgramMultisigInstruction implements MultisigInstruction {
   readonly program = MultisigInstructionProgram.SystemProgram;

+ 3 - 3
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/WormholeMultisigInstruction.ts

@@ -3,15 +3,15 @@ import { WormholeInstructionCoder } from "@certusone/wormhole-sdk/lib/cjs/solana
 import { getPythClusterApiUrl } from "@pythnetwork/client/lib/cluster";
 import { Connection, TransactionInstruction } from "@solana/web3.js";
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
 } from ".";
 import {
   decodeGovernancePayload,
-  PythGovernanceAction,
+  type PythGovernanceAction,
 } from "../governance_payload";
-import { AnchorAccounts, resolveAccountNames } from "./anchor";
+import { type AnchorAccounts, resolveAccountNames } from "./anchor";
 
 export class WormholeMultisigInstruction implements MultisigInstruction {
   readonly program = MultisigInstructionProgram.WormholeBridge;

+ 3 - 3
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/anchor.ts

@@ -1,6 +1,6 @@
-import { Idl } from "@coral-xyz/anchor";
+import type { Idl } from "@coral-xyz/anchor";
 import {
-  AccountMeta,
+  type AccountMeta,
   PublicKey,
   TransactionInstruction,
 } from "@solana/web3.js";
@@ -25,7 +25,7 @@ export function resolveAccountNames(
   const remaining: RemainingAccounts = [];
   instruction.keys.map((account, idx) => {
     if (idx < ix.accounts.length) {
-      named[ix.accounts[idx].name] = account;
+      named[ix.accounts[idx]!.name] = account;
     } else {
       remaining.push(account);
     }

+ 2 - 2
governance/xc_admin/packages/xc_admin_common/src/multisig_transaction/index.ts

@@ -1,6 +1,6 @@
 import {
   getPythProgramKeyForCluster,
-  PythCluster,
+  type PythCluster,
 } from "@pythnetwork/client/lib/cluster";
 import {
   PublicKey,
@@ -20,7 +20,7 @@ import { WormholeMultisigInstruction } from "./WormholeMultisigInstruction";
 import { SystemProgramMultisigInstruction } from "./SystemProgramInstruction";
 import { BpfUpgradableLoaderInstruction } from "./BpfUpgradableLoaderMultisigInstruction";
 import { BPF_UPGRADABLE_LOADER } from "../bpf_upgradable_loader";
-import { AnchorAccounts } from "./anchor";
+import type { AnchorAccounts } from "./anchor";
 import { SolanaStakingMultisigInstruction } from "./SolanaStakingMultisigInstruction";
 import { DEFAULT_RECEIVER_PROGRAM_ID } from "@pythnetwork/pyth-solana-receiver";
 import {

+ 7 - 7
governance/xc_admin/packages/xc_admin_common/src/price_store.ts

@@ -1,5 +1,5 @@
 import {
-  AccountMeta,
+  type AccountMeta,
   Connection,
   MAX_SEED_LENGTH,
   PublicKey,
@@ -7,11 +7,11 @@ import {
   TransactionInstruction,
 } from "@solana/web3.js";
 import {
-  MultisigInstruction,
+  type MultisigInstruction,
   MultisigInstructionProgram,
   UNRECOGNIZED_INSTRUCTION,
 } from "./multisig_transaction";
-import { AnchorAccounts } from "./multisig_transaction/anchor";
+import { type AnchorAccounts } from "./multisig_transaction/anchor";
 import { PRICE_FEED_OPS_KEY } from "./multisig";
 
 export const PRICE_STORE_PROGRAM_ID: PublicKey = new PublicKey(
@@ -172,7 +172,7 @@ export function parsePriceStoreInstruction(
       data = {
         type: "Initialize",
         data: {
-          payerKey: instruction.keys[0].pubkey,
+          payerKey: instruction.keys[0]!.pubkey,
           authorityKey,
         },
       };
@@ -189,8 +189,8 @@ export function parsePriceStoreInstruction(
       data = {
         type: "InitializePublisher",
         data: {
-          authorityKey: instruction.keys[0].pubkey,
-          bufferKey: instruction.keys[3].pubkey,
+          authorityKey: instruction.keys[0]!.pubkey,
+          bufferKey: instruction.keys[3]!.pubkey,
           publisherKey,
         },
       };
@@ -220,7 +220,7 @@ export function parsePriceStoreInstruction(
     a.pubkey.equals(b.pubkey);
 
   const accountMismatch = expected.keys.some(
-    (ex, index) => !accountEquals(ex, instruction.keys[index]),
+    (ex, index) => !accountEquals(ex, instruction.keys[index]!),
   );
   if (accountMismatch) {
     const expectedJson = JSON.stringify(expected.keys);

+ 22 - 24
governance/xc_admin/packages/xc_admin_common/src/programs/core/core_functions.ts

@@ -1,19 +1,18 @@
 import {
   PublicKey,
   TransactionInstruction,
-  AccountInfo,
+  type AccountInfo,
   Connection,
 } from "@solana/web3.js";
 import {
   AccountType,
-  PythCluster,
-  getPythProgramKeyForCluster,
+  type PythCluster,
   parseBaseData,
   parseMappingData,
   parsePermissionData,
   parsePriceData,
   parseProductData,
-  Product,
+  type Product,
 } from "@pythnetwork/client";
 import {
   findDetermisticAccountAddress,
@@ -27,18 +26,17 @@ import {
   isPriceStorePublisherInitialized,
   createDetermisticPriceStoreInitializePublisherInstruction,
 } from "../../index";
-import {
+import type {
   DownloadableConfig,
   DownloadablePriceAccount,
   DownloadableProduct,
   PriceRawConfig,
   RawConfig,
   ValidationResult,
-  ProgramType,
 } from "../types";
 import { Program } from "@coral-xyz/anchor";
-import { PythOracle } from "@pythnetwork/client/lib/anchor";
-import { MessageBuffer } from "message_buffer/idl/message_buffer";
+import type { PythOracle } from "@pythnetwork/client/lib/anchor";
+import type { MessageBuffer } from "message_buffer/idl/message_buffer";
 
 /**
  * Maximum sizes for instruction data to fit into transactions
@@ -189,7 +187,7 @@ export function getConfig(params: CoreConfigParams): RawConfig {
           ) {
             processedPriceKeys.add(priceAccountKey);
             const priceConfig: PriceRawConfig =
-              priceRawConfigs[priceAccountKey];
+              priceRawConfigs[priceAccountKey]!;
             priceAccounts.push(priceConfig);
             priceAccountKey = priceConfig.next
               ? priceConfig.next.toBase58()
@@ -253,7 +251,7 @@ export function getConfig(params: CoreConfigParams): RawConfig {
     ...(permissionAccount && {
       permissionAccount: parsePermissionData(permissionAccount.account.data),
     }),
-  };
+  } as RawConfig;
 }
 
 /**
@@ -265,13 +263,13 @@ export function getDownloadableConfig(
   // Convert the raw config to a user-friendly format for download
   if (rawConfig.mappingAccounts.length > 0) {
     const symbolToData = Object.fromEntries(
-      rawConfig.mappingAccounts
-        .sort(
+      rawConfig
+        .mappingAccounts!.sort(
           (mapping1, mapping2) =>
             mapping2.products.length - mapping1.products.length,
-        )[0]
+        )[0]!
         .products.sort((product1, product2) =>
-          product1.metadata.symbol.localeCompare(product2.metadata.symbol),
+          product1.metadata.symbol!.localeCompare(product2.metadata.symbol!),
         )
         .map((product) => {
           const { price_account, ...metadataWithoutPriceAccount } =
@@ -315,8 +313,8 @@ export function validateUploadedConfig(
     const changes: Record<
       string,
       {
-        prev?: Partial<DownloadableProduct>;
-        new?: Partial<DownloadableProduct>;
+        prev?: Partial<DownloadableProduct> | undefined;
+        new?: Partial<DownloadableProduct> | undefined;
       }
     > = {};
 
@@ -408,8 +406,8 @@ export function validateUploadedConfig(
     for (const symbol of Object.keys(processedConfig)) {
       if (
         existingSymbols.has(symbol) &&
-        processedConfig[symbol].address &&
-        processedConfig[symbol].address !== existingConfig[symbol].address
+        processedConfig[symbol]?.address &&
+        processedConfig[symbol]?.address !== existingConfig[symbol]?.address
       ) {
         return {
           isValid: false,
@@ -422,8 +420,8 @@ export function validateUploadedConfig(
     for (const symbol of Object.keys(processedConfig)) {
       if (
         existingSymbols.has(symbol) &&
-        processedConfig[symbol].priceAccounts?.[0] &&
-        existingConfig[symbol].priceAccounts?.[0] &&
+        processedConfig[symbol]?.priceAccounts?.[0] &&
+        existingConfig[symbol]?.priceAccounts?.[0] &&
         processedConfig[symbol].priceAccounts[0].address &&
         processedConfig[symbol].priceAccounts[0].address !==
           existingConfig[symbol].priceAccounts[0].address
@@ -439,7 +437,7 @@ export function validateUploadedConfig(
     for (const symbol of Object.keys(processedConfig)) {
       const maximumNumberOfPublishers = getMaximumNumberOfPublishers(cluster);
       if (
-        processedConfig[symbol].priceAccounts?.[0]?.publishers &&
+        processedConfig[symbol]?.priceAccounts?.[0]?.publishers &&
         processedConfig[symbol].priceAccounts[0].publishers.length >
           maximumNumberOfPublishers
       ) {
@@ -527,7 +525,7 @@ async function generateAddInstructions(
       .addProduct({ ...newChanges.metadata })
       .accounts({
         fundingAccount,
-        tailMappingAccount: rawConfig.mappingAccounts[0].address,
+        tailMappingAccount: rawConfig.mappingAccounts[0]!.address,
         productAccount: productAccountKey,
       })
       .instruction();
@@ -672,7 +670,7 @@ async function generateDeleteInstructions(
         .delProduct()
         .accounts({
           fundingAccount,
-          mappingAccount: accounts.rawConfig.mappingAccounts[0].address,
+          mappingAccount: accounts.rawConfig.mappingAccounts[0]!.address,
           productAccount: new PublicKey(prev.address || ""),
         })
         .instruction(),
@@ -847,7 +845,7 @@ export async function generateInstructions(
   const verifiedPublishers: PublicKey[] = [];
 
   for (const symbol of Object.keys(changes)) {
-    const { prev, new: newChanges } = changes[symbol];
+    const { prev, new: newChanges } = changes[symbol] ?? {};
 
     if (!prev && newChanges) {
       // Add new product/price

+ 10 - 10
governance/xc_admin/packages/xc_admin_common/src/programs/lazer/lazer_functions.ts

@@ -1,9 +1,9 @@
 import { PublicKey, TransactionInstruction } from "@solana/web3.js";
-import { PythCluster } from "@pythnetwork/client";
+import type { PythCluster } from "@pythnetwork/client";
 import {
-  ValidationResult,
-  DownloadableProduct,
-  DownloadableConfig,
+  type ValidationResult,
+  type DownloadableProduct,
+  type DownloadableConfig,
   ProgramType,
 } from "../types";
 
@@ -21,7 +21,7 @@ export const LAZER_PROGRAM_ID = new PublicKey(
 export type LazerConfig = {
   programType: ProgramType.PYTH_LAZER;
   // Make cluster optional since Lazer might not be tied to a specific cluster
-  cluster?: PythCluster;
+  cluster?: PythCluster | undefined;
   // More generic data source instead of Solana-specific accounts
   feeds: LazerFeed[];
   // Additional metadata that might be relevant for Lazer
@@ -148,9 +148,9 @@ export function getDownloadableConfig(config: LazerConfig): DownloadableConfig {
  * @returns Object with validation result and optional error message
  */
 export function validateUploadedConfig(
-  existingConfig: DownloadableConfig,
+  _: DownloadableConfig,
   uploadedConfig: unknown,
-  cluster: PythCluster,
+  __: PythCluster,
 ): ValidationResult {
   // Basic validation logic for Lazer config
   try {
@@ -185,15 +185,15 @@ export function validateUploadedConfig(
  * @returns Promise resolving to an array of TransactionInstructions
  */
 export async function generateInstructions(
-  changes: Record<
+  _: Record<
     string,
     {
       prev?: Partial<DownloadableProduct>;
       new?: Partial<DownloadableProduct>;
     }
   >,
-  cluster: PythCluster,
-  accounts: LazerInstructionAccounts,
+  __: PythCluster,
+  ___: LazerInstructionAccounts,
 ): Promise<TransactionInstruction[]> {
   // Simple placeholder implementation that returns an empty array of instructions
   // In a real implementation, this would transform the changes into Lazer-specific instructions

+ 12 - 9
governance/xc_admin/packages/xc_admin_common/src/programs/program_registry.ts

@@ -1,22 +1,25 @@
-import { AccountInfo, PublicKey } from "@solana/web3.js";
-import { getPythProgramKeyForCluster, PythCluster } from "@pythnetwork/client";
+import { PublicKey } from "@solana/web3.js";
 import {
-  DownloadableConfig,
+  getPythProgramKeyForCluster,
+  type PythCluster,
+} from "@pythnetwork/client";
+import {
+  type DownloadableConfig,
   ProgramType,
-  ProgramConfig,
-  ValidationResult,
-  RawConfig,
+  type ProgramConfig,
+  type ValidationResult,
+  type RawConfig,
 } from "./types";
 
 // Import functions from each program implementation
 import * as pythCore from "./core/core_functions";
 import * as pythLazer from "./lazer/lazer_functions";
 import {
-  LazerConfig,
+  type LazerConfig,
   LAZER_PROGRAM_ID,
-  LazerConfigParams,
+  type LazerConfigParams,
 } from "./lazer/lazer_functions";
-import { CoreConfigParams } from "./core/core_functions";
+import type { CoreConfigParams } from "./core/core_functions";
 
 /**
  * Function to get the program address for each program type

+ 6 - 3
governance/xc_admin/packages/xc_admin_common/src/programs/types.ts

@@ -1,7 +1,10 @@
 import { PublicKey } from "@solana/web3.js";
-import { PermissionData, Product } from "@pythnetwork/client";
-import { LazerConfig, LazerInstructionAccounts } from "./lazer/lazer_functions";
-import { CoreInstructionAccounts } from "./core/core_functions";
+import type { PermissionData, Product } from "@pythnetwork/client";
+import type {
+  LazerConfig,
+  LazerInstructionAccounts,
+} from "./lazer/lazer_functions";
+import type { CoreInstructionAccounts } from "./core/core_functions";
 /**
  * Represents the different Pyth programs supported by the application.
  */

+ 16 - 15
governance/xc_admin/packages/xc_admin_common/src/propose.ts

@@ -1,37 +1,38 @@
 import {
-  PublicKey,
-  Transaction,
-  TransactionInstruction,
+  SystemProgram,
   SYSVAR_RENT_PUBKEY,
+  type PublicKey,
+  type Transaction,
+  type TransactionInstruction,
   SYSVAR_CLOCK_PUBKEY,
-  SystemProgram,
-  ConfirmOptions,
+  type ConfirmOptions,
 } from "@solana/web3.js";
 import { BN } from "bn.js";
 import { AnchorProvider } from "@coral-xyz/anchor";
 import {
   createWormholeProgramInterface,
-  deriveWormholeBridgeDataKey,
   deriveEmitterSequenceKey,
   deriveFeeCollectorKey,
+  deriveWormholeBridgeDataKey,
 } from "@certusone/wormhole-sdk/lib/cjs/solana/wormhole";
 import { ExecutePostedVaa } from "./governance_payload/ExecutePostedVaa";
 import { getOpsKey } from "./multisig";
-import { PythCluster } from "@pythnetwork/client/lib/cluster";
-import { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
-import SquadsMesh, { getIxAuthorityPDA, getTxPDA } from "@sqds/mesh";
-import { MultisigAccount } from "@sqds/mesh/lib/types";
+import type { PythCluster } from "@pythnetwork/client/lib/cluster";
+import type { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
+import { getIxAuthorityPDA, getTxPDA } from "@sqds/mesh";
+import type { MultisigAccount } from "@sqds/mesh/lib/types";
 import { mapKey } from "./remote_executor";
 import { WORMHOLE_ADDRESS } from "./wormhole";
 import {
-  TransactionBuilder,
   sendTransactions,
+  TransactionBuilder,
 } from "@pythnetwork/solana-utils";
 import {
   PACKET_DATA_SIZE_WITH_ROOM_FOR_COMPUTE_BUDGET,
-  PriorityFeeConfig,
+  type PriorityFeeConfig,
 } from "@pythnetwork/solana-utils";
-import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
+import type NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
+import type SquadsMesh from "@sqds/mesh";
 
 export const MAX_EXECUTOR_PAYLOAD_SIZE =
   PACKET_DATA_SIZE_WITH_ROOM_FOR_COMPUTE_BUDGET - 687; // Bigger payloads won't fit in one addInstruction call when adding to the proposal
@@ -252,7 +253,7 @@ export class MultisigVault {
         proposalAddress,
         1 + i,
         this.wormholeAddress()!,
-        payloads[i],
+        payloads[i]!,
         messagePayer,
       );
       ixToSend.push(
@@ -435,7 +436,7 @@ export function batchIntoExecutorPayload(
     }
     const batch: TransactionInstruction[] = [];
     for (let k = i; k < j - 1; k += 1) {
-      batch.push(instructions[k]);
+      batch.push(instructions[k]!);
     }
     i = j - 1;
     batches.push(batch);

+ 1 - 1
governance/xc_admin/packages/xc_admin_common/src/wormhole.ts

@@ -1,4 +1,4 @@
-import { PythCluster } from "@pythnetwork/client/lib/cluster";
+import { type PythCluster } from "@pythnetwork/client/lib/cluster";
 import { PublicKey } from "@solana/web3.js";
 
 export const WORMHOLE_ADDRESS: Record<PythCluster, PublicKey | undefined> = {

+ 5 - 1
governance/xc_admin/packages/xc_admin_common/tsconfig.json

@@ -1,5 +1,9 @@
 {
   "extends": "@cprussin/tsconfig/base.json",
   "include": ["src"],
-  "exclude": ["dist", "node_modules", "**/__tests__/*"]
+  "compilerOptions": {
+    "module": "preserve",
+    "moduleResolution": "node"
+  },
+  "exclude": ["dist", "node_modules"]
 }