diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..f068b05ac8 --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# the shebang is ignored, but nice for editors + +if type -P lorri &>/dev/null; then + eval "$(lorri direnv)" +elif type -P nix-shell &>/dev/null; then + echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]' + use nix +fi diff --git a/.github/workflows/ci-ethereum-contract.yml b/.github/workflows/ci-ethereum-contract.yml index 3fd40d6463..9c1c7ed93a 100644 --- a/.github/workflows/ci-ethereum-contract.yml +++ b/.github/workflows/ci-ethereum-contract.yml @@ -22,8 +22,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install contract npm dependencies - run: npm ci + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: true - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1.1.1 @@ -31,7 +33,7 @@ jobs: version: nightly - name: Install Forge dependencies - run: npm run install-forge-deps + run: pnpm run install-forge-deps - name: Run tests run: forge test -vvv --deny-warnings diff --git a/.github/workflows/ci-hermes-client-api-types.yml b/.github/workflows/ci-hermes-client-api-types.yml index a7b7480ac1..facc39cc09 100644 --- a/.github/workflows/ci-hermes-client-api-types.yml +++ b/.github/workflows/ci-hermes-client-api-types.yml @@ -11,13 +11,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 - cache: "npm" - - name: Install deps - run: npm ci + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: true - name: Generate API Types - run: npx lerna run generate-hermes-api-types + run: pnpm exec lerna run generate-hermes-api-types - name: Check API Types - run: npx lerna run check-hermes-api-types + run: pnpm exec lerna run check-hermes-api-types diff --git a/.github/workflows/ci-message-buffer-idl.yml b/.github/workflows/ci-message-buffer-idl.yml index f64ad20342..ce86c05c0a 100644 --- a/.github/workflows/ci-message-buffer-idl.yml +++ b/.github/workflows/ci-message-buffer-idl.yml @@ -34,11 +34,13 @@ jobs: run: anchor build - name: Copy anchor target files run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/ + - uses: pnpm/action-setup@v4 + name: Install pnpm - name: Install prettier globally - run: npm install -g prettier@2.7.1 + run: pnpm install -g prettier@2.7.1 - name: Run prettier (to avoid pre-commit failures) run: | - npx prettier@2.7.1 --write "./idl/*" + pnpm dlx prettier@2.7.1 --write "./idl/*" - 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. diff --git a/.github/workflows/ci-typescript.yml b/.github/workflows/ci-typescript.yml index 0a2c0b181c..d9a8b6d5e9 100644 --- a/.github/workflows/ci-typescript.yml +++ b/.github/workflows/ci-typescript.yml @@ -24,19 +24,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 - cache: "npm" - - name: Install deps - run: npm ci + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: true - name: Build - run: npx lerna run build + run: pnpm exec lerna run build - name: Test - run: npx lerna run test + run: pnpm exec lerna run test - name: Lint - run: npx lerna run lint + run: pnpm exec lerna run lint - name: Generate ABIs - run: npx lerna run generate-abi + run: pnpm exec lerna run generate-abi - name: Check ABIs - run: npx lerna run check-abi + run: pnpm exec lerna run check-abi diff --git a/.github/workflows/publish-js.yml b/.github/workflows/publish-js.yml index 20c8435ed6..921a7ad542 100644 --- a/.github/workflows/publish-js.yml +++ b/.github/workflows/publish-js.yml @@ -10,12 +10,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: "18" - registry-url: "https://registry.npmjs.org" - - run: npm ci - - run: npx lerna run build --no-private - - run: npx lerna publish from-package --no-private --no-git-tag-version --yes + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: true + - run: pnpm exec lerna run build --no-private + - run: pnpm exec lerna publish from-package --no-private --no-git-tag-version --yes env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-pyth-cosmwasm-contract.yml b/.github/workflows/release-pyth-cosmwasm-contract.yml index 1422baa4b3..bf3bbc87c4 100644 --- a/.github/workflows/release-pyth-cosmwasm-contract.yml +++ b/.github/workflows/release-pyth-cosmwasm-contract.yml @@ -14,20 +14,20 @@ jobs: steps: - uses: actions/checkout@v2 - name: Setup tool - run: npm ci + run: pnpm i - name: Build generic cosmwasm contract run: | - npm run build-contract -- --cosmwasm + pnpm run build-contract -- --cosmwasm mv ../artifacts ../cosmwasm zip -r cosmwasm.zip ../cosmwasm - name: Build injective cosmwasm contract run: | - npm run build-contract -- --injective + pnpm run build-contract -- --injective mv ../artifacts ../injective zip -r injective.zip ../injective - name: Build osmosis cosmwasm contract run: | - npm run build-contract -- --osmosis + pnpm run build-contract -- --osmosis mv ../artifacts ../osmosis zip -r osmosis.zip ../osmosis diff --git a/.gitignore b/.gitignore index 4827570465..eb01640550 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ bigtable-writer.json tsconfig.tsbuildinfo *~ *mnemonic* -.envrc */*.sui.log* __pycache__ .DS_Store +.vercel diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 483e4cb484..e2a980e3eb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,11 +3,11 @@ repos: rev: v3.2.0 hooks: - id: trailing-whitespace - exclude: target_chains/sui/vendor/ + exclude: target_chains/sui/vendor/|patches/ - id: end-of-file-fixer - exclude: target_chains/sui/vendor/ + exclude: target_chains/sui/vendor/|patches/ - id: check-added-large-files - exclude: package-lock.json,target_chains/sui/vendor/ + exclude: 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 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..cfb068d33d --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +pnpm-lock.yaml +patches/ diff --git a/Dockerfile.lerna b/Dockerfile.lerna index 3800cdf3ae..4f1adca928 100644 --- a/Dockerfile.lerna +++ b/Dockerfile.lerna @@ -30,7 +30,7 @@ COPY --from=base --chown=1000:1000 /home/node ./ RUN --mount=type=cache,uid=1000,gid=1000,id=lerna,target=/home/node/.npm \ --mount=type=cache,uid=1000,gid=1000,id=lerna,target=/home/node/node_modules \ - npm ci && cp -r node_modules node_modules_cache + pnpm i && cp -r node_modules node_modules_cache # Folders in the cache are not visible in the container that's why we copy # them and then move them back. diff --git a/README.md b/README.md index 19ba63bd02..f6d63f1ee3 100644 --- a/README.md +++ b/README.md @@ -71,19 +71,19 @@ Integration tests run in Tilt (via the `tilt ci` command). The Tilt CI workflow All of the typescript / javascript packages in this repository are part of a lerna monorepo. This setup allows each package to reference the current version of the others. -You can install dependencies using `npm ci` from the repository root. -You can build all of the packages using `npx lerna run build` and test with `npx lerna run test`. +You can install dependencies using `pnpm i` from the repository root. +You can build all of the packages using `pnpm exec lerna run build` and test with `pnpm exec lerna run test`. Lerna has some common failure modes that you may encounter: -1. `npm ci` fails with a typescript compilation error about a missing package. +1. `pnpm i` fails with a typescript compilation error about a missing package. This error likely means that the failing package has a `prepare` entry compiling the typescript in its `package.json`. Fix this error by moving that logic to the `prepublishOnly` entry. 2. The software builds locally but fails in CI, or vice-versa. This error likely means that some local build caches need to be cleaned. The build error may not indicate that this is a caching issue, e.g., it may appear that the packages are being built in the wrong order. Delete `node_modules/`, `lib/` and `tsconfig.tsbuildinfo` from each package's subdirectory. then try again. -3. `npm ci` fails due to wrong node version. Make sure to be using `v18`. Node version `v21` is not supported and known to cause issues. +3. `pnpm i` fails due to wrong node version. Make sure to be using `v18`. Node version `v21` is not supported and known to cause issues. ## Audit / Feature Status diff --git a/apps/hermes/client/js/package.json b/apps/hermes/client/js/package.json index 77c54215ca..81f9d78025 100644 --- a/apps/hermes/client/js/package.json +++ b/apps/hermes/client/js/package.json @@ -25,12 +25,12 @@ "build": "tsc", "generate-hermes-api-types": "openapi-zod-client https://hermes.pyth.network/docs/openapi.json --output src/zodSchemas.ts && prettier --write src/zodSchemas.ts", "check-hermes-api-types": "git diff --exit-code src/zodSchemas.ts", - "example": "npm run build && node lib/examples/HermesClient.js", + "example": "pnpm run build && node lib/examples/HermesClient.js", "format": "prettier --write \"src/**/*.ts\"", "lint": "eslint src/", - "prepublishOnly": "npm run build && npm test && npm run lint", - "preversion": "npm run lint", - "version": "npm run format && git add -A src" + "prepublishOnly": "pnpm run build && pnpm test && pnpm run lint", + "preversion": "pnpm run lint", + "version": "pnpm run format && git add -A src" }, "keywords": [ "pyth", @@ -40,6 +40,7 @@ "devDependencies": { "@types/eventsource": "^1.1.15", "@types/jest": "^29.4.0", + "@types/node": "^20.14.2", "@types/yargs": "^17.0.10", "@typescript-eslint/eslint-plugin": "^5.21.0", "@typescript-eslint/parser": "^5.21.0", @@ -52,6 +53,7 @@ "yargs": "^17.4.1" }, "dependencies": { + "@zodios/core": "^10.9.6", "eventsource": "^2.0.2", "zod": "^3.23.8" } diff --git a/apps/price_pusher/Dockerfile b/apps/price_pusher/Dockerfile index 881c371586..54f7231232 100644 --- a/apps/price_pusher/Dockerfile +++ b/apps/price_pusher/Dockerfile @@ -15,8 +15,8 @@ COPY --chown=1000:1000 target_chains/solana/sdk/js target_chains/solana/sdk/js COPY --chown=1000:1000 apps/price_pusher apps/price_pusher -RUN npx lerna run build --scope="@pythnetwork/price-pusher" --include-dependencies +RUN pnpm exec lerna run build --scope="@pythnetwork/price-pusher" --include-dependencies WORKDIR /home/node/apps/price_pusher -ENTRYPOINT [ "npm", "run", "start" ] +ENTRYPOINT [ "pnpm", "run", "start" ] diff --git a/apps/price_pusher/README.md b/apps/price_pusher/README.md index ffb65c2974..a2279dd479 100644 --- a/apps/price_pusher/README.md +++ b/apps/price_pusher/README.md @@ -84,7 +84,7 @@ To run the price pusher, please run the following commands, replacing the comman ```sh # Please run the two following commands once from the root of the repo to build the code. npm install -npx lerna run build --scope @pythnetwork/price-pusher --include-dependencies +pnpm exec lerna run build --scope @pythnetwork/price-pusher --include-dependencies # Navigate to the price_pusher folder cd apps/price_pusher diff --git a/apps/price_pusher/package.json b/apps/price_pusher/package.json index bdb22ca490..6538d47f22 100644 --- a/apps/price_pusher/package.json +++ b/apps/price_pusher/package.json @@ -26,9 +26,9 @@ "lint": "eslint src/", "start": "node lib/index.js", "dev": "ts-node src/index.ts", - "prepublishOnly": "npm run build && npm test && npm run lint", - "preversion": "npm run lint", - "version": "npm run format && git add -A src" + "prepublishOnly": "pnpm run build && pnpm test && pnpm run lint", + "preversion": "pnpm run lint", + "version": "pnpm run format && git add -A src" }, "keywords": [ "pyth", @@ -42,27 +42,33 @@ "@types/ethereum-protocol": "^1.0.2", "@types/jest": "^27.4.1", "@types/yargs": "^17.0.10", - "@typescript-eslint/eslint-plugin": "^5.20.0", - "@typescript-eslint/parser": "^5.20.0", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.13.0", "jest": "^29.7.0", "prettier": "^2.6.2", "ts-jest": "^29.1.1", + "ts-node": "^10.9.1", "typescript": "^5.3.3" }, "dependencies": { + "@coral-xyz/anchor": "^0.30.0", + "@injectivelabs/networks": "^1.14.6", "@injectivelabs/sdk-ts": "1.10.72", "@mysten/sui.js": "^0.49.1", - "@pythnetwork/price-service-client": "*", - "@pythnetwork/pyth-sdk-solidity": "*", - "@pythnetwork/pyth-solana-receiver": "*", - "@pythnetwork/pyth-sui-js": "*", + "@pythnetwork/price-service-client": "workspace:*", + "@pythnetwork/price-service-sdk": "workspace:^", + "@pythnetwork/pyth-sdk-solidity": "workspace:*", + "@pythnetwork/pyth-solana-receiver": "workspace:*", + "@pythnetwork/pyth-sui-js": "workspace:*", + "@pythnetwork/solana-utils": "workspace:*", "@truffle/hdwallet-provider": "^2.1.3", "aptos": "^1.8.5", "jito-ts": "^3.0.1", "joi": "^17.6.0", "near-api-js": "^3.0.2", "web3": "^1.8.1", + "web3-core": "^1.8.1", "web3-eth-contract": "^1.8.1", "yaml": "^2.1.1", "yargs": "^17.5.1" diff --git a/apps/price_pusher/src/evm/evm.ts b/apps/price_pusher/src/evm/evm.ts index a20f92c09d..1dc65203d8 100644 --- a/apps/price_pusher/src/evm/evm.ts +++ b/apps/price_pusher/src/evm/evm.ts @@ -10,6 +10,7 @@ import { addLeading0x, DurationInSeconds, removeLeading0x } from "../utils"; import AbstractPythAbi from "@pythnetwork/pyth-sdk-solidity/abis/AbstractPyth.json"; import HDWalletProvider from "@truffle/hdwallet-provider"; import Web3 from "web3"; +import { HttpProvider, WebsocketProvider } from "web3-core"; import { isWsEndpoint } from "../utils"; import { PriceServiceConnection, @@ -17,8 +18,8 @@ import { UnixTimestamp, } from "@pythnetwork/price-service-client"; import { CustomGasStation } from "./custom-gas-station"; -import { Provider } from "web3/providers"; import { PushAttempt } from "../common"; +import { ProviderOrUrl } from "@truffle/hdwallet-provider/dist/constructor/types"; export class EvmPriceListener extends ChainPriceListener { private pythContractFactory: PythContractFactory; @@ -356,7 +357,7 @@ export class PythContractFactory { return isWsEndpoint(this.endpoint); } - createWeb3Provider() { + createWeb3Provider(): HttpProvider | WebsocketProvider { if (isWsEndpoint(this.endpoint)) { Web3.providers.WebsocketProvider.prototype.sendAsync = Web3.providers.WebsocketProvider.prototype.send; @@ -387,7 +388,7 @@ export class PythContractFactory { mnemonic: { phrase: this.mnemonic, }, - providerOrUrl: this.createWeb3Provider() as Provider, + providerOrUrl: this.createWeb3Provider() as ProviderOrUrl, }); } } diff --git a/apps/price_pusher/src/solana/solana.ts b/apps/price_pusher/src/solana/solana.ts index d4dba4ffc2..da213bd1c0 100644 --- a/apps/price_pusher/src/solana/solana.ts +++ b/apps/price_pusher/src/solana/solana.ts @@ -65,7 +65,8 @@ export class SolanaPricePusher implements IPricePusher { async updatePriceFeed( priceIds: string[], - pubTimesToPush: number[] + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _pubTimesToPush: number[] ): Promise { if (priceIds.length === 0) { return; @@ -122,7 +123,8 @@ export class SolanaPricePusherJito implements IPricePusher { async updatePriceFeed( priceIds: string[], - pubTimesToPush: number[] + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _pubTimesToPush: number[] ): Promise { let priceFeedUpdateData: string[]; try { diff --git a/contract_manager/README.md b/contract_manager/README.md index ebb740fffc..f0de1fb3c1 100644 --- a/contract_manager/README.md +++ b/contract_manager/README.md @@ -20,8 +20,8 @@ Each of these entities has a specialized class for each supported chain (EVM/Cos # Docs -You can generate the docs by running `npx typedoc src/index.ts` from this directory. Open the docs by opening `docs/index.html` in your browser. +You can generate the docs by running `pnpm exec typedoc src/index.ts` from this directory. Open the docs by opening `docs/index.html` in your browser. # Scripts -You can run the scripts by executing `npx ts-node scripts/.ts` from this directory. +You can run the scripts by executing `pnpm exec ts-node scripts/.ts` from this directory. diff --git a/contract_manager/package.json b/contract_manager/package.json index 4a88a2aae7..68618f7d69 100644 --- a/contract_manager/package.json +++ b/contract_manager/package.json @@ -23,20 +23,32 @@ "dependencies": { "@certusone/wormhole-sdk": "^0.9.8", "@coral-xyz/anchor": "^0.29.0", + "@cosmjs/cosmwasm-stargate": "^0.32.3", + "@cosmjs/stargate": "^0.32.3", "@injectivelabs/networks": "^1.14.6", "@mysten/sui.js": "^0.49.1", - "@pythnetwork/cosmwasm-deploy-tools": "*", - "@pythnetwork/entropy-sdk-solidity": "*", - "@pythnetwork/price-service-client": "*", - "@pythnetwork/pyth-sui-js": "*", + "@pythnetwork/client": "^2.21.0", + "@pythnetwork/contract-manager": "workspace:*", + "@pythnetwork/cosmwasm-deploy-tools": "workspace:*", + "@pythnetwork/entropy-sdk-solidity": "workspace:*", + "@pythnetwork/price-service-client": "workspace:*", + "@pythnetwork/pyth-sdk-solidity": "workspace:^", + "@pythnetwork/pyth-sui-js": "workspace:*", + "@pythnetwork/solana-utils": "workspace:^", + "@pythnetwork/xc-admin-common": "workspace:*", + "@sqds/mesh": "^1.0.6", "@types/yargs": "^17.0.32", "aptos": "^1.5.0", "axios": "^0.24.0", "bs58": "^5.0.0", "ts-node": "^10.9.1", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "web3": "^1.8.2", + "web3-eth-contract": "^1.8.2", + "yaml": "^2.1.1" }, "devDependencies": { + "@types/web3": "^1.2.2", "prettier": "^2.6.2", "typedoc": "^0.25.7" } diff --git a/contract_manager/src/chains.ts b/contract_manager/src/chains.ts index 351c165222..9d93bd7858 100644 --- a/contract_manager/src/chains.ts +++ b/contract_manager/src/chains.ts @@ -21,7 +21,6 @@ import { import { Network } from "@injectivelabs/networks"; import { SuiClient } from "@mysten/sui.js/client"; import { Ed25519Keypair } from "@mysten/sui.js/keypairs/ed25519"; -import { TransactionObject } from "web3/eth/types"; import { TokenId } from "./token"; export type ChainConfig = Record & { @@ -52,7 +51,7 @@ export abstract class Chain extends Storable { if (toChainId(this.wormholeChainName) === undefined) throw new Error( `Invalid chain name ${wormholeChainName}. - Try rebuilding @pythnetwork/xc-admin-common: npx lerna run build --scope @pythnetwork/xc-admin-common` + Try rebuilding @pythnetwork/xc-admin-common: pnpm exec lerna run build --scope @pythnetwork/xc-admin-common` ); } @@ -398,7 +397,7 @@ export class EvmChain extends Chain { } async estiamteAndSendTransaction( - transactionObject: TransactionObject, + transactionObject: any, txParams: { from?: string; value?: string } ) { const GAS_ESTIMATE_MULTIPLIER = 2; diff --git a/contract_manager/src/contracts/evm.ts b/contract_manager/src/contracts/evm.ts index 58e719d326..57101d9b6e 100644 --- a/contract_manager/src/contracts/evm.ts +++ b/contract_manager/src/contracts/evm.ts @@ -1,4 +1,5 @@ import Web3 from "web3"; +import type { Contract } from "web3-eth-contract"; import PythInterfaceAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json"; import EntropyAbi from "@pythnetwork/entropy-sdk-solidity/abis/IEntropy.json"; import { PriceFeedContract, PrivateKey, Storable } from "../base"; @@ -424,7 +425,7 @@ export class EvmWormholeContract extends WormholeContract { constructor(public chain: EvmChain, public address: string) { super(); } - getContract() { + getContract(): Contract { const web3 = new Web3(this.chain.getRpcUrl()); return new web3.eth.Contract(WORMHOLE_ABI, this.address); } diff --git a/express_relay/examples/easy_lend/package.json b/express_relay/examples/easy_lend/package.json index 4f184679e9..9f604814ea 100644 --- a/express_relay/examples/easy_lend/package.json +++ b/express_relay/examples/easy_lend/package.json @@ -10,7 +10,7 @@ "build": "tsc", "lint": "eslint src/", "format": "prettier --write \"src/**/*.ts\"", - "monitor": "npm run build && node tslib/monitor.js", + "monitor": "pnpm run build && node tslib/monitor.js", "install-forge-deps": "forge install foundry-rs/forge-std@v1.7.6 --no-git --no-commit" }, "author": "", @@ -21,10 +21,11 @@ }, "dependencies": { "@openzeppelin/contracts": "^4.5.0", - "@pythnetwork/express-relay-evm-js": "*", - "@pythnetwork/express-relay-sdk-solidity": "*", - "@pythnetwork/pyth-evm-js": "*", - "@pythnetwork/pyth-sdk-solidity": "*", + "@pythnetwork/express-relay-evm-js": "workspace:*", + "@pythnetwork/express-relay-sdk-solidity": "workspace:*", + "@pythnetwork/price-service-client": "workspace:^", + "@pythnetwork/pyth-evm-js": "workspace:*", + "@pythnetwork/pyth-sdk-solidity": "workspace:*", "ts-node": "^10.9.1", "typescript": "^5.3.3", "viem": "^2.7.6" diff --git a/express_relay/sdk/js/package.json b/express_relay/sdk/js/package.json index 31798f00e8..860d007938 100644 --- a/express_relay/sdk/js/package.json +++ b/express_relay/sdk/js/package.json @@ -15,13 +15,13 @@ "scripts": { "build": "tsc", "test": "jest src/ --passWithNoTests", - "simple-searcher": "npm run build && node lib/examples/simpleSearcher.js", + "simple-searcher": "pnpm run build && node lib/examples/simpleSearcher.js", "generate-api-types": "openapi-typescript http://127.0.0.1:9000/docs/openapi.json --output src/serverTypes.d.ts", "format": "prettier --write \"src/**/*.ts\"", "lint": "eslint src", - "prepublishOnly": "npm run build && npm test && npm run lint", - "preversion": "npm run lint", - "version": "npm run format && git add -A src" + "prepublishOnly": "pnpm run build && pnpm test && pnpm run lint", + "preversion": "pnpm run lint", + "version": "pnpm run format && git add -A src" }, "keywords": [ "pyth", @@ -42,11 +42,11 @@ "ws": "^8.16.0" }, "devDependencies": { - "@pythnetwork/pyth-evm-js": "*", + "@pythnetwork/pyth-evm-js": "workspace:*", "@types/node": "^20.12.7", "@types/yargs": "^17.0.10", - "@typescript-eslint/eslint-plugin": "^5.21.0", - "@typescript-eslint/parser": "^5.21.0", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.56.0", "jest": "^27.5.1", "prettier": "^2.6.2", diff --git a/express_relay/sdk/js/src/index.ts b/express_relay/sdk/js/src/index.ts index 0db641cbed..dae71b9b19 100644 --- a/express_relay/sdk/js/src/index.ts +++ b/express_relay/sdk/js/src/index.ts @@ -1,7 +1,6 @@ import type { components, paths } from "./serverTypes"; import createClient, { ClientOptions as FetchClientOptions, - HeadersOptions, } from "openapi-fetch"; import { Address, Hex, isAddress, isHex } from "viem"; import { privateKeyToAccount, signTypedData } from "viem/accounts"; diff --git a/express_relay/sdk/solidity/package.json b/express_relay/sdk/solidity/package.json index 4e44e00401..7424f5fccc 100644 --- a/express_relay/sdk/solidity/package.json +++ b/express_relay/sdk/solidity/package.json @@ -11,8 +11,8 @@ "access": "public" }, "scripts": { - "format": "npx prettier --write .", - "generate-abi": "npx generate-abis IExpressRelay IExpressRelayFeeReceiver", + "format": "prettier --write .", + "generate-abi": "generate-abis IExpressRelay IExpressRelayFeeReceiver", "check-abi": "git diff --exit-code abis" }, "keywords": [ @@ -29,6 +29,6 @@ "devDependencies": { "prettier": "^2.7.1", "prettier-plugin-solidity": "^1.0.0-rc.1", - "abi_generator": "*" + "abi_generator": "workspace:*" } } diff --git a/governance/multisig_wh_message_builder/package.json b/governance/multisig_wh_message_builder/package.json index fabd682056..9837f27ce8 100644 --- a/governance/multisig_wh_message_builder/package.json +++ b/governance/multisig_wh_message_builder/package.json @@ -19,9 +19,9 @@ "build": "tsc", "format": "prettier --write \"src/**/*.ts\"", "lint": "eslint src/", - "prepublishOnly": "npm run build && npm test && npm run lint", - "preversion": "npm run lint", - "version": "npm run format && git add -A src", + "prepublishOnly": "pnpm run build && pnpm test && pnpm run lint", + "preversion": "pnpm run lint", + "version": "pnpm run format && git add -A src", "start": "node lib/index.js" }, "keywords": [ diff --git a/governance/xc_admin/Dockerfile b/governance/xc_admin/Dockerfile index 5d79146e29..fa3ee143bf 100644 --- a/governance/xc_admin/Dockerfile +++ b/governance/xc_admin/Dockerfile @@ -11,8 +11,8 @@ COPY --chown=1000:1000 governance/xc_admin governance/xc_admin COPY --chown=1000:1000 pythnet/message_buffer pythnet/message_buffer COPY --chown=1000:1000 price_service/sdk/js price_service/sdk/js -RUN npx lerna run build --scope="{@pythnetwork/xc-admin-crank-executor,@pythnetwork/xc-admin-crank-pythnet-relayer,@pythnetwork/xc-admin-proposer-server}" --include-dependencies +RUN pnpm exec lerna run build --scope="{@pythnetwork/xc-admin-crank-executor,@pythnetwork/xc-admin-crank-pythnet-relayer,@pythnetwork/xc-admin-proposer-server}" --include-dependencies WORKDIR /home/node/governance/xc_admin -CMD [ "npx", "node", "packages/crank_executor/lib/index.js" ] +CMD [ "node", "packages/crank_executor/lib/index.js" ] diff --git a/governance/xc_admin/packages/crank_executor/package.json b/governance/xc_admin/packages/crank_executor/package.json index 40628cba67..cd11868e62 100644 --- a/governance/xc_admin/packages/crank_executor/package.json +++ b/governance/xc_admin/packages/crank_executor/package.json @@ -21,10 +21,14 @@ "dependencies": { "@certusone/wormhole-sdk": "^0.9.9", "@coral-xyz/anchor": "^0.29.0", + "@project-serum/anchor": "^0.25.0", "@pythnetwork/client": "^2.9.0", + "@pythnetwork/xc-admin-common": "workspace:*", "@solana/web3.js": "^1.73.0", "@sqds/mesh": "^1.0.6", - "ts-node": "^10.9.1", - "@pythnetwork/xc-admin-common": "*" + "ts-node": "^10.9.1" + }, + "devDependencies": { + "typescript": "^5.4.5" } } diff --git a/governance/xc_admin/packages/crank_pythnet_relayer/package.json b/governance/xc_admin/packages/crank_pythnet_relayer/package.json index c661278fb9..e305456e35 100644 --- a/governance/xc_admin/packages/crank_pythnet_relayer/package.json +++ b/governance/xc_admin/packages/crank_pythnet_relayer/package.json @@ -25,6 +25,6 @@ "@solana/web3.js": "^1.73.0", "@sqds/mesh": "^1.0.6", "ts-node": "^10.9.1", - "@pythnetwork/xc-admin-common": "*" + "@pythnetwork/xc-admin-common": "workspace:*" } } diff --git a/governance/xc_admin/packages/proposer_server/package.json b/governance/xc_admin/packages/proposer_server/package.json index d2c4e427a1..c7617c8c1a 100644 --- a/governance/xc_admin/packages/proposer_server/package.json +++ b/governance/xc_admin/packages/proposer_server/package.json @@ -21,7 +21,7 @@ "dependencies": { "@coral-xyz/anchor": "^0.29.0", "@pythnetwork/client": "^2.17.0", - "@pythnetwork/xc-admin-common": "*", + "@pythnetwork/xc-admin-common": "workspace:*", "@solana/web3.js": "^1.76.0", "@sqds/mesh": "^1.0.6", "@types/cors": "^2.8.17", diff --git a/governance/xc_admin/packages/xc_admin_cli/README.md b/governance/xc_admin/packages/xc_admin_cli/README.md index 24e6b0e11f..ff0562e767 100644 --- a/governance/xc_admin/packages/xc_admin_cli/README.md +++ b/governance/xc_admin/packages/xc_admin_cli/README.md @@ -26,8 +26,8 @@ Note: To activate a transaction: ``` -npm install -npx lerna run build --scope "@pythnetwork/xc-admin-common" --include-dependencies -npx ts-node src/index.ts activate -t -c -w -lda -ldc +pnpm i +pnpm exec lerna run build --scope "@pythnetwork/xc-admin-common" --include-dependencies +pnpm exec ts-node src/index.ts activate -t -c -w -lda -ldc ``` diff --git a/governance/xc_admin/packages/xc_admin_cli/package.json b/governance/xc_admin/packages/xc_admin_cli/package.json index 633a2084e2..89104bd465 100644 --- a/governance/xc_admin/packages/xc_admin_cli/package.json +++ b/governance/xc_admin/packages/xc_admin_cli/package.json @@ -17,18 +17,20 @@ "scripts": { "build": "tsc", "format": "prettier --write \"src/**/*.ts\"", - "cli": "npm run build && node lib/cli.js" + "cli": "pnpm run build && node lib/cli.js" }, "dependencies": { "@coral-xyz/anchor": "^0.29.0", "@ledgerhq/hw-transport": "^6.27.10", "@ledgerhq/hw-transport-node-hid": "^6.27.10", "@pythnetwork/client": "^2.9.0", + "@pythnetwork/pyth-solana-receiver": "workspace:*", + "@pythnetwork/solana-utils": "workspace:^", + "@pythnetwork/xc-admin-common": "workspace:*", + "@solana/spl-token": "^0.3.7", "@solana/web3.js": "^1.73.0", "@sqds/mesh": "^1.0.6", "commander": "^9.5.0", - "typescript": "^4.9.4", - "@pythnetwork/xc-admin-common": "*", - "@pythnetwork/pyth-solana-receiver": "*" + "typescript": "^4.9.4" } } diff --git a/governance/xc_admin/packages/xc_admin_common/jest.config.js b/governance/xc_admin/packages/xc_admin_common/jest.config.js index 3abcbd9467..abced2baf8 100644 --- a/governance/xc_admin/packages/xc_admin_common/jest.config.js +++ b/governance/xc_admin/packages/xc_admin_common/jest.config.js @@ -2,4 +2,7 @@ module.exports = { preset: "ts-jest", testEnvironment: "node", + moduleNameMapper: { + "^uuid$": "uuid", + }, }; diff --git a/governance/xc_admin/packages/xc_admin_common/package.json b/governance/xc_admin/packages/xc_admin_common/package.json index aec8b44695..a849d066de 100644 --- a/governance/xc_admin/packages/xc_admin_common/package.json +++ b/governance/xc_admin/packages/xc_admin_common/package.json @@ -29,15 +29,17 @@ "@coral-xyz/anchor": "^0.29.0", "@injectivelabs/sdk-ts": "^1.10.72", "@injectivelabs/token-metadata": "~1.10.42", + "@project-serum/anchor": "^0.25.0", "@pythnetwork/client": "^2.17.0", - "@pythnetwork/pyth-solana-receiver": "*", - "@pythnetwork/solana-utils": "*", + "@pythnetwork/pyth-solana-receiver": "workspace:*", + "@pythnetwork/solana-utils": "workspace:*", "@solana/buffer-layout": "^4.0.1", "@solana/web3.js": "^1.73.0", "@sqds/mesh": "^1.0.6", "bigint-buffer": "^1.1.5", "ethers": "^5.7.2", "lodash": "^4.17.21", + "message_buffer": "workspace:^", "typescript": "^4.9.4" }, "devDependencies": { diff --git a/governance/xc_admin/packages/xc_admin_common/src/__tests__/MessageBufferMultisigInstruction.test.ts b/governance/xc_admin/packages/xc_admin_common/src/__tests__/MessageBufferMultisigInstruction.test.ts index d4056f7fc2..0ab6d95971 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/__tests__/MessageBufferMultisigInstruction.test.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/__tests__/MessageBufferMultisigInstruction.test.ts @@ -1,3 +1,7 @@ +import crypto from "crypto"; +// @ts-expect-error +globalThis.crypto = crypto; + import { AnchorProvider, Wallet, Program, Idl } from "@coral-xyz/anchor"; import { getPythClusterApiUrl, diff --git a/governance/xc_admin/packages/xc_admin_common/src/__tests__/PythMultisigInstruction.test.ts b/governance/xc_admin/packages/xc_admin_common/src/__tests__/PythMultisigInstruction.test.ts index 918963feb7..9af008d59e 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/__tests__/PythMultisigInstruction.test.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/__tests__/PythMultisigInstruction.test.ts @@ -1,3 +1,7 @@ +import crypto from "crypto"; +// @ts-expect-error +globalThis.crypto = crypto; + import { AnchorProvider, Wallet } from "@coral-xyz/anchor"; import { pythOracleProgram } from "@pythnetwork/client"; import { diff --git a/governance/xc_admin/packages/xc_admin_common/src/__tests__/TransactionSize.test.ts b/governance/xc_admin/packages/xc_admin_common/src/__tests__/TransactionSize.test.ts index b7350c3d07..95af3950be 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/__tests__/TransactionSize.test.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/__tests__/TransactionSize.test.ts @@ -1,3 +1,7 @@ +import crypto from "crypto"; +// @ts-expect-error +globalThis.crypto = crypto; + import { AnchorProvider, Wallet } from "@coral-xyz/anchor"; import { pythOracleProgram } from "@pythnetwork/client"; import { diff --git a/governance/xc_admin/packages/xc_admin_common/src/__tests__/WormholeMultisigInstruction.test.ts b/governance/xc_admin/packages/xc_admin_common/src/__tests__/WormholeMultisigInstruction.test.ts index 255109f7f2..699da6d38b 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/__tests__/WormholeMultisigInstruction.test.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/__tests__/WormholeMultisigInstruction.test.ts @@ -1,3 +1,7 @@ +import crypto from "crypto"; +// @ts-expect-error +globalThis.crypto = crypto; + import { createWormholeProgramInterface } from "@certusone/wormhole-sdk/lib/cjs/solana/wormhole"; import { AnchorProvider, Wallet } from "@coral-xyz/anchor"; import { diff --git a/governance/xc_admin/packages/xc_admin_frontend/Dockerfile b/governance/xc_admin/packages/xc_admin_frontend/Dockerfile index 0fc820d2f0..1c0ea720ac 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/Dockerfile +++ b/governance/xc_admin/packages/xc_admin_frontend/Dockerfile @@ -17,7 +17,7 @@ ENV NODE_ENV production ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_PUBLIC_RPC_POOL_TOKEN $NEXT_PUBLIC_RPC_POOL_TOKEN -RUN npx lerna run build --scope="@pythnetwork/xc-admin-frontend" --include-dependencies +RUN pnpm exec lerna run build --scope="@pythnetwork/xc-admin-frontend" --include-dependencies WORKDIR /home/node/governance/xc_admin/packages/xc_admin_frontend @@ -25,4 +25,4 @@ EXPOSE 3000 ENV PORT 3000 -CMD ["npm", "start"] +CMD ["pnpm", "start"] diff --git a/governance/xc_admin/packages/xc_admin_frontend/README.md b/governance/xc_admin/packages/xc_admin_frontend/README.md index fb0321bd67..c8e730d9b2 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/README.md +++ b/governance/xc_admin/packages/xc_admin_frontend/README.md @@ -5,8 +5,8 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next First, run the development server: ```bash -pyth-crosschain % npm install -pyth-crosschain % npx lerna run build --scope @pythnetwork/xc-admin-frontend --include-dependencies +pyth-crosschain % pnpm i +pyth-crosschain % pnpm exec lerna run build --scope @pythnetwork/xc-admin-frontend --include-dependencies pyth-crosschain % cd governance/xc_admin/packages/xc_admin_frontend xc_admin_frontend % npm run dev ``` diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/common/SocialLinks.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/common/SocialLinks.tsx index a64a2c7c4f..74245524a6 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/components/common/SocialLinks.tsx +++ b/governance/xc_admin/packages/xc_admin_frontend/components/common/SocialLinks.tsx @@ -9,35 +9,43 @@ import Youtube from '@images/icons/youtube.inline.svg' const SocialLinks = () => { return (
- - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + +
) diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/layout/Footer.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/layout/Footer.tsx index 2758ea0d91..3f289c1edb 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/components/layout/Footer.tsx +++ b/governance/xc_admin/packages/xc_admin_frontend/components/layout/Footer.tsx @@ -9,8 +9,8 @@ const Footer = () => { © 2024 Pyth Data Association
- - Pyth Network + + Pyth Network {' '}
diff --git a/governance/xc_admin/packages/xc_admin_frontend/components/layout/Header.tsx b/governance/xc_admin/packages/xc_admin_frontend/components/layout/Header.tsx index c8c257cd14..964f92a7a9 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/components/layout/Header.tsx +++ b/governance/xc_admin/packages/xc_admin_frontend/components/layout/Header.tsx @@ -73,21 +73,20 @@ const Header = () => { <>
- - - - + +