Ver código fonte

Merge pull request #2478 from pyth-network/cprussin/move-prettier-to-turbo

chore: move all prettier formatting into individual packages
Connor Prussin 8 meses atrás
pai
commit
df1ca64174
100 arquivos alterados com 965 adições e 1026 exclusões
  1. 7 5
      .github/workflows/ci-message-buffer.yml
  2. 0 71
      .github/workflows/ci-pre-commit.yml
  3. 1 1
      .github/workflows/ci-turbo-test.yml
  4. 5 10
      .pre-commit-config.yaml
  5. 34 20
      .prettierignore
  6. 6 7
      README.md
  7. 1 1
      apps/api-reference/package.json
  8. 0 16
      apps/api-reference/turbo.json
  9. 0 19
      apps/entropy-debugger/turbo.json
  10. 4 3
      apps/hermes/client/js/README.md
  11. 4 2
      apps/hermes/client/js/package.json
  12. 11 11
      apps/hermes/client/js/src/HermesClient.ts
  13. 2 2
      apps/hermes/client/js/src/examples/HermesClient.ts
  14. 1 1
      apps/hermes/client/js/src/utils.ts
  15. 4 3
      apps/hermes/client/js/turbo.json
  16. 11 21
      apps/insights/turbo.json
  17. 4 2
      apps/price_pusher/package.json
  18. 16 16
      apps/price_pusher/src/aptos/aptos.ts
  19. 6 6
      apps/price_pusher/src/aptos/command.ts
  20. 3 3
      apps/price_pusher/src/controller.ts
  21. 7 7
      apps/price_pusher/src/evm/command.ts
  22. 2 2
      apps/price_pusher/src/evm/custom-gas-station.ts
  23. 34 34
      apps/price_pusher/src/evm/evm.ts
  24. 1 1
      apps/price_pusher/src/evm/pyth-contract.ts
  25. 1 1
      apps/price_pusher/src/evm/super-wallet.ts
  26. 5 5
      apps/price_pusher/src/fuel/command.ts
  27. 8 8
      apps/price_pusher/src/fuel/fuel.ts
  28. 5 5
      apps/price_pusher/src/injective/command.ts
  29. 10 10
      apps/price_pusher/src/injective/injective.ts
  30. 5 5
      apps/price_pusher/src/interface.ts
  31. 6 6
      apps/price_pusher/src/near/command.ts
  32. 15 15
      apps/price_pusher/src/near/near.ts
  33. 6 6
      apps/price_pusher/src/price-config.ts
  34. 5 5
      apps/price_pusher/src/pyth-price-listener.ts
  35. 10 10
      apps/price_pusher/src/solana/command.ts
  36. 20 21
      apps/price_pusher/src/solana/solana.ts
  37. 7 7
      apps/price_pusher/src/sui/command.ts
  38. 37 38
      apps/price_pusher/src/sui/sui.ts
  39. 5 5
      apps/price_pusher/src/ton/command.ts
  40. 7 7
      apps/price_pusher/src/ton/ton.ts
  41. 5 5
      apps/price_pusher/src/utils.ts
  42. 1 1
      apps/staking/package.json
  43. 2 14
      apps/staking/turbo.json
  44. 5 3
      contract_manager/package.json
  45. 15 15
      contract_manager/scripts/check_proposal.ts
  46. 24 24
      contract_manager/scripts/common.ts
  47. 3 3
      contract_manager/scripts/deploy_cosmwasm.ts
  48. 2 2
      contract_manager/scripts/deploy_evm_contract.ts
  49. 16 16
      contract_manager/scripts/deploy_evm_entropy_contracts.ts
  50. 10 10
      contract_manager/scripts/deploy_evm_pricefeed_contracts.ts
  51. 13 13
      contract_manager/scripts/deploy_evm_pulse_contracts.ts
  52. 2 2
      contract_manager/scripts/entropy-accept-admin-and-ownership.ts
  53. 3 3
      contract_manager/scripts/entropy_debug_reveal.ts
  54. 4 4
      contract_manager/scripts/execute_vaas.ts
  55. 6 8
      contract_manager/scripts/fetch_account_balance.ts
  56. 2 2
      contract_manager/scripts/fetch_fees.ts
  57. 2 2
      contract_manager/scripts/generate_governance_set_fee_payload.ts
  58. 2 2
      contract_manager/scripts/generate_upgrade_near_contract_proposal.ts
  59. 4 4
      contract_manager/scripts/generate_upgrade_ton_contract_proposal.ts
  60. 3 3
      contract_manager/scripts/get_entropy_registration.ts
  61. 3 3
      contract_manager/scripts/latency_entropy.ts
  62. 5 5
      contract_manager/scripts/latency_entropy_with_callback.ts
  63. 3 3
      contract_manager/scripts/load_test_entropy.ts
  64. 3 3
      contract_manager/scripts/send_message_to_wormhole.ts
  65. 5 5
      contract_manager/scripts/sync_governance_vaas.ts
  66. 1 1
      contract_manager/scripts/sync_wormhole_guardian_set.ts
  67. 6 6
      contract_manager/scripts/update_all_pricefeeds.ts
  68. 6 6
      contract_manager/scripts/update_pricefeed.ts
  69. 6 6
      contract_manager/scripts/upgrade_evm_entropy_contracts.ts
  70. 4 4
      contract_manager/scripts/upgrade_evm_pricefeed_contracts.ts
  71. 3 3
      contract_manager/scripts/upgrade_ton_contract.ts
  72. 2 2
      contract_manager/scripts/upload_cosmwasm.ts
  73. 2 2
      contract_manager/src/base.ts
  74. 45 45
      contract_manager/src/chains.ts
  75. 20 17
      contract_manager/src/contracts/aptos.ts
  76. 18 12
      contract_manager/src/contracts/cosmwasm.ts
  77. 66 48
      contract_manager/src/contracts/evm.ts
  78. 16 10
      contract_manager/src/contracts/fuel.ts
  79. 30 27
      contract_manager/src/contracts/iota.ts
  80. 18 15
      contract_manager/src/contracts/near.ts
  81. 17 11
      contract_manager/src/contracts/starknet.ts
  82. 30 27
      contract_manager/src/contracts/sui.ts
  83. 21 15
      contract_manager/src/contracts/ton.ts
  84. 2 2
      contract_manager/src/contracts/wormhole.ts
  85. 6 6
      contract_manager/src/executor.ts
  86. 25 25
      contract_manager/src/governance.ts
  87. 1 1
      contract_manager/src/shell.ts
  88. 7 7
      contract_manager/src/store.ts
  89. 1 1
      contract_manager/src/token.ts
  90. 3 3
      flake.nix
  91. 1 1
      governance/pyth_staking_sdk/package.json
  92. 2 1
      governance/xc_admin/packages/crank_executor/package.json
  93. 2 2
      governance/xc_admin/packages/crank_executor/src/index.ts
  94. 2 1
      governance/xc_admin/packages/crank_pythnet_relayer/package.json
  95. 19 20
      governance/xc_admin/packages/crank_pythnet_relayer/src/index.ts
  96. 2 1
      governance/xc_admin/packages/proposer_server/package.json
  97. 3 3
      governance/xc_admin/packages/proposer_server/src/index.ts
  98. 3 2
      governance/xc_admin/packages/xc_admin_cli/package.json
  99. 104 108
      governance/xc_admin/packages/xc_admin_cli/src/index.ts
  100. 12 12
      governance/xc_admin/packages/xc_admin_cli/src/ledger.ts

+ 7 - 5
.github/workflows/ci-message-buffer.yml

@@ -38,6 +38,9 @@ jobs:
         run: |
           sudo apt-get install g++-12
           echo "CXX=/usr/bin/g++-12" >> "${GITHUB_ENV}"
+      - uses: actions/setup-node@v4
+        with:
+          node-version-file: "package.json"
       # Libusb is a build requirement for the node-hid package and so pnpm
       # install will fail if this isn't in the build environment and if a
       # precompiled binary isn't found.
@@ -45,15 +48,14 @@ jobs:
         run: sudo apt install -y libusb-1.0-0-dev libudev-dev
       - uses: pnpm/action-setup@v4
         name: Install pnpm
-      - name: Install prettier globally
-        run: pnpm install -g prettier@2.7.1
+        with:
+          run_install: true
       - name: Build and generate IDLs
         run: anchor build
       - name: Copy anchor target files
         run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/
-      - name: Run prettier (to avoid pre-commit failures)
-        run: |
-          pnpm dlx prettier@2.7.1 --write "./idl/*"
+      - name: Fix formatting (to avoid pre-commit failures)
+        run: pnpm turbo --filter message_buffer fix:format
       - name: Check IDL changes
         # Fails if the IDL files are not up to date. Please use anchor build to regenerate the IDL files for
         # the current version of the contract and update idl directory.

+ 0 - 71
.github/workflows/ci-pre-commit.yml

@@ -1,71 +0,0 @@
-name: Pre-commit checks
-
-on:
-  pull_request:
-    branches: "**"
-  push:
-    branches: [main]
-
-env:
-  PYTHON_VERSION: "3.11"
-  POETRY_VERSION: "1.4.2"
-jobs:
-  pre-commit:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4
-      - uses: actions-rs/toolchain@v1
-        with:
-          profile: default
-          toolchain: 1.82.0
-      - name: Install Rust versions
-        run: |
-          rustup install 1.73.0
-          rustup install 1.66.1
-      - name: Cache Rust dependencies
-        uses: Swatinem/rust-cache@v2
-        with:
-          workspaces: |
-            apps/fortuna
-            apps/hermes/server
-            target_chains/ethereum/sdk/stylus
-            target_chains/cosmwasm
-            target_chains/fuel/contracts
-            target_chains/solana
-            governance/remote_executor
-            lazer
-            pythnet/message_buffer
-            pythnet/pythnet_sdk
-            pythnet/stake_caps_parameters
-          # We only save the cache from runs on `main` because the cache is ~5GB, and the total Github Cache limit is 10GB.
-          # Branches have their own caches, so saving this cache on PRs can result in evicting the main cache.
-          save-if: ${{ github.ref == 'refs/heads/main' }}
-      - name: Install protoc
-        uses: arduino/setup-protoc@v3
-        with:
-          repo-token: ${{ secrets.GITHUB_TOKEN }}
-      - name: Install poetry
-        run: pipx install poetry
-      - name: Install g++ 12
-        run: |
-          sudo apt-get install g++-12
-          echo "CXX=/usr/bin/g++-12" >> "${GITHUB_ENV}"
-      - uses: actions/setup-python@v2
-        with:
-          python-version: ${{ env.PYTHON_VERSION }}
-        id: setup_python
-      - name: Cache Poetry cache
-        uses: actions/cache@v3
-        with:
-          path: ~/.cache/pypoetry
-          key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
-      # Install Aptos CLI for Lazer contract formatting and linting
-      - name: Download Aptos CLI
-        run: wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v6.1.1/aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip
-      - name: Install Aptos CLI
-        run: |
-          unzip aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip
-          sudo mv aptos /usr/local/bin/
-          chmod +x /usr/local/bin/aptos
-          aptos update movefmt
-      - uses: pre-commit/action@v3.0.0

+ 1 - 1
.github/workflows/ci-turbo-test.yml

@@ -31,4 +31,4 @@ jobs:
       - name: Cache for Turbo
         uses: rharkor/caching-for-turbo@v1.5
       - name: Test
-        run: pnpm test:ci
+        run: pnpm turbo test

+ 5 - 10
.pre-commit-config.yaml

@@ -23,18 +23,13 @@ repos:
             target_chains/sui/vendor/|
             patches/
           )
-  # Hook to format many type of files in the repo
-  # including solidity contracts.
-  - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: "v2.7.1"
-    hooks:
-      - id: prettier
-        additional_dependencies:
-          - "prettier@2.7.1"
-          - "prettier-plugin-solidity@1.0.0-rc.1"
-        exclude: target_chains/sui/vendor/
   - repo: local
     hooks:
+      - id: turbo-fix
+        name: Run turbo fix on packages changed since the last commit
+        language: system
+        entry: sh -c 'TURBO_SCM_BASE="HEAD^1" pnpm turbo fix --affected'
+        pass_filenames: false
       # Hooks for the remote executor
       - id: cargo-fmt-remote-executor
         name: Cargo format for remote executor

+ 34 - 20
.prettierignore

@@ -1,25 +1,39 @@
 pnpm-lock.yaml
 patches/
 .turbo/
+target_chains/sui/vendor/
 
-# These apps have their own prettier config that uses a later version of
-# prettier
-#
-# TODO(cprussin): eventually I'll figure out how to upgrade prettier everywhere
-# and hook it in to pre-commit.  For now, I don't want to downgrade prettier in
-# the packages that are using the later version, and pre-commit doesn't support
-# later versions of prettier directly.
-#
-# Ideally, we should probably hook up a pre-commit script to run auto-fixes in a
-# generic way that packages can hook into by defining lifecycle scripts, or by
-# using the nx task graph.  Then, packages can use their own formatters /
-# formatter versions and can also hook up other auto-fixes like eslint, etc.
-#
-# I'll explore doing this when I get around to spending some time on our nx
-# build graph config.
-apps/api-reference
-apps/staking
-apps/insights
-apps/entropy-debugger
-governance/pyth_staking_sdk
+# This should stay in sync with the list of workspaces from
+# `pnpm-workspace.yaml`
+apps/*
 packages/*
+apps/hermes/client/js
+governance/xc_admin/packages/*
+governance/pyth_staking_sdk
+price_service/sdk/js
+price_service/client/js
+pythnet/message_buffer
+target_chains/aptos/cli
+target_chains/aptos/sdk/js
+target_chains/cosmwasm/tools
+target_chains/cosmwasm/deploy-scripts
+target_chains/ethereum/contracts
+target_chains/ethereum/abi_generator
+target_chains/ethereum/entropy_sdk/solidity
+target_chains/ethereum/sdk/js
+target_chains/ethereum/sdk/solidity
+target_chains/ethereum/sdk/stylus/pyth-mock-solidity
+target_chains/ethereum/examples/coin_flip/app
+target_chains/fuel/sdk/js
+target_chains/starknet/sdk/js
+target_chains/sui/sdk/js
+target_chains/sui/sdk/js-iota
+target_chains/sui/cli
+target_chains/sui/cli-iota
+target_chains/solana/sdk/js/solana_utils
+target_chains/solana/sdk/js/pyth_solana_receiver
+target_chains/ton/contracts
+target_chains/ton/sdk/js
+contract_manager
+lazer/contracts/solana
+lazer/sdk/js

+ 6 - 7
README.md

@@ -98,7 +98,6 @@ If you don't use nix at all, then install the required system packages:
   `package.json`; you can experiment with
   [corepack](https://nodejs.org/api/corepack.html) to manage your pnpm version
   for you.
-- [turbo](https://turbo.build/repo/docs/getting-started/installation)
 
 #### Common tasks
 
@@ -109,13 +108,13 @@ and will only re-run as necessary. For any of the following tasks, you can pass
 [any valid `turbo run` option](https://turbo.build/repo/docs/reference/run)
 after `--`, for instance you could run `pnpm test -- --concurrency 2`.
 
-- `pnpm test`: Run all unit tests, integration tests, linting, and format
+- `pnpm turbo test`: Run all unit tests, integration tests, linting, and format
   checks, as well as whatever other code checks any packages support.
-- `pnpm fix`: Run auto fixes, including reformatting code and auto-fixing lint
-  rules where possible.
-- `pnpm start:dev`: Start all development servers in parallel.
-- `pnpm start:prod`: Run production builds and start production mode servers in
-  parallel.
+- `pnpm turbo fix`: Run auto fixes, including reformatting code and auto-fixing
+  lint rules where possible.
+- `pnpm turbo start:dev`: Start all development servers in parallel.
+- `pnpm turbo start:prod`: Run production builds and start production mode
+  servers in parallel.
 
 #### Building a new package
 

+ 1 - 1
apps/api-reference/package.json

@@ -60,7 +60,7 @@
     "eslint": "^9.5.0",
     "jest": "^29.7.0",
     "postcss": "^8.4.38",
-    "prettier": "^3.3.2",
+    "prettier": "catalog:",
     "tailwindcss": "^3.4.4",
     "typescript": "^5.5.2",
     "vercel": "^34.2.7"

+ 0 - 16
apps/api-reference/turbo.json

@@ -3,27 +3,11 @@
   "extends": ["//"],
   "tasks": {
     "build": {
-      "dependsOn": ["pull:env", "^build"],
-      "outputs": [".next/**", "!.next/cache/**"],
       "env": [
         "WALLETCONNECT_PROJECT_ID",
         "AMPLITUDE_API_KEY",
         "GOOGLE_ANALYTICS_ID"
       ]
-    },
-    "pull:env": {
-      "outputs": [".env.local"],
-      "cache": false
-    },
-    "start:dev": {
-      "dependsOn": ["pull:env"],
-      "persistent": true,
-      "cache": false
-    },
-    "start:prod": {
-      "dependsOn": ["build"],
-      "persistent": true,
-      "cache": false
     }
   }
 }

+ 0 - 19
apps/entropy-debugger/turbo.json

@@ -1,19 +0,0 @@
-{
-  "$schema": "https://turbo.build/schema.json",
-  "extends": ["//"],
-  "tasks": {
-    "build": {
-      "dependsOn": ["^build"],
-      "outputs": [".next/**", "!.next/cache/**"]
-    },
-    "start:dev": {
-      "persistent": true,
-      "cache": false
-    },
-    "start:prod": {
-      "dependsOn": ["build"],
-      "persistent": true,
-      "cache": false
-    }
-  }
-}

+ 4 - 3
apps/hermes/client/js/README.md

@@ -76,11 +76,12 @@ The [HermesClient](./src/examples/HermesClient.ts) example demonstrates both the
 examples above. To run the example:
 
 1. Clone [the Pyth monorepo](https://github.com/pyth-network/pyth-crosschain)
-2. In the root of the monorepo, run `pnpm example:hermes-client -- <args>`. For
-   example, to print BTC and ETH price feeds in the testnet network, run:
+2. In the root of the monorepo, run `pnpm turbo --filter
+   @pythnetwork/hermes-client example -- <args>`. For example, to print BTC and
+   ETH price feeds in the testnet network, run:
 
 ```bash
-pnpm example:hermes-client -- \
+pnpm turbo --filter @pythnetwork/hermes-client example -- \
   --endpoint https://hermes.pyth.network \
   --price-ids \
     0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43 \

+ 4 - 2
apps/hermes/client/js/package.json

@@ -24,8 +24,10 @@
     "build:schemas": "openapi-zod-client ./schema.json --output src/zodSchemas.ts",
     "pull:schema": "curl -o schema.json -z schema.json https://hermes.pyth.network/docs/openapi.json",
     "example": "node lib/examples/HermesClient.js",
-    "format": "prettier --write \"src/**/*.ts\"",
+    "fix:lint": "eslint src/ --fix --max-warnings 0",
+    "fix:format": "prettier --write \"src/**/*.ts\"",
     "test:lint": "eslint src/ --max-warnings 0",
+    "test:format": "prettier --check \"src/**/*.ts\"",
     "prepublishOnly": "pnpm run build:typescript && pnpm run test:lint",
     "preversion": "pnpm run test:lint",
     "version": "pnpm run format && git add -A src"
@@ -44,7 +46,7 @@
     "eslint": "^8.14.0",
     "jest": "^29.4.0",
     "openapi-zod-client": "^1.18.1",
-    "prettier": "^2.6.2",
+    "prettier": "catalog:",
     "ts-jest": "^29.0.5",
     "typescript": "catalog:",
     "yargs": "^17.4.1"

+ 11 - 11
apps/hermes/client/js/src/HermesClient.ts

@@ -63,7 +63,7 @@ export class HermesClient {
     schema: z.ZodSchema<ResponseData>,
     options?: RequestInit,
     retries = this.httpRetries,
-    backoff = 100 + Math.floor(Math.random() * 100) // Adding randomness to the initial backoff to avoid "thundering herd" scenario where a lot of clients that get kicked off all at the same time (say some script or something) and fail to connect all retry at exactly the same time too
+    backoff = 100 + Math.floor(Math.random() * 100), // Adding randomness to the initial backoff to avoid "thundering herd" scenario where a lot of clients that get kicked off all at the same time (say some script or something) and fail to connect all retry at exactly the same time too
   ): Promise<ResponseData> {
     try {
       const response = await fetch(url, {
@@ -79,7 +79,7 @@ export class HermesClient {
         throw new Error(
           `HTTP error! status: ${response.status}${
             errorBody ? `, body: ${errorBody}` : ""
-          }`
+          }`,
         );
       }
       const data = await response.json();
@@ -124,7 +124,7 @@ export class HermesClient {
     return await this.httpRequest(
       url.toString(),
       schemas.PriceFeedMetadata.array(),
-      fetchOptions
+      fetchOptions,
     );
   }
 
@@ -154,7 +154,7 @@ export class HermesClient {
     return await this.httpRequest(
       url.toString(),
       schemas.LatestPublisherStakeCapsUpdateDataResponse,
-      fetchOptions
+      fetchOptions,
     );
   }
 
@@ -178,7 +178,7 @@ export class HermesClient {
       parsed?: boolean;
       ignoreInvalidPriceIds?: boolean;
     },
-    fetchOptions?: RequestInit
+    fetchOptions?: RequestInit,
   ): Promise<PriceUpdate> {
     const url = this.buildURL("updates/price/latest");
     for (const id of ids) {
@@ -215,7 +215,7 @@ export class HermesClient {
       parsed?: boolean;
       ignoreInvalidPriceIds?: boolean;
     },
-    fetchOptions?: RequestInit
+    fetchOptions?: RequestInit,
   ): Promise<PriceUpdate> {
     const url = this.buildURL(`updates/price/${publishTime}`);
     for (const id of ids) {
@@ -255,7 +255,7 @@ export class HermesClient {
       allowUnordered?: boolean;
       benchmarksOnly?: boolean;
       ignoreInvalidPriceIds?: boolean;
-    }
+    },
   ): Promise<EventSource> {
     const url = this.buildURL("updates/price/stream");
     ids.forEach((id) => {
@@ -302,7 +302,7 @@ export class HermesClient {
       parsed?: boolean;
       ignoreInvalidPriceIds?: boolean;
     },
-    fetchOptions?: RequestInit
+    fetchOptions?: RequestInit,
   ): Promise<TwapsResponse> {
     const url = this.buildURL(`updates/twap/${window_seconds}/latest`);
     for (const id of ids) {
@@ -317,13 +317,13 @@ export class HermesClient {
     return this.httpRequest(
       url.toString(),
       schemas.TwapsResponse,
-      fetchOptions
+      fetchOptions,
     );
   }
 
   private appendUrlSearchParams(
     url: URL,
-    params: Record<string, string | boolean>
+    params: Record<string, string | boolean>,
   ) {
     Object.entries(params).forEach(([key, value]) => {
       if (value !== undefined) {
@@ -337,7 +337,7 @@ export class HermesClient {
       `./v2/${endpoint}`,
       // We ensure the `baseURL` ends with a `/` so that URL doesn't resolve the
       // path relative to the parent.
-      `${this.baseURL}${this.baseURL.endsWith("/") ? "" : "/"}`
+      `${this.baseURL}${this.baseURL.endsWith("/") ? "" : "/"}`,
     );
   }
 }

+ 2 - 2
apps/hermes/client/js/src/examples/HermesClient.ts

@@ -43,7 +43,7 @@ function extractBasicAuthorizationHeadersFromUrl(urlString: string): {
 
   if (url.username && url.password) {
     headers["Authorization"] = `Basic ${btoa(
-      `${url.username}:${url.password}`
+      `${url.username}:${url.password}`,
     )}`;
     url.username = "";
     url.password = "";
@@ -54,7 +54,7 @@ function extractBasicAuthorizationHeadersFromUrl(urlString: string): {
 
 async function run() {
   const { endpoint, headers } = extractBasicAuthorizationHeadersFromUrl(
-    argv.endpoint
+    argv.endpoint,
   );
   const connection = new HermesClient(endpoint, { headers });
 

+ 1 - 1
apps/hermes/client/js/src/utils.ts

@@ -3,7 +3,7 @@ function camelToSnakeCase(str: string): string {
 }
 
 export function camelToSnakeCaseObject(
-  obj: Record<string, string | boolean>
+  obj: Record<string, string | boolean>,
 ): Record<string, string | boolean> {
   const result: Record<string, string | boolean> = {};
   Object.keys(obj).forEach((key) => {

+ 4 - 3
apps/hermes/client/js/turbo.json

@@ -3,22 +3,23 @@
   "extends": ["//"],
   "tasks": {
     "build:schemas": {
-      "dependsOn": ["pull:schema"],
+      "dependsOn": ["//#install:modules", "pull:schema"],
       "inputs": ["schema.json"],
       "outputs": ["src/zodSchemas.ts"]
     },
     "build:typescript": {
-      "dependsOn": ["build:schemas", "^build"],
+      "dependsOn": ["//#install:modules", "build:schemas", "^build"],
       "outputs": ["lib/**"]
     },
     "build": {
       "dependsOn": ["build:typescript", "build:schemas"]
     },
     "example": {
-      "dependsOn": ["build"],
+      "dependsOn": ["//#install:modules", "build"],
       "cache": false
     },
     "pull:schema": {
+      "dependsOn": ["//#install:modules"],
       "outputs": ["schema.json"],
       "cache": false
     }

+ 11 - 21
apps/insights/turbo.json

@@ -3,8 +3,6 @@
   "extends": ["//"],
   "tasks": {
     "build": {
-      "dependsOn": ["pull:env", "^build"],
-      "outputs": [".next/**", "!.next/cache/**"],
       "env": [
         "VERCEL_ENV",
         "GOOGLE_ANALYTICS_ID",
@@ -17,36 +15,28 @@
       ]
     },
     "fix:lint": {
-      "dependsOn": ["fix:lint:eslint", "fix:lint:stylelint"],
-      "cache": false
+      "dependsOn": [
+        "//#install:modules",
+        "fix:lint:eslint",
+        "fix:lint:stylelint"
+      ]
     },
     "fix:lint:eslint": {
-      "dependsOn": ["^build"],
+      "dependsOn": ["//#install:modules", "^build"],
       "cache": false
     },
     "fix:lint:stylelint": {
-      "cache": false
-    },
-    "pull:env": {
-      "outputs": [".env.local"],
-      "cache": false
-    },
-    "start:dev": {
-      "dependsOn": ["pull:env"],
-      "persistent": true,
-      "cache": false
-    },
-    "start:prod": {
-      "dependsOn": ["build"],
-      "persistent": true,
+      "dependsOn": ["//#install:modules"],
       "cache": false
     },
     "test:lint": {
       "dependsOn": ["test:lint:eslint", "test:lint:stylelint"]
     },
     "test:lint:eslint": {
-      "dependsOn": ["^build"]
+      "dependsOn": ["//#install:modules", "^build"]
     },
-    "test:lint:stylelint": {}
+    "test:lint:stylelint": {
+      "dependsOn": ["//#install:modules"]
+    }
   }
 }

+ 4 - 2
apps/price_pusher/package.json

@@ -21,7 +21,9 @@
   },
   "scripts": {
     "build": "tsc",
-    "format": "prettier --write \"src/**/*.ts\"",
+    "fix:format": "prettier --write \"src/**/*.ts\"",
+    "fix:lint": "eslint src/ --fix --max-warnings 0",
+    "test:format": "prettier --check \"src/**/*.ts\"",
     "test:lint": "eslint src/ --max-warnings 0",
     "start": "node lib/index.js",
     "dev": "ts-node src/index.ts",
@@ -50,7 +52,7 @@
     "eslint": "^8.13.0",
     "jest": "^29.7.0",
     "pino-pretty": "^11.2.1",
-    "prettier": "^2.6.2",
+    "prettier": "catalog:",
     "ts-jest": "^29.1.1",
     "ts-node": "^10.9.1",
     "typescript": "^5.3.3"

+ 16 - 16
apps/price_pusher/src/aptos/aptos.ts

@@ -17,7 +17,7 @@ export class AptosPriceListener extends ChainPriceListener {
     private logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
   }
@@ -27,7 +27,7 @@ export class AptosPriceListener extends ChainPriceListener {
 
     const res = await client.getAccountResource(
       this.pythModule,
-      `${this.pythModule}::state::LatestPriceInfo`
+      `${this.pythModule}::state::LatestPriceInfo`,
     );
 
     try {
@@ -50,8 +50,8 @@ export class AptosPriceListener extends ChainPriceListener {
 
       this.logger.debug(
         `Polled an Aptos on-chain price for feed ${this.priceIdToAlias.get(
-          priceId
-        )} (${priceId}).`
+          priceId,
+        )} (${priceId}).`,
       );
 
       return {
@@ -62,7 +62,7 @@ export class AptosPriceListener extends ChainPriceListener {
     } catch (err) {
       this.logger.error(
         err,
-        `Polling Aptos on-chain price for ${priceId} failed.`
+        `Polling Aptos on-chain price for ${priceId} failed.`,
       );
       return undefined;
     }
@@ -94,7 +94,7 @@ export class AptosPricePusher implements IPricePusher {
     private pythContractAddress: string,
     private endpoint: string,
     private mnemonic: string,
-    private overrideGasPriceMultiplier: number
+    private overrideGasPriceMultiplier: number,
   ) {
     this.sequenceNumberLocked = false;
   }
@@ -111,13 +111,13 @@ export class AptosPricePusher implements IPricePusher {
       encoding: "base64",
     });
     return response.binary.data.map((data) =>
-      Array.from(Buffer.from(data, "base64"))
+      Array.from(Buffer.from(data, "base64")),
     );
   }
 
   async updatePriceFeed(
     priceIds: string[],
-    pubTimesToPush: number[]
+    pubTimesToPush: number[],
   ): Promise<void> {
     if (priceIds.length === 0) {
       return;
@@ -137,7 +137,7 @@ export class AptosPricePusher implements IPricePusher {
 
     const account = AptosAccount.fromDerivePath(
       APTOS_ACCOUNT_HD_PATH,
-      this.mnemonic
+      this.mnemonic,
     );
     const client = new AptosClient(this.endpoint);
 
@@ -151,7 +151,7 @@ export class AptosPricePusher implements IPricePusher {
       },
       {
         sequence_number: sequenceNumber.toFixed(),
-      }
+      },
     );
 
     try {
@@ -160,7 +160,7 @@ export class AptosPricePusher implements IPricePusher {
 
       this.logger.debug(
         { hash: pendingTx.hash },
-        "Successfully broadcasted tx."
+        "Successfully broadcasted tx.",
       );
 
       // Sometimes broadcasted txs don't make it on-chain and they cause our sequence number
@@ -183,7 +183,7 @@ export class AptosPricePusher implements IPricePusher {
   // Wait for the transaction to be confirmed. If it fails, reset the sequence number.
   private async waitForTransactionConfirmation(
     client: AptosClient,
-    txHash: string
+    txHash: string,
   ): Promise<void> {
     try {
       await client.waitForTransaction(txHash, {
@@ -195,7 +195,7 @@ export class AptosPricePusher implements IPricePusher {
     } catch (err) {
       this.logger.error(
         { err, hash: txHash },
-        `Transaction failed to confirm.`
+        `Transaction failed to confirm.`,
       );
 
       this.lastSequenceNumber = undefined;
@@ -207,7 +207,7 @@ export class AptosPricePusher implements IPricePusher {
   // the blockchain itself (and caches it for later).
   private async tryGetNextSequenceNumber(
     client: AptosClient,
-    account: AptosAccount
+    account: AptosAccount,
   ): Promise<number> {
     if (this.lastSequenceNumber !== undefined) {
       this.lastSequenceNumber += 1;
@@ -220,10 +220,10 @@ export class AptosPricePusher implements IPricePusher {
         try {
           this.sequenceNumberLocked = true;
           this.lastSequenceNumber = Number(
-            (await client.getAccount(account.address())).sequence_number
+            (await client.getAccount(account.address())).sequence_number,
           );
           this.logger.debug(
-            `Fetched account sequence number: ${this.lastSequenceNumber}`
+            `Fetched account sequence number: ${this.lastSequenceNumber}`,
           );
           return this.lastSequenceNumber;
         } catch (e: any) {

+ 6 - 6
apps/price_pusher/src/aptos/command.ts

@@ -64,7 +64,7 @@ export default {
     const mnemonic = fs.readFileSync(mnemonicFile, "utf-8").trim();
     const account = AptosAccount.fromDerivePath(
       APTOS_ACCOUNT_HD_PATH,
-      mnemonic
+      mnemonic,
     );
     logger.info(`Pushing from account address: ${account.address()}`);
 
@@ -78,7 +78,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -87,7 +87,7 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger.child({ module: "PythPriceListener" })
+      logger.child({ module: "PythPriceListener" }),
     );
 
     const aptosListener = new AptosPriceListener(
@@ -95,7 +95,7 @@ export default {
       endpoint,
       priceItems,
       logger.child({ module: "AptosPriceListener" }),
-      { pollingFrequency }
+      { pollingFrequency },
     );
 
     const aptosPusher = new AptosPricePusher(
@@ -104,7 +104,7 @@ export default {
       pythContractAddress,
       endpoint,
       mnemonic,
-      overrideGasPriceMultiplier
+      overrideGasPriceMultiplier,
     );
 
     const controller = new Controller(
@@ -113,7 +113,7 @@ export default {
       aptosListener,
       aptosPusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     controller.start();

+ 3 - 3
apps/price_pusher/src/controller.ts

@@ -14,7 +14,7 @@ export class Controller {
     private logger: Logger,
     config: {
       pushingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     this.pushingFrequency = config.pushingFrequency;
   }
@@ -48,7 +48,7 @@ export class Controller {
           priceConfig,
           sourceLatestPrice,
           targetLatestPrice,
-          this.logger
+          this.logger,
         );
         if (priceShouldUpdate == UpdateCondition.YES) {
           pushThresholdMet = true;
@@ -70,7 +70,7 @@ export class Controller {
               alias: priceConfig.alias,
             })),
           },
-          "Some of the checks triggered pushing update. Will push the updates for some feeds."
+          "Some of the checks triggered pushing update. Will push the updates for some feeds.",
         );
 
         // note that the priceIds are without leading "0x"

+ 7 - 7
apps/price_pusher/src/evm/command.ts

@@ -125,7 +125,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -134,14 +134,14 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger.child({ module: "PythPriceListener" })
+      logger.child({ module: "PythPriceListener" }),
     );
 
     const client = await createClient(endpoint, mnemonic);
     const pythContract = createPythContract(client, pythContractAddress);
 
     logger.info(
-      `Pushing updates from wallet address: ${client.account.address}`
+      `Pushing updates from wallet address: ${client.account.address}`,
     );
 
     // It is possible to watch the events in the non-ws endpoints, either by getFilter
@@ -156,13 +156,13 @@ export default {
       logger.child({ module: "EvmPriceListener" }),
       {
         pollingFrequency,
-      }
+      },
     );
 
     const gasStation = getCustomGasStation(
       logger.child({ module: "CustomGasStation" }),
       customGasStation,
-      txSpeed
+      txSpeed,
     );
     const evmPusher = new EvmPricePusher(
       hermesClient,
@@ -174,7 +174,7 @@ export default {
       updateFeeMultiplier,
       gasLimit,
       gasStation,
-      gasPrice
+      gasPrice,
     );
 
     const controller = new Controller(
@@ -183,7 +183,7 @@ export default {
       evmListener,
       evmPusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     controller.start();

+ 2 - 2
apps/price_pusher/src/evm/custom-gas-station.ts

@@ -36,7 +36,7 @@ export class CustomGasStation {
     } catch (err) {
       this.logger.error(
         err,
-        "Failed to fetch gas price from Matic mainnet. Returning undefined"
+        "Failed to fetch gas price from Matic mainnet. Returning undefined",
       );
       return undefined;
     }
@@ -46,7 +46,7 @@ export class CustomGasStation {
 export function getCustomGasStation(
   logger: Logger,
   customGasStation?: number,
-  txSpeed?: string
+  txSpeed?: string,
 ) {
   if (customGasStation && txSpeed) {
     return new CustomGasStation(logger, customGasStation, txSpeed);

+ 34 - 34
apps/price_pusher/src/evm/evm.ts

@@ -41,7 +41,7 @@ export class EvmPriceListener extends ChainPriceListener {
     private logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
 
@@ -58,7 +58,7 @@ export class EvmPriceListener extends ChainPriceListener {
     } else {
       this.logger.info(
         "The target network RPC endpoint is not Websocket. " +
-          "Listening for updates only via polling...."
+          "Listening for updates only via polling....",
       );
     }
 
@@ -69,12 +69,12 @@ export class EvmPriceListener extends ChainPriceListener {
   private async startWatching() {
     this.pythContract.watchEvent.PriceFeedUpdate(
       { id: this.priceItems.map((item) => addLeading0x(item.id)) },
-      { strict: true, onLogs: this.onPriceFeedUpdate.bind(this) }
+      { strict: true, onLogs: this.onPriceFeedUpdate.bind(this) },
     );
   }
 
   private onPriceFeedUpdate(
-    logs: WatchContractEventOnLogsParameter<typeof PythAbi, "PriceFeedUpdate">
+    logs: WatchContractEventOnLogsParameter<typeof PythAbi, "PriceFeedUpdate">,
   ) {
     for (const log of logs) {
       const priceId = removeLeading0x(assertDefined(log.args.id));
@@ -88,8 +88,8 @@ export class EvmPriceListener extends ChainPriceListener {
       this.logger.debug(
         { priceInfo },
         `Received a new Evm PriceFeedUpdate event for price feed ${this.priceIdToAlias.get(
-          priceId
-        )} (${priceId}).`
+          priceId,
+        )} (${priceId}).`,
       );
 
       this.updateLatestPriceInfo(priceId, priceInfo);
@@ -97,7 +97,7 @@ export class EvmPriceListener extends ChainPriceListener {
   }
 
   async getOnChainPriceInfo(
-    priceId: HexString
+    priceId: HexString,
   ): Promise<PriceInfo | undefined> {
     let priceRaw: any;
     try {
@@ -111,8 +111,8 @@ export class EvmPriceListener extends ChainPriceListener {
 
     this.logger.debug(
       `Polled an EVM on chain price for feed ${this.priceIdToAlias.get(
-        priceId
-      )} (${priceId}).`
+        priceId,
+      )} (${priceId}).`,
     );
 
     return {
@@ -137,7 +137,7 @@ export class EvmPricePusher implements IPricePusher {
     private updateFeeMultiplier: number,
     private gasLimit?: number,
     private customGasStation?: CustomGasStation,
-    private gasPrice?: number
+    private gasPrice?: number,
   ) {}
 
   // The pubTimes are passed here to use the values that triggered the push.
@@ -148,7 +148,7 @@ export class EvmPricePusher implements IPricePusher {
   // is not landed yet.
   async updatePriceFeed(
     priceIds: string[],
-    pubTimesToPush: UnixTimestamp[]
+    pubTimesToPush: UnixTimestamp[],
   ): Promise<void> {
     if (priceIds.length === 0) {
       return;
@@ -158,11 +158,11 @@ export class EvmPricePusher implements IPricePusher {
       throw new Error("Invalid arguments");
 
     const priceFeedUpdateData = (await this.getPriceFeedsUpdateData(
-      priceIds
+      priceIds,
     )) as `0x${string}`[];
 
     const priceFeedUpdateDataWith0x = priceFeedUpdateData.map((data) =>
-      addLeading0x(data)
+      addLeading0x(data),
     );
 
     let updateFee;
@@ -172,13 +172,13 @@ export class EvmPricePusher implements IPricePusher {
         priceFeedUpdateDataWith0x,
       ]);
       updateFee = BigInt(
-        Math.round(Number(updateFee) * (this.updateFeeMultiplier || 1))
+        Math.round(Number(updateFee) * (this.updateFeeMultiplier || 1)),
       );
       this.logger.debug(`Update fee: ${updateFee}`);
     } catch (e: any) {
       this.logger.error(
         e,
-        "An unidentified error has occured when getting the update fee."
+        "An unidentified error has occured when getting the update fee.",
       );
       throw e;
     }
@@ -191,7 +191,7 @@ export class EvmPricePusher implements IPricePusher {
       this.gasPrice ??
       Number(
         await (this.customGasStation?.getCustomGasPrice() ??
-          this.client.getGasPrice())
+          this.client.getGasPrice()),
       );
 
     // Try to re-use the same nonce and increase the gas if the last tx is not landed yet.
@@ -221,7 +221,7 @@ export class EvmPricePusher implements IPricePusher {
     ) {
       gasPrice = Math.min(
         gasPriceToOverride,
-        gasPrice * this.overrideGasPriceMultiplierCap
+        gasPrice * this.overrideGasPriceMultiplierCap,
       );
     }
 
@@ -230,7 +230,7 @@ export class EvmPricePusher implements IPricePusher {
     this.logger.debug(`Using gas price: ${gasPrice} and nonce: ${txNonce}`);
 
     const pubTimesToPushParam = pubTimesToPush.map((pubTime) =>
-      BigInt(pubTime)
+      BigInt(pubTime),
     );
 
     const priceIdsWith0x = priceIds.map((priceId) => addLeading0x(priceId));
@@ -247,7 +247,7 @@ export class EvmPricePusher implements IPricePusher {
               this.gasLimit !== undefined
                 ? BigInt(Math.ceil(this.gasLimit))
                 : undefined,
-          }
+          },
         );
 
       this.logger.debug({ request }, "Simulated request successfully");
@@ -265,11 +265,11 @@ export class EvmPricePusher implements IPricePusher {
           err.walk(
             (e) =>
               e instanceof ContractFunctionRevertedError &&
-              e.data?.errorName === "NoFreshUpdate"
+              e.data?.errorName === "NoFreshUpdate",
           )
         ) {
           this.logger.info(
-            "Simulation reverted because none of the updates are fresh. This is an expected behaviour to save gas. Skipping this push."
+            "Simulation reverted because none of the updates are fresh. This is an expected behaviour to save gas. Skipping this push.",
           );
           return;
         }
@@ -278,7 +278,7 @@ export class EvmPricePusher implements IPricePusher {
           this.logger.error(
             { err },
             "Wallet doesn't have enough balance. In rare cases, there might be issues with gas price " +
-              "calculation in the RPC."
+              "calculation in the RPC.",
           );
           throw err;
         }
@@ -288,14 +288,14 @@ export class EvmPricePusher implements IPricePusher {
           err.walk(
             (e) =>
               e instanceof InternalRpcError &&
-              e.details.includes("replacement transaction underpriced")
+              e.details.includes("replacement transaction underpriced"),
           )
         ) {
           this.logger.warn(
             "The gas price of the transaction is too low or there is an existing transaction with higher gas with the same nonce. " +
               "The price will be increased in the next push. Skipping this push. " +
               "If this keeps happening or transactions are not landing you need to increase the override gas price " +
-              "multiplier and the cap to increase the likelihood of the transaction landing on-chain."
+              "multiplier and the cap to increase the likelihood of the transaction landing on-chain.",
           );
           return;
         }
@@ -305,11 +305,11 @@ export class EvmPricePusher implements IPricePusher {
             (e) =>
               e instanceof TransactionExecutionError &&
               (e.details.includes("nonce too low") ||
-                e.message.includes("Nonce provided for the transaction"))
+                e.message.includes("Nonce provided for the transaction")),
           )
         ) {
           this.logger.info(
-            "The nonce is incorrect. This is an expected behaviour in high frequency or multi-instance setup. Skipping this push."
+            "The nonce is incorrect. This is an expected behaviour in high frequency or multi-instance setup. Skipping this push.",
           );
           return;
         }
@@ -319,7 +319,7 @@ export class EvmPricePusher implements IPricePusher {
           this.logger.warn(
             { err },
             "The contract function execution failed in simulation. This is an expected behaviour in high frequency or multi-instance setup. " +
-              "Please review this error and file an issue if it is a bug. Skipping this push."
+              "Please review this error and file an issue if it is a bug. Skipping this push.",
           );
           return;
         }
@@ -330,7 +330,7 @@ export class EvmPricePusher implements IPricePusher {
           this.logger.error(
             { err },
             "Transaction execution failed. This is an expected behaviour in high frequency or multi-instance setup. " +
-              "Please review this error and file an issue if it is a bug. Skipping this push."
+              "Please review this error and file an issue if it is a bug. Skipping this push.",
           );
           return;
         }
@@ -343,7 +343,7 @@ export class EvmPricePusher implements IPricePusher {
           err.message.includes("invalid nonce")
         ) {
           this.logger.info(
-            "The nonce is incorrect (are multiple users using this account?). Skipping this push."
+            "The nonce is incorrect (are multiple users using this account?). Skipping this push.",
           );
           return;
         }
@@ -355,7 +355,7 @@ export class EvmPricePusher implements IPricePusher {
           // and increase the gas price accordingly.
           this.logger.warn(
             "The transaction failed with error: max fee per gas less than block base fee. " +
-              "The fee will be increased in the next push. Skipping this push."
+              "The fee will be increased in the next push. Skipping this push.",
           );
           return;
         }
@@ -369,7 +369,7 @@ export class EvmPricePusher implements IPricePusher {
 
         if (err.message.includes("could not replace existing tx")) {
           this.logger.error(
-            "A transaction with the same nonce has been mined and this one is no longer needed. Skipping this push."
+            "A transaction with the same nonce has been mined and this one is no longer needed. Skipping this push.",
           );
           return;
         }
@@ -379,7 +379,7 @@ export class EvmPricePusher implements IPricePusher {
       this.logger.error(
         { err },
         "The transaction failed with an unhandled error. crashing the process. " +
-          "Please review this error and file an issue if it is a bug."
+          "Please review this error and file an issue if it is a bug.",
       );
       throw err;
     }
@@ -406,7 +406,7 @@ export class EvmPricePusher implements IPricePusher {
           this.logger.info(
             { hash, receipt },
             "Price update did not succeed or its transaction did not land. " +
-              "This is an expected behaviour in high frequency or multi-instance setup."
+              "This is an expected behaviour in high frequency or multi-instance setup.",
           );
       }
     } catch (err: any) {
@@ -415,7 +415,7 @@ export class EvmPricePusher implements IPricePusher {
   }
 
   private async getPriceFeedsUpdateData(
-    priceIds: HexString[]
+    priceIds: HexString[],
   ): Promise<string[]> {
     const response = await this.hermesClient.getLatestPriceUpdates(priceIds, {
       encoding: "hex",

+ 1 - 1
apps/price_pusher/src/evm/pyth-contract.ts

@@ -9,7 +9,7 @@ export type PythContract = GetContractReturnType<
 
 export const createPythContract = (
   client: SuperWalletClient,
-  address: Address
+  address: Address,
 ): PythContract =>
   getContract({
     client,

+ 1 - 1
apps/price_pusher/src/evm/super-wallet.ts

@@ -55,7 +55,7 @@ const getChainById = (chainId: number): Chain =>
 
 export const createClient = async (
   endpoint: string,
-  mnemonic: string
+  mnemonic: string,
 ): Promise<SuperWalletClient> => {
   const transport = getTransport(endpoint);
 

+ 5 - 5
apps/price_pusher/src/fuel/command.ts

@@ -64,7 +64,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -73,7 +73,7 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger.child({ module: "PythPriceListener" })
+      logger.child({ module: "PythPriceListener" }),
     );
 
     const provider = await Provider.create(endpoint);
@@ -85,14 +85,14 @@ export default {
       pythContractAddress,
       priceItems,
       logger.child({ module: "FuelPriceListener" }),
-      { pollingFrequency }
+      { pollingFrequency },
     );
 
     const fuelPricePusher = new FuelPricePusher(
       wallet,
       pythContractAddress,
       hermesClient,
-      logger.child({ module: "FuelPricePusher" })
+      logger.child({ module: "FuelPricePusher" }),
     );
 
     const controller = new Controller(
@@ -101,7 +101,7 @@ export default {
       fuelPriceListener,
       fuelPricePusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     await controller.start();

+ 8 - 8
apps/price_pusher/src/fuel/fuel.ts

@@ -31,13 +31,13 @@ export class FuelPriceListener extends ChainPriceListener {
     private logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
     this.contract = new Contract(
       this.pythContractId,
       PYTH_CONTRACT_ABI,
-      this.provider
+      this.provider,
     );
   }
 
@@ -56,8 +56,8 @@ export class FuelPriceListener extends ChainPriceListener {
 
       this.logger.debug(
         `Polled a Fuel on chain price for feed ${this.priceIdToAlias.get(
-          priceId
-        )} (${priceId}).`
+          priceId,
+        )} (${priceId}).`,
       );
 
       return {
@@ -79,19 +79,19 @@ export class FuelPricePusher implements IPricePusher {
     private wallet: Wallet,
     private pythContractId: string,
     private hermesClient: HermesClient,
-    private logger: Logger
+    private logger: Logger,
   ) {
     this.contract = new Contract(
       this.pythContractId,
       PYTH_CONTRACT_ABI,
-      this.wallet as Provider
+      this.wallet as Provider,
     );
   }
 
   async updatePriceFeed(
     priceIds: string[],
     // eslint-disable-next-line @typescript-eslint/no-unused-vars
-    pubTimesToPush: number[]
+    pubTimesToPush: number[],
   ): Promise<void> {
     if (priceIds.length === 0) {
       return;
@@ -124,7 +124,7 @@ export class FuelPricePusher implements IPricePusher {
 
       this.logger.info(
         { transactionId: result.transactionId },
-        "updatePriceFeed successful"
+        "updatePriceFeed successful",
       );
     } catch (err: any) {
       this.logger.error(err, "updatePriceFeed failed");

+ 5 - 5
apps/price_pusher/src/injective/command.ts

@@ -80,7 +80,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -89,7 +89,7 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger.child({ module: "PythPriceListener" })
+      logger.child({ module: "PythPriceListener" }),
     );
 
     const injectiveListener = new InjectivePriceListener(
@@ -99,7 +99,7 @@ export default {
       logger.child({ module: "InjectivePriceListener" }),
       {
         pollingFrequency,
-      }
+      },
     );
     const injectivePusher = new InjectivePricePusher(
       hermesClient,
@@ -111,7 +111,7 @@ export default {
         chainId: getNetworkInfo(network).chainId,
         gasPrice,
         gasMultiplier,
-      }
+      },
     );
 
     const controller = new Controller(
@@ -120,7 +120,7 @@ export default {
       injectiveListener,
       injectivePusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     controller.start();

+ 10 - 10
apps/price_pusher/src/injective/injective.ts

@@ -49,20 +49,20 @@ export class InjectivePriceListener extends ChainPriceListener {
     private logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
   }
 
   async getOnChainPriceInfo(
-    priceId: HexString
+    priceId: HexString,
   ): Promise<PriceInfo | undefined> {
     let priceQueryResponse: PriceQueryResponse;
     try {
       const api = new ChainGrpcWasmApi(this.grpcEndpoint);
       const { data } = await api.fetchSmartContractState(
         this.pythContractAddress,
-        Buffer.from(`{"price_feed":{"id":"${priceId}"}}`).toString("base64")
+        Buffer.from(`{"price_feed":{"id":"${priceId}"}}`).toString("base64"),
       );
 
       const json = Buffer.from(data).toString();
@@ -74,8 +74,8 @@ export class InjectivePriceListener extends ChainPriceListener {
 
     this.logger.debug(
       `Polled an Injective on chain price for feed ${this.priceIdToAlias.get(
-        priceId
-      )} (${priceId}).`
+        priceId,
+      )} (${priceId}).`,
     );
 
     return {
@@ -102,7 +102,7 @@ export class InjectivePricePusher implements IPricePusher {
     private grpcEndpoint: string,
     private logger: Logger,
     mnemonic: string,
-    chainConfig?: Partial<InjectiveConfig>
+    chainConfig?: Partial<InjectiveConfig>,
   ) {
     this.wallet = PrivateKey.fromMnemonic(mnemonic);
 
@@ -121,7 +121,7 @@ export class InjectivePricePusher implements IPricePusher {
     const chainGrpcAuthApi = new ChainGrpcAuthApi(this.grpcEndpoint);
     // Fetch the latest account details only if it's not stored.
     this.account ??= await chainGrpcAuthApi.fetchAccount(
-      this.injectiveAddress()
+      this.injectiveAddress(),
     );
 
     const { txRaw: simulateTxRaw } = createTransactionFromMsg({
@@ -198,7 +198,7 @@ export class InjectivePricePusher implements IPricePusher {
 
   async updatePriceFeed(
     priceIds: string[],
-    pubTimesToPush: number[]
+    pubTimesToPush: number[],
   ): Promise<void> {
     if (priceIds.length === 0) {
       return;
@@ -226,8 +226,8 @@ export class InjectivePricePusher implements IPricePusher {
             get_update_fee: {
               vaas: priceFeedUpdateObject.update_price_feeds.data,
             },
-          })
-        ).toString("base64")
+          }),
+        ).toString("base64"),
       );
 
       const json = Buffer.from(data).toString();

+ 5 - 5
apps/price_pusher/src/interface.ts

@@ -24,11 +24,11 @@ export abstract class ChainPriceListener implements IPriceListener {
 
   constructor(
     private pollingFrequency: DurationInSeconds,
-    protected priceItems: PriceItem[]
+    protected priceItems: PriceItem[],
   ) {
     this.latestPriceInfo = new Map();
     this.priceIdToAlias = new Map(
-      priceItems.map(({ id, alias }) => [id, alias])
+      priceItems.map(({ id, alias }) => [id, alias]),
     );
   }
 
@@ -49,7 +49,7 @@ export abstract class ChainPriceListener implements IPriceListener {
 
   protected updateLatestPriceInfo(
     priceId: HexString,
-    observedPrice: PriceInfo
+    observedPrice: PriceInfo,
   ) {
     const cachedLatestPriceInfo = this.getLatestPriceInfo(priceId);
 
@@ -72,13 +72,13 @@ export abstract class ChainPriceListener implements IPriceListener {
   }
 
   abstract getOnChainPriceInfo(
-    priceId: HexString
+    priceId: HexString,
   ): Promise<PriceInfo | undefined>;
 }
 
 export interface IPricePusher {
   updatePriceFeed(
     priceIds: string[],
-    pubTimesToPush: UnixTimestamp[]
+    pubTimesToPush: UnixTimestamp[],
   ): Promise<void>;
 }

+ 6 - 6
apps/price_pusher/src/near/command.ts

@@ -72,7 +72,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -81,7 +81,7 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger
+      logger,
     );
 
     const nearAccount = new NearAccount(
@@ -89,7 +89,7 @@ export default {
       accountId,
       nodeUrl,
       privateKeyPath,
-      pythContractAddress
+      pythContractAddress,
     );
 
     const nearListener = new NearPriceListener(
@@ -98,13 +98,13 @@ export default {
       logger.child({ module: "NearPriceListener" }),
       {
         pollingFrequency,
-      }
+      },
     );
 
     const nearPusher = new NearPricePusher(
       nearAccount,
       hermesClient,
-      logger.child({ module: "NearPricePusher" })
+      logger.child({ module: "NearPricePusher" }),
     );
 
     const controller = new Controller(
@@ -113,7 +113,7 @@ export default {
       nearListener,
       nearPusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     controller.start();

+ 15 - 15
apps/price_pusher/src/near/near.ts

@@ -27,7 +27,7 @@ export class NearPriceListener extends ChainPriceListener {
     private logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
   }
@@ -38,8 +38,8 @@ export class NearPriceListener extends ChainPriceListener {
 
       this.logger.debug(
         `Polled a NEAR on chain price for feed ${this.priceIdToAlias.get(
-          priceId
-        )} (${priceId}) ${JSON.stringify(priceRaw)}.`
+          priceId,
+        )} (${priceId}) ${JSON.stringify(priceRaw)}.`,
       );
 
       if (priceRaw) {
@@ -62,12 +62,12 @@ export class NearPricePusher implements IPricePusher {
   constructor(
     private account: NearAccount,
     private hermesClient: HermesClient,
-    private logger: Logger
+    private logger: Logger,
   ) {}
 
   async updatePriceFeed(
     priceIds: string[],
-    pubTimesToPush: number[]
+    pubTimesToPush: number[],
   ): Promise<void> {
     if (priceIds.length === 0) {
       return;
@@ -102,7 +102,7 @@ export class NearPricePusher implements IPricePusher {
             if (
               Object.prototype.hasOwnProperty.call(
                 receipt["outcome"]["status"],
-                "Failure"
+                "Failure",
               )
             ) {
               failureMessages.push(receipt["outcome"]["status"]);
@@ -110,12 +110,12 @@ export class NearPricePusher implements IPricePusher {
             }
             return is_success;
           },
-          true
+          true,
         );
         if (is_success) {
           this.logger.info(
             { hash: outcome["transaction"]["hash"] },
-            "updatePriceFeeds successful."
+            "updatePriceFeeds successful.",
           );
         } else {
           this.logger.error({ failureMessages }, "updatePriceFeeds failed");
@@ -127,7 +127,7 @@ export class NearPricePusher implements IPricePusher {
   }
 
   private async getPriceFeedsUpdateData(
-    priceIds: HexString[]
+    priceIds: HexString[],
   ): Promise<string[]> {
     const response = await this.hermesClient.getLatestPriceUpdates(priceIds, {
       encoding: "base64",
@@ -144,13 +144,13 @@ export class NearAccount {
     accountId: string,
     nodeUrl: string,
     privateKeyPath: string | undefined,
-    private pythAccountId: string
+    private pythAccountId: string,
   ) {
     const connection = this.getConnection(
       network,
       accountId,
       nodeUrl,
-      privateKeyPath
+      privateKeyPath,
     );
     this.account = new Account(connection, accountId);
   }
@@ -177,7 +177,7 @@ export class NearAccount {
 
   async updatePriceFeeds(
     data: string,
-    updateFee: any
+    updateFee: any,
   ): Promise<FinalExecutionOutcome> {
     return await this.account.functionCall({
       contractId: this.pythAccountId,
@@ -194,7 +194,7 @@ export class NearAccount {
     network: string,
     accountId: string,
     nodeUrl: string,
-    privateKeyPath: string | undefined
+    privateKeyPath: string | undefined,
   ): Connection {
     const content = fs.readFileSync(
       privateKeyPath ||
@@ -202,8 +202,8 @@ export class NearAccount {
           os.homedir(),
           ".near-credentials",
           network,
-          accountId + ".json"
-        )
+          accountId + ".json",
+        ),
     );
     const accountInfo = JSON.parse(content.toString());
     let privateKey = accountInfo.private_key;

+ 6 - 6
apps/price_pusher/src/price-config.ts

@@ -21,7 +21,7 @@ const PriceConfigFileSchema: Joi.Schema = Joi.array()
         price_deviation: Joi.number().optional(),
         confidence_ratio: Joi.number().optional(),
       }).optional(),
-    })
+    }),
   )
   .unique("id")
   .unique("alias")
@@ -92,7 +92,7 @@ export function shouldUpdate(
   priceConfig: PriceConfig,
   sourceLatestPrice: PriceInfo | undefined,
   targetLatestPrice: PriceInfo | undefined,
-  logger: Logger
+  logger: Logger,
 ): UpdateCondition {
   const priceId = priceConfig.id;
 
@@ -104,7 +104,7 @@ export function shouldUpdate(
   // It means that price never existed there. So we should push the latest price feed.
   if (targetLatestPrice === undefined) {
     logger.info(
-      `${priceConfig.alias} (${priceId}) is not available on the target network. Pushing the price.`
+      `${priceConfig.alias} (${priceId}) is not available on the target network. Pushing the price.`,
     );
     return UpdateCondition.YES;
   }
@@ -119,12 +119,12 @@ export function shouldUpdate(
 
   const priceDeviationPct =
     (Math.abs(
-      Number(sourceLatestPrice.price) - Number(targetLatestPrice.price)
+      Number(sourceLatestPrice.price) - Number(targetLatestPrice.price),
     ) /
       Number(targetLatestPrice.price)) *
     100;
   const confidenceRatioPct = Math.abs(
-    (Number(sourceLatestPrice.conf) / Number(sourceLatestPrice.price)) * 100
+    (Number(sourceLatestPrice.conf) / Number(sourceLatestPrice.price)) * 100,
   );
 
   logger.info(
@@ -140,7 +140,7 @@ export function shouldUpdate(
       }%? / early: < ${priceConfig.earlyUpdatePriceDeviation}%?) OR ` +
       `Confidence ratio: ${confidenceRatioPct.toFixed(5)}% (< ${
         priceConfig.confidenceRatio
-      }%? / early: < ${priceConfig.earlyUpdatePriceDeviation}%?)`
+      }%? / early: < ${priceConfig.earlyUpdatePriceDeviation}%?)`,
   );
 
   if (

+ 5 - 5
apps/price_pusher/src/pyth-price-listener.ts

@@ -20,12 +20,12 @@ export class PythPriceListener implements IPriceListener {
   constructor(
     hermesClient: HermesClient,
     priceItems: PriceItem[],
-    logger: Logger
+    logger: Logger,
   ) {
     this.hermesClient = hermesClient;
     this.priceIds = priceItems.map((priceItem) => priceItem.id);
     this.priceIdToAlias = new Map(
-      priceItems.map((priceItem) => [priceItem.id, priceItem.alias])
+      priceItems.map((priceItem) => [priceItem.id, priceItem.alias]),
     );
     this.latestPriceInfo = new Map();
     this.logger = logger;
@@ -39,15 +39,15 @@ export class PythPriceListener implements IPriceListener {
       {
         parsed: true,
         ignoreInvalidPriceIds: true,
-      }
+      },
     );
     eventSource.onmessage = (event: MessageEvent<string>) => {
       const priceUpdates = JSON.parse(event.data) as PriceUpdate;
       priceUpdates.parsed?.forEach((priceUpdate) => {
         this.logger.debug(
           `Received new price feed update from Pyth price service: ${this.priceIdToAlias.get(
-            priceUpdate.id
-          )} ${priceUpdate.id}`
+            priceUpdate.id,
+          )} ${priceUpdate.id}`,
         );
 
         // Consider price to be currently available if it is not older than 60s

+ 10 - 10
apps/price_pusher/src/solana/command.ts

@@ -140,7 +140,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -149,13 +149,13 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger.child({ module: "PythPriceListener" })
+      logger.child({ module: "PythPriceListener" }),
     );
 
     const wallet = new NodeWallet(
       Keypair.fromSecretKey(
-        Uint8Array.from(JSON.parse(fs.readFileSync(keypairFile, "ascii")))
-      )
+        Uint8Array.from(JSON.parse(fs.readFileSync(keypairFile, "ascii"))),
+      ),
     );
 
     const connection = new Connection(endpoint, "processed");
@@ -176,7 +176,7 @@ export default {
     let solanaPricePusher;
     if (jitoTipLamports) {
       const jitoKeypair = Keypair.fromSecretKey(
-        Uint8Array.from(JSON.parse(fs.readFileSync(jitoKeypairFile, "ascii")))
+        Uint8Array.from(JSON.parse(fs.readFileSync(jitoKeypairFile, "ascii"))),
       );
 
       const jitoClient = searcherClient(jitoEndpoint, jitoKeypair);
@@ -191,7 +191,7 @@ export default {
         jitoClient,
         jitoBundleSize,
         updatesPerJitoBundle,
-        lookupTableAccount
+        lookupTableAccount,
       );
 
       onBundleResult(jitoClient, logger.child({ module: "JitoClient" }));
@@ -202,7 +202,7 @@ export default {
         logger.child({ module: "SolanaPricePusher" }),
         shardId,
         computeUnitPriceMicroLamports,
-        lookupTableAccount
+        lookupTableAccount,
       );
     }
 
@@ -211,7 +211,7 @@ export default {
       shardId,
       priceItems,
       logger.child({ module: "SolanaPriceListener" }),
-      { pollingFrequency }
+      { pollingFrequency },
     );
 
     const controller = new Controller(
@@ -220,7 +220,7 @@ export default {
       solanaPriceListener,
       solanaPricePusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     controller.start();
@@ -232,6 +232,6 @@ export const onBundleResult = (c: SearcherClient, logger: Logger) => {
     () => undefined,
     (err) => {
       logger.error(err, "Error in bundle result");
-    }
+    },
   );
 };

+ 20 - 21
apps/price_pusher/src/solana/solana.ts

@@ -26,7 +26,7 @@ export class SolanaPriceListener extends ChainPriceListener {
     private logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
   }
@@ -36,9 +36,8 @@ export class SolanaPriceListener extends ChainPriceListener {
   private async checkHealth() {
     const slot = await this.pythSolanaReceiver.connection.getSlot("finalized");
     try {
-      const blockTime = await this.pythSolanaReceiver.connection.getBlockTime(
-        slot
-      );
+      const blockTime =
+        await this.pythSolanaReceiver.connection.getBlockTime(slot);
       if (
         blockTime === null ||
         blockTime < Date.now() / 1000 - HEALTH_CHECK_TIMEOUT_SECONDS
@@ -47,7 +46,7 @@ export class SolanaPriceListener extends ChainPriceListener {
           this.logger.info(
             `Solana connection is behind by ${
               Date.now() / 1000 - blockTime
-            } seconds`
+            } seconds`,
           );
         }
       }
@@ -68,12 +67,12 @@ export class SolanaPriceListener extends ChainPriceListener {
       const priceFeedAccount =
         await this.pythSolanaReceiver.fetchPriceFeedAccount(
           this.shardId,
-          Buffer.from(priceId, "hex")
+          Buffer.from(priceId, "hex"),
         );
       this.logger.debug(
         `Polled a Solana on chain price for feed ${this.priceIdToAlias.get(
-          priceId
-        )} (${priceId}).`
+          priceId,
+        )} (${priceId}).`,
       );
       if (priceFeedAccount) {
         return {
@@ -98,7 +97,7 @@ export class SolanaPricePusher implements IPricePusher {
     private logger: Logger,
     private shardId: number,
     private computeUnitPriceMicroLamports: number,
-    private addressLookupTableAccount?: AddressLookupTableAccount
+    private addressLookupTableAccount?: AddressLookupTableAccount,
   ) {}
 
   async updatePriceFeed(priceIds: string[]): Promise<void> {
@@ -119,7 +118,7 @@ export class SolanaPricePusher implements IPricePusher {
         shuffledPriceIds,
         {
           encoding: "base64",
-        }
+        },
       );
       priceFeedUpdateData = response.binary.data;
     } catch (err: any) {
@@ -131,11 +130,11 @@ export class SolanaPricePusher implements IPricePusher {
       {
         closeUpdateAccounts: true,
       },
-      this.addressLookupTableAccount
+      this.addressLookupTableAccount,
     );
     await transactionBuilder.addUpdatePriceFeed(
       priceFeedUpdateData,
-      this.shardId
+      this.shardId,
     );
 
     const transactions = await transactionBuilder.buildVersionedTransactions({
@@ -147,7 +146,7 @@ export class SolanaPricePusher implements IPricePusher {
       const signatures = await sendTransactions(
         transactions,
         this.pythSolanaReceiver.connection,
-        this.pythSolanaReceiver.wallet
+        this.pythSolanaReceiver.wallet,
       );
       this.logger.info({ signatures }, "updatePriceFeed successful");
     } catch (err: any) {
@@ -169,24 +168,24 @@ export class SolanaPricePusherJito implements IPricePusher {
     private searcherClient: SearcherClient,
     private jitoBundleSize: number,
     private updatesPerJitoBundle: number,
-    private addressLookupTableAccount?: AddressLookupTableAccount
+    private addressLookupTableAccount?: AddressLookupTableAccount,
   ) {}
 
   async getRecentJitoTipLamports(): Promise<number | undefined> {
     try {
       const response = await fetch(
-        "http://bundles-api-rest.jito.wtf/api/v1/bundles/tip_floor"
+        "http://bundles-api-rest.jito.wtf/api/v1/bundles/tip_floor",
       );
       if (!response.ok) {
         this.logger.error(
           { status: response.status, statusText: response.statusText },
-          "getRecentJitoTips http request failed"
+          "getRecentJitoTips http request failed",
         );
         return undefined;
       }
       const data = await response.json();
       return Math.floor(
-        Number(data[0].landed_tips_50th_percentile) * LAMPORTS_PER_SOL
+        Number(data[0].landed_tips_50th_percentile) * LAMPORTS_PER_SOL,
       );
     } catch (err: any) {
       this.logger.error({ err }, "getRecentJitoTips failed");
@@ -224,17 +223,17 @@ export class SolanaPricePusherJito implements IPricePusher {
         {
           closeUpdateAccounts: true,
         },
-        this.addressLookupTableAccount
+        this.addressLookupTableAccount,
       );
       await transactionBuilder.addUpdatePriceFeed(
         priceFeedUpdateData.map((x) => {
           return sliceAccumulatorUpdateData(
             Buffer.from(x, "base64"),
             i,
-            i + this.updatesPerJitoBundle
+            i + this.updatesPerJitoBundle,
           ).toString("base64");
         }),
-        this.shardId
+        this.shardId,
       );
 
       const transactions = await transactionBuilder.buildVersionedTransactions({
@@ -249,7 +248,7 @@ export class SolanaPricePusherJito implements IPricePusher {
           await sendTransactionsJito(
             transactions,
             this.searcherClient,
-            this.pythSolanaReceiver.wallet
+            this.pythSolanaReceiver.wallet,
           );
           break;
         } catch (err: any) {

+ 7 - 7
apps/price_pusher/src/sui/command.ts

@@ -99,12 +99,12 @@ export default {
     const mnemonic = fs.readFileSync(mnemonicFile, "utf-8").trim();
     const keypair = Ed25519Keypair.deriveKeypair(
       mnemonic,
-      `m/44'/784'/${accountIndex}'/0'/0'`
+      `m/44'/784'/${accountIndex}'/0'/0'`,
     );
     logger.info(
       `Pushing updates from wallet address: ${keypair
         .getPublicKey()
-        .toSuiAddress()}`
+        .toSuiAddress()}`,
     );
 
     let priceItems = priceConfigs.map(({ id, alias }) => ({ id, alias }));
@@ -117,7 +117,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -126,7 +126,7 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger.child({ module: "PythPriceListener" })
+      logger.child({ module: "PythPriceListener" }),
     );
 
     const suiListener = new SuiPriceListener(
@@ -135,7 +135,7 @@ export default {
       endpoint,
       priceItems,
       logger.child({ module: "SuiPriceListener" }),
-      { pollingFrequency }
+      { pollingFrequency },
     );
     const suiPusher = await SuiPricePusher.createWithAutomaticGasPool(
       hermesClient,
@@ -146,7 +146,7 @@ export default {
       keypair,
       gasBudget,
       numGasObjects,
-      ignoreGasObjects
+      ignoreGasObjects,
     );
 
     const controller = new Controller(
@@ -155,7 +155,7 @@ export default {
       suiListener,
       suiPusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     controller.start();

+ 37 - 38
apps/price_pusher/src/sui/sui.ts

@@ -32,23 +32,22 @@ export class SuiPriceListener extends ChainPriceListener {
     logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
     this.provider = new SuiClient({ url: endpoint });
     this.pythClient = new SuiPythClient(
       this.provider,
       pythStateId,
-      wormholeStateId
+      wormholeStateId,
     );
     this.logger = logger;
   }
 
   async getOnChainPriceInfo(priceId: string): Promise<PriceInfo | undefined> {
     try {
-      const priceInfoObjectId = await this.pythClient.getPriceFeedObjectId(
-        priceId
-      );
+      const priceInfoObjectId =
+        await this.pythClient.getPriceFeedObjectId(priceId);
       if (priceInfoObjectId === undefined) {
         throw new Error("Price not found on chain for price id " + priceId);
       }
@@ -84,7 +83,7 @@ export class SuiPriceListener extends ChainPriceListener {
     } catch (err) {
       this.logger.error(
         err,
-        `Polling Sui on-chain price for ${priceId} failed.`
+        `Polling Sui on-chain price for ${priceId} failed.`,
       );
       return undefined;
     }
@@ -113,7 +112,7 @@ export class SuiPricePusher implements IPricePusher {
     private hermesClient: HermesClient,
     private gasBudget: number,
     private gasPool: SuiObjectRef[],
-    private pythClient: SuiPythClient
+    private pythClient: SuiPythClient,
   ) {}
 
   /**
@@ -125,7 +124,7 @@ export class SuiPricePusher implements IPricePusher {
    */
   static async getPackageId(
     provider: SuiClient,
-    objectId: ObjectId
+    objectId: ObjectId,
   ): Promise<ObjectId> {
     const state = await provider
       .getObject({
@@ -164,11 +163,11 @@ export class SuiPricePusher implements IPricePusher {
     keypair: Ed25519Keypair,
     gasBudget: number,
     numGasObjects: number,
-    ignoreGasObjects: string[]
+    ignoreGasObjects: string[],
   ): Promise<SuiPricePusher> {
     if (numGasObjects > MAX_NUM_OBJECTS_IN_ARGUMENT) {
       throw new Error(
-        `numGasObjects cannot be greater than ${MAX_NUM_OBJECTS_IN_ARGUMENT} until we implement split chunking`
+        `numGasObjects cannot be greater than ${MAX_NUM_OBJECTS_IN_ARGUMENT} until we implement split chunking`,
       );
     }
 
@@ -179,13 +178,13 @@ export class SuiPricePusher implements IPricePusher {
       provider,
       numGasObjects,
       ignoreGasObjects,
-      logger
+      logger,
     );
 
     const pythClient = new SuiPythClient(
       provider,
       pythStateId,
-      wormholeStateId
+      wormholeStateId,
     );
 
     return new SuiPricePusher(
@@ -195,13 +194,13 @@ export class SuiPricePusher implements IPricePusher {
       hermesClient,
       gasBudget,
       gasPool,
-      pythClient
+      pythClient,
     );
   }
 
   async updatePriceFeed(
     priceIds: string[],
-    pubTimesToPush: number[]
+    pubTimesToPush: number[],
   ): Promise<void> {
     if (priceIds.length === 0) {
       return;
@@ -226,11 +225,11 @@ export class SuiPricePusher implements IPricePusher {
           priceIdChunk,
           {
             encoding: "base64",
-          }
+          },
         );
         if (response.binary.data.length !== 1) {
           throw new Error(
-            `Expected a single VAA for all priceIds ${priceIdChunk} but received ${response.binary.data.length} VAAs: ${response.binary.data}`
+            `Expected a single VAA for all priceIds ${priceIdChunk} but received ${response.binary.data.length} VAAs: ${response.binary.data}`,
           );
         }
         const vaa = response.binary.data[0];
@@ -238,10 +237,10 @@ export class SuiPricePusher implements IPricePusher {
         await this.pythClient.updatePriceFeeds(
           tx,
           [Buffer.from(vaa, "base64")],
-          priceIdChunk
+          priceIdChunk,
         );
         txBlocks.push(tx);
-      })
+      }),
     );
 
     await this.sendTransactionBlocks(txBlocks);
@@ -278,7 +277,7 @@ export class SuiPricePusher implements IPricePusher {
 
       this.logger.info(
         { hash: result.digest },
-        "Successfully updated price with transaction digest"
+        "Successfully updated price with transaction digest",
       );
     } catch (err: any) {
       if (
@@ -291,12 +290,12 @@ export class SuiPricePusher implements IPricePusher {
       } else {
         this.logger.error(
           err,
-          "Failed to update price. Trying to refresh gas object references."
+          "Failed to update price. Trying to refresh gas object references.",
         );
         // Refresh the coin object here in case the error is caused by an object version mismatch.
         nextGasObject = await SuiPricePusher.tryRefreshObjectReference(
           this.provider,
-          gasObject
+          gasObject,
         );
       }
     }
@@ -315,14 +314,14 @@ export class SuiPricePusher implements IPricePusher {
     provider: SuiClient,
     numGasObjects: number,
     ignoreGasObjects: string[],
-    logger: Logger
+    logger: Logger,
   ): Promise<SuiObjectRef[]> {
     const signerAddress = signer.toSuiAddress();
 
     if (ignoreGasObjects.length > 0) {
       logger.info(
         { ignoreGasObjects },
-        "Ignoring some gas objects for coin merging"
+        "Ignoring some gas objects for coin merging",
       );
     }
 
@@ -331,7 +330,7 @@ export class SuiPricePusher implements IPricePusher {
       provider,
       signerAddress,
       ignoreGasObjects,
-      logger
+      logger,
     );
     const coinResult = await provider.getObject({
       id: consolidatedCoin.objectId,
@@ -356,7 +355,7 @@ export class SuiPricePusher implements IPricePusher {
       signerAddress,
       Number(splitAmount),
       numGasObjects,
-      consolidatedCoin
+      consolidatedCoin,
     );
     logger.info({ gasPool }, "Gas pool is filled with coins");
     return gasPool;
@@ -366,7 +365,7 @@ export class SuiPricePusher implements IPricePusher {
   // of the object. Throws an error if the object cannot be refreshed.
   private static async tryRefreshObjectReference(
     provider: SuiClient,
-    ref: SuiObjectRef
+    ref: SuiObjectRef,
   ): Promise<SuiObjectRef> {
     const objectResponse = await provider.getObject({ id: ref.objectId });
     if (objectResponse.data !== undefined) {
@@ -382,7 +381,7 @@ export class SuiPricePusher implements IPricePusher {
 
   private static async getAllGasCoins(
     provider: SuiClient,
-    owner: SuiAddress
+    owner: SuiAddress,
   ): Promise<SuiObjectRef[]> {
     let hasNextPage = true;
     let cursor;
@@ -400,8 +399,8 @@ export class SuiPricePusher implements IPricePusher {
             objectId: c.coinObjectId,
             version: c.version,
             digest: c.digest,
-          })
-        )
+          }),
+        ),
       );
       hasNextPage = paginatedCoins.hasNextPage;
       cursor = paginatedCoins.nextCursor;
@@ -419,18 +418,18 @@ export class SuiPricePusher implements IPricePusher {
     signerAddress: SuiAddress,
     splitAmount: number,
     numGasObjects: number,
-    gasCoin: SuiObjectRef
+    gasCoin: SuiObjectRef,
   ): Promise<SuiObjectRef[]> {
     // TODO: implement chunking if numGasObjects exceeds MAX_NUM_CREATED_OBJECTS
     const tx = new Transaction();
     const coins = tx.splitCoins(
       tx.gas,
-      Array.from({ length: numGasObjects }, () => tx.pure.u64(splitAmount))
+      Array.from({ length: numGasObjects }, () => tx.pure.u64(splitAmount)),
     );
 
     tx.transferObjects(
       Array.from({ length: numGasObjects }, (_, i) => coins[i]),
-      tx.pure.address(signerAddress)
+      tx.pure.address(signerAddress),
     );
     tx.setGasPayment([gasCoin]);
     const result = await provider.signAndExecuteTransaction({
@@ -441,13 +440,13 @@ export class SuiPricePusher implements IPricePusher {
     const error = result?.effects?.status.error;
     if (error) {
       throw new Error(
-        `Failed to initialize gas pool: ${error}. Try re-running the script`
+        `Failed to initialize gas pool: ${error}. Try re-running the script`,
       );
     }
     const newCoins = result.effects!.created!.map((obj) => obj.reference);
     if (newCoins.length !== numGasObjects) {
       throw new Error(
-        `Failed to initialize gas pool. Expected ${numGasObjects}, got: ${newCoins}`
+        `Failed to initialize gas pool. Expected ${numGasObjects}, got: ${newCoins}`,
       );
     }
     return newCoins;
@@ -458,7 +457,7 @@ export class SuiPricePusher implements IPricePusher {
     provider: SuiClient,
     owner: SuiAddress,
     initialLockedAddresses: string[],
-    logger: Logger
+    logger: Logger,
   ): Promise<SuiObjectRef> {
     const gasCoins = await SuiPricePusher.getAllGasCoins(provider, owner);
     // skip merging if there is only one coin
@@ -468,7 +467,7 @@ export class SuiPricePusher implements IPricePusher {
 
     const gasCoinsChunks = chunkArray<SuiObjectRef>(
       gasCoins,
-      MAX_NUM_GAS_OBJECTS_IN_PTB - 2
+      MAX_NUM_GAS_OBJECTS_IN_PTB - 2,
     );
     let finalCoin;
     const lockedAddresses: Set<string> = new Set();
@@ -493,7 +492,7 @@ export class SuiPricePusher implements IPricePusher {
 
         if (
           String(err).includes(
-            "quorum of validators because of locked objects. Retried a conflicting transaction"
+            "quorum of validators because of locked objects. Retried a conflicting transaction",
           )
         ) {
           Object.values((err as any).data).forEach((lockedObjects: any) => {
@@ -510,7 +509,7 @@ export class SuiPricePusher implements IPricePusher {
       const error = mergeResult?.effects?.status.error;
       if (error) {
         throw new Error(
-          `Failed to merge coins when initializing gas pool: ${error}. Try re-running the script`
+          `Failed to merge coins when initializing gas pool: ${error}. Try re-running the script`,
         );
       }
       finalCoin = mergeResult.effects!.mutated!.map((obj) => obj.reference)[0];

+ 5 - 5
apps/price_pusher/src/ton/command.ts

@@ -65,7 +65,7 @@ export default {
       logger.error(
         `Invalid price id submitted for: ${invalidPriceItems
           .map(({ alias }) => alias)
-          .join(", ")}`
+          .join(", ")}`,
       );
     }
 
@@ -74,7 +74,7 @@ export default {
     const pythListener = new PythPriceListener(
       hermesClient,
       priceItems,
-      logger.child({ module: "PythPriceListener" })
+      logger.child({ module: "PythPriceListener" }),
     );
 
     const client = new TonClient({ endpoint });
@@ -87,7 +87,7 @@ export default {
       contractAddress,
       priceItems,
       logger.child({ module: "TonPriceListener" }),
-      { pollingFrequency }
+      { pollingFrequency },
     );
 
     const tonPricePusher = new TonPricePusher(
@@ -95,7 +95,7 @@ export default {
       privateKey,
       contractAddress,
       hermesClient,
-      logger.child({ module: "TonPricePusher" })
+      logger.child({ module: "TonPricePusher" }),
     );
 
     const controller = new Controller(
@@ -104,7 +104,7 @@ export default {
       tonPriceListener,
       tonPricePusher,
       logger.child({ module: "Controller" }, { level: controllerLogLevel }),
-      { pushingFrequency }
+      { pushingFrequency },
     );
 
     await controller.start();

+ 7 - 7
apps/price_pusher/src/ton/ton.ts

@@ -31,11 +31,11 @@ export class TonPriceListener extends ChainPriceListener {
     private logger: Logger,
     config: {
       pollingFrequency: DurationInSeconds;
-    }
+    },
   ) {
     super(config.pollingFrequency, priceItems);
     this.contract = this.provider.open(
-      PythContract.createFromAddress(this.contractAddress)
+      PythContract.createFromAddress(this.contractAddress),
     );
   }
 
@@ -46,8 +46,8 @@ export class TonPriceListener extends ChainPriceListener {
 
       this.logger.debug(
         `Polled a TON on chain price for feed ${this.priceIdToAlias.get(
-          priceId
-        )} (${priceId}).`
+          priceId,
+        )} (${priceId}).`,
       );
 
       return {
@@ -71,7 +71,7 @@ export class TonPricePusher implements IPricePusher {
     private privateKey: string,
     private contractAddress: Address,
     private hermesClient: HermesClient,
-    private logger: Logger
+    private logger: Logger,
   ) {
     this.contract = this.client
       .provider(this.contractAddress)
@@ -88,7 +88,7 @@ export class TonPricePusher implements IPricePusher {
   async updatePriceFeed(
     priceIds: string[],
     // eslint-disable-next-line @typescript-eslint/no-unused-vars
-    pubTimesToPush: number[]
+    pubTimesToPush: number[],
   ): Promise<void> {
     if (priceIds.length === 0) {
       return;
@@ -116,7 +116,7 @@ export class TonPricePusher implements IPricePusher {
         await this.contract.sendUpdatePriceFeeds(
           this.sender,
           updateDataBuffer,
-          totalFee
+          totalFee,
         );
       }
 

+ 5 - 5
apps/price_pusher/src/utils.ts

@@ -4,9 +4,9 @@ import { PriceItem } from "./interface";
 export type PctNumber = number;
 export type DurationInSeconds = number;
 export const txSpeeds = ["slow", "standard", "fast"] as const;
-export type TxSpeed = typeof txSpeeds[number];
+export type TxSpeed = (typeof txSpeeds)[number];
 export const customGasChainIds = [137] as const;
-export type CustomGasChainId = typeof customGasChainIds[number];
+export type CustomGasChainId = (typeof customGasChainIds)[number];
 
 export async function sleep(ms: number): Promise<void> {
   return new Promise((resolve) => setTimeout(resolve, ms));
@@ -38,7 +38,7 @@ export function isWsEndpoint(endpoint: string): boolean {
 
 export function verifyValidOption<
   options extends Readonly<Array<any>>,
-  validOption extends options[number]
+  validOption extends options[number],
 >(option: any, validOptions: options) {
   if (validOptions.includes(option)) {
     return option as validOption;
@@ -58,7 +58,7 @@ export const assertDefined = <T>(value: T | undefined): T => {
 
 export async function filterInvalidPriceItems(
   hermesClient: HermesClient,
-  priceItems: PriceItem[]
+  priceItems: PriceItem[],
 ): Promise<{
   existingPriceItems: PriceItem[];
   invalidPriceItems: PriceItem[];
@@ -79,7 +79,7 @@ export async function filterInvalidPriceItems(
       }
       return acc;
     },
-    { existingPriceItems: [], invalidPriceItems: [] }
+    { existingPriceItems: [], invalidPriceItems: [] },
   );
 
   return { existingPriceItems, invalidPriceItems };

+ 1 - 1
apps/staking/package.json

@@ -68,7 +68,7 @@
     "eslint": "^9.8.0",
     "jest": "^29.7.0",
     "postcss": "^8.4.40",
-    "prettier": "^3.3.2",
+    "prettier": "catalog:",
     "tailwindcss": "^3.4.7",
     "tailwindcss-animate": "^1.0.7",
     "tailwindcss-react-aria-components": "^1.1.5",

+ 2 - 14
apps/staking/turbo.json

@@ -3,8 +3,6 @@
   "extends": ["//"],
   "tasks": {
     "build": {
-      "dependsOn": ["pull:env", "^build"],
-      "outputs": [".next/**", "!.next/cache/**"],
       "env": [
         "IP_ALLOWLIST",
         "GOVERNANCE_ONLY_REGIONS",
@@ -17,23 +15,13 @@
         "GOOGLE_ANALYTICS_ID"
       ]
     },
-    "pull:env": {
-      "outputs": [".env.local"],
-      "cache": false
-    },
     "start:dev": {
       "dependsOn": [
+        "//#install:modules",
         "pull:env",
         "@pythnetwork/hermes-client#build",
         "@pythnetwork/solana-utils#build"
-      ],
-      "persistent": true,
-      "cache": false
-    },
-    "start:prod": {
-      "dependsOn": ["build"],
-      "persistent": true,
-      "cache": false
+      ]
     }
   }
 }

+ 5 - 3
contract_manager/package.json

@@ -11,8 +11,10 @@
   "scripts": {
     "build": "tsc",
     "shell": "ts-node ./src/shell.ts",
+    "fix:lint": "eslint src/ scripts/ --fix --max-warnings 0",
+    "fix:format": "prettier --write \"src/**/*.ts\" \"scripts/**/*.ts\"",
     "test:lint": "eslint src/ scripts/ --max-warnings 0",
-    "format": "prettier --write \"src/**/*.ts\" \"scripts/**/*.ts\""
+    "test:format": "prettier --check \"src/**/*.ts\" \"scripts/**/*.ts\""
   },
   "author": "",
   "license": "Apache-2.0",
@@ -34,10 +36,10 @@
     "@pythnetwork/hermes-client": "workspace:*",
     "@pythnetwork/price-service-client": "workspace:*",
     "@pythnetwork/pyth-fuel-js": "workspace:*",
+    "@pythnetwork/pyth-iota-js": "workspace:*",
     "@pythnetwork/pyth-sdk-solidity": "workspace:^",
     "@pythnetwork/pyth-starknet-js": "^0.2.1",
     "@pythnetwork/pyth-sui-js": "workspace:*",
-    "@pythnetwork/pyth-iota-js": "workspace:*",
     "@pythnetwork/pyth-ton": "workspace:*",
     "@pythnetwork/pyth-ton-js": "workspace:*",
     "@pythnetwork/solana-utils": "workspace:^",
@@ -67,7 +69,7 @@
   "devDependencies": {
     "@types/web3": "^1.2.2",
     "eslint": "^8.0.0",
-    "prettier": "^2.6.2",
+    "prettier": "catalog:",
     "typedoc": "^0.25.7"
   }
 }

+ 15 - 15
contract_manager/scripts/check_proposal.ts

@@ -47,7 +47,7 @@ async function main() {
   const cluster = argv.cluster as PythCluster;
   const squad = SquadsMesh.endpoint(
     getPythClusterApiUrl(cluster),
-    new NodeWallet(Keypair.generate()) // dummy wallet
+    new NodeWallet(Keypair.generate()), // dummy wallet
   );
   const transaction = await squad.getTransaction(new PublicKey(argv.proposal));
   const instructions = await getProposalInstructions(squad, transaction);
@@ -64,7 +64,7 @@ async function main() {
     if (instruction instanceof WormholeMultisigInstruction) {
       if (instruction.governanceAction instanceof EvmSetWormholeAddress) {
         console.log(
-          `Verifying EVM set wormhole address on ${instruction.governanceAction.targetChainId}`
+          `Verifying EVM set wormhole address on ${instruction.governanceAction.targetChainId}`,
         );
         for (const chain of Object.values(DefaultStore.chains)) {
           if (
@@ -83,23 +83,23 @@ async function main() {
               await proxyContract.getImplementationAddress();
             const implementationCode = await new EvmPriceFeedContract(
               chain,
-              receiverImplementation
+              receiverImplementation,
             ).getCode();
             const proxyDigest = Web3.utils.keccak256(proxyCode);
             const implementationDigest =
               Web3.utils.keccak256(implementationCode);
             const guardianSetDigest = Web3.utils.keccak256(
-              JSON.stringify(guardianSet)
+              JSON.stringify(guardianSet),
             );
             console.log(
-              `${chain.getId()}  Address:\t\t${address}\nproxy digest:\t\t${proxyDigest}\nimplementation digest:\t${implementationDigest} \nguardian set index:\t${currentIndex} \nguardian set:\t\t${guardianSetDigest}`
+              `${chain.getId()}  Address:\t\t${address}\nproxy digest:\t\t${proxyDigest}\nimplementation digest:\t${implementationDigest} \nguardian set index:\t${currentIndex} \nguardian set:\t\t${guardianSetDigest}`,
             );
           }
         }
       }
       if (instruction.governanceAction instanceof EvmUpgradeContract) {
         console.log(
-          `Verifying EVM Upgrade Contract on ${instruction.governanceAction.targetChainId}`
+          `Verifying EVM Upgrade Contract on ${instruction.governanceAction.targetChainId}`,
         );
         for (const chain of Object.values(DefaultStore.chains)) {
           if (
@@ -118,7 +118,7 @@ async function main() {
       }
       if (instruction.governanceAction instanceof CosmosUpgradeContract) {
         console.log(
-          `Verifying Cosmos Upgrade Contract on ${instruction.governanceAction.targetChainId}`
+          `Verifying Cosmos Upgrade Contract on ${instruction.governanceAction.targetChainId}`,
         );
         for (const chain of Object.values(DefaultStore.chains)) {
           if (
@@ -132,7 +132,7 @@ async function main() {
             console.log(
               `${chain.getId()} Code Id:${codeId} digest:${createHash("sha256")
                 .update(code)
-                .digest("hex")}`
+                .digest("hex")}`,
             );
           }
         }
@@ -140,7 +140,7 @@ async function main() {
       if (instruction.governanceAction instanceof EvmExecute) {
         // Note: it only checks for upgrade entropy contracts right now
         console.log(
-          `Verifying EVMExecute on ${instruction.governanceAction.targetChainId}`
+          `Verifying EVMExecute on ${instruction.governanceAction.targetChainId}`,
         );
         for (const chain of Object.values(DefaultStore.chains)) {
           if (
@@ -165,7 +165,7 @@ async function main() {
               console.log(
                 `Executor Address: ${executorAddress.toUpperCase()} is not equal to Owner Address: ${owner
                   .replace("0x", "")
-                  .toUpperCase()}`
+                  .toUpperCase()}`,
               );
               continue;
             }
@@ -183,27 +183,27 @@ async function main() {
             if (calldataHex.startsWith(methodSignature)) {
               newImplementationAddress = web3.eth.abi.decodeParameter(
                 "address",
-                calldataHex.replace(methodSignature, "")
+                calldataHex.replace(methodSignature, ""),
               ) as unknown as string;
             }
 
             if (newImplementationAddress === undefined) {
               console.log(
-                `We couldn't parse the instruction for ${chain.getId()}`
+                `We couldn't parse the instruction for ${chain.getId()}`,
               );
               continue;
             }
 
             const newImplementationCode = await getCodeDigestWithoutAddress(
               chain.getWeb3(),
-              newImplementationAddress
+              newImplementationAddress,
             );
             // this should be the same keccak256 of the deployedCode property generated by truffle
             console.log(
-              `${chain.getId()}  call ${invokedMethod} with arguments (${newImplementationAddress}) on ${contract.getType()} at address:${callAddress} from executor:${executorAddress}.`
+              `${chain.getId()}  call ${invokedMethod} with arguments (${newImplementationAddress}) on ${contract.getType()} at address:${callAddress} from executor:${executorAddress}.`,
             );
             console.log(
-              `${chain.getId()}    new implementation address:${newImplementationAddress} has code digest:${newImplementationCode}`
+              `${chain.getId()}    new implementation address:${newImplementationAddress} has code digest:${newImplementationCode}`,
             );
           }
         }

+ 24 - 24
contract_manager/scripts/common.ts

@@ -29,13 +29,13 @@ export async function deployIfNotCached(
   config: BaseDeployConfig,
   artifactName: string,
   deployArgs: any[], // eslint-disable-line  @typescript-eslint/no-explicit-any
-  cacheKey?: string
+  cacheKey?: string,
 ): Promise<string> {
   const runIfNotCached = makeCacheFunction(cacheFile);
   const key = cacheKey ?? `${chain.getId()}-${artifactName}`;
   return runIfNotCached(key, async () => {
     const artifact = JSON.parse(
-      readFileSync(join(config.jsonOutputDir, `${artifactName}.json`), "utf8")
+      readFileSync(join(config.jsonOutputDir, `${artifactName}.json`), "utf8"),
     );
 
     // Handle bytecode which can be either a string or an object with an 'object' property
@@ -60,7 +60,7 @@ export async function deployIfNotCached(
       bytecode,
       deployArgs,
       config.gasMultiplier,
-      config.gasPriceMultiplier
+      config.gasPriceMultiplier,
     );
     console.log(`✅ Deployed ${artifactName} on ${chain.getId()} at ${addr}`);
 
@@ -71,10 +71,10 @@ export async function deployIfNotCached(
 export function getWeb3Contract(
   jsonOutputDir: string,
   artifactName: string,
-  address: string
+  address: string,
 ): Contract {
   const artifact = JSON.parse(
-    readFileSync(join(jsonOutputDir, `${artifactName}.json`), "utf8")
+    readFileSync(join(jsonOutputDir, `${artifactName}.json`), "utf8"),
   );
   const web3 = new Web3();
   return new web3.eth.Contract(artifact["abi"], address);
@@ -156,11 +156,11 @@ export const COMMON_UPGRADE_OPTIONS = {
 } as const;
 
 export function makeCacheFunction(
-  cacheFile: string
+  cacheFile: string,
 ): (cacheKey: string, fn: () => Promise<string>) => Promise<string> {
   async function runIfNotCached(
     cacheKey: string,
-    fn: () => Promise<string>
+    fn: () => Promise<string>,
   ): Promise<string> {
     const cache = existsSync(cacheFile)
       ? JSON.parse(readFileSync(cacheFile, "utf8"))
@@ -178,9 +178,9 @@ export function makeCacheFunction(
 }
 
 export function getSelectedChains(argv: {
-  chain: InferredOptionType<typeof COMMON_UPGRADE_OPTIONS["chain"]>;
-  testnet: InferredOptionType<typeof COMMON_UPGRADE_OPTIONS["testnet"]>;
-  allChains: InferredOptionType<typeof COMMON_UPGRADE_OPTIONS["all-chains"]>;
+  chain: InferredOptionType<(typeof COMMON_UPGRADE_OPTIONS)["chain"]>;
+  testnet: InferredOptionType<(typeof COMMON_UPGRADE_OPTIONS)["testnet"]>;
+  allChains: InferredOptionType<(typeof COMMON_UPGRADE_OPTIONS)["all-chains"]>;
 }) {
   const selectedChains: EvmChain[] = [];
   if (argv.allChains && argv.chain)
@@ -199,7 +199,7 @@ export function getSelectedChains(argv: {
     throw new Error(
       `Some chains were not found ${selectedChains
         .map((chain) => chain.getId())
-        .toString()}`
+        .toString()}`,
     );
   for (const chain of selectedChains) {
     if (chain.isMainnet() != selectedChains[0].isMainnet())
@@ -229,7 +229,7 @@ export function findEntropyContract(chain: EvmChain): EvmEntropyContract {
  * @returns If found, the wormhole contract for the given EVM chain. Else, undefined
  */
 export function findWormholeContract(
-  chain: EvmChain
+  chain: EvmChain,
 ): EvmWormholeContract | undefined {
   for (const contract of Object.values(DefaultStore.wormhole_contracts)) {
     if (
@@ -256,14 +256,14 @@ export interface DeployWormholeReceiverContractsConfig
 export async function deployWormholeContract(
   chain: EvmChain,
   config: DeployWormholeReceiverContractsConfig,
-  cacheFile: string
+  cacheFile: string,
 ): Promise<EvmWormholeContract> {
   const receiverSetupAddr = await deployIfNotCached(
     cacheFile,
     chain,
     config,
     "ReceiverSetup",
-    []
+    [],
   );
 
   const receiverImplAddr = await deployIfNotCached(
@@ -271,14 +271,14 @@ export async function deployWormholeContract(
     chain,
     config,
     "ReceiverImplementation",
-    []
+    [],
   );
 
   // Craft the init data for the proxy contract
   const setupContract = getWeb3Contract(
     config.jsonOutputDir,
     "ReceiverSetup",
-    receiverSetupAddr
+    receiverSetupAddr,
   );
 
   const { wormholeConfig } = getDefaultDeploymentConfig(config.type);
@@ -289,7 +289,7 @@ export async function deployWormholeContract(
       wormholeConfig.initialGuardianSet.map((addr: string) => "0x" + addr),
       chain.getWormholeChainId(),
       wormholeConfig.governanceChainId,
-      "0x" + wormholeConfig.governanceContract
+      "0x" + wormholeConfig.governanceContract,
     )
     .encodeABI();
 
@@ -298,7 +298,7 @@ export async function deployWormholeContract(
     chain,
     config,
     "WormholeReceiver",
-    [receiverSetupAddr, initData]
+    [receiverSetupAddr, initData],
   );
 
   const wormholeContract = new EvmWormholeContract(chain, wormholeReceiverAddr);
@@ -330,7 +330,7 @@ export async function deployWormholeContract(
 export async function getOrDeployWormholeContract(
   chain: EvmChain,
   config: DeployWormholeReceiverContractsConfig,
-  cacheFile: string
+  cacheFile: string,
 ): Promise<EvmWormholeContract> {
   return (
     findWormholeContract(chain) ??
@@ -347,7 +347,7 @@ export async function topupAccountsIfNecessary(
   chain: EvmChain,
   deploymentConfig: BaseDeployConfig,
   accounts: Array<[string, DefaultAddresses]>,
-  minBalance = 0.01
+  minBalance = 0.01,
 ) {
   for (const [accountName, defaultAddresses] of accounts) {
     const accountAddress = chain.isMainnet()
@@ -355,15 +355,15 @@ export async function topupAccountsIfNecessary(
       : defaultAddresses.testnet;
     const web3 = chain.getWeb3();
     const balance = Number(
-      web3.utils.fromWei(await web3.eth.getBalance(accountAddress), "ether")
+      web3.utils.fromWei(await web3.eth.getBalance(accountAddress), "ether"),
     );
     console.log(`${accountName} balance: ${balance} ETH`);
     if (balance < minBalance) {
       console.log(
-        `Balance is less than ${minBalance}. Topping up the ${accountName} address...`
+        `Balance is less than ${minBalance}. Topping up the ${accountName} address...`,
       );
       const signer = web3.eth.accounts.privateKeyToAccount(
-        deploymentConfig.privateKey
+        deploymentConfig.privateKey,
       );
       web3.eth.accounts.wallet.add(signer);
       const estimatedGas = await web3.eth.estimateGas({
@@ -381,7 +381,7 @@ export async function topupAccountsIfNecessary(
 
       console.log(
         `Topped up the ${accountName} address. Tx: `,
-        tx.transactionHash
+        tx.transactionHash,
       );
     }
   }

+ 3 - 3
contract_manager/scripts/deploy_cosmwasm.ts

@@ -9,7 +9,7 @@ import { COMMON_DEPLOY_OPTIONS } from "./common";
 const parser = yargs(hideBin(process.argv))
   .scriptName("deploy_cosmwasm.ts")
   .usage(
-    "Usage: $0 --code <path/to/artifact.wasm> --private-key <private-key> --chain <chain>"
+    "Usage: $0 --code <path/to/artifact.wasm> --private-key <private-key> --chain <chain>",
   )
   .options({
     code: {
@@ -38,8 +38,8 @@ async function main() {
       DefaultStore.chains[argv.chain] as CosmWasmChain,
       wormholeContract,
       argv["private-key"],
-      code
-    )
+      code,
+    ),
   );
 }
 

+ 2 - 2
contract_manager/scripts/deploy_evm_contract.ts

@@ -10,7 +10,7 @@ import { COMMON_DEPLOY_OPTIONS } from "./common";
 const parser = yargs(hideBin(process.argv))
   .scriptName("deploy_evm_contract.ts")
   .usage(
-    "Usage: $0 --std-output <path/to/std-output.json> --private-key <private-key> --chain <chain> [--deploy-args <arg> [... <args>]]"
+    "Usage: $0 --std-output <path/to/std-output.json> --private-key <private-key> --chain <chain> [--deploy-args <arg> [... <args>]]",
   )
   .options({
     "std-output": {
@@ -39,7 +39,7 @@ async function main() {
     toPrivateKey(argv["private-key"]),
     artifact["abi"],
     artifact["bytecode"],
-    argv["deploy-args"] || []
+    argv["deploy-args"] || [],
   );
 
   console.log(`Deployed contract at ${address}`);

+ 16 - 16
contract_manager/scripts/deploy_evm_entropy_contracts.ts

@@ -31,7 +31,7 @@ const CACHE_FILE = ".cache-deploy-evm-entropy-contracts";
 const parser = yargs(hideBin(process.argv))
   .scriptName("deploy_evm_entropy_contracts.ts")
   .usage(
-    "Usage: $0 --std-output-dir <path/to/std-output-dir/> --private-key <private-key> --chain <chain> --wormhole-addr <wormhole-addr>"
+    "Usage: $0 --std-output-dir <path/to/std-output-dir/> --private-key <private-key> --chain <chain> --wormhole-addr <wormhole-addr>",
   )
   .options({
     ...COMMON_DEPLOY_OPTIONS,
@@ -45,14 +45,14 @@ const parser = yargs(hideBin(process.argv))
 async function deployExecutorContracts(
   chain: EvmChain,
   config: DeploymentConfig,
-  wormholeAddr: string
+  wormholeAddr: string,
 ): Promise<string> {
   const executorImplAddr = await deployIfNotCached(
     CACHE_FILE,
     chain,
     config,
     "ExecutorUpgradable",
-    []
+    [],
   );
 
   // Craft the init data for the proxy contract
@@ -61,7 +61,7 @@ async function deployExecutorContracts(
   const executorImplContract = getWeb3Contract(
     config.jsonOutputDir,
     "ExecutorUpgradable",
-    executorImplAddr
+    executorImplAddr,
   );
 
   const executorInitData = executorImplContract.methods
@@ -70,7 +70,7 @@ async function deployExecutorContracts(
       0, // lastExecutedSequence,
       chain.getWormholeChainId(),
       governanceDataSource.emitterChain,
-      `0x${governanceDataSource.emitterAddress}`
+      `0x${governanceDataSource.emitterAddress}`,
     )
     .encodeABI();
 
@@ -83,20 +83,20 @@ async function deployExecutorContracts(
 async function deployEntropyContracts(
   chain: EvmChain,
   config: DeploymentConfig,
-  executorAddr: string
+  executorAddr: string,
 ): Promise<string> {
   const entropyImplAddr = await deployIfNotCached(
     CACHE_FILE,
     chain,
     config,
     "EntropyUpgradable",
-    []
+    [],
   );
 
   const entropyImplContract = getWeb3Contract(
     config.jsonOutputDir,
     "EntropyUpgradable",
-    entropyImplAddr
+    entropyImplAddr,
   );
 
   const entropyInitData = entropyImplContract.methods
@@ -107,7 +107,7 @@ async function deployEntropyContracts(
       chain.isMainnet()
         ? ENTROPY_DEFAULT_PROVIDER.mainnet
         : ENTROPY_DEFAULT_PROVIDER.testnet,
-      true // prefillRequestStorage
+      true, // prefillRequestStorage
     )
     .encodeABI();
 
@@ -120,13 +120,13 @@ async function deployEntropyContracts(
     // NOTE: we are deploying a ERC1967Proxy when deploying executor
     // we need to provide a different cache key. As the `artifactname`
     // is same in both case which means the cache key will be same
-    `${chain.getId()}-ERC1967Proxy-ENTROPY`
+    `${chain.getId()}-ERC1967Proxy-ENTROPY`,
   );
 }
 
 async function topupEntropyAccountsIfNecessary(
   chain: EvmChain,
-  deploymentConfig: DeploymentConfig
+  deploymentConfig: DeploymentConfig,
 ) {
   const accounts: Array<[string, DefaultAddresses]> = [
     ["keeper", ENTROPY_DEFAULT_KEEPER],
@@ -153,13 +153,13 @@ async function main() {
   const wormholeContract = await getOrDeployWormholeContract(
     chain,
     deploymentConfig,
-    CACHE_FILE
+    CACHE_FILE,
   );
 
   await topupEntropyAccountsIfNecessary(chain, deploymentConfig);
 
   console.log(
-    `Deployment config: ${JSON.stringify(deploymentConfig, null, 2)}\n`
+    `Deployment config: ${JSON.stringify(deploymentConfig, null, 2)}\n`,
   );
 
   console.log(`Deploying entropy contracts on ${chain.getId()}...`);
@@ -167,12 +167,12 @@ async function main() {
   const executorAddr = await deployExecutorContracts(
     chain,
     deploymentConfig,
-    wormholeContract.address
+    wormholeContract.address,
   );
   const entropyAddr = await deployEntropyContracts(
     chain,
     deploymentConfig,
-    executorAddr
+    executorAddr,
   );
 
   if (deploymentConfig.saveContract) {
@@ -183,7 +183,7 @@ async function main() {
   }
 
   console.log(
-    `✅ Deployed entropy contracts on ${chain.getId()} at ${entropyAddr}\n\n`
+    `✅ Deployed entropy contracts on ${chain.getId()} at ${entropyAddr}\n\n`,
   );
 }
 

+ 10 - 10
contract_manager/scripts/deploy_evm_pricefeed_contracts.ts

@@ -29,7 +29,7 @@ const CACHE_FILE = ".cache-deploy-evm";
 const parser = yargs(hideBin(process.argv))
   .scriptName("deploy_evm_pricefeed_contracts.ts")
   .usage(
-    "Usage: $0 --std-output-dir <path/to/std-output-dir/> --private-key <private-key> --chain <chain0> --chain <chain1>"
+    "Usage: $0 --std-output-dir <path/to/std-output-dir/> --private-key <private-key> --chain <chain0> --chain <chain1>",
   )
   .options({
     ...COMMON_DEPLOY_OPTIONS,
@@ -50,25 +50,25 @@ const parser = yargs(hideBin(process.argv))
 async function deployPriceFeedContracts(
   chain: EvmChain,
   config: DeploymentConfig,
-  wormholeAddr: string
+  wormholeAddr: string,
 ): Promise<string> {
   const pythImplAddr = await deployIfNotCached(
     CACHE_FILE,
     chain,
     config,
     "PythUpgradable",
-    []
+    [],
   );
 
   // Craft the init data for the proxy contract
   const { dataSources, governanceDataSource } = getDefaultDeploymentConfig(
-    config.type
+    config.type,
   );
 
   const pythImplContract = getWeb3Contract(
     config.jsonOutputDir,
     "PythUpgradable",
-    pythImplAddr
+    pythImplAddr,
   );
 
   const pythInitData = pythImplContract.methods
@@ -80,7 +80,7 @@ async function deployPriceFeedContracts(
       "0x" + governanceDataSource.emitterAddress,
       0, // governanceInitialSequence
       config.validTimePeriodSeconds,
-      config.singleUpdateFeeInWei
+      config.singleUpdateFeeInWei,
     )
     .encodeABI();
 
@@ -105,7 +105,7 @@ async function main() {
   };
 
   console.log(
-    `Deployment config: ${JSON.stringify(deploymentConfig, null, 2)}\n`
+    `Deployment config: ${JSON.stringify(deploymentConfig, null, 2)}\n`,
   );
 
   const chainNames = argv.chain;
@@ -118,13 +118,13 @@ async function main() {
     const wormholeContract = await getOrDeployWormholeContract(
       chain,
       deploymentConfig,
-      CACHE_FILE
+      CACHE_FILE,
     );
 
     const priceFeedAddr = await deployPriceFeedContracts(
       chain,
       deploymentConfig,
-      wormholeContract.address
+      wormholeContract.address,
     );
 
     if (deploymentConfig.saveContract) {
@@ -135,7 +135,7 @@ async function main() {
     }
 
     console.log(
-      `✅ Deployed price feed contracts on ${chain.getId()} at ${priceFeedAddr}\n\n`
+      `✅ Deployed price feed contracts on ${chain.getId()} at ${priceFeedAddr}\n\n`,
     );
   }
 }

+ 13 - 13
contract_manager/scripts/deploy_evm_pulse_contracts.ts

@@ -32,7 +32,7 @@ const CACHE_FILE = ".cache-deploy-evm-pulse-contracts";
 const parser = yargs(hideBin(process.argv))
   .scriptName("deploy_evm_pulse_contracts.ts")
   .usage(
-    "Usage: $0 --std-output-dir <path/to/std-output-dir/> --private-key <private-key> --chain <chain> --default-provider <default-provider> --wormhole-addr <wormhole-addr>"
+    "Usage: $0 --std-output-dir <path/to/std-output-dir/> --private-key <private-key> --chain <chain> --default-provider <default-provider> --wormhole-addr <wormhole-addr>",
   )
   .options({
     ...COMMON_DEPLOY_OPTIONS,
@@ -46,7 +46,7 @@ const parser = yargs(hideBin(process.argv))
 async function deployPulseContracts(
   chain: EvmChain,
   config: DeploymentConfig,
-  executorAddr: string
+  executorAddr: string,
 ): Promise<string> {
   console.log("Deploying PulseUpgradeable on", chain.getId(), "...");
 
@@ -54,8 +54,8 @@ async function deployPulseContracts(
   const pulseArtifact = JSON.parse(
     fs.readFileSync(
       path.join(config.jsonOutputDir, "PulseUpgradeable.json"),
-      "utf8"
-    )
+      "utf8",
+    ),
   );
   console.log("PulseArtifact bytecode type:", typeof pulseArtifact.bytecode);
 
@@ -64,7 +64,7 @@ async function deployPulseContracts(
     chain,
     config,
     "PulseUpgradeable",
-    []
+    [],
   );
 
   console.log("PulseUpgradeable implementation deployed at:", pulseImplAddr);
@@ -72,7 +72,7 @@ async function deployPulseContracts(
   const pulseImplContract = getWeb3Contract(
     config.jsonOutputDir,
     "PulseUpgradeable",
-    pulseImplAddr
+    pulseImplAddr,
   );
 
   console.log("Preparing initialization data...");
@@ -87,7 +87,7 @@ async function deployPulseContracts(
         ? PULSE_DEFAULT_PROVIDER.mainnet
         : PULSE_DEFAULT_PROVIDER.testnet,
       true, // prefillRequestStorage
-      3600 // exclusivityPeriodSeconds - 1 hour
+      3600, // exclusivityPeriodSeconds - 1 hour
     )
     .encodeABI();
 
@@ -102,13 +102,13 @@ async function deployPulseContracts(
     // NOTE: we are deploying a ERC1967Proxy when deploying executor
     // we need to provide a different cache key. As the `artifactname`
     // is same in both case which means the cache key will be same
-    `${chain.getId()}-ERC1967Proxy-PULSE1`
+    `${chain.getId()}-ERC1967Proxy-PULSE1`,
   );
 }
 
 async function topupPulseAccountsIfNecessary(
   chain: EvmChain,
-  deploymentConfig: DeploymentConfig
+  deploymentConfig: DeploymentConfig,
 ) {
   const accounts: Array<[string, DefaultAddresses]> = [
     ["keeper", PULSE_DEFAULT_KEEPER],
@@ -141,13 +141,13 @@ async function main() {
   const wormholeContract = await getOrDeployWormholeContract(
     chain,
     deploymentConfig,
-    CACHE_FILE
+    CACHE_FILE,
   );
 
   await topupPulseAccountsIfNecessary(chain, deploymentConfig);
 
   console.log(
-    `Deployment config: ${JSON.stringify(deploymentConfig, null, 2)}\n`
+    `Deployment config: ${JSON.stringify(deploymentConfig, null, 2)}\n`,
   );
 
   console.log(`Deploying pulse contracts on ${chain.getId()}...`);
@@ -156,7 +156,7 @@ async function main() {
   const pulseAddr = await deployPulseContracts(
     chain,
     deploymentConfig,
-    executorAddr
+    executorAddr,
   );
 
   if (deploymentConfig.saveContract) {
@@ -167,7 +167,7 @@ async function main() {
   }
 
   console.log(
-    `✅ Deployed pulse contracts on ${chain.getId()} at ${pulseAddr}\n\n`
+    `✅ Deployed pulse contracts on ${chain.getId()} at ${pulseAddr}\n\n`,
   );
 }
 

+ 2 - 2
contract_manager/scripts/entropy-accept-admin-and-ownership.ts

@@ -5,7 +5,7 @@ import { DefaultStore, EvmChain, loadHotWallet } from "../src";
 const parser = yargs(hideBin(process.argv))
   .usage(
     "Creates governance proposal to accept pending admin or ownership transfer for Pyth entropy contracts.\n" +
-      "Usage: $0 --chain <chain_1> --chain <chain_2> --ops-key-path <ops_key_path>"
+      "Usage: $0 --chain <chain_1> --chain <chain_2> --ops-key-path <ops_key_path>",
   )
   .options({
     testnet: {
@@ -50,7 +50,7 @@ async function main() {
     throw new Error(
       `Some chains were not found ${selectedChains
         .map((chain) => chain.getId())
-        .toString()}`
+        .toString()}`,
     );
   for (const chain of selectedChains) {
     if (chain.isMainnet() != selectedChains[0].isMainnet())

+ 3 - 3
contract_manager/scripts/entropy_debug_reveal.ts

@@ -7,7 +7,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Tries to reveal an entropy request with callback using the provided private key.\n" +
       "This can be used to manually debug why a callback was not triggered.\n" +
-      "Usage: $0 --chain <chain-id> --private-key <private-key> --sequence-number <sequence-number>"
+      "Usage: $0 --chain <chain-id> --private-key <private-key> --sequence-number <sequence-number>",
   )
   .options({
     chain: {
@@ -41,7 +41,7 @@ async function main() {
   const userRandomNumber = await contract.getUserRandomNumber(
     provider,
     sequenceNumber,
-    parseInt(request.blockNumber)
+    parseInt(request.blockNumber),
   );
   console.log("User random number: ", userRandomNumber);
   const revealUrl = providerInfo.uri + `/revelations/${sequenceNumber}`;
@@ -57,7 +57,7 @@ async function main() {
     providerRevelation,
     provider,
     sequenceNumber,
-    privateKey
+    privateKey,
   );
 }
 

+ 4 - 4
contract_manager/scripts/execute_vaas.ts

@@ -13,7 +13,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Tries to execute all vaas on a vault.\n" +
       "Useful for batch upgrades.\n" +
-      "Usage: $0 --vault <mainnet|devnet> --private-key <private-key> --offset <offset> [--dryrun]"
+      "Usage: $0 --vault <mainnet|devnet> --private-key <private-key> --offset <offset> [--dryrun]",
   )
   .options({
     vault: {
@@ -52,12 +52,12 @@ async function main() {
   console.log("Executing VAAs for vault", vault.getId());
   console.log(
     "Executing VAAs for emitter",
-    (await vault.getEmitter()).toBase58()
+    (await vault.getEmitter()).toBase58(),
   );
   const lastSequenceNumber = await vault.getLastSequenceNumber();
   const startSequenceNumber = lastSequenceNumber - argv.offset;
   console.log(
-    `Going from sequence number ${startSequenceNumber} to ${lastSequenceNumber}`
+    `Going from sequence number ${startSequenceNumber} to ${lastSequenceNumber}`,
   );
   for (
     let seqNumber = startSequenceNumber;
@@ -67,7 +67,7 @@ async function main() {
     const submittedWormholeMessage = new SubmittedWormholeMessage(
       await vault.getEmitter(),
       seqNumber,
-      vault.cluster
+      vault.cluster,
     );
     const vaa = await submittedWormholeMessage.fetchVaa();
     const decodedAction = decodeGovernancePayload(parseVaa(vaa).payload);

+ 6 - 8
contract_manager/scripts/fetch_account_balance.ts

@@ -25,16 +25,14 @@ type AccountBalance = {
 
 async function getBalance(
   chain: string,
-  privateKey: PrivateKey
+  privateKey: PrivateKey,
 ): Promise<AccountBalance | undefined> {
-  const address = await DefaultStore.chains[chain].getAccountAddress(
-    privateKey
-  );
+  const address =
+    await DefaultStore.chains[chain].getAccountAddress(privateKey);
 
   try {
-    const balance = await DefaultStore.chains[chain].getAccountBalance(
-      privateKey
-    );
+    const balance =
+      await DefaultStore.chains[chain].getAccountBalance(privateKey);
     return { chain, address, balance };
   } catch (e) {
     console.error(`Error fetching balance for ${chain}`, e);
@@ -51,7 +49,7 @@ async function main() {
   const privateKey = toPrivateKey(argv["private-key"]);
 
   const balances = await Promise.all(
-    chains.map((chain) => getBalance(chain, privateKey))
+    chains.map((chain) => getBalance(chain, privateKey)),
   );
 
   console.table(balances);

+ 2 - 2
contract_manager/scripts/fetch_fees.ts

@@ -47,11 +47,11 @@ async function main() {
           feeUsd = Number(fee.amount) * prices[fee.denom];
           totalFeeUsd += feeUsd;
           console.log(
-            `${contract.getId()} ${fee.amount} ${fee.denom} ($${feeUsd})`
+            `${contract.getId()} ${fee.amount} ${fee.denom} ($${feeUsd})`,
           );
         } else {
           console.log(
-            `${contract.getId()} ${fee.amount} ${fee.denom} ($ value unknown)`
+            `${contract.getId()} ${fee.amount} ${fee.denom} ($ value unknown)`,
           );
         }
       } catch (e) {

+ 2 - 2
contract_manager/scripts/generate_governance_set_fee_payload.ts

@@ -38,12 +38,12 @@ async function main() {
     const chain = DefaultStore.getChainOrThrow(setFeeEntry.chainName);
     const payload = chain.generateGovernanceSetFeePayload(
       setFeeEntry.fee,
-      setFeeEntry.exponent
+      setFeeEntry.exponent,
     );
     updatePayloads.push(payload);
     console.log(
       `Generated payload for chain ${setFeeEntry.chainName}:`,
-      payload.toString("hex")
+      payload.toString("hex"),
     );
   }
 

+ 2 - 2
contract_manager/scripts/generate_upgrade_near_contract_proposal.ts

@@ -6,7 +6,7 @@ import { NearChain } from "../src/chains";
 const parser = yargs(hideBin(process.argv))
   .usage(
     "Creates a governance proposal to upgrade the price feeds contract on Near.\n" +
-      "Usage: $0 --network <mainnet|testnet> --code-hash <hash> --ops-key-path <ops_key_path>\n"
+      "Usage: $0 --network <mainnet|testnet> --code-hash <hash> --ops-key-path <ops_key_path>\n",
   )
   .options({
     network: {
@@ -45,7 +45,7 @@ async function main() {
     throw new Error("invalid code hash format");
   }
   console.log(
-    `Upgrading contract on Near ${argv.network} to code hash: ${codeHash}`
+    `Upgrading contract on Near ${argv.network} to code hash: ${codeHash}`,
   );
 
   // Generate governance payload for the upgrade

+ 4 - 4
contract_manager/scripts/generate_upgrade_ton_contract_proposal.ts

@@ -12,7 +12,7 @@ const parser = yargs(hideBin(process.argv))
       "Usage: $0 --network <mainnet|testnet> --contract-address <address> --ops-key-path <ops_key_path>\n" +
       "Required environment variables:\n" +
       "  - ENV_TON_MAINNET_API_KEY: API key for TON mainnet\n" +
-      "  - ENV_TON_TESTNET_API_KEY: API key for TON testnet"
+      "  - ENV_TON_TESTNET_API_KEY: API key for TON testnet",
   )
   .options({
     network: {
@@ -44,7 +44,7 @@ async function main() {
   // Get the TON chain instance from DefaultStore based on network
   const chain = DefaultStore.getChainOrThrow(
     isMainnet ? "ton_mainnet" : "ton_testnet",
-    TonChain
+    TonChain,
   );
 
   const vault =
@@ -53,14 +53,14 @@ async function main() {
     ];
 
   console.log(
-    `Upgrading contract on TON ${argv.network} (Chain ID: ${chainId}, Wormhole Chain Name: ${wormholeChainName})`
+    `Upgrading contract on TON ${argv.network} (Chain ID: ${chainId}, Wormhole Chain Name: ${wormholeChainName})`,
   );
 
   // Read the compiled contract from the build directory
   // NOTE: Remember to rebuild contract_manager before running this script because it will also build the ton contract
   const compiledPath = path.resolve(
     __dirname,
-    "../../target_chains/ton/contracts/build/Main.compiled.json"
+    "../../target_chains/ton/contracts/build/Main.compiled.json",
   );
   const compiled = JSON.parse(fs.readFileSync(compiledPath, "utf8"));
   const newCodeHash = compiled.hash;

+ 3 - 3
contract_manager/scripts/get_entropy_registration.ts

@@ -39,12 +39,12 @@ async function main() {
 
     const commitmentMetadata = providerInfo.commitmentMetadata.replace(
       "0x",
-      ""
+      "",
     );
 
     // const binaryData = hexToBytes(commitmentMetadata);
     const metadata = deserializeCommitmentMetadata(
-      Buffer.from(commitmentMetadata, "hex")
+      Buffer.from(commitmentMetadata, "hex"),
     );
     console.log("=".repeat(100));
     console.log(`Fetched info for ${contract.getId()}`);
@@ -56,7 +56,7 @@ async function main() {
     console.log(`chainLength       : ${metadata.chainLength}`);
     console.log(`seed              : [${metadata.seed}]`);
     console.log(
-      `original seq no   : ${providerInfo.originalCommitmentSequenceNumber}`
+      `original seq no   : ${providerInfo.originalCommitmentSequenceNumber}`,
     );
   }
 }

+ 3 - 3
contract_manager/scripts/latency_entropy.ts

@@ -7,7 +7,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Requests and reveals a random number from an entropy contract while measuing the\n" +
       "latency between request submission and availablity of the provider revelation from fortuna.\n" +
-      "Usage: $0 --chain <chain-id> --private-key <private-key>"
+      "Usage: $0 --chain <chain-id> --private-key <private-key>",
   )
   .options({
     chain: {
@@ -30,7 +30,7 @@ async function main() {
   const requestResponse = await contract.requestRandomness(
     userRandomNumber,
     provider,
-    privateKey
+    privateKey,
   );
   console.log("Request tx hash: ", requestResponse.transactionHash);
   const startTime = Date.now();
@@ -50,7 +50,7 @@ async function main() {
         providerRevelation,
         provider,
         sequenceNumber,
-        privateKey
+        privateKey,
       );
       console.log("Reveal tx hash: ", revealResponse.transactionHash);
       break;

+ 5 - 5
contract_manager/scripts/latency_entropy_with_callback.ts

@@ -13,7 +13,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Requests a random number from an entropy contract and measures the\n" +
       "latency between request submission and fulfillment by the Fortuna keeper service.\n" +
-      "Usage: $0 --private-key <private-key> --chain <chain-id> | --all-chains <testnet|mainnet>"
+      "Usage: $0 --private-key <private-key> --chain <chain-id> | --all-chains <testnet|mainnet>",
   )
   .options({
     chain: {
@@ -32,7 +32,7 @@ const parser = yargs(hideBin(process.argv))
 
 async function testLatency(
   contract: EvmEntropyContract,
-  privateKey: PrivateKey
+  privateKey: PrivateKey,
 ) {
   const provider = await contract.getDefaultProvider();
   const userRandomNumber = contract.generateUserRandomNumber();
@@ -40,7 +40,7 @@ async function testLatency(
     userRandomNumber,
     provider,
     privateKey,
-    true // with callback
+    true, // with callback
   );
   console.log(`Request tx hash  : ${requestResponse.transactionHash}`);
   // Read the sequence number for the request from the transaction events.
@@ -69,7 +69,7 @@ async function testLatency(
     });
 
     const event = events.find(
-      (event) => event.returnValues.request[1] == sequenceNumber
+      (event) => event.returnValues.request[1] == sequenceNumber,
     );
 
     if (event !== undefined) {
@@ -79,7 +79,7 @@ async function testLatency(
       console.log(
         `Revealed after   : ${
           currentBlock - requestResponse.blockNumber
-        } blocks`
+        } blocks`,
       );
       break;
     }

+ 3 - 3
contract_manager/scripts/load_test_entropy.ts

@@ -7,7 +7,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Load tests the entropy contract using the EntropyTester contract with many requests in a single transaction\n" +
       "it does not monitor whether the callbacks are actually submitted or not.\n" +
-      "Usage: $0 --private-key <private-key> --chain <chain-id> --tester-address <tester-address>"
+      "Usage: $0 --private-key <private-key> --chain <chain-id> --tester-address <tester-address>",
   )
   .options({
     chain: {
@@ -72,7 +72,7 @@ async function main() {
   const transactionObject = testerContract.methods.batchRequests(
     provider,
     argv.successCount,
-    argv.revertCount
+    argv.revertCount,
   );
   const totalCount = argv.successCount + argv.revertCount;
   const result = await contract.chain.estiamteAndSendTransaction(
@@ -80,7 +80,7 @@ async function main() {
     {
       from: address,
       value: (fee * totalCount).toString(),
-    }
+    },
   );
   console.log("Submitted transaction ", result.transactionHash);
 }

+ 3 - 3
contract_manager/scripts/send_message_to_wormhole.ts

@@ -4,7 +4,7 @@ import { WormholeEmitter, loadHotWallet } from "../src/governance";
 
 const parser = yargs(hideBin(process.argv))
   .usage(
-    "Usage: $0 --cluster <cluster> --wallet-path <path_to_wallet_file> --message <message>"
+    "Usage: $0 --cluster <cluster> --wallet-path <path_to_wallet_file> --message <message>",
   )
   .options({
     cluster: {
@@ -38,14 +38,14 @@ async function main() {
   console.log(
     `Message sent. Emitter: ${submittedMessage.emitter.toBase58()}, Sequence Number: ${
       submittedMessage.sequenceNumber
-    }`
+    }`,
   );
   console.log(`Sleeping for 5 seconds to allow the message to be processed...`);
   await new Promise((resolve) => setTimeout(resolve, 5000));
   console.log(
     `Fetching VAA for message ${submittedMessage.emitter.toBase58()}, Sequence Number: ${
       submittedMessage.sequenceNumber
-    }...`
+    }...`,
   );
   const vaa = await submittedMessage.fetchVaa();
   console.log(`VAA: ${vaa.toString("hex")}`);

+ 5 - 5
contract_manager/scripts/sync_governance_vaas.ts

@@ -10,7 +10,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Tries to execute all vaas on a contract.\n" +
       "Useful for recently deployed contracts.\n" +
-      "Usage: $0 --contract <contract_id> --private-key <private-key>"
+      "Usage: $0 --contract <contract_id> --private-key <private-key>",
   )
   .options({
     contract: {
@@ -57,7 +57,7 @@ async function main() {
     matchedVault = mainnetVault;
   } else {
     throw new Error(
-      "can not find a multisig that matches the governance source of the contract"
+      "can not find a multisig that matches the governance source of the contract",
     );
   }
   let lastExecuted = await contract.getLastExecutedGovernanceSequence();
@@ -72,7 +72,7 @@ async function main() {
     const submittedWormholeMessage = new SubmittedWormholeMessage(
       await matchedVault.getEmitter(),
       lastExecuted + 1,
-      matchedVault.cluster
+      matchedVault.cluster,
     );
     let vaa: Buffer;
     try {
@@ -93,13 +93,13 @@ async function main() {
       console.log("executing vaa", lastExecuted + 1);
       await contract.executeGovernanceInstruction(
         toPrivateKey(argv["private-key"]),
-        vaa
+        vaa,
       );
     } else {
       console.log(
         `vaa is not for this chain (${
           contract.getChain().wormholeChainName
-        } != ${action.targetChainId}, skipping`
+        } != ${action.targetChainId}, skipping`,
       );
     }
     lastExecuted++;

+ 1 - 1
contract_manager/scripts/sync_wormhole_guardian_set.ts

@@ -79,7 +79,7 @@ async function main() {
         // }
 
         console.log(
-          `Current Guardianset for ${contract.getId()}: ${await wormhole.getCurrentGuardianSetIndex()}`
+          `Current Guardianset for ${contract.getId()}: ${await wormhole.getCurrentGuardianSetIndex()}`,
         );
 
         await wormhole.syncMainnetGuardianSets(privateKey);

+ 6 - 6
contract_manager/scripts/update_all_pricefeeds.ts

@@ -39,7 +39,7 @@ async function main() {
   const argv = await parser.argv;
   let priceFeedsMetadata: PriceFeedMetadata[] = [];
   const client = new HermesClient(
-    argv.endpoint || "https://hermes.pyth.network"
+    argv.endpoint || "https://hermes.pyth.network",
   );
   const contract = DefaultStore.contracts[argv.contract];
   const privateKey = toPrivateKey(argv["private-key"]);
@@ -56,8 +56,8 @@ async function main() {
   for (let i = 0; i < priceFeedIds.length; i += chunkSize) {
     console.log(
       `Processing chunk ${i / chunkSize + 1} of ${Math.ceil(
-        priceFeedIds.length / chunkSize
-      )}`
+        priceFeedIds.length / chunkSize,
+      )}`,
     );
     const chunk = priceFeedIds.slice(i, i + chunkSize);
     console.log(`length: ${chunk.length}`);
@@ -70,9 +70,9 @@ async function main() {
         updates.binary.data.map((update) =>
           encoding === "hex"
             ? Buffer.from(update, "hex")
-            : Buffer.from(update, "base64")
-        )
-      )
+            : Buffer.from(update, "base64"),
+        ),
+      ),
     );
   }
 }

+ 6 - 6
contract_manager/scripts/update_pricefeed.ts

@@ -5,7 +5,7 @@ import { PriceServiceConnection } from "@pythnetwork/price-service-client";
 
 const parser = yargs(hideBin(process.argv))
   .usage(
-    "Usage: $0 --contract <contract_id> --feed-id <feed-id> --private-key <private-key>"
+    "Usage: $0 --contract <contract_id> --feed-id <feed-id> --private-key <private-key>",
   )
   .options({
     contract: {
@@ -35,20 +35,20 @@ async function main() {
   if (!contract) {
     throw new Error(
       `Contract ${argv.contract} not found. Contracts found: ${Object.keys(
-        DefaultStore.contracts
-      )}`
+        DefaultStore.contracts,
+      )}`,
     );
   }
   const priceService = new PriceServiceConnection(
-    argv.endpoint || "https://hermes.pyth.network"
+    argv.endpoint || "https://hermes.pyth.network",
   );
   const vaas = await priceService.getLatestVaas(argv["feed-id"] as string[]);
   const privateKey = toPrivateKey(argv["private-key"]);
   console.log(
     await contract.executeUpdatePriceFeed(
       privateKey,
-      vaas.map((vaa) => Buffer.from(vaa, "base64"))
-    )
+      vaas.map((vaa) => Buffer.from(vaa, "base64")),
+    ),
   );
 }
 

+ 6 - 6
contract_manager/scripts/upgrade_evm_entropy_contracts.ts

@@ -17,7 +17,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Deploys a new Upgradeable contract for Executor or Entropy to a set of chains where Entropy is deployed and creates a governance proposal for it.\n" +
       `Uses a cache file to avoid deploying contracts twice\n` +
-      "Usage: $0 --chain <chain_1> --chain <chain_2> --private-key <private_key> --ops-key-path <ops_key_path> --std-output <std_output>"
+      "Usage: $0 --chain <chain_1> --chain <chain_2> --private-key <private_key> --ops-key-path <ops_key_path> --std-output <std_output>",
   )
   .options({
     ...COMMON_UPGRADE_OPTIONS,
@@ -75,12 +75,12 @@ async function main() {
               artifact["abi"],
               artifact["bytecode"],
               [],
-              2
+              2,
             );
-          }
+          },
         );
         console.log(
-          `Deployed contract at ${address} on ${contract.chain.getId()}`
+          `Deployed contract at ${address} on ${contract.chain.getId()}`,
         );
         const payload =
           argv["contract-type"] === "executor"
@@ -99,8 +99,8 @@ async function main() {
   if (failures.length > 0) {
     throw new Error(
       `Some chains could not be deployed: ${failures.join(
-        ", "
-      )}. Scroll up to see the errors from each chain.`
+        ", ",
+      )}. Scroll up to see the errors from each chain.`,
     );
   }
 

+ 4 - 4
contract_manager/scripts/upgrade_evm_pricefeed_contracts.ts

@@ -16,7 +16,7 @@ const parser = yargs(hideBin(process.argv))
   .usage(
     "Deploys a new PythUpgradable contract to a set of chains and creates a governance proposal for it.\n" +
       `Uses a cache file (${CACHE_FILE}) to avoid deploying contracts twice\n` +
-      "Usage: $0 --chain <chain_1> --chain <chain_2> --private-key <private_key> --ops-key-path <ops_key_path> --std-output <std_output>"
+      "Usage: $0 --chain <chain_1> --chain <chain_2> --private-key <private_key> --ops-key-path <ops_key_path> --std-output <std_output>",
   )
   .options(COMMON_UPGRADE_OPTIONS);
 
@@ -32,7 +32,7 @@ async function main() {
   console.log("Using cache file", CACHE_FILE);
   console.log(
     "Upgrading on chains",
-    selectedChains.map((c) => c.getId())
+    selectedChains.map((c) => c.getId()),
   );
 
   const payloads: Buffer[] = [];
@@ -44,12 +44,12 @@ async function main() {
         toPrivateKey(argv["private-key"]),
         artifact["abi"],
         artifact["bytecode"],
-        []
+        [],
       );
     });
     console.log(`Deployed contract at ${address} on ${chain.getId()}`);
     payloads.push(
-      chain.generateGovernanceUpgradePayload(address.replace("0x", ""))
+      chain.generateGovernanceUpgradePayload(address.replace("0x", "")),
     );
   }
 

+ 3 - 3
contract_manager/scripts/upgrade_ton_contract.ts

@@ -13,7 +13,7 @@ import { Cell } from "@ton/ton";
 const parser = yargs(hideBin(process.argv))
   .usage(
     "Upgrades the Pyth contract on TON and creates a governance proposal for it.\n" +
-      "Usage: $0 --contract <contract_name> --private-key <private_key>"
+      "Usage: $0 --contract <contract_name> --private-key <private_key>",
   )
   .options({
     contract: {
@@ -39,7 +39,7 @@ async function main() {
   // NOTE: Remember to rebuild contract_manager before running this script because it will also build the ton contract
   const compiledPath = path.resolve(
     __dirname,
-    "../../target_chains/ton/contracts/build/Main.compiled.json"
+    "../../target_chains/ton/contracts/build/Main.compiled.json",
   );
   const compiled = JSON.parse(fs.readFileSync(compiledPath, "utf8"));
   const newCode = Cell.fromHex(compiled.hex);
@@ -47,7 +47,7 @@ async function main() {
 
   const tx = await contract.upgradeContract(
     toPrivateKey(argv["private-key"]),
-    newCode
+    newCode,
   );
   console.log("Upgrade transaction:", tx);
 }

+ 2 - 2
contract_manager/scripts/upload_cosmwasm.ts

@@ -7,7 +7,7 @@ import { toPrivateKey } from "../src";
 
 const parser = yargs(hideBin(process.argv))
   .usage(
-    "Usage: $0 --code <path/to/artifact.wasm> --private-key <private-key> --chain <chain>"
+    "Usage: $0 --code <path/to/artifact.wasm> --private-key <private-key> --chain <chain>",
   )
   .options({
     code: {
@@ -33,7 +33,7 @@ async function main() {
   const { codeId } = await CosmWasmPriceFeedContract.storeCode(
     DefaultStore.chains[argv.chain] as CosmWasmChain,
     toPrivateKey(argv["private-key"]),
-    code
+    code,
   );
   console.log(`Successfully uploaded code with id ${codeId}`);
 }

+ 2 - 2
contract_manager/src/base.ts

@@ -101,7 +101,7 @@ export abstract class PriceFeedContract extends Storable {
    */
   abstract executeUpdatePriceFeed(
     senderPrivateKey: PrivateKey,
-    vaas: Buffer[]
+    vaas: Buffer[],
   ): Promise<TxResult>;
 
   /**
@@ -111,7 +111,7 @@ export abstract class PriceFeedContract extends Storable {
    */
   abstract executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult>;
 
   /**

+ 45 - 45
contract_manager/src/chains.ts

@@ -55,7 +55,7 @@ export function parseRpcUrl(rpcUrl: string): string {
       const envValue = process.env[envName];
       if (!envValue) {
         throw new Error(
-          `Missing env variable ${envName} required for this RPC: ${rpcUrl}`
+          `Missing env variable ${envName} required for this RPC: ${rpcUrl}`,
         );
       }
       rpcUrl = rpcUrl.replace(envMatch, envValue);
@@ -86,7 +86,7 @@ export abstract class Chain extends Storable {
     protected id: string,
     protected mainnet: boolean,
     wormholeChainName: string,
-    protected nativeToken: TokenId | undefined
+    protected nativeToken: TokenId | undefined,
   ) {
     super();
     this.wormholeChainName = wormholeChainName as ChainName;
@@ -119,7 +119,7 @@ export abstract class Chain extends Storable {
     return new SetFee(
       this.wormholeChainName,
       BigInt(fee),
-      BigInt(exponent)
+      BigInt(exponent),
     ).encode();
   }
 
@@ -136,11 +136,11 @@ export abstract class Chain extends Storable {
    * @param newValidStalePriceThreshold the new stale price threshold in seconds
    */
   generateGovernanceSetStalePriceThreshold(
-    newValidStalePriceThreshold: bigint
+    newValidStalePriceThreshold: bigint,
   ): Buffer {
     return new SetValidPeriod(
       this.wormholeChainName,
-      newValidStalePriceThreshold
+      newValidStalePriceThreshold,
     ).encode();
   }
 
@@ -175,7 +175,7 @@ export class GlobalChain extends Chain {
 
   generateGovernanceUpgradePayload(): Buffer {
     throw new Error(
-      "Can not create a governance message for upgrading contracts on all chains!"
+      "Can not create a governance message for upgrading contracts on all chains!",
     );
   }
 
@@ -214,7 +214,7 @@ export class CosmWasmChain extends Chain {
     public endpoint: string,
     public gasPrice: string,
     public prefix: string,
-    public feeDenom: string
+    public feeDenom: string,
   ) {
     super(id, mainnet, wormholeChainName, nativeToken);
   }
@@ -229,7 +229,7 @@ export class CosmWasmChain extends Chain {
       parsed.endpoint,
       parsed.gasPrice,
       parsed.prefix,
-      parsed.feeDenom
+      parsed.feeDenom,
     );
   }
 
@@ -260,18 +260,18 @@ export class CosmWasmChain extends Chain {
   }
 
   async getExecutor(
-    privateKey: PrivateKey
+    privateKey: PrivateKey,
   ): Promise<CosmwasmExecutor | InjectiveExecutor> {
     if (this.getId().indexOf("injective") > -1) {
       return InjectiveExecutor.fromPrivateKey(
         this.isMainnet() ? Network.Mainnet : Network.Testnet,
-        privateKey
+        privateKey,
       );
     }
     return new CosmwasmExecutor(
       this.endpoint,
       await CosmwasmExecutor.getSignerFromPrivateKey(privateKey, this.prefix),
-      this.gasPrice + this.feeDenom
+      this.gasPrice + this.feeDenom,
     );
   }
 
@@ -298,7 +298,7 @@ export class SuiChain extends Chain {
     mainnet: boolean,
     wormholeChainName: string,
     nativeToken: TokenId | undefined,
-    public rpcUrl: string
+    public rpcUrl: string,
   ) {
     super(id, mainnet, wormholeChainName, nativeToken);
   }
@@ -310,7 +310,7 @@ export class SuiChain extends Chain {
       parsed.mainnet,
       parsed.wormholeChainName,
       parsed.nativeToken,
-      parsed.rpcUrl
+      parsed.rpcUrl,
     );
   }
 
@@ -342,7 +342,7 @@ export class SuiChain extends Chain {
 
   async getAccountAddress(privateKey: PrivateKey): Promise<string> {
     const keypair = SuiEd25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(privateKey, "hex"))
+      new Uint8Array(Buffer.from(privateKey, "hex")),
     );
     return keypair.toSuiAddress();
   }
@@ -364,7 +364,7 @@ export class IotaChain extends Chain {
     mainnet: boolean,
     wormholeChainName: string,
     nativeToken: TokenId | undefined,
-    public rpcUrl: string
+    public rpcUrl: string,
   ) {
     super(id, mainnet, wormholeChainName, nativeToken);
   }
@@ -376,7 +376,7 @@ export class IotaChain extends Chain {
       parsed.mainnet,
       parsed.wormholeChainName,
       parsed.nativeToken,
-      parsed.rpcUrl
+      parsed.rpcUrl,
     );
   }
 
@@ -408,7 +408,7 @@ export class IotaChain extends Chain {
 
   async getAccountAddress(privateKey: PrivateKey): Promise<string> {
     const keypair = IotaEd25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(privateKey, "hex"))
+      new Uint8Array(Buffer.from(privateKey, "hex")),
     );
     return keypair.toIotaAddress();
   }
@@ -430,7 +430,7 @@ export class EvmChain extends Chain {
     mainnet: boolean,
     nativeToken: TokenId | undefined,
     private rpcUrl: string,
-    private networkId: number
+    private networkId: number,
   ) {
     // On EVM networks we use the chain id as the wormhole chain name
     super(id, mainnet, id, nativeToken);
@@ -450,7 +450,7 @@ export class EvmChain extends Chain {
       parsed.mainnet,
       parsed.nativeToken,
       parsed.rpcUrl,
-      parsed.networkId
+      parsed.networkId,
     );
   }
 
@@ -488,14 +488,14 @@ export class EvmChain extends Chain {
   generateExecutorPayload(
     executor: string,
     callAddress: string,
-    calldata: string
+    calldata: string,
   ): Buffer {
     return new EvmExecute(
       this.wormholeChainName,
       executor.replace("0x", ""),
       callAddress.replace("0x", ""),
       0n,
-      Buffer.from(calldata.replace("0x", ""), "hex")
+      Buffer.from(calldata.replace("0x", ""), "hex"),
     ).encode();
   }
 
@@ -529,7 +529,7 @@ export class EvmChain extends Chain {
 
   async estiamteAndSendTransaction(
     transactionObject: any, // eslint-disable-line @typescript-eslint/no-explicit-any
-    txParams: { from?: string; value?: string }
+    txParams: { from?: string; value?: string },
   ) {
     const GAS_ESTIMATE_MULTIPLIER = 2;
     const gasEstimate = await transactionObject.estimateGas(txParams);
@@ -556,7 +556,7 @@ export class EvmChain extends Chain {
     bytecode: string,
     deployArgs: any[], // eslint-disable-line  @typescript-eslint/no-explicit-any
     gasMultiplier = 1,
-    gasPriceMultiplier = 1
+    gasPriceMultiplier = 1,
   ): Promise<string> {
     const web3 = this.getWeb3();
     const signer = web3.eth.accounts.privateKeyToAccount(privateKey);
@@ -573,7 +573,7 @@ export class EvmChain extends Chain {
           BigInt(gas) * BigInt(gasPrice)
         } wei, but only have ${deployerBalance} wei. We need ${
           Number(gasDiff) / 10 ** 18
-        } ETH more.`
+        } ETH more.`,
       );
     }
 
@@ -601,7 +601,7 @@ export class EvmChain extends Chain {
   async getAccountBalance(privateKey: PrivateKey): Promise<number> {
     const web3 = this.getWeb3();
     const balance = await web3.eth.getBalance(
-      await this.getAccountAddress(privateKey)
+      await this.getAccountAddress(privateKey),
     );
     return Number(balance) / 10 ** 18;
   }
@@ -615,7 +615,7 @@ export class AptosChain extends Chain {
     mainnet: boolean,
     wormholeChainName: string,
     nativeToken: TokenId | undefined,
-    public rpcUrl: string
+    public rpcUrl: string,
   ) {
     super(id, mainnet, wormholeChainName, nativeToken);
   }
@@ -653,13 +653,13 @@ export class AptosChain extends Chain {
       parsed.mainnet,
       parsed.wormholeChainName,
       parsed.nativeToken,
-      parsed.rpcUrl
+      parsed.rpcUrl,
     );
   }
 
   async getAccountAddress(privateKey: PrivateKey): Promise<string> {
     const account = new AptosAccount(
-      new Uint8Array(Buffer.from(privateKey, "hex"))
+      new Uint8Array(Buffer.from(privateKey, "hex")),
     );
     return account.address().toString();
   }
@@ -667,7 +667,7 @@ export class AptosChain extends Chain {
   async getAccountBalance(privateKey: PrivateKey): Promise<number> {
     const client = this.getClient();
     const account = new AptosAccount(
-      new Uint8Array(Buffer.from(privateKey, "hex"))
+      new Uint8Array(Buffer.from(privateKey, "hex")),
     );
     const coinClient = new CoinClient(client);
     return Number(await coinClient.checkBalance(account)) / 10 ** 8;
@@ -675,18 +675,18 @@ export class AptosChain extends Chain {
 
   async sendTransaction(
     senderPrivateKey: PrivateKey,
-    txPayload: TxnBuilderTypes.TransactionPayloadEntryFunction
+    txPayload: TxnBuilderTypes.TransactionPayloadEntryFunction,
   ): Promise<TxResult> {
     const client = this.getClient();
     const sender = new AptosAccount(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
     const result = await client.generateSignSubmitWaitForTransaction(
       sender,
       txPayload,
       {
         maxGasAmount: BigInt(30000),
-      }
+      },
     );
     return { id: result.hash, info: result };
   }
@@ -700,7 +700,7 @@ export class FuelChain extends Chain {
     mainnet: boolean,
     wormholeChainName: string,
     nativeToken: TokenId | undefined,
-    public gqlUrl: string
+    public gqlUrl: string,
   ) {
     super(id, mainnet, wormholeChainName, nativeToken);
   }
@@ -744,7 +744,7 @@ export class FuelChain extends Chain {
       parsed.mainnet,
       parsed.wormholeChainName,
       parsed.nativeToken,
-      parsed.gqlUrl
+      parsed.gqlUrl,
     );
   }
 
@@ -767,7 +767,7 @@ export class StarknetChain extends Chain {
     id: string,
     mainnet: boolean,
     wormholeChainName: string,
-    public rpcUrl: string
+    public rpcUrl: string,
   ) {
     super(id, mainnet, wormholeChainName, undefined);
   }
@@ -792,7 +792,7 @@ export class StarknetChain extends Chain {
       parsed.id,
       parsed.mainnet,
       parsed.wormholeChainName,
-      parsed.rpcUrl
+      parsed.rpcUrl,
     );
   }
 
@@ -856,7 +856,7 @@ export class TonChain extends Chain {
     mainnet: boolean,
     wormholeChainName: string,
     nativeToken: TokenId | undefined,
-    private rpcUrl: string
+    private rpcUrl: string,
   ) {
     super(id, mainnet, wormholeChainName, nativeToken);
   }
@@ -876,7 +876,7 @@ export class TonChain extends Chain {
   async getContract(address: string): Promise<OpenedContract<PythContract>> {
     const client = await this.getClient();
     const contract = client.open(
-      PythContract.createFromAddress(Address.parse(address))
+      PythContract.createFromAddress(Address.parse(address)),
     );
     return contract;
   }
@@ -934,7 +934,7 @@ export class TonChain extends Chain {
       parsed.mainnet,
       parsed.wormholeChainName,
       parsed.nativeToken,
-      parsed.rpcUrl
+      parsed.rpcUrl,
     );
   }
 
@@ -960,7 +960,7 @@ export class NearChain extends Chain {
     wormholeChainName: string,
     nativeToken: TokenId | undefined,
     private rpcUrl: string,
-    private networkId: string
+    private networkId: string,
   ) {
     super(id, mainnet, wormholeChainName, nativeToken);
   }
@@ -973,7 +973,7 @@ export class NearChain extends Chain {
       parsed.wormholeChainName,
       parsed.nativeToken,
       parsed.rpcUrl,
-      parsed.networkId
+      parsed.networkId,
     );
   }
 
@@ -1003,10 +1003,10 @@ export class NearChain extends Chain {
   async getAccountAddress(privateKey: PrivateKey): Promise<string> {
     return Buffer.from(
       SuiEd25519Keypair.fromSecretKey(
-        new Uint8Array(Buffer.from(privateKey, "hex"))
+        new Uint8Array(Buffer.from(privateKey, "hex")),
       )
         .getPublicKey()
-        .toRawBytes()
+        .toRawBytes(),
     ).toString("hex");
   }
 
@@ -1019,12 +1019,12 @@ export class NearChain extends Chain {
 
   async getNearAccount(
     accountId: string,
-    senderPrivateKey?: PrivateKey
+    senderPrivateKey?: PrivateKey,
   ): Promise<nearAPI.Account> {
     const keyStore = new nearAPI.keyStores.InMemoryKeyStore();
     if (typeof senderPrivateKey !== "undefined") {
       const key = bs58.encode(
-        new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+        new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
       );
       const keyPair = nearAPI.KeyPair.fromString(key);
       const address = await this.getAccountAddress(senderPrivateKey);

+ 20 - 17
contract_manager/src/contracts/aptos.ts

@@ -41,7 +41,7 @@ export class AptosWormholeContract extends WormholeContract {
     parsed: {
       type: string;
       address: string;
-    }
+    },
   ): AptosWormholeContract {
     if (parsed.type !== AptosWormholeContract.type)
       throw new Error("Invalid type");
@@ -50,7 +50,10 @@ export class AptosWormholeContract extends WormholeContract {
     return new AptosWormholeContract(chain, parsed.address);
   }
 
-  constructor(public chain: AptosChain, public address: string) {
+  constructor(
+    public chain: AptosChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -93,15 +96,15 @@ export class AptosWormholeContract extends WormholeContract {
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const txPayload = new TxnBuilderTypes.TransactionPayloadEntryFunction(
       TxnBuilderTypes.EntryFunction.natural(
         `${this.address}::guardian_set_upgrade`,
         "submit_vaa_entry",
         [],
-        [BCS.bcsSerializeBytes(vaa)]
-      )
+        [BCS.bcsSerializeBytes(vaa)],
+      ),
     );
     return this.chain.sendTransaction(senderPrivateKey, txPayload);
   }
@@ -121,7 +124,7 @@ export class AptosPriceFeedContract extends PriceFeedContract {
   constructor(
     public chain: AptosChain,
     public stateId: string,
-    public wormholeStateId: string
+    public wormholeStateId: string,
   ) {
     super();
   }
@@ -132,7 +135,7 @@ export class AptosPriceFeedContract extends PriceFeedContract {
       type: string;
       stateId: string;
       wormholeStateId: string;
-    }
+    },
   ): AptosPriceFeedContract {
     if (parsed.type !== AptosPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -141,21 +144,21 @@ export class AptosPriceFeedContract extends PriceFeedContract {
     return new AptosPriceFeedContract(
       chain,
       parsed.stateId,
-      parsed.wormholeStateId
+      parsed.wormholeStateId,
     );
   }
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const txPayload = new TxnBuilderTypes.TransactionPayloadEntryFunction(
       TxnBuilderTypes.EntryFunction.natural(
         `${this.stateId}::governance`,
         "execute_governance_instruction",
         [],
-        [BCS.bcsSerializeBytes(vaa)]
-      )
+        [BCS.bcsSerializeBytes(vaa)],
+      ),
     );
     return this.chain.sendTransaction(senderPrivateKey, txPayload);
   }
@@ -166,15 +169,15 @@ export class AptosPriceFeedContract extends PriceFeedContract {
 
   async executeUpdatePriceFeed(
     senderPrivateKey: PrivateKey,
-    vaas: Buffer[]
+    vaas: Buffer[],
   ): Promise<TxResult> {
     const txPayload = new TxnBuilderTypes.TransactionPayloadEntryFunction(
       TxnBuilderTypes.EntryFunction.natural(
         `${this.stateId}::pyth`,
         "update_price_feeds_with_funder",
         [],
-        [BCS.serializeVectorWithFunc(vaas, "serializeBytes")]
-      )
+        [BCS.serializeVectorWithFunc(vaas, "serializeBytes")],
+      ),
     );
     return this.chain.sendTransaction(senderPrivateKey, txPayload);
   }
@@ -264,7 +267,7 @@ export class AptosPriceFeedContract extends PriceFeedContract {
         emitterChain: Number(source.emitter_chain),
         emitterAddress: source.emitter_address.external_address.replace(
           "0x",
-          ""
+          "",
         ),
       };
     });
@@ -281,14 +284,14 @@ export class AptosPriceFeedContract extends PriceFeedContract {
       emitterChain: Number(data.source.emitter_chain),
       emitterAddress: data.source.emitter_address.external_address.replace(
         "0x",
-        ""
+        "",
       ),
     };
   }
 
   async getLastExecutedGovernanceSequence() {
     const data = (await this.findResource(
-      "LastExecutedGovernanceSequence"
+      "LastExecutedGovernanceSequence",
     )) as { sequence: string };
     return Number(data.sequence);
   }

+ 18 - 12
contract_manager/src/contracts/cosmwasm.ts

@@ -59,7 +59,7 @@ export class CosmWasmWormholeContract extends WormholeContract {
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): CosmWasmWormholeContract {
     if (parsed.type !== CosmWasmWormholeContract.type)
       throw new Error("Invalid type");
@@ -68,7 +68,10 @@ export class CosmWasmWormholeContract extends WormholeContract {
     return new CosmWasmWormholeContract(chain, parsed.address);
   }
 
-  constructor(public chain: CosmWasmChain, public address: string) {
+  constructor(
+    public chain: CosmWasmChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -100,13 +103,13 @@ export class CosmWasmWormholeContract extends WormholeContract {
 
     const guardianSet = JSON.parse(config[key])["addresses"];
     return guardianSet.map((entry: { bytes: string }) =>
-      Buffer.from(entry.bytes, "base64").toString("hex")
+      Buffer.from(entry.bytes, "base64").toString("hex"),
     );
   }
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const executor = await this.chain.getExecutor(senderPrivateKey);
     const result = await executor.executeContract({
@@ -129,7 +132,7 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
           emitterChain: Number(chain_id),
           emitterAddress: Buffer.from(emitter, "base64").toString("hex"),
         };
-      }
+      },
     );
   }
 
@@ -143,13 +146,16 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
     };
   }
 
-  constructor(public chain: CosmWasmChain, public address: string) {
+  constructor(
+    public chain: CosmWasmChain,
+    public address: string,
+  ) {
     super();
   }
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): CosmWasmPriceFeedContract {
     if (parsed.type !== CosmWasmPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -172,7 +178,7 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
   static async storeCode(
     chain: CosmWasmChain,
     privateKey: PrivateKey,
-    wasmPath: string
+    wasmPath: string,
   ) {
     const contractBytes = readFileSync(wasmPath);
     const executor = await chain.getExecutor(privateKey);
@@ -190,7 +196,7 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
     chain: CosmWasmChain,
     codeId: number,
     config: DeploymentConfig,
-    privateKey: PrivateKey
+    privateKey: PrivateKey,
   ): Promise<CosmWasmPriceFeedContract> {
     const executor = await chain.getExecutor(privateKey);
     const result = await executor.instantiateContract({
@@ -276,7 +282,7 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
 
   equalDataSources(
     dataSources1: WormholeSource[],
-    dataSources2: WormholeSource[]
+    dataSources2: WormholeSource[],
   ): boolean {
     if (dataSources1.length !== dataSources2.length) return false;
     for (let i = 0; i < dataSources1.length; i++) {
@@ -368,7 +374,7 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
     const client = await CosmWasmClient.connect(this.chain.endpoint);
     const coin = await client.getBalance(
       this.address,
-      this.getChain().feeDenom
+      this.getChain().feeDenom,
     );
     return {
       amount: BigInt(coin.amount),
@@ -380,7 +386,7 @@ export class CosmWasmPriceFeedContract extends PriceFeedContract {
     const client = await CosmWasmClient.connect(this.chain.endpoint);
     const result = await client.queryContractSmart(
       this.address,
-      "get_valid_time_period"
+      "get_valid_time_period",
     );
     return Number(result.secs + result.nanos * 1e-9);
   }

+ 66 - 48
contract_manager/src/contracts/evm.ts

@@ -25,12 +25,12 @@ import {
  */
 export async function getCodeDigestWithoutAddress(
   web3: Web3,
-  address: string
+  address: string,
 ): Promise<string> {
   const code = await web3.eth.getCode(address);
   const strippedCode = code.replaceAll(
     address.toLowerCase().replace("0x", ""),
-    "0000000000000000000000000000000000000000"
+    "0000000000000000000000000000000000000000",
   );
   return Web3.utils.keccak256(strippedCode);
 }
@@ -57,7 +57,7 @@ export class EvmWormholeContract extends WormholeContract {
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): EvmWormholeContract {
     if (parsed.type !== EvmWormholeContract.type)
       throw new Error("Invalid type");
@@ -66,7 +66,10 @@ export class EvmWormholeContract extends WormholeContract {
     return new EvmWormholeContract(chain, parsed.address);
   }
 
-  constructor(public chain: EvmChain, public address: string) {
+  constructor(
+    public chain: EvmChain,
+    public address: string,
+  ) {
     super();
   }
   getContract(): Contract {
@@ -77,7 +80,7 @@ export class EvmWormholeContract extends WormholeContract {
   async getCurrentGuardianSetIndex(): Promise<number> {
     const wormholeContract = this.getContract();
     return Number(
-      await wormholeContract.methods.getCurrentGuardianSetIndex().call()
+      await wormholeContract.methods.getCurrentGuardianSetIndex().call(),
     );
   }
 
@@ -103,11 +106,11 @@ export class EvmWormholeContract extends WormholeContract {
     const { address } = web3.eth.accounts.wallet.add(senderPrivateKey);
     const wormholeContract = new web3.eth.Contract(WORMHOLE_ABI, this.address);
     const transactionObject = wormholeContract.methods.submitNewGuardianSet(
-      "0x" + vaa.toString("hex")
+      "0x" + vaa.toString("hex"),
     );
     const result = await this.chain.estiamteAndSendTransaction(
       transactionObject,
-      { from: address }
+      { from: address },
     );
     return { id: result.transactionHash, info: result };
   }
@@ -158,7 +161,10 @@ export const ENTROPY_DEFAULT_KEEPER = {
 export class EvmEntropyContract extends Storable {
   static type = "EvmEntropyContract";
 
-  constructor(public chain: EvmChain, public address: string) {
+  constructor(
+    public chain: EvmChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -181,7 +187,7 @@ export class EvmEntropyContract extends Storable {
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): EvmEntropyContract {
     if (parsed.type !== EvmEntropyContract.type)
       throw new Error("Invalid type");
@@ -205,20 +211,20 @@ export class EvmEntropyContract extends Storable {
   }
 
   async generateUpgradeEntropyContractPayload(
-    newImplementation: string
+    newImplementation: string,
   ): Promise<Buffer> {
     const contract = this.getContract();
     const data = contract.methods.upgradeTo(newImplementation).encodeABI();
     return this.chain.generateExecutorPayload(
       await this.getOwner(),
       this.address,
-      data
+      data,
     );
   }
 
   // Generates a payload to upgrade the executor contract, the owner of entropy contracts
   async generateUpgradeExecutorContractsPayload(
-    newImplementation: string
+    newImplementation: string,
   ): Promise<Buffer> {
     // Executor contract is the owner of entropy contract
     const executorAddr = await this.getOwner();
@@ -280,7 +286,7 @@ export class EvmEntropyContract extends Storable {
    */
   async getRequest(
     provider: string,
-    sequenceNumber: number
+    sequenceNumber: number,
   ): Promise<EntropyRequest> {
     const contract = this.getContract();
     return contract.methods.getRequest(provider, sequenceNumber).call();
@@ -298,7 +304,7 @@ export class EvmEntropyContract extends Storable {
   async getUserRandomNumber(
     provider: string,
     sequenceNumber: number,
-    block: number
+    block: number,
   ): Promise<string> {
     const contract = this.getContract();
     const result = await contract.getPastEvents("RequestedWithCallback", {
@@ -325,7 +331,7 @@ export class EvmEntropyContract extends Storable {
     providerRevelation: string,
     provider: string,
     sequenceNumber: number,
-    senderPrivateKey: PrivateKey
+    senderPrivateKey: PrivateKey,
   ) {
     const web3 = this.chain.getWeb3();
     // can not use `this.getContract()` because it uses another web3 instance without the wallet
@@ -335,7 +341,7 @@ export class EvmEntropyContract extends Storable {
       provider,
       sequenceNumber,
       userRandomNumber,
-      providerRevelation
+      providerRevelation,
     );
     return this.chain.estiamteAndSendTransaction(transactionObject, {
       from: address,
@@ -356,7 +362,7 @@ export class EvmEntropyContract extends Storable {
     userRandomNumber: string,
     provider: string,
     senderPrivateKey: PrivateKey,
-    withCallback?: boolean
+    withCallback?: boolean,
   ) {
     const web3 = this.chain.getWeb3();
     const userCommitment = web3.utils.keccak256(userRandomNumber);
@@ -368,14 +374,14 @@ export class EvmEntropyContract extends Storable {
     if (withCallback) {
       transactionObject = contract.methods.requestWithCallback(
         provider,
-        userCommitment
+        userCommitment,
       );
     } else {
       const useBlockHash = false;
       transactionObject = contract.methods.request(
         provider,
         userCommitment,
-        useBlockHash
+        useBlockHash,
       );
     }
 
@@ -390,7 +396,7 @@ export class EvmEntropyContract extends Storable {
     providerRevelation: string,
     provider: string,
     sequenceNumber: string,
-    senderPrivateKey: PrivateKey
+    senderPrivateKey: PrivateKey,
   ) {
     const web3 = this.chain.getWeb3();
     const contract = new web3.eth.Contract(EXTENDED_ENTROPY_ABI, this.address);
@@ -399,7 +405,7 @@ export class EvmEntropyContract extends Storable {
       provider,
       sequenceNumber,
       userRevelation,
-      providerRevelation
+      providerRevelation,
     );
     return this.chain.estiamteAndSendTransaction(transactionObject, {
       from: address,
@@ -410,7 +416,10 @@ export class EvmEntropyContract extends Storable {
 export class EvmExpressRelayContract extends Storable {
   static type = "EvmExpressRelayContract";
 
-  constructor(public chain: EvmChain, public address: string) {
+  constructor(
+    public chain: EvmChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -433,7 +442,7 @@ export class EvmExpressRelayContract extends Storable {
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): EvmExpressRelayContract {
     if (parsed.type !== EvmExpressRelayContract.type)
       throw new Error("Invalid type");
@@ -448,7 +457,7 @@ export class EvmExpressRelayContract extends Storable {
     return this.chain.generateExecutorPayload(
       await this.getOwner(),
       this.address,
-      data
+      data,
     );
   }
 
@@ -492,7 +501,10 @@ export class EvmExpressRelayContract extends Storable {
 }
 
 export class EvmExecutorContract {
-  constructor(public chain: EvmChain, public address: string) {}
+  constructor(
+    public chain: EvmChain,
+    public address: string,
+  ) {}
 
   getId(): string {
     return `${this.chain.getId()}_${this.address}`;
@@ -540,17 +552,17 @@ export class EvmExecutorContract {
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ) {
     const web3 = this.chain.getWeb3();
     const { address } = web3.eth.accounts.wallet.add(senderPrivateKey);
     const executorContract = new web3.eth.Contract(EXECUTOR_ABI, this.address);
     const transactionObject = executorContract.methods.execute(
-      "0x" + vaa.toString("hex")
+      "0x" + vaa.toString("hex"),
     );
     const result = await this.chain.estiamteAndSendTransaction(
       transactionObject,
-      { from: address }
+      { from: address },
     );
     return { id: result.transactionHash, info: result };
   }
@@ -559,13 +571,16 @@ export class EvmExecutorContract {
 export class EvmPriceFeedContract extends PriceFeedContract {
   static type = "EvmPriceFeedContract";
 
-  constructor(public chain: EvmChain, public address: string) {
+  constructor(
+    public chain: EvmChain,
+    public address: string,
+  ) {
     super();
   }
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): EvmPriceFeedContract {
     if (parsed.type !== EvmPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -640,7 +655,7 @@ export class EvmPriceFeedContract extends PriceFeedContract {
   async getLastExecutedGovernanceSequence() {
     const pythContract = await this.getContract();
     return Number(
-      await pythContract.methods.lastExecutedGovernanceSequence().call()
+      await pythContract.methods.lastExecutedGovernanceSequence().call(),
     );
   }
 
@@ -704,7 +719,7 @@ export class EvmPriceFeedContract extends PriceFeedContract {
           emitterChain: Number(chainId),
           emitterAddress: emitterAddress.replace("0x", ""),
         };
-      }
+      },
     );
   }
 
@@ -731,24 +746,24 @@ export class EvmPriceFeedContract extends PriceFeedContract {
       pythContract.methods.updatePriceFeeds(priceFeedUpdateData);
     const result = await this.chain.estiamteAndSendTransaction(
       transactionObject,
-      { from: address, value: updateFee }
+      { from: address, value: updateFee },
     );
     return { id: result.transactionHash, info: result };
   }
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ) {
     const web3 = this.chain.getWeb3();
     const { address } = web3.eth.accounts.wallet.add(senderPrivateKey);
     const pythContract = new web3.eth.Contract(EXTENDED_PYTH_ABI, this.address);
     const transactionObject = pythContract.methods.executeGovernanceInstruction(
-      "0x" + vaa.toString("hex")
+      "0x" + vaa.toString("hex"),
     );
     const result = await this.chain.estiamteAndSendTransaction(
       transactionObject,
-      { from: address }
+      { from: address },
     );
     return { id: result.transactionHash, info: result };
   }
@@ -778,7 +793,10 @@ export const PULSE_DEFAULT_KEEPER = {
 export class EvmPulseContract extends Storable {
   static type = "EvmPulseContract";
 
-  constructor(public chain: EvmChain, public address: string) {
+  constructor(
+    public chain: EvmChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -801,7 +819,7 @@ export class EvmPulseContract extends Storable {
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): EvmPulseContract {
     if (parsed.type !== EvmPulseContract.type) throw new Error("Invalid type");
     if (!(chain instanceof EvmChain))
@@ -889,7 +907,7 @@ export class EvmPulseContract extends Storable {
     senderPrivateKey: PrivateKey,
     publishTime: number,
     priceIds: string[],
-    callbackGasLimit: number
+    callbackGasLimit: number,
   ) {
     const web3 = this.chain.getWeb3();
     const { address } = web3.eth.accounts.wallet.add(senderPrivateKey);
@@ -899,12 +917,12 @@ export class EvmPulseContract extends Storable {
     const transactionObject = contract.methods.requestPriceUpdatesWithCallback(
       publishTime,
       priceIds,
-      callbackGasLimit
+      callbackGasLimit,
     );
 
     const result = await this.chain.estiamteAndSendTransaction(
       transactionObject,
-      { from: address, value: fee }
+      { from: address, value: fee },
     );
     return { id: result.transactionHash, info: result };
   }
@@ -913,7 +931,7 @@ export class EvmPulseContract extends Storable {
     senderPrivateKey: PrivateKey,
     sequenceNumber: number,
     updateData: string[],
-    priceIds: string[]
+    priceIds: string[],
   ) {
     const web3 = this.chain.getWeb3();
     const { address } = web3.eth.accounts.wallet.add(senderPrivateKey);
@@ -922,12 +940,12 @@ export class EvmPulseContract extends Storable {
     const transactionObject = contract.methods.executeCallback(
       sequenceNumber,
       updateData,
-      priceIds
+      priceIds,
     );
 
     const result = await this.chain.estiamteAndSendTransaction(
       transactionObject,
-      { from: address }
+      { from: address },
     );
     return { id: result.transactionHash, info: result };
   }
@@ -939,7 +957,7 @@ export class EvmPulseContract extends Storable {
     return this.chain.generateExecutorPayload(
       await this.getOwner(),
       this.address,
-      data
+      data,
     );
   }
 
@@ -949,12 +967,12 @@ export class EvmPulseContract extends Storable {
     return this.chain.generateExecutorPayload(
       await this.getOwner(),
       this.address,
-      data
+      data,
     );
   }
 
   async generateSetExclusivityPeriodPayload(
-    periodSeconds: number
+    periodSeconds: number,
   ): Promise<Buffer> {
     const contract = this.getContract();
     const data = contract.methods
@@ -963,7 +981,7 @@ export class EvmPulseContract extends Storable {
     return this.chain.generateExecutorPayload(
       await this.getOwner(),
       this.address,
-      data
+      data,
     );
   }
 }

+ 16 - 10
contract_manager/src/contracts/fuel.ts

@@ -44,7 +44,7 @@ export class FuelWormholeContract extends WormholeContract {
     parsed: {
       type: string;
       address: string;
-    }
+    },
   ): FuelWormholeContract {
     if (parsed.type !== FuelWormholeContract.type)
       throw new Error("Invalid type");
@@ -53,7 +53,10 @@ export class FuelWormholeContract extends WormholeContract {
     return new FuelWormholeContract(chain, parsed.address);
   }
 
-  constructor(public chain: FuelChain, public address: string) {
+  constructor(
+    public chain: FuelChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -63,7 +66,7 @@ export class FuelWormholeContract extends WormholeContract {
     return new Contract(
       this.address,
       FuelContractAbi,
-      wallet ? (wallet as Account) : provider
+      wallet ? (wallet as Account) : provider,
     );
   }
 
@@ -92,7 +95,7 @@ export class FuelWormholeContract extends WormholeContract {
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const wallet = await this.chain.getWallet(senderPrivateKey);
     const contract = await this.getContract(wallet);
@@ -112,13 +115,16 @@ export class FuelWormholeContract extends WormholeContract {
 export class FuelPriceFeedContract extends PriceFeedContract {
   static type = "FuelPriceFeedContract";
 
-  constructor(public chain: FuelChain, public address: string) {
+  constructor(
+    public chain: FuelChain,
+    public address: string,
+  ) {
     super();
   }
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): FuelPriceFeedContract {
     if (parsed.type !== FuelPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -143,7 +149,7 @@ export class FuelPriceFeedContract extends PriceFeedContract {
     return new Contract(
       this.address,
       FuelContractAbi,
-      wallet ? (wallet as Account) : provider
+      wallet ? (wallet as Account) : provider,
     );
   }
 
@@ -160,7 +166,7 @@ export class FuelPriceFeedContract extends PriceFeedContract {
     const pythContract = await this.getContract();
     return Number(
       (await pythContract.functions.last_executed_governance_sequence().get())
-        .value
+        .value,
     );
   }
 
@@ -234,7 +240,7 @@ export class FuelPriceFeedContract extends PriceFeedContract {
           emitterChain: chain_id,
           emitterAddress: emitter_address.replace("0x", ""),
         };
-      }
+      },
     );
   }
 
@@ -270,7 +276,7 @@ export class FuelPriceFeedContract extends PriceFeedContract {
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ) {
     const wallet = await this.chain.getWallet(senderPrivateKey);
     const contract = await this.getContract(wallet);

+ 30 - 27
contract_manager/src/contracts/iota.ts

@@ -25,19 +25,19 @@ export class IotaPriceFeedContract extends PriceFeedContract {
   constructor(
     public chain: IotaChain,
     public stateId: string,
-    public wormholeStateId: string
+    public wormholeStateId: string,
   ) {
     super();
     this.client = new IotaPythClient(
       this.getProvider(),
       this.stateId,
-      this.wormholeStateId
+      this.wormholeStateId,
     );
   }
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; stateId: string; wormholeStateId: string }
+    parsed: { type: string; stateId: string; wormholeStateId: string },
   ): IotaPriceFeedContract {
     if (parsed.type !== IotaPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -46,7 +46,7 @@ export class IotaPriceFeedContract extends PriceFeedContract {
     return new IotaPriceFeedContract(
       chain,
       parsed.stateId,
-      parsed.wormholeStateId
+      parsed.wormholeStateId,
     );
   }
 
@@ -118,12 +118,12 @@ export class IotaPriceFeedContract extends PriceFeedContract {
     });
     if (!priceInfo.data || !priceInfo.data.content) {
       throw new Error(
-        `Price feed ID ${priceInfoObjectId} in price table but object not found!!`
+        `Price feed ID ${priceInfoObjectId} in price table but object not found!!`,
       );
     }
     if (priceInfo.data.content.dataType !== "moveObject") {
       throw new Error(
-        `Expected ${priceInfoObjectId} to be a moveObject (PriceInfoObject)`
+        `Expected ${priceInfoObjectId} to be a moveObject (PriceInfoObject)`,
       );
     }
     return {
@@ -131,12 +131,12 @@ export class IotaPriceFeedContract extends PriceFeedContract {
         // eslint-disable-next-line @typescript-eslint/ban-ts-comment
         // @ts-ignore
         priceInfo.data.content.fields.price_info.fields.price_feed.fields
-          .ema_price
+          .ema_price,
       ),
       price: await this.parsePrice(
         // eslint-disable-next-line @typescript-eslint/ban-ts-comment
         // @ts-ignore
-        priceInfo.data.content.fields.price_info.fields.price_feed.fields.price
+        priceInfo.data.content.fields.price_info.fields.price_feed.fields.price,
       ),
     };
   }
@@ -153,7 +153,7 @@ export class IotaPriceFeedContract extends PriceFeedContract {
     const verificationReceipt = await this.getVaaVerificationReceipt(
       tx,
       packageId,
-      vaa
+      vaa,
     );
 
     tx.moveCall({
@@ -175,24 +175,24 @@ export class IotaPriceFeedContract extends PriceFeedContract {
   async executeUpdatePriceFeedWithFeeds(
     senderPrivateKey: string,
     vaas: Buffer[],
-    feedIds: string[]
+    feedIds: string[],
   ): Promise<TxResult> {
     const tx = new Transaction();
     await this.client.updatePriceFeeds(tx, vaas, feedIds);
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
     const result = await this.executeTransaction(tx, keypair);
     return { id: result.digest, info: result };
   }
   async executeCreatePriceFeed(
     senderPrivateKey: string,
-    vaas: Buffer[]
+    vaas: Buffer[],
   ): Promise<TxResult> {
     const tx = new Transaction();
     await this.client.createPriceFeed(tx, vaas);
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
 
     const result = await this.executeTransaction(tx, keypair);
@@ -201,17 +201,17 @@ export class IotaPriceFeedContract extends PriceFeedContract {
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
     const tx = new Transaction();
     const packageId = await this.getPythPackageId();
     const verificationReceipt = await this.getVaaVerificationReceipt(
       tx,
       packageId,
-      vaa
+      vaa,
     );
 
     tx.moveCall({
@@ -227,14 +227,14 @@ export class IotaPriceFeedContract extends PriceFeedContract {
     vaa: Buffer,
     keypair: Ed25519Keypair,
     modules: number[][],
-    dependencies: string[]
+    dependencies: string[],
   ) {
     const tx = new Transaction();
     const packageId = await this.getPythPackageId();
     const verificationReceipt = await this.getVaaVerificationReceipt(
       tx,
       packageId,
-      vaa
+      vaa,
     );
 
     const [upgradeTicket] = tx.moveCall({
@@ -268,7 +268,7 @@ export class IotaPriceFeedContract extends PriceFeedContract {
   async getVaaVerificationReceipt(
     tx: Transaction,
     packageId: string,
-    vaa: Buffer
+    vaa: Buffer,
   ) {
     const wormholePackageId = await this.getWormholePackageId();
 
@@ -330,7 +330,7 @@ export class IotaPriceFeedContract extends PriceFeedContract {
     });
     if (!result.data || !result.data.content) {
       throw new Error(
-        "Data Sources not found, contract may not be initialized"
+        "Data Sources not found, contract may not be initialized",
       );
     }
     if (result.data.content.dataType !== "moveObject") {
@@ -350,10 +350,10 @@ export class IotaPriceFeedContract extends PriceFeedContract {
         return {
           emitterChain: Number(fields.emitter_chain),
           emitterAddress: Buffer.from(
-            fields.emitter_address.fields.value.fields.data
+            fields.emitter_address.fields.value.fields.data,
           ).toString("hex"),
         };
-      }
+      },
     );
   }
 
@@ -431,7 +431,7 @@ export class IotaWormholeContract extends WormholeContract {
       type: string;
       address: string;
       stateId: string;
-    }
+    },
   ): IotaWormholeContract {
     if (parsed.type !== IotaWormholeContract.type)
       throw new Error("Invalid type");
@@ -440,7 +440,10 @@ export class IotaWormholeContract extends WormholeContract {
     return new IotaWormholeContract(chain, parsed.stateId);
   }
 
-  constructor(public chain: IotaChain, public stateId: string) {
+  constructor(
+    public chain: IotaChain,
+    public stateId: string,
+  ) {
     super();
     this.client = new IotaPythClient(
       this.chain.getProvider(),
@@ -449,7 +452,7 @@ export class IotaWormholeContract extends WormholeContract {
       // so there is no Pyth contract here, passing empty string to type-
       // check.
       "",
-      this.stateId
+      this.stateId,
     );
   }
 
@@ -480,7 +483,7 @@ export class IotaWormholeContract extends WormholeContract {
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const tx = new Transaction();
     const coreObjectId = this.stateId;
@@ -517,7 +520,7 @@ export class IotaWormholeContract extends WormholeContract {
     });
 
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
     const result = await this.executeTransaction(tx, keypair);
     return { id: result.digest, info: result };

+ 18 - 15
contract_manager/src/contracts/near.ts

@@ -14,7 +14,10 @@ import { WormholeContract } from "./wormhole";
 export class NearWormholeContract extends WormholeContract {
   static type = "NearWormholeContract";
 
-  constructor(public chain: NearChain, public address: string) {
+  constructor(
+    public chain: NearChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -32,7 +35,7 @@ export class NearWormholeContract extends WormholeContract {
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): NearWormholeContract {
     if (parsed.type !== NearWormholeContract.type)
       throw new Error("Invalid type");
@@ -51,12 +54,12 @@ export class NearWormholeContract extends WormholeContract {
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const senderAddress = await this.chain.getAccountAddress(senderPrivateKey);
     const account = await this.chain.getNearAccount(
       senderAddress,
-      senderPrivateKey
+      senderPrivateKey,
     );
     const outcome = await account.functionCall({
       contractId: this.address,
@@ -70,17 +73,17 @@ export class NearWormholeContract extends WormholeContract {
 
   getCurrentGuardianSetIndex(): Promise<number> {
     throw new Error(
-      "near wormhole contract doesn't implement getCurrentGuardianSetIndex method"
+      "near wormhole contract doesn't implement getCurrentGuardianSetIndex method",
     );
   }
   getChainId(): Promise<number> {
     throw new Error(
-      "near wormhole contract doesn't implement getChainId method"
+      "near wormhole contract doesn't implement getChainId method",
     );
   }
   getGuardianSet(): Promise<string[]> {
     throw new Error(
-      "near wormhole contract doesn't implement getGuardianSet method"
+      "near wormhole contract doesn't implement getGuardianSet method",
     );
   }
 }
@@ -92,7 +95,7 @@ export class NearPriceFeedContract extends PriceFeedContract {
     public chain: NearChain,
     public address: string,
     public governanceDataSource: DataSource,
-    public lastExecutedGovernanceSequence: number
+    public lastExecutedGovernanceSequence: number,
   ) {
     super();
   }
@@ -128,7 +131,7 @@ export class NearPriceFeedContract extends PriceFeedContract {
       governanceDataSourceAddress: string;
       governanceDataSourceChain: number;
       lastExecutedGovernanceSequence: number;
-    }
+    },
   ): NearPriceFeedContract {
     if (parsed.type !== NearPriceFeedContract.type) {
       throw new Error("Invalid type");
@@ -143,12 +146,12 @@ export class NearPriceFeedContract extends PriceFeedContract {
         emitterAddress: parsed.governanceDataSourceAddress,
         emitterChain: parsed.governanceDataSourceChain,
       },
-      parsed.lastExecutedGovernanceSequence
+      parsed.lastExecutedGovernanceSequence,
     );
   }
 
   async getContractNearAccount(
-    senderPrivateKey?: PrivateKey
+    senderPrivateKey?: PrivateKey,
   ): Promise<nearAPI.Account> {
     return await this.chain.getNearAccount(this.address, senderPrivateKey);
   }
@@ -220,7 +223,7 @@ export class NearPriceFeedContract extends PriceFeedContract {
 
   async executeUpdatePriceFeed(
     senderPrivateKey: PrivateKey,
-    vaas: Buffer[]
+    vaas: Buffer[],
   ): Promise<TxResult> {
     if (vaas.length === 0) {
       throw new Error("no vaas specified");
@@ -228,7 +231,7 @@ export class NearPriceFeedContract extends PriceFeedContract {
     const senderAddress = await this.chain.getAccountAddress(senderPrivateKey);
     const account = await this.chain.getNearAccount(
       senderAddress,
-      senderPrivateKey
+      senderPrivateKey,
     );
     const results = [];
     for (const vaa of vaas) {
@@ -253,12 +256,12 @@ export class NearPriceFeedContract extends PriceFeedContract {
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const senderAddress = await this.chain.getAccountAddress(senderPrivateKey);
     const account = await this.chain.getNearAccount(
       senderAddress,
-      senderPrivateKey
+      senderPrivateKey,
     );
     const outcome = await account.functionCall({
       contractId: this.address,

+ 17 - 11
contract_manager/src/contracts/starknet.ts

@@ -36,7 +36,7 @@ export class StarknetWormholeContract extends WormholeContract {
     parsed: {
       type: string;
       address: string;
-    }
+    },
   ): StarknetWormholeContract {
     if (parsed.type !== StarknetWormholeContract.type)
       throw new Error("Invalid type");
@@ -45,7 +45,10 @@ export class StarknetWormholeContract extends WormholeContract {
     return new StarknetWormholeContract(chain, parsed.address);
   }
 
-  constructor(public chain: StarknetChain, public address: string) {
+  constructor(
+    public chain: StarknetChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -74,7 +77,7 @@ export class StarknetWormholeContract extends WormholeContract {
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const senderAddress = await this.chain.getAccountAddress(senderPrivateKey);
     const provider = this.chain.getProvider();
@@ -82,7 +85,7 @@ export class StarknetWormholeContract extends WormholeContract {
     const account = new Account(
       provider,
       "0x" + senderAddress,
-      "0x" + senderPrivateKey
+      "0x" + senderPrivateKey,
     );
     contract.connect(account);
 
@@ -96,7 +99,10 @@ export class StarknetWormholeContract extends WormholeContract {
 export class StarknetPriceFeedContract extends PriceFeedContract {
   static type = "StarknetPriceFeedContract";
 
-  constructor(public chain: StarknetChain, public address: string) {
+  constructor(
+    public chain: StarknetChain,
+    public address: string,
+  ) {
     super();
   }
 
@@ -105,7 +111,7 @@ export class StarknetPriceFeedContract extends PriceFeedContract {
     parsed: {
       type: string;
       address: string;
-    }
+    },
   ): StarknetPriceFeedContract {
     if (parsed.type !== StarknetPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -172,7 +178,7 @@ export class StarknetPriceFeedContract extends PriceFeedContract {
    * @param token hex encoded token address without 0x prefix
    */
   async getBaseUpdateFeeInToken(
-    token: string
+    token: string,
   ): Promise<{ amount: string; denom?: string | undefined }> {
     token = "0x" + token;
     const provider = this.chain.getProvider();
@@ -205,7 +211,7 @@ export class StarknetPriceFeedContract extends PriceFeedContract {
 
   async executeUpdatePriceFeed(
     senderPrivateKey: PrivateKey,
-    vaas: Buffer[]
+    vaas: Buffer[],
   ): Promise<TxResult> {
     const senderAddress = await this.chain.getAccountAddress(senderPrivateKey);
     const provider = this.chain.getProvider();
@@ -213,7 +219,7 @@ export class StarknetPriceFeedContract extends PriceFeedContract {
     const account = new Account(
       provider,
       "0x" + senderAddress,
-      "0x" + senderPrivateKey
+      "0x" + senderPrivateKey,
     );
     contract.connect(account);
 
@@ -240,7 +246,7 @@ export class StarknetPriceFeedContract extends PriceFeedContract {
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const senderAddress = await this.chain.getAccountAddress(senderPrivateKey);
     const provider = this.chain.getProvider();
@@ -248,7 +254,7 @@ export class StarknetPriceFeedContract extends PriceFeedContract {
     const account = new Account(
       provider,
       "0x" + senderAddress,
-      "0x" + senderPrivateKey
+      "0x" + senderPrivateKey,
     );
     contract.connect(account);
 

+ 30 - 27
contract_manager/src/contracts/sui.ts

@@ -25,19 +25,19 @@ export class SuiPriceFeedContract extends PriceFeedContract {
   constructor(
     public chain: SuiChain,
     public stateId: string,
-    public wormholeStateId: string
+    public wormholeStateId: string,
   ) {
     super();
     this.client = new SuiPythClient(
       this.getProvider(),
       this.stateId,
-      this.wormholeStateId
+      this.wormholeStateId,
     );
   }
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; stateId: string; wormholeStateId: string }
+    parsed: { type: string; stateId: string; wormholeStateId: string },
   ): SuiPriceFeedContract {
     if (parsed.type !== SuiPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -46,7 +46,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
     return new SuiPriceFeedContract(
       chain,
       parsed.stateId,
-      parsed.wormholeStateId
+      parsed.wormholeStateId,
     );
   }
 
@@ -118,12 +118,12 @@ export class SuiPriceFeedContract extends PriceFeedContract {
     });
     if (!priceInfo.data || !priceInfo.data.content) {
       throw new Error(
-        `Price feed ID ${priceInfoObjectId} in price table but object not found!!`
+        `Price feed ID ${priceInfoObjectId} in price table but object not found!!`,
       );
     }
     if (priceInfo.data.content.dataType !== "moveObject") {
       throw new Error(
-        `Expected ${priceInfoObjectId} to be a moveObject (PriceInfoObject)`
+        `Expected ${priceInfoObjectId} to be a moveObject (PriceInfoObject)`,
       );
     }
     return {
@@ -131,12 +131,12 @@ export class SuiPriceFeedContract extends PriceFeedContract {
         // eslint-disable-next-line @typescript-eslint/ban-ts-comment
         // @ts-ignore
         priceInfo.data.content.fields.price_info.fields.price_feed.fields
-          .ema_price
+          .ema_price,
       ),
       price: await this.parsePrice(
         // eslint-disable-next-line @typescript-eslint/ban-ts-comment
         // @ts-ignore
-        priceInfo.data.content.fields.price_info.fields.price_feed.fields.price
+        priceInfo.data.content.fields.price_info.fields.price_feed.fields.price,
       ),
     };
   }
@@ -153,7 +153,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
     const verificationReceipt = await this.getVaaVerificationReceipt(
       tx,
       packageId,
-      vaa
+      vaa,
     );
 
     tx.moveCall({
@@ -175,24 +175,24 @@ export class SuiPriceFeedContract extends PriceFeedContract {
   async executeUpdatePriceFeedWithFeeds(
     senderPrivateKey: string,
     vaas: Buffer[],
-    feedIds: string[]
+    feedIds: string[],
   ): Promise<TxResult> {
     const tx = new Transaction();
     await this.client.updatePriceFeeds(tx, vaas, feedIds);
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
     const result = await this.executeTransaction(tx, keypair);
     return { id: result.digest, info: result };
   }
   async executeCreatePriceFeed(
     senderPrivateKey: string,
-    vaas: Buffer[]
+    vaas: Buffer[],
   ): Promise<TxResult> {
     const tx = new Transaction();
     await this.client.createPriceFeed(tx, vaas);
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
 
     const result = await this.executeTransaction(tx, keypair);
@@ -201,17 +201,17 @@ export class SuiPriceFeedContract extends PriceFeedContract {
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
     const tx = new Transaction();
     const packageId = await this.getPythPackageId();
     const verificationReceipt = await this.getVaaVerificationReceipt(
       tx,
       packageId,
-      vaa
+      vaa,
     );
 
     tx.moveCall({
@@ -227,14 +227,14 @@ export class SuiPriceFeedContract extends PriceFeedContract {
     vaa: Buffer,
     keypair: Ed25519Keypair,
     modules: number[][],
-    dependencies: string[]
+    dependencies: string[],
   ) {
     const tx = new Transaction();
     const packageId = await this.getPythPackageId();
     const verificationReceipt = await this.getVaaVerificationReceipt(
       tx,
       packageId,
-      vaa
+      vaa,
     );
 
     const [upgradeTicket] = tx.moveCall({
@@ -268,7 +268,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
   async getVaaVerificationReceipt(
     tx: Transaction,
     packageId: string,
-    vaa: Buffer
+    vaa: Buffer,
   ) {
     const wormholePackageId = await this.getWormholePackageId();
 
@@ -330,7 +330,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
     });
     if (!result.data || !result.data.content) {
       throw new Error(
-        "Data Sources not found, contract may not be initialized"
+        "Data Sources not found, contract may not be initialized",
       );
     }
     if (result.data.content.dataType !== "moveObject") {
@@ -350,10 +350,10 @@ export class SuiPriceFeedContract extends PriceFeedContract {
         return {
           emitterChain: Number(fields.emitter_chain),
           emitterAddress: Buffer.from(
-            fields.emitter_address.fields.value.fields.data
+            fields.emitter_address.fields.value.fields.data,
           ).toString("hex"),
         };
-      }
+      },
     );
   }
 
@@ -430,7 +430,7 @@ export class SuiWormholeContract extends WormholeContract {
     parsed: {
       type: string;
       stateId: string;
-    }
+    },
   ): SuiWormholeContract {
     if (parsed.type !== SuiWormholeContract.type)
       throw new Error("Invalid type");
@@ -439,7 +439,10 @@ export class SuiWormholeContract extends WormholeContract {
     return new SuiWormholeContract(chain, parsed.stateId);
   }
 
-  constructor(public chain: SuiChain, public stateId: string) {
+  constructor(
+    public chain: SuiChain,
+    public stateId: string,
+  ) {
     super();
     this.client = new SuiPythClient(
       this.chain.getProvider(),
@@ -448,7 +451,7 @@ export class SuiWormholeContract extends WormholeContract {
       // so there is no Pyth contract here, passing empty string to type-
       // check.
       "",
-      this.stateId
+      this.stateId,
     );
   }
 
@@ -479,7 +482,7 @@ export class SuiWormholeContract extends WormholeContract {
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const tx = new Transaction();
     const coreObjectId = this.stateId;
@@ -516,7 +519,7 @@ export class SuiWormholeContract extends WormholeContract {
     });
 
     const keypair = Ed25519Keypair.fromSecretKey(
-      new Uint8Array(Buffer.from(senderPrivateKey, "hex"))
+      new Uint8Array(Buffer.from(senderPrivateKey, "hex")),
     );
     const result = await this.executeTransaction(tx, keypair);
     return { id: result.digest, info: result };

+ 21 - 15
contract_manager/src/contracts/ton.ts

@@ -37,7 +37,7 @@ export class TonWormholeContract extends WormholeContract {
     parsed: {
       type: string;
       address: string;
-    }
+    },
   ): TonWormholeContract {
     if (parsed.type !== TonWormholeContract.type)
       throw new Error("Invalid type");
@@ -46,14 +46,17 @@ export class TonWormholeContract extends WormholeContract {
     return new TonWormholeContract(chain, parsed.address);
   }
 
-  constructor(public chain: TonChain, public address: string) {
+  constructor(
+    public chain: TonChain,
+    public address: string,
+  ) {
     super();
   }
 
   async getContract(): Promise<OpenedContract<PythContract>> {
     const provider = await this.chain.getContractProvider(this.address);
     const contract = provider.open(
-      PythContract.createFromAddress(Address.parse(this.address))
+      PythContract.createFromAddress(Address.parse(this.address)),
     );
 
     return contract;
@@ -80,7 +83,7 @@ export class TonWormholeContract extends WormholeContract {
 
   async upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const contract = await this.getContract();
     const provider = await this.chain.getContractProvider(this.address);
@@ -93,7 +96,7 @@ export class TonWormholeContract extends WormholeContract {
       wallet.address,
       BigInt(0),
       Buffer.alloc(0),
-      1
+      1,
     );
 
     return {
@@ -106,13 +109,16 @@ export class TonWormholeContract extends WormholeContract {
 export class TonPriceFeedContract extends PriceFeedContract {
   static type = "TonPriceFeedContract";
 
-  constructor(public chain: TonChain, public address: string) {
+  constructor(
+    public chain: TonChain,
+    public address: string,
+  ) {
     super();
   }
 
   static fromJson(
     chain: Chain,
-    parsed: { type: string; address: string }
+    parsed: { type: string; address: string },
   ): TonPriceFeedContract {
     if (parsed.type !== TonPriceFeedContract.type)
       throw new Error("Invalid type");
@@ -136,7 +142,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
   async getContract(): Promise<OpenedContract<PythContract>> {
     const provider = await this.chain.getContractProvider(this.address);
     const contract = provider.open(
-      PythContract.createFromAddress(Address.parse(this.address))
+      PythContract.createFromAddress(Address.parse(this.address)),
     );
 
     return contract;
@@ -225,7 +231,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
 
   async executeUpdatePriceFeed(
     senderPrivateKey: PrivateKey,
-    vaas: Buffer[]
+    vaas: Buffer[],
   ): Promise<TxResult> {
     const client = await this.chain.getClient();
     const contract = await this.getContract();
@@ -237,7 +243,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
       await contract.sendUpdatePriceFeeds(
         sender,
         vaa,
-        calculateUpdatePriceFeedsFee(BigInt(fee)) + BigInt(fee)
+        calculateUpdatePriceFeedsFee(BigInt(fee)) + BigInt(fee),
       );
     }
 
@@ -246,7 +252,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
     });
     const txHash = Buffer.from(txDetails[0].hash()).toString("hex");
     const txInfo = JSON.stringify(txDetails[0].description, (_, value) =>
-      typeof value === "bigint" ? value.toString() : value
+      typeof value === "bigint" ? value.toString() : value,
     );
 
     return {
@@ -257,7 +263,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
 
   async executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult> {
     const client = await this.chain.getClient();
     const contract = await this.getContract();
@@ -270,7 +276,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
     });
     const txHash = Buffer.from(txDetails[0].hash()).toString("hex");
     const txInfo = JSON.stringify(txDetails[0].description, (_, value) =>
-      typeof value === "bigint" ? value.toString() : value
+      typeof value === "bigint" ? value.toString() : value,
     );
 
     return {
@@ -281,7 +287,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
 
   async upgradeContract(
     senderPrivateKey: PrivateKey,
-    newCode: Cell
+    newCode: Cell,
   ): Promise<TxResult> {
     const client = await this.chain.getClient();
     const contract = await this.getContract();
@@ -294,7 +300,7 @@ export class TonPriceFeedContract extends PriceFeedContract {
     });
     const txHash = Buffer.from(txDetails[0].hash()).toString("hex");
     const txInfo = JSON.stringify(txDetails[0].description, (_, value) =>
-      typeof value === "bigint" ? value.toString() : value
+      typeof value === "bigint" ? value.toString() : value,
     );
 
     return {

+ 2 - 2
contract_manager/src/contracts/wormhole.ts

@@ -21,7 +21,7 @@ export abstract class WormholeContract extends Storable {
    */
   abstract upgradeGuardianSets(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult>;
 
   /**
@@ -40,7 +40,7 @@ export abstract class WormholeContract extends Storable {
       const vaa = MAINNET_UPGRADE_VAAS[i];
       const result = await this.upgradeGuardianSets(
         senderPrivateKey,
-        Buffer.from(vaa, "hex")
+        Buffer.from(vaa, "hex"),
       );
       console.log(`Submitted upgrade VAA ${i} with tx id ${result.id}`);
       // make sure the upgrade is complete before continuing

+ 6 - 6
contract_manager/src/executor.ts

@@ -17,14 +17,14 @@ interface GovernanceContract {
   getLastExecutedGovernanceSequence(): Promise<number>;
   executeGovernanceInstruction(
     senderPrivateKey: PrivateKey,
-    vaa: Buffer
+    vaa: Buffer,
   ): Promise<TxResult>;
 }
 
 async function executeForGovernanceContract(
   contract: GovernanceContract,
   vaa: Buffer,
-  senderPrivateKey: PrivateKey
+  senderPrivateKey: PrivateKey,
 ) {
   const parsedVaa = parseVaa(vaa);
   const governanceSource = await contract.getGovernanceDataSource();
@@ -37,13 +37,13 @@ async function executeForGovernanceContract(
       await contract.getLastExecutedGovernanceSequence();
     if (lastExecutedSequence >= parsedVaa.sequence) {
       console.log(
-        `Skipping on contract ${contract.getId()} as it was already executed`
+        `Skipping on contract ${contract.getId()} as it was already executed`,
       );
       return;
     }
     const { id } = await contract.executeGovernanceInstruction(
       senderPrivateKey,
-      vaa
+      vaa,
     );
     console.log(`Executed on contract ${contract.getId()} with txHash: ${id}`);
   }
@@ -67,13 +67,13 @@ export async function executeVaa(senderPrivateKey: PrivateKey, vaa: Buffer) {
       ) {
         const executorContract = new EvmExecutorContract(
           chain,
-          action.executorAddress
+          action.executorAddress,
         );
 
         await executeForGovernanceContract(
           executorContract,
           vaa,
-          senderPrivateKey
+          senderPrivateKey,
         );
       }
     }

+ 25 - 25
contract_manager/src/governance.ts

@@ -49,7 +49,7 @@ export class SubmittedWormholeMessage {
   constructor(
     public emitter: PublicKey,
     public sequenceNumber: number,
-    public cluster: PythCluster
+    public cluster: PythCluster,
   ) {}
 
   /**
@@ -63,20 +63,20 @@ export class SubmittedWormholeMessage {
   static async fromTransactionSignature(
     signature: string,
     cluster: PythCluster,
-    registry: SolanaRpcRegistry = getPythClusterApiUrl
+    registry: SolanaRpcRegistry = getPythClusterApiUrl,
   ): Promise<SubmittedWormholeMessage> {
     const connection = new Connection(registry(cluster), "confirmed");
 
     const txDetails = await connection.getParsedTransaction(signature);
     const sequenceLogPrefix = "Sequence: ";
     const txLog = txDetails?.meta?.logMessages?.find((s) =>
-      s.includes(sequenceLogPrefix)
+      s.includes(sequenceLogPrefix),
     );
 
     const sequenceNumber = Number(
       txLog?.substring(
-        txLog.indexOf(sequenceLogPrefix) + sequenceLogPrefix.length
-      )
+        txLog.indexOf(sequenceLogPrefix) + sequenceLogPrefix.length,
+      ),
     );
 
     const wormholeAddress = WORMHOLE_ADDRESS[cluster];
@@ -97,7 +97,7 @@ export class SubmittedWormholeMessage {
     });
     if (!emitter)
       throw new InvalidTransactionError(
-        "Could not find wormhole postMessage instruction"
+        "Could not find wormhole postMessage instruction",
       );
     return new SubmittedWormholeMessage(emitter, sequenceNumber, cluster);
   }
@@ -115,7 +115,7 @@ export class SubmittedWormholeMessage {
       const response = await fetch(
         `${rpcUrl}/v1/signed_vaa/1/${this.emitter.toBuffer().toString("hex")}/${
           this.sequenceNumber
-        }`
+        }`,
       );
       if (response.status === 404) {
         await new Promise((resolve) => setTimeout(resolve, 1000));
@@ -160,7 +160,7 @@ export class WormholeEmitter {
    */
   async sendMessage(
     payload: Buffer,
-    registry: SolanaRpcRegistry = getPythClusterApiUrl
+    registry: SolanaRpcRegistry = getPythClusterApiUrl,
   ) {
     const provider = new AnchorProvider(
       new Connection(registry(this.cluster), "confirmed"),
@@ -168,7 +168,7 @@ export class WormholeEmitter {
       {
         commitment: "confirmed",
         preflightCommitment: "confirmed",
-      }
+      },
     );
     const wormholeAddress = WORMHOLE_ADDRESS[this.cluster];
     if (!wormholeAddress) throw new Error(`Invalid cluster ${this.cluster}`);
@@ -188,7 +188,7 @@ export class WormholeEmitter {
     };
     const wormholeProgram = createWormholeProgramInterface(
       wormholeAddress,
-      provider
+      provider,
     );
     const transaction = new Transaction();
     transaction.add(
@@ -196,18 +196,18 @@ export class WormholeEmitter {
         fromPubkey: emitter,
         toPubkey: feeCollector,
         lamports: 1000,
-      })
+      }),
     );
     transaction.add(
       await wormholeProgram.methods
         .postMessage(0, payload, 0)
         .accounts(accounts)
-        .instruction()
+        .instruction(),
     );
     const signature = await provider.sendAndConfirm(transaction, [kp]);
     return SubmittedWormholeMessage.fromTransactionSignature(
       signature,
-      this.cluster
+      this.cluster,
     );
   }
 }
@@ -216,7 +216,7 @@ export class WormholeMultisigProposal {
   constructor(
     public address: PublicKey,
     public squad: SquadsMesh,
-    public cluster: PythCluster
+    public cluster: PythCluster,
   ) {}
 
   /**
@@ -240,7 +240,7 @@ export class WormholeMultisigProposal {
       this.squad,
       this.cluster,
       this.squad.connection.commitment,
-      {}
+      {},
     );
     const msgs: SubmittedWormholeMessage[] = [];
     for (const signature of signatures) {
@@ -248,8 +248,8 @@ export class WormholeMultisigProposal {
         msgs.push(
           await SubmittedWormholeMessage.fromTransactionSignature(
             signature,
-            this.cluster
-          )
+            this.cluster,
+          ),
         );
       } catch (e) {
         if (!(e instanceof InvalidTransactionError)) throw e;
@@ -309,7 +309,7 @@ export class Vault extends Storable {
    */
   public connect(
     wallet: Wallet,
-    registry: SolanaRpcRegistry = getPythClusterApiUrl
+    registry: SolanaRpcRegistry = getPythClusterApiUrl,
   ): void {
     this.squad = SquadsMesh.endpoint(registry(this.cluster), wallet);
   }
@@ -326,7 +326,7 @@ export class Vault extends Storable {
   public async getEmitter(registry: SolanaRpcRegistry = getPythClusterApiUrl) {
     const squad = SquadsMesh.endpoint(
       registry(this.cluster),
-      new NodeWallet(Keypair.generate()) // dummy wallet
+      new NodeWallet(Keypair.generate()), // dummy wallet
     );
     return squad.getAuthorityPDA(this.key, 1);
   }
@@ -341,7 +341,7 @@ export class Vault extends Storable {
     const rpcUrl = WORMHOLE_API_ENDPOINT[this.cluster];
     const emitter = await this.getEmitter();
     const response = await fetch(
-      `${rpcUrl}/api/v1/vaas/1/${emitter.toBase58()}`
+      `${rpcUrl}/api/v1/vaas/1/${emitter.toBase58()}`,
     );
     const { data } = await response.json();
     return data[0].sequence;
@@ -357,21 +357,21 @@ export class Vault extends Storable {
   public async proposeWormholeMessage(
     payloads: Buffer[],
     proposalAddress?: PublicKey,
-    priorityFeeConfig: PriorityFeeConfig = {}
+    priorityFeeConfig: PriorityFeeConfig = {},
   ): Promise<WormholeMultisigProposal> {
     const squad = this.getSquadOrThrow();
     const multisigVault = new MultisigVault(
       squad.wallet as Wallet,
       this.cluster,
       squad,
-      this.key
+      this.key,
     );
     const txAccount =
       await multisigVault.proposeWormholeMultipleMessagesWithPayer(
         payloads,
         squad.wallet.publicKey,
         proposalAddress,
-        priorityFeeConfig
+        priorityFeeConfig,
       );
     return new WormholeMultisigProposal(txAccount, squad, this.cluster);
   }
@@ -385,7 +385,7 @@ export class Vault extends Storable {
 export async function loadHotWallet(walletPath: string): Promise<Wallet> {
   return new NodeWallet(
     Keypair.fromSecretKey(
-      Uint8Array.from(JSON.parse(readFileSync(walletPath, "ascii")))
-    )
+      Uint8Array.from(JSON.parse(readFileSync(walletPath, "ascii"))),
+    ),
   );
 }

+ 1 - 1
contract_manager/src/shell.ts

@@ -14,5 +14,5 @@ repl.evalCode(
     "import { StarknetPriceFeedContract } from './src/contracts/starknet';" +
     "import { DefaultStore } from './src/store';" +
     "import { toPrivateKey } from './src/base';" +
-    "DefaultStore"
+    "DefaultStore",
 );

+ 7 - 7
contract_manager/src/store.ts

@@ -102,7 +102,7 @@ export class Store {
       for (const parsed of parsedArray) {
         if (allChainClasses[parsed.type] === undefined) {
           throw new Error(
-            `No chain class found for chain type: ${parsed.type}`
+            `No chain class found for chain type: ${parsed.type}`,
           );
         }
         const chain = allChainClasses[parsed.type].fromJson(parsed);
@@ -127,7 +127,7 @@ export class Store {
     for (const [type, contracts] of Object.entries(contractsByType)) {
       writeFileSync(
         `${this.path}/contracts/${type}s.yaml`,
-        stringify(contracts.map((c) => c.toJson()))
+        stringify(contracts.map((c) => c.toJson())),
       );
     }
   }
@@ -143,7 +143,7 @@ export class Store {
     for (const [type, chains] of Object.entries(chainsByType)) {
       writeFileSync(
         `${this.path}/chains/${type}s.yaml`,
-        stringify(chains.map((c) => c.toJson()))
+        stringify(chains.map((c) => c.toJson())),
       );
     }
   }
@@ -180,7 +180,7 @@ export class Store {
         const chain = this.chains[parsed.chain];
         const chainContract = allContractClasses[parsed.type].fromJson(
           chain,
-          parsed
+          parsed,
         );
         if (
           this.contracts[chainContract.getId()] ||
@@ -188,7 +188,7 @@ export class Store {
           this.wormhole_contracts[chainContract.getId()]
         )
           throw new Error(
-            `Multiple contracts with id ${chainContract.getId()} found`
+            `Multiple contracts with id ${chainContract.getId()} found`,
           );
         if (chainContract instanceof EvmEntropyContract) {
           this.entropy_contracts[chainContract.getId()] = chainContract;
@@ -241,7 +241,7 @@ export class Store {
    */
   getChainOrThrow<T extends Chain>(
     chainId: string,
-    ChainClass?: { new (...args: any[]): T; type: string } // eslint-disable-line @typescript-eslint/no-explicit-any
+    ChainClass?: { new (...args: any[]): T; type: string }, // eslint-disable-line @typescript-eslint/no-explicit-any
   ): T {
     const chain = this.chains[chainId];
     if (!chain) {
@@ -249,7 +249,7 @@ export class Store {
     }
     if (ChainClass && !(chain instanceof ChainClass)) {
       throw new Error(
-        `Chain with ID '${chainId}' is not of type ${ChainClass.type}.`
+        `Chain with ID '${chainId}' is not of type ${ChainClass.type}.`,
       );
     }
     return chain as T;

+ 1 - 1
contract_manager/src/token.ts

@@ -23,7 +23,7 @@ export class Token extends Storable {
     // The hexadecimal pyth id of the tokens X/USD price feed
     // (get this from hermes or the Pyth docs page)
     public pythId: string | undefined,
-    public decimals: number
+    public decimals: number,
   ) {
     super();
   }

+ 3 - 3
flake.nix

@@ -18,7 +18,7 @@
           cli = prev.lib.mkCli "cli" {
             _noAll = true;
 
-            start = "${prev.lib.getExe prev.pnpm} start:dev";
+            start = "${prev.lib.getExe prev.pnpm} turbo start:dev";
 
             test = {
               nix = {
@@ -26,7 +26,7 @@
                 dead-code = "${prev.deadnix}/bin/deadnix --exclude ./node_modules .";
                 format = "${prev.alejandra}/bin/alejandra --exclude ./node_modules --check .";
               };
-              turbo = "${prev.lib.getExe prev.pnpm} test -- --ui stream";
+              turbo = "${prev.lib.getExe prev.pnpm} turbo test -- --ui stream";
             };
 
             fix = {
@@ -35,7 +35,7 @@
                 dead-code = "${prev.deadnix}/bin/deadnix --exclude ./node_modules -e .";
                 format = "${prev.alejandra}/bin/alejandra --exclude ./node_modules .";
               };
-              turbo = "${prev.lib.getExe prev.pnpm} fix -- --ui stream";
+              turbo = "${prev.lib.getExe prev.pnpm} turbo fix -- --ui stream";
             };
           };
         };

+ 1 - 1
governance/pyth_staking_sdk/package.json

@@ -30,7 +30,7 @@
     "@typescript-eslint/parser": "^8.3.0",
     "eslint": "^9.8.0",
     "jest": "^29.7.0",
-    "prettier": "^3.3.2",
+    "prettier": "catalog:",
     "typescript": "^5.5.4"
   },
   "dependencies": {

+ 2 - 1
governance/xc_admin/packages/crank_executor/package.json

@@ -17,7 +17,8 @@
   "scripts": {
     "build": "tsc",
     "start": "node lib/index.js",
-    "format": "prettier --write \"src/**/*.ts\""
+    "fix:format": "prettier --write \"src/**/*.ts\"",
+    "test:format": "prettier --check \"src/**/*.ts\""
   },
   "dependencies": {
     "@certusone/wormhole-sdk": "^0.10.15",

+ 2 - 2
governance/xc_admin/packages/crank_executor/src/index.ts

@@ -15,7 +15,7 @@ import {
 const CLUSTER: PythCluster = envOrErr("CLUSTER") as PythCluster;
 const VAULT: PublicKey = new PublicKey(envOrErr("VAULT"));
 const KEYPAIR: Keypair = Keypair.fromSecretKey(
-  Uint8Array.from(JSON.parse(fs.readFileSync(envOrErr("WALLET"), "ascii")))
+  Uint8Array.from(JSON.parse(fs.readFileSync(envOrErr("WALLET"), "ascii"))),
 );
 const SOLANA_RPC = process.env.SOLANA_RPC;
 const COMMITMENT: Commitment =
@@ -29,7 +29,7 @@ async function run() {
   const squad = new SquadsMesh({
     connection: new Connection(
       SOLANA_RPC ?? getPythClusterApiUrl(CLUSTER),
-      COMMITMENT
+      COMMITMENT,
     ),
     wallet: new NodeWallet(KEYPAIR),
     multisigProgramId: DEFAULT_MULTISIG_PROGRAM_ID,

+ 2 - 1
governance/xc_admin/packages/crank_pythnet_relayer/package.json

@@ -17,7 +17,8 @@
   "scripts": {
     "build": "tsc",
     "start": "node lib/index.js",
-    "format": "prettier --write \"src/**/*.ts\""
+    "fix:format": "prettier --write \"src/**/*.ts\"",
+    "test:format": "prettier --check \"src/**/*.ts\""
   },
   "dependencies": {
     "@certusone/wormhole-sdk": "^0.10.15",

+ 19 - 20
governance/xc_admin/packages/crank_pythnet_relayer/src/index.ts

@@ -37,7 +37,7 @@ import {
 const CLUSTER: PythCluster = envOrErr("CLUSTER") as PythCluster;
 const EMITTER: PublicKey = new PublicKey(envOrErr("EMITTER"));
 const KEYPAIR: Keypair = Keypair.fromSecretKey(
-  Uint8Array.from(JSON.parse(fs.readFileSync(envOrErr("WALLET"), "ascii")))
+  Uint8Array.from(JSON.parse(fs.readFileSync(envOrErr("WALLET"), "ascii"))),
 );
 const OFFSET: number = Number(process.env.OFFSET ?? "-1");
 const SKIP_FAILED_REMOTE_INSTRUCTIONS: boolean =
@@ -55,7 +55,7 @@ async function run() {
     {
       commitment: COMMITMENT,
       preflightCommitment: COMMITMENT,
-    }
+    },
   );
   const multisigParser = MultisigParser.fromCluster(CLUSTER);
 
@@ -63,12 +63,11 @@ async function run() {
 
   const claimRecordAddress: PublicKey = PublicKey.findProgramAddressSync(
     [Buffer.from(CLAIM_RECORD_SEED), EMITTER.toBuffer()],
-    remoteExecutor.programId
+    remoteExecutor.programId,
   )[0];
   const executorKey: PublicKey = mapKey(EMITTER);
-  const claimRecord = await remoteExecutor.account.claimRecord.fetchNullable(
-    claimRecordAddress
-  );
+  const claimRecord =
+    await remoteExecutor.account.claimRecord.fetchNullable(claimRecordAddress);
   let lastSequenceNumber: number = claimRecord
     ? (claimRecord.sequence as BN).toNumber()
     : -1;
@@ -82,8 +81,8 @@ async function run() {
     const response = await (
       await fetch(
         `${wormholeApi}/v1/signed_vaa/1/${EMITTER.toBuffer().toString(
-          "hex"
-        )}/${lastSequenceNumber}`
+          "hex",
+        )}/${lastSequenceNumber}`,
       )
     ).json();
 
@@ -105,7 +104,7 @@ async function run() {
           WORMHOLE_ADDRESS[CLUSTER]!,
           provider.wallet.publicKey,
           Buffer.from(response.vaaBytes, "base64"),
-          { commitment: COMMITMENT }
+          { commitment: COMMITMENT },
         );
 
         console.log(`VAA ${lastSequenceNumber} relayed. executing ...`);
@@ -123,7 +122,7 @@ async function run() {
           extraAccountMetas.push(
             ...ix.keys.filter((acc) => {
               return !acc.pubkey.equals(executorKey);
-            })
+            }),
           );
 
           const parsedInstruction = multisigParser.parseInstruction(ix);
@@ -141,8 +140,8 @@ async function run() {
                 CLUSTER,
                 provider.wallet.publicKey,
                 parsedInstruction.args.symbol,
-                AccountType.Product
-              )
+                AccountType.Product,
+              ),
             );
             productAccountToSymbol[
               parsedInstruction.accounts.named.productAccount.pubkey.toBase58()
@@ -152,7 +151,7 @@ async function run() {
             parsedInstruction.name == "addPrice"
           ) {
             const productAccount = await provider.connection.getAccountInfo(
-              parsedInstruction.accounts.named.productAccount.pubkey
+              parsedInstruction.accounts.named.productAccount.pubkey,
             );
             const productSymbol = productAccount
               ? parseProductData(productAccount.data).product.symbol
@@ -166,8 +165,8 @@ async function run() {
                   CLUSTER,
                   provider.wallet.publicKey,
                   productSymbol,
-                  AccountType.Price
-                )
+                  AccountType.Price,
+                ),
               );
             } else {
               throw Error("Product account not found");
@@ -180,8 +179,8 @@ async function run() {
               await createDeterministicPublisherBufferAccountInstruction(
                 provider.connection,
                 provider.wallet.publicKey,
-                parsedInstruction.args.publisherKey
-              )
+                parsedInstruction.args.publisherKey,
+              ),
             );
           }
         }
@@ -193,7 +192,7 @@ async function run() {
               claimRecord: claimRecordAddress,
               postedVaa: derivePostedVaaKey(
                 WORMHOLE_ADDRESS[CLUSTER]!,
-                vaa.hash
+                vaa.hash,
               ),
             })
             .remainingAccounts(extraAccountMetas)
@@ -214,8 +213,8 @@ async function run() {
       console.log(`All VAAs have been relayed`);
       console.log(
         `${wormholeApi}/v1/signed_vaa/1/${EMITTER.toBuffer().toString(
-          "hex"
-        )}/${lastSequenceNumber}`
+          "hex",
+        )}/${lastSequenceNumber}`,
       );
       break;
     } else {

+ 2 - 1
governance/xc_admin/packages/proposer_server/package.json

@@ -17,7 +17,8 @@
   "scripts": {
     "build": "tsc",
     "start": "node lib/index.js",
-    "format": "prettier --write \"src/**/*.ts\""
+    "fix:format": "prettier --write \"src/**/*.ts\"",
+    "test:format": "prettier --check \"src/**/*.ts\""
   },
   "dependencies": {
     "@coral-xyz/anchor": "^0.29.0",

+ 3 - 3
governance/xc_admin/packages/proposer_server/src/index.ts

@@ -20,7 +20,7 @@ import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
 
 const PORT: number = Number(process.env.PORT ?? "4000");
 const KEYPAIR: Keypair = Keypair.fromSecretKey(
-  Uint8Array.from(JSON.parse(fs.readFileSync(envOrErr("WALLET"), "ascii")))
+  Uint8Array.from(JSON.parse(fs.readFileSync(envOrErr("WALLET"), "ascii"))),
 );
 const MAINNET_RPC: string =
   process.env.MAINNET_RPC ?? getPythClusterApiUrl("mainnet-beta");
@@ -63,7 +63,7 @@ app.post("/api/propose", async (req: Request, res: Response) => {
               pubkey: new PublicKey(key.pubkey),
             };
           }),
-        })
+        }),
     );
 
     const cluster: PythCluster = req.body.cluster;
@@ -78,7 +78,7 @@ app.post("/api/propose", async (req: Request, res: Response) => {
       wallet,
       getMultisigCluster(cluster),
       proposeSquads,
-      PRICE_FEED_MULTISIG[getMultisigCluster(cluster)]
+      PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
     );
 
     // preserve the existing API by returning only the first pubkey

+ 3 - 2
governance/xc_admin/packages/xc_admin_cli/package.json

@@ -16,8 +16,9 @@
   },
   "scripts": {
     "build": "tsc",
-    "format": "prettier --write \"src/**/*.ts\"",
-    "cli": "pnpm run build && node lib/index.js"
+    "cli": "pnpm run build && node lib/index.js",
+    "fix:format": "prettier --write \"src/**/*.ts\"",
+    "test:format": "prettier --check \"src/**/*.ts\""
   },
   "dependencies": {
     "@coral-xyz/anchor": "^0.29.0",

+ 104 - 108
governance/xc_admin/packages/xc_admin_cli/src/index.ts

@@ -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,
     );
   });
 

+ 12 - 12
governance/xc_admin/packages/xc_admin_cli/src/ledger.ts

@@ -14,7 +14,7 @@ export class LedgerNodeWallet implements Wallet {
   constructor(
     derivationPath: Buffer,
     transport: Transport,
-    publicKey: PublicKey
+    publicKey: PublicKey,
   ) {
     this._derivationPath = derivationPath;
     this._transport = transport;
@@ -23,12 +23,12 @@ export class LedgerNodeWallet implements Wallet {
 
   static async createWallet(
     derivationAccount?: number,
-    derivationChange?: number
+    derivationChange?: number,
   ): Promise<LedgerNodeWallet> {
     const transport = await TransportNodeHid.create();
     const derivationPath = getDerivationPath(
       derivationAccount,
-      derivationChange
+      derivationChange,
     );
     const publicKey = await getPublicKey(transport, derivationPath);
     console.log(`Loaded ledger: ${publicKey.toBase58()}}`);
@@ -36,7 +36,7 @@ export class LedgerNodeWallet implements Wallet {
   }
 
   async signTransaction<T extends Transaction | VersionedTransaction>(
-    tx: T
+    tx: T,
   ): Promise<T> {
     console.log("Please approve the transaction on your ledger device...");
     const transport = this._transport;
@@ -46,7 +46,7 @@ export class LedgerNodeWallet implements Wallet {
       const signature = await signTransaction(
         transport,
         tx,
-        this._derivationPath
+        this._derivationPath,
       );
       tx.addSignature(publicKey, signature);
     } else {
@@ -57,7 +57,7 @@ export class LedgerNodeWallet implements Wallet {
   }
 
   async signAllTransactions<T extends Transaction | VersionedTransaction>(
-    txs: T[]
+    txs: T[],
   ): Promise<T[]> {
     return await Promise.all(txs.map((tx) => this.signTransaction(tx)));
   }
@@ -105,13 +105,13 @@ const LEDGER_CLA = 0xe0;
 /** @internal */
 export async function getPublicKey(
   transport: Transport,
-  derivationPath: Buffer
+  derivationPath: Buffer,
 ): Promise<PublicKey> {
   const bytes = await send(
     transport,
     INS_GET_PUBKEY,
     P1_NON_CONFIRM,
-    derivationPath
+    derivationPath,
   );
   return new PublicKey(bytes);
 }
@@ -120,7 +120,7 @@ export async function getPublicKey(
 export async function signTransaction(
   transport: Transport,
   transaction: Transaction,
-  derivationPath: Buffer
+  derivationPath: Buffer,
 ): Promise<Buffer> {
   const paths = Buffer.alloc(1);
   paths.writeUInt8(1, 0);
@@ -136,7 +136,7 @@ async function send(
   transport: Transport,
   instruction: number,
   p1: number,
-  data: Buffer
+  data: Buffer,
 ): Promise<Buffer> {
   let p2 = 0;
   let offset = 0;
@@ -149,7 +149,7 @@ async function send(
         instruction,
         p1,
         p2 | P2_MORE,
-        buffer
+        buffer,
       );
       if (response.length !== 2)
         throw new TransportStatusError(StatusCodes.INCORRECT_DATA);
@@ -165,7 +165,7 @@ async function send(
     instruction,
     p1,
     p2,
-    buffer
+    buffer,
   );
 
   return response.subarray(0, response.length - 2);

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff